From ba4a211a0d9db598608a3bbd72dd3c10bc9944d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=8D=E5=96=9C?= Date: Fri, 8 Nov 2024 10:53:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=87=BA=E5=BA=93=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=9F=A5=E7=9C=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ktg/mes/md/domain/WmsOutTask.java | 65 +++++++++-------- .../service/impl/WmsOutTaskServiceImpl.java | 69 +++++++++++++++++-- 2 files changed, 99 insertions(+), 35 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsOutTask.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsOutTask.java index d02d975..67be088 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsOutTask.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsOutTask.java @@ -2,8 +2,9 @@ package com.ktg.mes.md.domain; import com.ktg.common.annotation.Excel; import com.ktg.common.core.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.HashMap; +import java.util.List; /** * 出库任务对象 WMS_OUT_TASK @@ -129,6 +130,8 @@ public class WmsOutTask extends BaseEntity { */ private Integer attr4; + private List> outInfoList; + public Long getWmsOutTaskId() { return wmsOutTaskId; } @@ -289,34 +292,38 @@ public class WmsOutTask extends BaseEntity { this.attr4 = attr4; } + public List> getOutInfoList() { + return outInfoList; + } + + public void setOutInfoList(List> outInfoList) { + this.outInfoList = outInfoList; + } + @Override public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("wmsOutTaskId", getWmsOutTaskId()) - .append("wmsOutPlanId", getWmsOutPlanId()) - .append("wmsOutPlanCode", getWmsOutPlanCode()) - .append("wmsOutPlanDetailId", getWmsOutPlanDetailId()) - .append("wmsBusinessTypeId", getWmsBusinessTypeId()) - .append("taskCode", getTaskCode()) - .append("taskNumber", getTaskNumber()) - .append("outNumber", getOutNumber()) - .append("wmStorageAreaId", getWmStorageAreaId()) - .append("batchNum", getBatchNum()) - .append("mdItemId", getMdItemId()) - .append("mdItemCode", getMdItemCode()) - .append("mdItemName", getMdItemName()) - .append("mdItemUnit", getMdItemUnit()) - .append("taskState", getTaskState()) - .append("recipientUsername", getRecipientUsername()) - .append("remark", getRemark()) - .append("attr1", getAttr1()) - .append("attr2", getAttr2()) - .append("attr3", getAttr3()) - .append("attr4", getAttr4()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); + return "WmsOutTask{" + + "wmsOutTaskId=" + wmsOutTaskId + + ", wmsOutPlanId=" + wmsOutPlanId + + ", wmsOutPlanCode='" + wmsOutPlanCode + '\'' + + ", wmsOutPlanDetailId=" + wmsOutPlanDetailId + + ", wmsBusinessTypeId=" + wmsBusinessTypeId + + ", taskCode='" + taskCode + '\'' + + ", taskNumber=" + taskNumber + + ", outNumber=" + outNumber + + ", wmStorageAreaId=" + wmStorageAreaId + + ", batchNum='" + batchNum + '\'' + + ", mdItemId=" + mdItemId + + ", mdItemCode='" + mdItemCode + '\'' + + ", mdItemName='" + mdItemName + '\'' + + ", mdItemUnit='" + mdItemUnit + '\'' + + ", taskState='" + taskState + '\'' + + ", recipientUsername='" + recipientUsername + '\'' + + ", attr1='" + attr1 + '\'' + + ", attr2='" + attr2 + '\'' + + ", attr3=" + attr3 + + ", attr4=" + attr4 + + ", outInfoList=" + outInfoList + + '}'; } } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutTaskServiceImpl.java index 71246d1..c81d5ce 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutTaskServiceImpl.java @@ -1,16 +1,17 @@ package com.ktg.mes.md.service.impl; +import com.alibaba.fastjson.JSON; import com.ktg.common.utils.DateUtils; -import com.ktg.mes.md.domain.WmsOutPlanDetailEntity; -import com.ktg.mes.md.domain.WmsOutTask; -import com.ktg.mes.md.mapper.BaseKnifeMapper; -import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper; -import com.ktg.mes.md.mapper.WmsOutTaskMapper; +import com.ktg.mes.md.domain.*; +import com.ktg.mes.md.mapper.*; import com.ktg.mes.md.service.IWmsOutTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; /** @@ -30,6 +31,12 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService { @Autowired private BaseKnifeMapper baseKnifeMapper; + @Autowired + private WmsOutPlanMapper wmsOutPlanMapper; + + @Autowired + private WmsBusinessTypeMapper wmsBusinessTypeMapper; + /** * 查询出库任务 * @@ -38,7 +45,57 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService { */ @Override public WmsOutTask selectWmsOutTaskByWmsOutTaskId(Long wmsOutTaskId) { - return wmsOutTaskMapper.selectWmsOutTaskByWmsOutTaskId(wmsOutTaskId); + WmsOutTask wmsOutTask = wmsOutTaskMapper.selectWmsOutTaskByWmsOutTaskId(wmsOutTaskId); + + // 构建出库信息 + List> hashMapList = new ArrayList<>(); + + // 获得当前出库计划明细实体列表,并遍历 + WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity(); + entityQuery.setWmsOutPlanDetailId(wmsOutTask.getWmsOutPlanDetailId()); + List wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery); + + System.out.println(JSON.toJSONString(wmsOutPlanDetailEntityList)); + + wmsOutPlanDetailEntityList.forEach(nowWmsOutPlanDetailEntity -> { + // 根据出库实例对象获取出库计划明细 + WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(nowWmsOutPlanDetailEntity.getWmsOutPlanDetailId()); + + // 根据计划明细获得出库计划 + WmsOutPlan wmsOutPlan = this.wmsOutPlanMapper.selectWmsOutPlanByWmsOutPlanId(wmsOutPlanDetail.getWmsOutPlanId()); + + // 根据出库计划获得出库类型 + WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString()); + + // 设定出库信息数据 + HashMap hashMap = new HashMap<>(); + /* 来自计划 */ + hashMap.put("planCode", wmsOutPlan.getPlanCode()); // 计划编号 + hashMap.put("planStatus", wmsOutPlan.getPlanState()); // 计划状态 + hashMap.put("planType", wmsOutPlan.getPlanType()); // 计划类型 + hashMap.put("useUsername", wmsOutPlan.getRecipientUsername()); // 领用人 + /* 来自出入库计划类型 */ + hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID + hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码 + hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称 + /* 来自计划明细 */ + hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次 + hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID + hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码 + hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称 + hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态 + /* 实体 */ + String outTime = null; + if (nowWmsOutPlanDetailEntity.getCreateTime() != null) + outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(nowWmsOutPlanDetailEntity.getCreateTime()); + hashMap.put("outTime", outTime); // 出库时间 + hashMapList.add(hashMap); + + // 注入出库信息对象 + wmsOutTask.setOutInfoList(hashMapList); + }); + + return wmsOutTask; } /**