物料流程整合
This commit is contained in:
@@ -53,9 +53,9 @@ public class MaterialInfoDO extends BaseDO {
|
||||
private Long materialTypeId;
|
||||
|
||||
/**
|
||||
* 流程ID
|
||||
* 物料流程
|
||||
*/
|
||||
private Long materialProcessId;
|
||||
private String materialProcess;
|
||||
|
||||
/**
|
||||
* 灯光等级
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MaterialImportRowReq implements Serializable {
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
@Schema(description = "流程名称")
|
||||
private String processName;
|
||||
@Schema(description = "物料流程")
|
||||
private String materialProcess;
|
||||
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ public class MaterialInfoReq implements Serializable {
|
||||
* 流程ID
|
||||
*/
|
||||
@Schema(description = "流程ID")
|
||||
@NotNull(message = "流程ID不能为空")
|
||||
private Long materialProcessId;
|
||||
@NotBlank(message = "流程ID不能为空")
|
||||
private String materialProcess;
|
||||
|
||||
/**
|
||||
* 灯光等级
|
||||
|
||||
@@ -66,11 +66,11 @@ public class MaterialInfoResp extends BaseDetailResp {
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
* 物料流程
|
||||
*/
|
||||
@Schema(description = "流程名称")
|
||||
@Schema(description = "物料流程")
|
||||
@ExcelProperty(value = "物料流程")
|
||||
private String processName;
|
||||
private String materialProcess;
|
||||
|
||||
/**
|
||||
* 物料类型ID
|
||||
@@ -79,13 +79,6 @@ public class MaterialInfoResp extends BaseDetailResp {
|
||||
@ExcelIgnore
|
||||
private Long materialTypeId;
|
||||
|
||||
/**
|
||||
* 流程ID
|
||||
*/
|
||||
@Schema(description = "流程ID")
|
||||
@ExcelIgnore
|
||||
private Long materialProcessId;
|
||||
|
||||
/**
|
||||
* 品类下行浮动范围(%)
|
||||
*/
|
||||
|
||||
@@ -51,7 +51,6 @@ import top.wms.admin.material.model.resp.MaterialImportParseResp;
|
||||
import top.wms.admin.material.model.resp.MaterialInfoImportResp;
|
||||
import top.wms.admin.material.model.resp.MaterialInfoResp;
|
||||
import top.wms.admin.material.service.MaterialInfoService;
|
||||
import top.wms.admin.materialProcess.mapper.MaterialProcessMapper;
|
||||
import top.wms.admin.materialProcess.model.entity.MaterialProcessDO;
|
||||
import top.wms.admin.materialType.mapper.MaterialTypeMapper;
|
||||
import top.wms.admin.materialType.model.entity.MaterialTypeDO;
|
||||
@@ -87,8 +86,6 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
||||
|
||||
private final MaterialTypeMapper materialTypeMapper;
|
||||
|
||||
private final MaterialProcessMapper materialProcessMapper;
|
||||
|
||||
@Override
|
||||
public PageResp<MaterialInfoResp> page(MaterialInfoQuery query, PageQuery pageQuery) {
|
||||
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
||||
@@ -218,18 +215,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
||||
materialTypeMap = materialTypeList.stream()
|
||||
.collect(Collectors.toMap(MaterialTypeDO::getTypeName, MaterialTypeDO::getId, (k1, v1) -> v1));
|
||||
}
|
||||
//查询物料流程
|
||||
List<String> collect1 = importMaterialList.stream()
|
||||
.map(MaterialImportRowReq::getProcessName)
|
||||
.distinct()
|
||||
.toList();
|
||||
List<MaterialProcessDO> materialProcessList = materialProcessMapper
|
||||
.selectList(new LambdaQueryWrapper<MaterialProcessDO>().in(MaterialProcessDO::getProcessName, collect1));
|
||||
Map<String, Long> materialProcessMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(materialProcessList)) {
|
||||
materialProcessMap = materialProcessList.stream()
|
||||
.collect(Collectors.toMap(MaterialProcessDO::getProcessName, MaterialProcessDO::getId, (k1, v1) -> v1));
|
||||
}
|
||||
|
||||
//处理灯光等级
|
||||
Map<String, Integer> lightLevelMap = new HashMap<>();
|
||||
importMaterialList.forEach(row -> {
|
||||
@@ -253,7 +239,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
||||
MaterialInfoDO materialDO = BeanUtil.toBeanIgnoreError(row, MaterialInfoDO.class);
|
||||
materialDO.setUnitWeight(NumberUtil.isValidNumber(row.getUnitWeight()) ? row.getUnitWeight() : null);
|
||||
materialDO.setMaterialSpec(StrUtil.isNotBlank(row.getMaterialSpec()) ? row.getMaterialSpec() : null);
|
||||
materialDO.setMaterialProcessId(materialProcessMap.get(row.getProcessName()));
|
||||
materialDO.setMaterialProcess(StrUtil.isNotBlank(row.getMaterialProcess()) ? row.getMaterialProcess() : null);
|
||||
materialDO.setMaterialTypeId(materialTypeMap.get(row.getTypeName()));
|
||||
materialDO.setLightLevel(lightLevelMap.get(row.getLightLevelName()));
|
||||
// 修改 or 新增
|
||||
|
||||
@@ -80,23 +80,19 @@
|
||||
<select id="selectMaterialInfoPage" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
||||
SELECT
|
||||
mi.*,
|
||||
mt.type_name typeName,
|
||||
mp.process_name processName
|
||||
mt.type_name typeName
|
||||
FROM
|
||||
sys_material_info mi
|
||||
left join sys_material_type mt on mi.material_type_id = mt.id
|
||||
left join sys_material_process mp on mi.material_process_id = mp.id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="selectMaterialInfoExport" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
||||
SELECT
|
||||
mi.*,
|
||||
mt.type_name typeName,
|
||||
mp.process_name processName
|
||||
mt.type_name typeName
|
||||
FROM
|
||||
sys_material_info mi
|
||||
left join sys_material_type mt on mi.material_type_id = mt.id
|
||||
left join sys_material_process mp on mi.material_process_id = mp.id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user