From 2d7e887629ef14e78a1716a1939f72692235f4db Mon Sep 17 00:00:00 2001 From: LJW Date: Thu, 21 Nov 2024 09:06:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=85=A5=E5=BA=93=E4=BB=BB=E5=8A=A1):?= =?UTF-8?q?=20=E5=85=A5=E5=BA=93=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/WmsInTaskController.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 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 21b5dfb..86ae899 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 @@ -5,6 +5,7 @@ import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.core.page.TableDataInfo; import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.mes.md.domain.BaseKnife; import com.ktg.mes.md.domain.MdItem; @@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Objects; +import java.util.Optional; +import java.util.stream.Stream; /** * 入库任务Controller @@ -130,8 +133,8 @@ public class WmsInTaskController extends BaseController { wmsInPlanDetailEntity.setPlanDetailsId(wmsInTask.getDetailInId()); List wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity); - // 入库类型为整刀回库 拆刀回库 - if (Objects.equals(wmsInTask.getPlanTypeId(), "9") || Objects.equals(wmsInTask.getPlanTypeId(), "15")) { + // 入库类型为整刀回库 + if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) { wmsInPlanDetailEntityList.forEach(planDetailEntity -> { BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId()); // 计算消耗寿命 @@ -144,12 +147,29 @@ public class WmsInTaskController extends BaseController { baseKnife.setIsLocked(0); // 设置工具状态 已入库 baseKnife.setKnifeFineState(1); - if (!planDetailEntity.getRfid().isEmpty()) { + if (StringUtils.isNotEmpty(planDetailEntity.getRfid())) { baseKnife.setRfid(planDetailEntity.getRfid()); } // 更新台账状态 baseKnifeService.updateBaseKnife(baseKnife); }); + } else if (Objects.equals(wmsInTask.getPlanTypeId(), "15")) { + // 拆刀回库 + wmsInPlanDetailEntityList.forEach(planDetailEntity -> { + BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId()); + // 设置工具状态 已拆刀 + baseKnife.setKnifeFineState(4); + // 更新整刀台账状态 + baseKnifeService.updateBaseKnife(baseKnife); + // 查询刀柄 + Optional bladeOpt = baseKnife.getBaseKnifeList().stream().filter(item -> item.getItemOrProduct().equals("ITEM")).findFirst(); + if (bladeOpt.isPresent()) { + // 设置状态为 解锁 + bladeOpt.get().setIsLocked(0); + bladeOpt.get().setKnifeFineState(1); + baseKnifeService.updateBaseKnife(bladeOpt.get()); + } + }); } else if (Objects.equals(wmsInTask.getPlanTypeId(), "7")) { // 入库类型为刀柄入库 wmsInPlanDetailEntityList.forEach(planDetailEntity -> {