diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java index 990a27c..d7a4fe3 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmsInTaskService.java @@ -58,4 +58,6 @@ public interface IWmsInTaskService * @return 结果 */ public int deleteWmsInTaskById(String id); + + public int issueBatch(String[] ids); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java index 183de07..8a3fd33 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsInTaskServiceImpl.java @@ -1,23 +1,22 @@ package com.ktg.mes.wm.service.impl; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; +import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; 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.mapper.MdItemMapper; +import com.ktg.mes.md.service.IBaseKnifeService; import com.ktg.mes.md.service.IMdItemService; -import com.ktg.mes.wm.domain.WmStorageArea; -import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; +import com.ktg.mes.wm.domain.*; import com.ktg.mes.wm.mapper.WmStorageAreaMapper; -import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; +import com.ktg.mes.wm.service.*; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ktg.mes.wm.mapper.WmsInTaskMapper; -import com.ktg.mes.wm.domain.WmsInTask; -import com.ktg.mes.wm.service.IWmsInTaskService; /** * 入库任务Service业务层处理 @@ -30,11 +29,19 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { @Autowired private WmsInTaskMapper wmsInTaskMapper; @Autowired - private MdItemMapper mdItemMapper; + private IMdItemService mdItemService; @Autowired private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; @Autowired private WmStorageAreaMapper wmStorageAreaMapper; + @Autowired + private IWmsInPlanService wmsInPlanService; + @Autowired + private IWmStorageAreaService wmStorageAreaService; + @Autowired + private IWmsZdTaskService wmsZdTaskService; + @Autowired + private IBaseKnifeService baseKnifeService; /** * 查询入库任务 @@ -57,7 +64,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { public List selectWmsInTaskList(WmsInTask wmsInTask) { List wmsInTaskList = new ArrayList<>(); wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> { - MdItem mdItem = mdItemMapper.selectMdItemByCode(task.getMaterialCode()); + MdItem mdItem = mdItemService.selectMdItemByCode(task.getMaterialCode()); task.setMaterialName(mdItem.getItemName()); WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity(); @@ -123,4 +130,33 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService { public int deleteWmsInTaskById(String id) { return wmsInTaskMapper.deleteWmsInTaskById(id); } + + @Override + public int issueBatch(String[] ids) { + for (String taskId : ids) { + // 获取任务信息 + WmsInTask wmsInTask = selectWmsInTaskById(taskId); + // 更新任务状态 + wmsInTask.setPlanInStatus("1"); + updateWmsInTask(wmsInTask); + + MdItem mbbBdMrlMitm = mdItemService.selectMdItemByCode(wmsInTask.getMaterialCode()); + BaseKnife baseKnifeQuery = new BaseKnife(); + baseKnifeQuery.setKnifeCode(mbbBdMrlMitm.getItemCode()); + baseKnifeQuery.setKnifeFineState(2); + List baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery); + + + for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) { + BaseKnife baseKnife = baseKnifeList.get(i); + // 设置状态为 解锁 + baseKnife.setIsLocked(0); + // 设置工具状态 已入库 + baseKnife.setKnifeFineState(1); + // 更新台账状态 + baseKnifeService.updateBaseKnife(baseKnife); + } + } + return 0; + } }