物料流程整合
This commit is contained in:
@@ -53,9 +53,9 @@ public class MaterialInfoDO extends BaseDO {
|
|||||||
private Long materialTypeId;
|
private Long materialTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程ID
|
* 物料流程
|
||||||
*/
|
*/
|
||||||
private Long materialProcessId;
|
private String materialProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 灯光等级
|
* 灯光等级
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class MaterialImportRowReq implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 流程名称
|
* 流程名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "流程名称")
|
@Schema(description = "物料流程")
|
||||||
private String processName;
|
private String materialProcess;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ public class MaterialInfoReq implements Serializable {
|
|||||||
* 流程ID
|
* 流程ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "流程ID")
|
@Schema(description = "流程ID")
|
||||||
@NotNull(message = "流程ID不能为空")
|
@NotBlank(message = "流程ID不能为空")
|
||||||
private Long materialProcessId;
|
private String materialProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 灯光等级
|
* 灯光等级
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ public class MaterialInfoResp extends BaseDetailResp {
|
|||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程名称
|
* 物料流程
|
||||||
*/
|
*/
|
||||||
@Schema(description = "流程名称")
|
@Schema(description = "物料流程")
|
||||||
@ExcelProperty(value = "物料流程")
|
@ExcelProperty(value = "物料流程")
|
||||||
private String processName;
|
private String materialProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料类型ID
|
* 物料类型ID
|
||||||
@@ -79,13 +79,6 @@ public class MaterialInfoResp extends BaseDetailResp {
|
|||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
private Long materialTypeId;
|
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.MaterialInfoImportResp;
|
||||||
import top.wms.admin.material.model.resp.MaterialInfoResp;
|
import top.wms.admin.material.model.resp.MaterialInfoResp;
|
||||||
import top.wms.admin.material.service.MaterialInfoService;
|
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.materialProcess.model.entity.MaterialProcessDO;
|
||||||
import top.wms.admin.materialType.mapper.MaterialTypeMapper;
|
import top.wms.admin.materialType.mapper.MaterialTypeMapper;
|
||||||
import top.wms.admin.materialType.model.entity.MaterialTypeDO;
|
import top.wms.admin.materialType.model.entity.MaterialTypeDO;
|
||||||
@@ -87,8 +86,6 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
|
|
||||||
private final MaterialTypeMapper materialTypeMapper;
|
private final MaterialTypeMapper materialTypeMapper;
|
||||||
|
|
||||||
private final MaterialProcessMapper materialProcessMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResp<MaterialInfoResp> page(MaterialInfoQuery query, PageQuery pageQuery) {
|
public PageResp<MaterialInfoResp> page(MaterialInfoQuery query, PageQuery pageQuery) {
|
||||||
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
||||||
@@ -218,18 +215,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
materialTypeMap = materialTypeList.stream()
|
materialTypeMap = materialTypeList.stream()
|
||||||
.collect(Collectors.toMap(MaterialTypeDO::getTypeName, MaterialTypeDO::getId, (k1, v1) -> v1));
|
.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<>();
|
Map<String, Integer> lightLevelMap = new HashMap<>();
|
||||||
importMaterialList.forEach(row -> {
|
importMaterialList.forEach(row -> {
|
||||||
@@ -253,7 +239,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
MaterialInfoDO materialDO = BeanUtil.toBeanIgnoreError(row, MaterialInfoDO.class);
|
MaterialInfoDO materialDO = BeanUtil.toBeanIgnoreError(row, MaterialInfoDO.class);
|
||||||
materialDO.setUnitWeight(NumberUtil.isValidNumber(row.getUnitWeight()) ? row.getUnitWeight() : null);
|
materialDO.setUnitWeight(NumberUtil.isValidNumber(row.getUnitWeight()) ? row.getUnitWeight() : null);
|
||||||
materialDO.setMaterialSpec(StrUtil.isNotBlank(row.getMaterialSpec()) ? row.getMaterialSpec() : 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.setMaterialTypeId(materialTypeMap.get(row.getTypeName()));
|
||||||
materialDO.setLightLevel(lightLevelMap.get(row.getLightLevelName()));
|
materialDO.setLightLevel(lightLevelMap.get(row.getLightLevelName()));
|
||||||
// 修改 or 新增
|
// 修改 or 新增
|
||||||
|
|||||||
@@ -80,23 +80,19 @@
|
|||||||
<select id="selectMaterialInfoPage" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
<select id="selectMaterialInfoPage" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
||||||
SELECT
|
SELECT
|
||||||
mi.*,
|
mi.*,
|
||||||
mt.type_name typeName,
|
mt.type_name typeName
|
||||||
mp.process_name processName
|
|
||||||
FROM
|
FROM
|
||||||
sys_material_info mi
|
sys_material_info mi
|
||||||
left join sys_material_type mt on mi.material_type_id = mt.id
|
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}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectMaterialInfoExport" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
<select id="selectMaterialInfoExport" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
||||||
SELECT
|
SELECT
|
||||||
mi.*,
|
mi.*,
|
||||||
mt.type_name typeName,
|
mt.type_name typeName
|
||||||
mp.process_name processName
|
|
||||||
FROM
|
FROM
|
||||||
sys_material_info mi
|
sys_material_info mi
|
||||||
left join sys_material_type mt on mi.material_type_id = mt.id
|
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}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -22,16 +22,11 @@ public class VmCommandController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimpleRequestMatcher requestMatcher;
|
private SimpleRequestMatcher requestMatcher;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MaterialProcessMapper materialProcessMapper;
|
|
||||||
|
|
||||||
@PostMapping("/send")
|
@PostMapping("/send")
|
||||||
public String sendAndWait(@RequestBody JSONObject js) {
|
public String sendAndWait(@RequestBody JSONObject js) {
|
||||||
String msg = js.getString("msg");
|
String materialProcess = js.getString("materialProcess");
|
||||||
log.info("开始比对物料编码: {}", msg);
|
log.info("开始比对: {}", materialProcess);
|
||||||
String processCode = materialProcessMapper.getCodeByMaterial(msg);
|
CheckUtils.throwIf(StrUtil.isBlank(materialProcess), "物料流程编码不能为空");
|
||||||
log.info("物料流程编码: {}", processCode);
|
|
||||||
CheckUtils.throwIf(StrUtil.isBlank(processCode), "未查询到物料流程编码");
|
|
||||||
|
|
||||||
// 1. 检查连接
|
// 1. 检查连接
|
||||||
Channel channel = channelManager.getFirstChannel();
|
Channel channel = channelManager.getFirstChannel();
|
||||||
@@ -40,7 +35,7 @@ public class VmCommandController {
|
|||||||
}
|
}
|
||||||
// 2. 清空之前的响应队列,避免影响当前请求
|
// 2. 清空之前的响应队列,避免影响当前请求
|
||||||
requestMatcher.clear();
|
requestMatcher.clear();
|
||||||
channel.writeAndFlush(msg);
|
channel.writeAndFlush(materialProcess);
|
||||||
// 3. 等待响应
|
// 3. 等待响应
|
||||||
String response = requestMatcher.waitForResponse(20);
|
String response = requestMatcher.waitForResponse(20);
|
||||||
log.info("sendAndWait-收到响应: {}", response);
|
log.info("sendAndWait-收到响应: {}", response);
|
||||||
|
|||||||
Reference in New Issue
Block a user