feat: 根据料箱编码查询入库任务信息

This commit is contained in:
Kelvin 2024-12-06 15:30:51 +08:00
parent c985a22b5a
commit 866cac140d
3 changed files with 76 additions and 13 deletions

View File

@ -17,6 +17,7 @@ import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.service.IWmStorageAreaService; import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
import com.ktg.mes.wm.service.IWmsInTaskService; import com.ktg.mes.wm.service.IWmsInTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -34,18 +35,14 @@ import java.util.stream.Stream;
* @date 2024-11-01 * @date 2024-11-01
*/ */
@RestController @RestController
@RequiredArgsConstructor
@RequestMapping("/wm/wmsInTask") @RequestMapping("/wm/wmsInTask")
public class WmsInTaskController extends BaseController { public class WmsInTaskController extends BaseController {
@Autowired private final IWmsInTaskService wmsInTaskService;
private IWmsInTaskService wmsInTaskService; private final IMdItemService mdItemService;
@Autowired private final IBaseKnifeService baseKnifeService;
private IMdItemService mdItemService; private final IWmStorageAreaService wmStorageAreaService;
@Autowired private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private IBaseKnifeService baseKnifeService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
/** /**
* 查询入库任务列表 * 查询入库任务列表
@ -89,6 +86,18 @@ public class WmsInTaskController extends BaseController {
return AjaxResult.success(wmsInTaskService.selectWmsInTaskById(id)); return AjaxResult.success(wmsInTaskService.selectWmsInTaskById(id));
} }
/**
* 根据料箱rfid查询入库任务信息
*/
@GetMapping(value = "/open/box/{rfid}")
public AjaxResult getInfoByBox(@PathVariable("rfid") String rfid) {
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskByBoxRfid(rfid);
if (wmsInTask == null) {
return AjaxResult.error("未查询到相关任务");
}
return AjaxResult.success(wmsInTask);
}
/** /**
* 新增入库任务 * 新增入库任务
*/ */

View File

@ -19,6 +19,14 @@ public interface IWmsInTaskService
*/ */
public WmsInTask selectWmsInTaskById(String id); public WmsInTask selectWmsInTaskById(String id);
/**
* 查询入库任务
*
* @param rfid 料箱 RFID
* @return 入库任务
*/
public WmsInTask selectWmsInTaskByBoxRfid(String rfid);
/** /**
* 查询入库任务列表 * 查询入库任务列表
* *

View File

@ -1,17 +1,18 @@
package com.ktg.mes.wm.service.impl; package com.ktg.mes.wm.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.MdItem; import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.mapper.MdItemMapper; import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.service.IMdItemService; import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.UcmCtBase;
import com.ktg.mes.wm.domain.WmStorageArea; import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper; import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IUcmCtBaseService;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +34,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
private final MdItemMapper mdItemMapper; private final MdItemMapper mdItemMapper;
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
private final WmStorageAreaMapper wmStorageAreaMapper; private final WmStorageAreaMapper wmStorageAreaMapper;
private final IUcmCtBaseService ucmCtBaseService;
/** /**
* 查询入库任务 * 查询入库任务
@ -45,6 +47,50 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
return wmsInTaskMapper.selectWmsInTaskById(id); return wmsInTaskMapper.selectWmsInTaskById(id);
} }
/**
* 查询入库任务
*
* @param rfid 料箱 RFID
* @return 入库任务
*/
@Override
public WmsInTask selectWmsInTaskByBoxRfid(String rfid) {
List<WmsInTask> wmsInTaskList = new ArrayList<>();
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(rfid);
if (ucmCtBase == null) {
return null;
}
for (BaseKnife baseKnife : ucmCtBase.getBaseKnifeList()) {
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
wmsInPlanDetailEntityQuery.setRfid(baseKnife.getRfid());
// 查询所有符合条件的计划明细
List<WmsInPlanDetailEntity> planDetailEntities = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
// 遍历所有明细查询相应的WmsInTask
for (WmsInPlanDetailEntity entity : planDetailEntities) {
WmsInTask wmsInTaskQuery = new WmsInTask();
wmsInTaskQuery.setDetailInId(entity.getPlanDetailsId());
wmsInTaskQuery.setPlanInId(entity.getPlanId());
wmsInTaskQuery.setPlanInStatus("0");
// 查询并加入符合条件的任务
List<WmsInTask> tasks = selectWmsInTaskList(wmsInTaskQuery);
if (tasks != null && !tasks.isEmpty()) {
wmsInTaskList.addAll(tasks);
}
}
}
// 返回第一个符合条件的任务
if (!wmsInTaskList.isEmpty()) {
return wmsInTaskList.get(0);
}
return null;
}
/** /**
* 查询入库任务列表 * 查询入库任务列表
* *