增加出库任务查看接口

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.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<HashMap<String, Object>> outInfoList;
public Long getWmsOutTaskId() {
return wmsOutTaskId;
}
@ -289,34 +292,38 @@ public class WmsOutTask extends BaseEntity {
this.attr4 = attr4;
}
public List<HashMap<String, Object>> getOutInfoList() {
return outInfoList;
}
public void setOutInfoList(List<HashMap<String, Object>> 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 +
'}';
}
}

View File

@ -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<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;
}
/**