fix:拼单逻辑修改
This commit is contained in:
@@ -338,7 +338,6 @@
|
||||
WHERE cp.point_type = #{pointType}
|
||||
AND cp.point_status = #{pointStatus}
|
||||
AND cp.is_used = '1'
|
||||
AND cp.point_location = #{pointLocation}
|
||||
AND (cp.plan <![CDATA[ <> ]]> '1' OR ISNULL(cp.plan))
|
||||
AND IFNULL(p.qzzno, '') <![CDATA[ <> ]]> ''
|
||||
AND (IFNULL(cp.qzz_no2, '') = '' OR IFNULL(cp.qzz_no1, '') = '')
|
||||
@@ -346,9 +345,7 @@
|
||||
AND 0 <![CDATA[ < ]]> (SELECT COUNT(*)
|
||||
FROM st_ivt_cutpointivt sc
|
||||
WHERE sc.ext_code = p.resource_name
|
||||
AND sc.plan = #{plan}
|
||||
AND sc.product_area = #{area}
|
||||
AND sc.point_location = #{pointLocation})
|
||||
AND sc.plan = #{plan})
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071'
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.io.Serializable;
|
||||
public class CombinedOrderDto implements Serializable {
|
||||
private String pointType;
|
||||
private String pointStatus;
|
||||
private String pointLocation;
|
||||
/**
|
||||
* 判断是哪块合并区域
|
||||
*/
|
||||
|
||||
@@ -456,8 +456,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 6. 尝试拼单
|
||||
BstIvtCutpointivt combinedPoint = tryCombineOrder(demoPlan, deviceCode, startPoint, qzzNo);
|
||||
if (combinedPoint == null) {
|
||||
String end_point = tryCombineOrder(demoPlan, deviceCode, startPoint, qzzNo);
|
||||
if (end_point == null) {
|
||||
// 7. 正常业务流程(不拼单)
|
||||
handleNormalProcess(demoPlan, startPoint, qzzNo, containerNames, deviceCode, stepTipLogs);
|
||||
}
|
||||
@@ -3950,7 +3950,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
/**
|
||||
* 尝试拼单逻辑
|
||||
*/
|
||||
private BstIvtCutpointivt tryCombineOrder(PdmBiSlittingproductionplan demoPlan, String deviceCode,
|
||||
private String tryCombineOrder(PdmBiSlittingproductionplan demoPlan, String deviceCode,
|
||||
BstIvtShafttubeivt startPoint, String qzzNo) {
|
||||
Param codParam = paramService.findByCode(IS_COMBINED_ORDER);
|
||||
// 判断是否有同组(判断自己能不能拼单)
|
||||
@@ -3958,33 +3958,41 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
// 不允许拼单(未开启拼单逻辑)
|
||||
if (sameNumber != 0 || ObjectUtil.isEmpty(codParam) || !"1".equals(codParam.getValue())) {
|
||||
log.info("本身不允许拼单或者拼单配置未设置或者设置不拼单...");
|
||||
log.info("不允许拼单是否有同组:" + sameNumber + "拼单参数为:" + codParam);
|
||||
return null;
|
||||
}
|
||||
|
||||
String resourceName = demoPlan.getResource_name();
|
||||
StIvtCutpointivt deviceInfo = cutpointivtService.getPintByExtCode(resourceName, false);
|
||||
|
||||
// 查找能够拼单的点位(查找套轴对接位)
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = slitterMapper.getCombinedOrders(
|
||||
// 尝试与路上的轴拼单查找能够拼单的点位(查找套轴对接位)
|
||||
String end_point = tryMatchRunningTask(demoPlan, deviceCode, deviceInfo);
|
||||
|
||||
|
||||
//
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = new ArrayList<>();
|
||||
if (StrUtil.isEmpty(end_point)) {
|
||||
//如果找不到可以没有正在执行任务的点,就找一个新的点
|
||||
emptyNotTaskPoint = slitterMapper.getCombinedOrders(
|
||||
CombinedOrderDto.builder()
|
||||
.pointStatus("2")
|
||||
.pointType("1")
|
||||
.pointLocation(deviceInfo.getPoint_location())
|
||||
.plan(deviceInfo.getPlan())
|
||||
.device(resourceName)
|
||||
.area(deviceInfo.getProduct_area())
|
||||
.build());
|
||||
|
||||
// 如果没有空点位,尝试与路上的轴拼单
|
||||
if (emptyNotTaskPoint.isEmpty()) {
|
||||
emptyNotTaskPoint = tryMatchRunningTask(demoPlan, deviceCode, deviceInfo);
|
||||
if (ObjectUtil.isEmpty(emptyNotTaskPoint)){
|
||||
return null;
|
||||
}
|
||||
BstIvtCutpointivt cutPoint = emptyNotTaskPoint.get(0);
|
||||
end_point = ObjectUtil.isEmpty(cutPoint.getQzz_no1())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2();
|
||||
}
|
||||
|
||||
// 如果找到可拼单点位,创建任务
|
||||
if (!emptyNotTaskPoint.isEmpty()) {
|
||||
BstIvtCutpointivt cutPoint = emptyNotTaskPoint.get(0);
|
||||
createCombinedOrderTask(cutPoint, startPoint, demoPlan, qzzNo);
|
||||
return cutPoint;
|
||||
if (!StrUtil.isEmpty(end_point)) {
|
||||
createCombinedOrderTask(startPoint, demoPlan, qzzNo,end_point);
|
||||
return end_point;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -3993,10 +4001,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
/**
|
||||
* 尝试与运行中的任务拼单
|
||||
*/
|
||||
private List<BstIvtCutpointivt> tryMatchRunningTask(PdmBiSlittingproductionplan demoPlan,
|
||||
private String tryMatchRunningTask(PdmBiSlittingproductionplan demoPlan,
|
||||
String deviceCode, StIvtCutpointivt deviceInfo) {
|
||||
List<BstIvtCutpointivt> result = new ArrayList<>();
|
||||
|
||||
SchBaseTask runningTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getHandle_class, "org.nl.b_lms.sch.tasks.slitter.TrussSendAirShaftTask")
|
||||
.lt(SchBaseTask::getTask_status, "07")
|
||||
@@ -4004,14 +4010,17 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
.ne(SchBaseTask::getPoint_code1, deviceCode));
|
||||
|
||||
if (ObjectUtil.isEmpty(runningTask) || ObjectUtil.isEmpty(runningTask.getPoint_code2())) {
|
||||
return result;
|
||||
return "";
|
||||
}
|
||||
|
||||
List<PdmBiSlittingproductionplan> runningShafts = slittingproductionplanService.getByQzzNos(
|
||||
Arrays.asList(runningTask.getVehicle_code(), runningTask.getVehicle_code2()));
|
||||
List<String> qzzNoList = Stream.of(runningTask.getVehicle_code(), runningTask.getVehicle_code2())
|
||||
.filter(s -> s != null && StrUtil.isNotEmpty(s)) // 过滤 null 和空字符串
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<PdmBiSlittingproductionplan> runningShafts = slittingproductionplanService.getByQzzNos(qzzNoList);
|
||||
|
||||
if (runningShafts.isEmpty()) {
|
||||
return result;
|
||||
return "";
|
||||
}
|
||||
|
||||
PdmBiSlittingproductionplan runningShaft = runningShafts.get(0);
|
||||
@@ -4026,24 +4035,24 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code1, runningTask.getPoint_code2()).or()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, runningTask.getPoint_code2()));
|
||||
|
||||
if (one != null && canCombineWithRunningTask(one, runningTask)) {
|
||||
result.add(one);
|
||||
if (one != null && StrUtil.isNotEmpty(canCombineWithRunningTask(one, runningTask)) ) {
|
||||
return canCombineWithRunningTask(one,runningTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否可以与运行中的任务拼单
|
||||
*/
|
||||
private boolean canCombineWithRunningTask(BstIvtCutpointivt one, SchBaseTask runningTask) {
|
||||
private String canCombineWithRunningTask(BstIvtCutpointivt one, SchBaseTask runningTask) {
|
||||
String specialPoint = one.getTruss_point_code1().equals(runningTask.getPoint_code2())
|
||||
? one.getTruss_point_code2() : one.getTruss_point_code1();
|
||||
|
||||
return (specialPoint.equals(one.getTruss_point_code1()) && ObjectUtil.isNotEmpty(one.getQzz_no1()))
|
||||
|| (specialPoint.equals(one.getTruss_point_code2()) && ObjectUtil.isNotEmpty(one.getQzz_no2()));
|
||||
return (specialPoint.equals(one.getTruss_point_code1()) && ObjectUtil.isEmpty(one.getQzz_no1()))
|
||||
|| (specialPoint.equals(one.getTruss_point_code2()) && ObjectUtil.isEmpty(one.getQzz_no2())) ? specialPoint : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4054,19 +4063,17 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
* @param demoPlan 分切计划
|
||||
* @param qzzNo 气胀轴编码
|
||||
*/
|
||||
private void createCombinedOrderTask(BstIvtCutpointivt cutPoint, BstIvtShafttubeivt startPoint,
|
||||
PdmBiSlittingproductionplan demoPlan, String qzzNo) {
|
||||
private void createCombinedOrderTask(BstIvtShafttubeivt startPoint,
|
||||
PdmBiSlittingproductionplan demoPlan, String qzzNo, String endPoint) {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", startPoint.getPoint_code());
|
||||
taskParam.put("point_code2", endPoint);
|
||||
|
||||
String pointCode2 = ObjectUtil.isEmpty(cutPoint.getQzz_no1())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2();
|
||||
taskParam.put("point_code2", pointCode2);
|
||||
|
||||
String vehicleCode1 = ObjectUtil.isEmpty(cutPoint.getQzz_no1()) ? qzzNo : "";
|
||||
String vehicleCode2 = ObjectUtil.isEmpty(cutPoint.getQzz_no2()) ? qzzNo : "";
|
||||
String vehicleCode1 = endPoint.contains("A") ? qzzNo : "";
|
||||
String vehicleCode2 = endPoint.contains("B") ? qzzNo : "";
|
||||
taskParam.put("vehicle_code1", vehicleCode1);
|
||||
taskParam.put("vehicle_code2", vehicleCode2);
|
||||
taskParam.put("containers", demoPlan.getContainer_name());
|
||||
taskParam.put("flag", "1");
|
||||
taskParam.put("task_type", "010814");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
|
||||
Reference in New Issue
Block a user