feat: 送轴合单
This commit is contained in:
@@ -157,4 +157,11 @@ public interface IPdmBiSlittingproductionplanService extends IService<PdmBiSlitt
|
||||
|
||||
|
||||
List<PdmBiSlittingproductionplan> getPlansByDto(SlitterPlanDistinctDto dto);
|
||||
|
||||
/**
|
||||
* 获取相同母卷同躺的计划数量
|
||||
* @param demoPlan
|
||||
* @return
|
||||
*/
|
||||
Integer getSameTripParentContainerPlanCount(PdmBiSlittingproductionplan demoPlan);
|
||||
}
|
||||
|
||||
@@ -235,6 +235,19 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
|
||||
}
|
||||
return checkPlans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSameTripParentContainerPlanCount(PdmBiSlittingproductionplan demoPlan) {
|
||||
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(PdmBiSlittingproductionplan::getParent_container_name, demoPlan.getParent_container_name())
|
||||
.eq(PdmBiSlittingproductionplan::getRestruct_container_name, demoPlan.getRestruct_container_name())
|
||||
.eq(PdmBiSlittingproductionplan::getResource_name, demoPlan.getResource_name())
|
||||
.eq(PdmBiSlittingproductionplan::getSplit_group, demoPlan.getSplit_group())
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.ne(PdmBiSlittingproductionplan::getUp_or_down, demoPlan.getUp_or_down());
|
||||
return count(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCountXN(String area, String location) {
|
||||
return pdmBiSlittingproductionplanMapper.getCountXN(area, location);
|
||||
|
||||
@@ -57,8 +57,6 @@ public class AutoSendAirShaftAgvTask {
|
||||
public void run() {
|
||||
log.info("自动送气胀轴开始执行...");
|
||||
// 获取套轴对接位有气涨轴没任务的点位
|
||||
// 目前满足B1,B2
|
||||
// todo: 可以把区域校验去掉,就能够包括B1,B2,B3,B4
|
||||
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0", "0");
|
||||
for (BstIvtCutpointivt cutPoint : cutPoints) {
|
||||
log.info("此时执行的点位:{}", cutPoint.getPoint_code());
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.b_lms.sch.tasks.slitter.mapper;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CombinedOrderDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -72,4 +73,6 @@ public interface SlitterMapper {
|
||||
* @return
|
||||
*/
|
||||
List<String> getMoveTzdjwExceptionPoint();
|
||||
|
||||
List<BstIvtCutpointivt> getCombinedOrders(CombinedOrderDto cod);
|
||||
}
|
||||
|
||||
@@ -330,4 +330,36 @@
|
||||
ORDER BY p,
|
||||
truss_point_code;
|
||||
</select>
|
||||
<select id="getCombinedOrders" resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
|
||||
SELECT cp.*
|
||||
FROM `bst_ivt_cutpointivt` cp
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p
|
||||
ON p.qzzno = cp.qzz_no1 OR p.qzzno = cp.qzz_no2
|
||||
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, '') = '')
|
||||
AND (IFNULL(cp.qzz_no2, '') != '' OR IFNULL(cp.qzz_no1, '') != '')
|
||||
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 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071'
|
||||
AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND t.is_delete = '0'
|
||||
AND (
|
||||
t.point_code2 = cp.point_code
|
||||
OR t.point_code1 = cp.truss_point_code1
|
||||
OR t.point_code2 = cp.truss_point_code1
|
||||
OR t.point_code1 = cp.truss_point_code2
|
||||
OR t.point_code2 = cp.truss_point_code2
|
||||
))
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.mapper.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 合单需要的参数
|
||||
* @Author: lyd
|
||||
* @Date: 2025/8/18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CombinedOrderDto implements Serializable {
|
||||
private String pointType;
|
||||
private String pointStatus;
|
||||
private String pointLocation;
|
||||
/**
|
||||
* 判断是哪块合并区域
|
||||
*/
|
||||
private String plan;
|
||||
private String area;
|
||||
private String device;
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.sch.point.dao.mapper.StIvtCutpointivtMapper;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CombinedOrderDto;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
@@ -97,6 +99,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
* 套轴区域
|
||||
*/
|
||||
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
|
||||
/** 合单配送 */
|
||||
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
||||
@Autowired
|
||||
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
||||
@Autowired
|
||||
@@ -162,6 +166,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
// 预编译正则表达式,提升性能
|
||||
private static final Pattern GX_PATTERN = Pattern.compile("^GX(0[1-9]|[1-9]\\d)$");
|
||||
@Autowired
|
||||
private StIvtCutpointivtMapper stIvtCutpointivtMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject acsRequestShaftLoadTube(JSONObject param) {
|
||||
@@ -362,6 +368,11 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼单规则:双轴不拼,单轴拼,同区域拼
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -413,7 +424,6 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (plans.size() == 0) {
|
||||
log.error("找不到[{}]对应的分切计划,分切计划可能被删除或者拼接!", collect);
|
||||
// 移动到异常处理位(随机一个点位,在送到B2对面的位置)
|
||||
// List<BstIvtCutpointivt> exceptionPoints = bcutpointivtService.getAreaNotTaskPointByStatus("4", "1", "0", "0");
|
||||
List<String> exceptionPointCodes = bcutpointivtService.getCanUseMinPointByShelf("4", "0");
|
||||
if (exceptionPointCodes.size() > 0) {
|
||||
String exceptionPoint = exceptionPointCodes.get(0);
|
||||
@@ -435,28 +445,6 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("message", "创建送至异常处理位!");
|
||||
return res;
|
||||
}
|
||||
// 找套轴对接位(任取一个空点)
|
||||
// exceptionPointCodes = bcutpointivtService.getCanUseMinPointByShelfSpecial("1", "0");
|
||||
// if (exceptionPointCodes.size() > 0) {
|
||||
// String exceptionPoint = exceptionPointCodes.get(0);
|
||||
// JSONObject exParam = new JSONObject();
|
||||
// exParam.put("point_code1", startPoint.getPoint_code());
|
||||
// exParam.put("point_code2", exceptionPoint);
|
||||
// if (exceptionPoint.endsWith("A")) {
|
||||
// exParam.put("vehicle_code1", collect);
|
||||
// } else {
|
||||
// exParam.put("vehicle_code2", collect);
|
||||
// }
|
||||
// exParam.put("task_type", SlitterEnum.TASK_TYPE.code("套轴异常处理桁架任务"));
|
||||
// exParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
// exParam.put("acs_task_type", "6");
|
||||
// exParam.put("qzz_size", startPoint.getQzz_size());
|
||||
// exParam.put("containers", collect);
|
||||
// sendNBJExceptionPointTask.createTask(exParam);
|
||||
// res.put("status", HttpStatus.HTTP_OK);
|
||||
// res.put("message", "创建送至对接位等待异常处理位!");
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// 半条任务等待补齐
|
||||
stepTipLogs.add("套轴完成->[" + collect + "]对应的分切计划状态已更改,无暂存位置,创建任务失败!");
|
||||
@@ -505,8 +493,106 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
TaskUtils.updateOptMessageBySlitterPlan(plan);
|
||||
});
|
||||
slittingproductionplanService.updateBatchById(plans);
|
||||
// 搬运的点
|
||||
BstIvtCutpointivt cutPoint;
|
||||
//============================= 拼单业务 ==============================
|
||||
// 标记是否是通过拼单的
|
||||
String flag = "0";
|
||||
// 标记气胀轴编码是存到任务的载具号1还是2
|
||||
String vehicleLocation = "1";
|
||||
// 指定点位
|
||||
String specialPoint = "";
|
||||
// 合单开关
|
||||
Param codParam = paramService.findByCode(IS_COMBINED_ORDER);
|
||||
// 总判断是否有同组(判断自己能不能拼单)
|
||||
Integer sameNumber = slittingproductionplanService.getSameTripParentContainerPlanCount(demoPlan);
|
||||
// 允许拼单
|
||||
if (sameNumber == 0 && ObjectUtil.isNotEmpty(codParam) && "1".equals(codParam.getValue())) {
|
||||
StIvtCutpointivt deviceInfo = cutpointivtService.getPintByExtCode(resourceName, false);
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint;
|
||||
// 查找能够拼单(没任务)的点位
|
||||
emptyNotTaskPoint = slitterMapper.getCombinedOrders(CombinedOrderDto
|
||||
.builder()
|
||||
.pointStatus("2")
|
||||
.pointType("1")
|
||||
.pointLocation(deviceInfo.getPoint_location())
|
||||
.plan(deviceInfo.getPlan())
|
||||
.device(resourceName).build());
|
||||
flag = "1";
|
||||
// 如果为空,看看路上的那根轴能不能拼单
|
||||
if (emptyNotTaskPoint.size() == 0) {
|
||||
SchBaseTask runningTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getHandle_class, "org.nl.b_lms.sch.tasks.slitter.TrussSendAirShaftTask")
|
||||
.lt(SchBaseTask::getTask_status, "07")
|
||||
.eq(SchBaseTask::getIs_delete, "0")
|
||||
.ne(SchBaseTask::getPoint_code1, deviceCode));
|
||||
if (ObjectUtil.isNotEmpty(runningTask) && ObjectUtil.isNotEmpty(runningTask.getPoint_code2())) {
|
||||
List<PdmBiSlittingproductionplan> runningShafts = slittingproductionplanService.getByQzzNos(Arrays.asList(runningTask.getVehicle_code(), runningTask.getVehicle_code2()));
|
||||
if (runningShafts.size() > 0) {
|
||||
PdmBiSlittingproductionplan runningShaft = runningShafts.get(0);
|
||||
// 判断有没有同组同母卷同设备不同轴的卷号,没有则判断和当前计划是不是允许拼单的
|
||||
Integer otherPlans =
|
||||
slittingproductionplanService.getSameTripParentContainerPlanCount(runningShaft);
|
||||
if (otherPlans == 0) {
|
||||
StIvtCutpointivt runDeviceInfo = cutpointivtService.getPintByExtCode(runningShaft.getResource_name(), false);
|
||||
// 判断对应设备与当前计划设是否能够拼在一起
|
||||
if (runDeviceInfo.getPlan().equals(deviceInfo.getPlan())) {
|
||||
// 可以拼单
|
||||
BstIvtCutpointivt one = bcutpointivtService.getOne(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code1, runningTask.getPoint_code2()).or()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, runningTask.getPoint_code2()));
|
||||
// 判断目标点是否为空
|
||||
specialPoint = one.getTruss_point_code1().equals(runningTask.getPoint_code2())
|
||||
? one.getTruss_point_code2() : one.getTruss_point_code1();
|
||||
vehicleLocation = one.getTruss_point_code1().equals(runningTask.getPoint_code2())
|
||||
? "2" : "1";
|
||||
if ((specialPoint.equals(one.getTruss_point_code1())
|
||||
&& ObjectUtil.isNotEmpty(one.getQzz_no1()))
|
||||
|| (specialPoint.equals(one.getTruss_point_code2())
|
||||
&& ObjectUtil.isNotEmpty(one.getQzz_no2()))) {
|
||||
emptyNotTaskPoint.add(one);
|
||||
flag = "2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (emptyNotTaskPoint.size() > 0) {
|
||||
cutPoint = emptyNotTaskPoint.get(0);
|
||||
// 创建任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", startPoint.getPoint_code());
|
||||
taskParam.put("point_code2",
|
||||
"2".equals(flag) ? specialPoint
|
||||
: "1".equals(flag) ? ObjectUtil.isEmpty(cutPoint.getQzz_no1())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2()
|
||||
: SlitterConstant.SLITTER_SHAFT_UP.equals(demoPlan.getUp_or_down())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2());
|
||||
taskParam.put("vehicle_code1",
|
||||
"2".equals(flag) ? "1".equals(vehicleLocation) ? qzzNo : ""
|
||||
: "1".equals(flag) ? ObjectUtil.isEmpty(cutPoint.getQzz_no1())
|
||||
? qzzNo : ""
|
||||
: SlitterConstant.SLITTER_SHAFT_UP.equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("vehicle_code2",
|
||||
"2".equals(flag) ? "2".equals(vehicleLocation) ? qzzNo : ""
|
||||
: "1".equals(flag) ? ObjectUtil.isEmpty(cutPoint.getQzz_no2())
|
||||
? qzzNo : ""
|
||||
: SlitterConstant.SLITTER_SHAFT_DOWN.equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("task_type", "010814");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
taskParam.put("immediateNotifyAcs", "1");
|
||||
trussSendAirShaftTask.createTask(taskParam);
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "请求成功");
|
||||
res.put("msg", msg);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
flag = "0";
|
||||
//============================= 不进行拼单的正常业务 ==============================
|
||||
// 查找是否有同组的气胀轴位置
|
||||
BstIvtCutpointivt cutPoint = slitterMapper.getSameGroupPoint(demoPlan);
|
||||
cutPoint = slitterMapper.getSameGroupPoint(demoPlan);
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 也有可能在路上, 获取任务的终点
|
||||
String endPoint = slitterMapper.getSameGroupTaskPoint(demoPlan);
|
||||
@@ -2305,8 +2391,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
//获取机台对应的空闲对接位
|
||||
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(deviceCut.getProduct_area(),
|
||||
deviceCut.getSort_seq(),
|
||||
SlitterTaskUtil.getPointLocationInCutDevice(
|
||||
SlitterTaskUtil.getNumberByResourceCode(deviceCode),
|
||||
getPointLocationInCutDevice(
|
||||
getNumberByResourceCode(deviceCode),
|
||||
deviceCut.getProduct_area()));
|
||||
if (emptyPoint.size() == 0) {
|
||||
log.debug(deviceCode + "对接缓存位不是空位或存在执行中的任务!");
|
||||
|
||||
Reference in New Issue
Block a user