diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java index 576a0c0..a19654c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java @@ -11,14 +11,12 @@ import com.ktg.mes.md.domain.BaseKnife; import com.ktg.mes.md.domain.MdItem; import com.ktg.mes.md.service.IBaseKnifeService; 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.WmsInPlanDetailEntity; import com.ktg.mes.wm.domain.WmsInTask; -import com.ktg.mes.wm.service.IWmStorageAreaService; -import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; -import com.ktg.mes.wm.service.IWmsInTaskService; +import com.ktg.mes.wm.service.*; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.stream.Stream; /** * 入库任务Controller @@ -43,6 +40,8 @@ public class WmsInTaskController extends BaseController { private final IBaseKnifeService baseKnifeService; private final IWmStorageAreaService wmStorageAreaService; private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; + private final IUcmCtBaseService ucmCtBaseService; + private final IWmStorageLocationService wmStorageLocationService; /** * 查询入库任务列表 @@ -95,8 +94,25 @@ public class WmsInTaskController extends BaseController { if (wmsInTask == null) { return AjaxResult.error("未查询到相关任务"); } + + // 获得料箱 + UcmCtBase ucmCtBaseByCode = ucmCtBaseService.selectUcmCtBaseByCode(rfid); + if (ucmCtBaseByCode == null) { + return AjaxResult.error("未查询到相关料箱"); + } + + // 自动分配非临时库位 + WmStorageArea wmStorageArea = this.wmStorageLocationService.queryOneAreaByLocationCode("DDJ01", ucmCtBaseByCode.getAttr3() == 1); + wmsInTask.setCellTgt(wmStorageArea.getAreaId()); + wmsInTask.setCellName(wmStorageArea.getAreaName()); + wmsInTask.setCellCode(wmStorageArea.getAreaCode()); + wmsInTask.setCellX(wmStorageArea.getPositionX().toString()); + wmsInTask.setCellY(wmStorageArea.getPositionY().toString()); + wmsInTask.setCellZ(wmStorageArea.getPositionZ().toString()); + // 将料箱rfid绑定至任务 wmsInTask.setBoxRfid(rfid); + wmsInTaskService.updateWmsInTask(wmsInTask); return AjaxResult.success(wmsInTask); }