增加自动分配库位机制

This commit is contained in:
刘名喜 2024-12-18 16:02:34 +08:00
parent f769bc17be
commit 25f3092b65

View File

@ -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);
}