fix:产线叫料限制同一工单下的组盘物料

fix:mysql8的分组查询
This commit is contained in:
zhaoyf
2026-07-02 14:45:45 +08:00
parent e989e56af8
commit 3d8817994e
2 changed files with 31 additions and 15 deletions

View File

@@ -46,44 +46,46 @@ public class MesToWmsServiceImpl implements MesToWmsService {
@Override @Override
public void task(MesTaskParams mesTaskParams) { public void task(MesTaskParams mesTaskParams) {
SchBasePoint portPoint = iSchBasePointService.selectByCode(mesTaskParams.getPortCode()); SchBasePoint portPoint = iSchBasePointService.selectByCode(mesTaskParams.getPortCode());
if (portPoint == null){ if (portPoint == null) {
throw new BadRequestException(String.format("请求失败,点位%s信息不存在",mesTaskParams.getPortCode())); throw new BadRequestException(String.format("请求失败,点位%s信息不存在", mesTaskParams.getPortCode()));
} }
String vehicleCode = portPoint.getVehicle_code(); String vehicleCode = portPoint.getVehicle_code();
switch (mesTaskParams.getRequestedCode()){ switch (mesTaskParams.getRequestedCode()) {
case "1" ://返空 + 送满 case "1"://返空 + 送满
//不用处理顺序执行 //不用处理顺序执行
case "3" ://返空 case "3"://返空
case "4" ://托盘余料退回 case "4"://托盘余料退回
if (StrUtil.isEmptyIfStr(vehicleCode)){ if (StrUtil.isEmptyIfStr(vehicleCode)) {
throw new BadRequestException("请求失败,上料口没有绑定托盘"); throw new BadRequestException("请求失败,上料口没有绑定托盘");
} }
//获取回空对接位 //获取回空对接位
SchBasePoint pointDJ = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>() SchBasePoint pointDJ = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.isNull(SchBasePoint::getVehicle_code) .isNull(SchBasePoint::getVehicle_code)
.likeRight(SchBasePoint::getPoint_code, mesTaskParams.getLineCode() + "DJ")); .likeRight(SchBasePoint::getPoint_code, mesTaskParams.getLineCode() + "DJ"));
if (pointDJ == null){ if (pointDJ == null) {
throw new BadRequestException("未找到空闲返空对接位"); throw new BadRequestException("未找到空闲返空对接位");
} }
JSONObject taskFormReturn = new JSONObject(); JSONObject taskFormReturn = new JSONObject();
taskFormReturn.put("config_code","LineReturnEmptyTask"); taskFormReturn.put("config_code", "LineReturnEmptyTask");
taskFormReturn.put("point_code1", portPoint.getPoint_code()); taskFormReturn.put("point_code1", portPoint.getPoint_code());
taskFormReturn.put("point_code2", pointDJ.getPoint_code()); taskFormReturn.put("point_code2", pointDJ.getPoint_code());
taskFormReturn.put("vehicle_code", vehicleCode); taskFormReturn.put("vehicle_code", vehicleCode);
taskFormReturn.put("create_name", "MES"); taskFormReturn.put("create_name", "MES");
LineReturnEmptyTask lineReturnEmptyTask = SpringContextHolder.getBean("LineReturnEmptyTask"); LineReturnEmptyTask lineReturnEmptyTask = SpringContextHolder.getBean("LineReturnEmptyTask");
lineReturnEmptyTask.create(taskFormReturn); lineReturnEmptyTask.create(taskFormReturn);
if(Objects.equals(mesTaskParams.getRequestedCode(), "3") || Objects.equals(mesTaskParams.getRequestedCode(), "4")) break; if (Objects.equals(mesTaskParams.getRequestedCode(), "3") || Objects.equals(mesTaskParams.getRequestedCode(), "4"))
case "2" ://叫满 break;
if (!StrUtil.isEmptyIfStr(vehicleCode) && Objects.equals(mesTaskParams.getRequestedCode(), "2")){ case "2"://叫满
if (!StrUtil.isEmptyIfStr(vehicleCode) && Objects.equals(mesTaskParams.getRequestedCode(), "2")) {
throw new BadRequestException("请求失败,上料口存在托盘占用"); throw new BadRequestException("请求失败,上料口存在托盘占用");
} }
//获取组盘信息 //获取组盘信息
List<GroupPlate> groupList = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>() List<GroupPlate> groupList = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getLoad_port, portPoint.getPoint_code()) .eq(GroupPlate::getLoad_port, portPoint.getPoint_code())
.eq(GroupPlate::getExt_code, mesTaskParams.getOrderCode())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))); .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
if (groupList.isEmpty()){ if (groupList.isEmpty()) {
throw new BadRequestException("叫满任务失败,库存没有当前下料口的组盘物料"); throw new BadRequestException("叫满任务失败,库存没有当前下料口的组盘物料");
} }
GroupPlate groupPlate = groupList.get(0); GroupPlate groupPlate = groupList.get(0);
@@ -92,7 +94,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
SchBasePoint start_point = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>() SchBasePoint start_point = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getVehicle_code, storagevehicleCode)); .eq(SchBasePoint::getVehicle_code, storagevehicleCode));
JSONObject taskFormCall = new JSONObject(); JSONObject taskFormCall = new JSONObject();
taskFormCall.put("config_code","LineCallFullTask"); taskFormCall.put("config_code", "LineCallFullTask");
taskFormCall.put("point_code1", start_point.getPoint_code()); taskFormCall.put("point_code1", start_point.getPoint_code());
taskFormCall.put("point_code2", portPoint.getPoint_code()); taskFormCall.put("point_code2", portPoint.getPoint_code());
taskFormCall.put("vehicle_code", storagevehicleCode); taskFormCall.put("vehicle_code", storagevehicleCode);

View File

@@ -56,7 +56,21 @@
AND m.create_time &lt;= #{params.createTime[1]} AND m.create_time &lt;= #{params.createTime[1]}
</if> </if>
</where> </where>
GROUP BY m.bill_id GROUP BY
m.id,
m.bill_id,
m.order_no,
m.order_type,
m.forwardZD,
m.supplier_code,
m.supplier_name,
m.creator,
m.create_time,
m.modify_date,
m.status,
m.red,
m.bill_status,
m.audit_msg
ORDER BY m.create_time DESC ORDER BY m.create_time DESC
</select> </select>