增加出库任务查看接口

This commit is contained in:
刘名喜 2024-11-08 10:53:01 +08:00
parent cd2b5620c3
commit ba4a211a0d
2 changed files with 99 additions and 35 deletions

View File

@ -2,8 +2,9 @@ package com.ktg.mes.md.domain;
import com.ktg.common.annotation.Excel; import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity; 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 * 出库任务对象 WMS_OUT_TASK
@ -129,6 +130,8 @@ public class WmsOutTask extends BaseEntity {
*/ */
private Integer attr4; private Integer attr4;
private List<HashMap<String, Object>> outInfoList;
public Long getWmsOutTaskId() { public Long getWmsOutTaskId() {
return wmsOutTaskId; return wmsOutTaskId;
} }
@ -289,34 +292,38 @@ public class WmsOutTask extends BaseEntity {
this.attr4 = attr4; this.attr4 = attr4;
} }
public List<HashMap<String, Object>> getOutInfoList() {
return outInfoList;
}
public void setOutInfoList(List<HashMap<String, Object>> outInfoList) {
this.outInfoList = outInfoList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return "WmsOutTask{" +
.append("wmsOutTaskId", getWmsOutTaskId()) "wmsOutTaskId=" + wmsOutTaskId +
.append("wmsOutPlanId", getWmsOutPlanId()) ", wmsOutPlanId=" + wmsOutPlanId +
.append("wmsOutPlanCode", getWmsOutPlanCode()) ", wmsOutPlanCode='" + wmsOutPlanCode + '\'' +
.append("wmsOutPlanDetailId", getWmsOutPlanDetailId()) ", wmsOutPlanDetailId=" + wmsOutPlanDetailId +
.append("wmsBusinessTypeId", getWmsBusinessTypeId()) ", wmsBusinessTypeId=" + wmsBusinessTypeId +
.append("taskCode", getTaskCode()) ", taskCode='" + taskCode + '\'' +
.append("taskNumber", getTaskNumber()) ", taskNumber=" + taskNumber +
.append("outNumber", getOutNumber()) ", outNumber=" + outNumber +
.append("wmStorageAreaId", getWmStorageAreaId()) ", wmStorageAreaId=" + wmStorageAreaId +
.append("batchNum", getBatchNum()) ", batchNum='" + batchNum + '\'' +
.append("mdItemId", getMdItemId()) ", mdItemId=" + mdItemId +
.append("mdItemCode", getMdItemCode()) ", mdItemCode='" + mdItemCode + '\'' +
.append("mdItemName", getMdItemName()) ", mdItemName='" + mdItemName + '\'' +
.append("mdItemUnit", getMdItemUnit()) ", mdItemUnit='" + mdItemUnit + '\'' +
.append("taskState", getTaskState()) ", taskState='" + taskState + '\'' +
.append("recipientUsername", getRecipientUsername()) ", recipientUsername='" + recipientUsername + '\'' +
.append("remark", getRemark()) ", attr1='" + attr1 + '\'' +
.append("attr1", getAttr1()) ", attr2='" + attr2 + '\'' +
.append("attr2", getAttr2()) ", attr3=" + attr3 +
.append("attr3", getAttr3()) ", attr4=" + attr4 +
.append("attr4", getAttr4()) ", outInfoList=" + outInfoList +
.append("createBy", getCreateBy()) '}';
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
} }
} }

View File

@ -1,16 +1,17 @@
package com.ktg.mes.md.service.impl; package com.ktg.mes.md.service.impl;
import com.alibaba.fastjson.JSON;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity; import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.domain.WmsOutTask; import com.ktg.mes.md.mapper.*;
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.service.IWmsOutTaskService; import com.ktg.mes.md.service.IWmsOutTaskService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
@ -30,6 +31,12 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
@Autowired @Autowired
private BaseKnifeMapper baseKnifeMapper; private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
/** /**
* 查询出库任务 * 查询出库任务
* *
@ -38,7 +45,57 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
*/ */
@Override @Override
public WmsOutTask selectWmsOutTaskByWmsOutTaskId(Long wmsOutTaskId) { public WmsOutTask selectWmsOutTaskByWmsOutTaskId(Long wmsOutTaskId) {
return wmsOutTaskMapper.selectWmsOutTaskByWmsOutTaskId(wmsOutTaskId); WmsOutTask wmsOutTask = wmsOutTaskMapper.selectWmsOutTaskByWmsOutTaskId(wmsOutTaskId);
// 构建出库信息
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
// 获得当前出库计划明细实体列表并遍历
WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity();
entityQuery.setWmsOutPlanDetailId(wmsOutTask.getWmsOutPlanDetailId());
List<WmsOutPlanDetailEntity> 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<String, Object> 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;
} }
/** /**