refactor(入库计划明细实例): 增加字段

This commit is contained in:
LJW 2024-11-14 16:56:58 +08:00
parent 1492deeeda
commit 92de67e498
2 changed files with 153 additions and 23 deletions

View File

@ -55,6 +55,36 @@ public class WmsInPlanDetailEntity extends BaseEntity {
@Excel(name = "消耗寿命")
private Integer consumeLife;
/**
* 入库计划编码
*/
private String planCode;
/**
* 计划状态
*/
private String planState;
/**
* 来源类型手工录入等
*/
private String planSourceType;
/**
* 入库计划类型
*/
private String planType;
/**
* 库位编码
*/
private String cellCode;
/**
* 库位名称
*/
private String cellName;
/**
* 明细批次
*/
private String detailBatch;
public void setId(Long id) {
this.id = id;
}
@ -111,11 +141,74 @@ public class WmsInPlanDetailEntity extends BaseEntity {
return consumeLife;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanState() {
return planState;
}
public void setPlanState(String planState) {
this.planState = planState;
}
public String getPlanSourceType() {
return planSourceType;
}
public void setPlanSourceType(String planSourceType) {
this.planSourceType = planSourceType;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public String getCellCode() {
return cellCode;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellName() {
return cellName;
}
public void setCellName(String cellName) {
this.cellName = cellName;
}
public String getDetailBatch() {
return detailBatch;
}
public void setDetailBatch(String detailBatch) {
this.detailBatch = detailBatch;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planId", getPlanId())
.append("planCode", getPlanCode())
.append("planState", getPlanState())
.append("planSourceType", getPlanSourceType())
.append("planType", getPlanType())
.append("cellCode", getCellCode())
.append("cellName", getCellName())
.append("detailBatch", getDetailBatch())
.append("planDetailsId", getPlanDetailsId())
.append("source", getSource())
.append("knifeId", getKnifeId())

View File

@ -1,7 +1,15 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import java.util.*;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.WmsBusinessType;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
@ -10,25 +18,32 @@ import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
/**
* 入库计划明细实体Service业务层处理
*
*
* @author yinjinlu
* @date 2024-11-05
*/
@Service
public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityService
{
public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityService {
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private WmsInPlanMapper wmsInPlanMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
/**
* 查询入库计划明细实体
*
*
* @param id 入库计划明细实体主键
* @return 入库计划明细实体
*/
@Override
public WmsInPlanDetailEntity selectWmsInPlanDetailEntityById(Long id)
{
public WmsInPlanDetailEntity selectWmsInPlanDetailEntityById(Long id) {
return wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityById(id);
}
@ -45,63 +60,85 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS
/**
* 查询入库计划明细实体列表
*
*
* @param wmsInPlanDetailEntity 入库计划明细实体
* @return 入库计划明细实体
*/
@Override
public List<WmsInPlanDetailEntity> selectWmsInPlanDetailEntityList(WmsInPlanDetailEntity wmsInPlanDetailEntity)
{
return wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
public List<WmsInPlanDetailEntity> selectWmsInPlanDetailEntityList(WmsInPlanDetailEntity wmsInPlanDetailEntity) {
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
List<WmsInPlanDetailEntity> handleWmsInPlanDetailEntityList = new ArrayList<>();
wmsInPlanDetailEntityList.forEach(entity -> {
// 获取入库计划信息
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString());
// 获取入库计划
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId());
for (WmsInPlanDetails detail : wmsInPlan.getWmsInPlanDetailsList()) {
// 匹配入库明细
if (detail.getDetailsId().equals(entity.getPlanDetailsId())) {
System.out.println("---" + detail.getDetailsId() + "+测试+" + entity.getPlanDetailsId());
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(detail.getCellId());
entity.setDetailBatch(detail.getBatch());
// 设置库位信息
entity.setCellCode(wmStorageArea.getAreaCode());
entity.setCellName(wmStorageArea.getAreaName());
}
}
entity.setPlanCode(wmsInPlan.getPlanCode());
entity.setPlanType(wmsBusinessType.getName());
entity.setPlanState(wmsInPlan.getState());
entity.setPlanSourceType(wmsInPlan.getSourceType());
handleWmsInPlanDetailEntityList.add(entity);
});
return handleWmsInPlanDetailEntityList;
}
/**
* 新增入库计划明细实体
*
*
* @param wmsInPlanDetailEntity 入库计划明细实体
* @return 结果
*/
@Override
public int insertWmsInPlanDetailEntity(WmsInPlanDetailEntity wmsInPlanDetailEntity)
{
public int insertWmsInPlanDetailEntity(WmsInPlanDetailEntity wmsInPlanDetailEntity) {
wmsInPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
return wmsInPlanDetailEntityMapper.insertWmsInPlanDetailEntity(wmsInPlanDetailEntity);
}
/**
* 修改入库计划明细实体
*
*
* @param wmsInPlanDetailEntity 入库计划明细实体
* @return 结果
*/
@Override
public int updateWmsInPlanDetailEntity(WmsInPlanDetailEntity wmsInPlanDetailEntity)
{
public int updateWmsInPlanDetailEntity(WmsInPlanDetailEntity wmsInPlanDetailEntity) {
wmsInPlanDetailEntity.setUpdateTime(DateUtils.getNowDate());
return wmsInPlanDetailEntityMapper.updateWmsInPlanDetailEntity(wmsInPlanDetailEntity);
}
/**
* 批量删除入库计划明细实体
*
*
* @param ids 需要删除的入库计划明细实体主键
* @return 结果
*/
@Override
public int deleteWmsInPlanDetailEntityByIds(Long[] ids)
{
public int deleteWmsInPlanDetailEntityByIds(Long[] ids) {
return wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityByIds(ids);
}
/**
* 删除入库计划明细实体信息
*
*
* @param id 入库计划明细实体主键
* @return 结果
*/
@Override
public int deleteWmsInPlanDetailEntityById(Long id)
{
public int deleteWmsInPlanDetailEntityById(Long id) {
return wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityById(id);
}
}