feat: 改造-分切下卷/上轴
This commit is contained in:
@@ -0,0 +1,263 @@
|
|||||||
|
package org.nl.b_lms.sch.tasks.slitter;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||||
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||||
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||||
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||||
|
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt;
|
||||||
|
import org.nl.b_lms.sch.point.service.IstIvtCutpointivtService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
|
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
|
||||||
|
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.common.utils.TaskUtils;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.pdm.ivt.deliverycache.service.IDeliverycachepointivtService;
|
||||||
|
import org.nl.wms.pdm.ivt.deliverycache.service.dao.Deliverycachepointivt;
|
||||||
|
import org.nl.wms.sch.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新的上轴任务
|
||||||
|
* @Author: liyongde
|
||||||
|
* @Date: 2026/4/24 14:21
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class UpShaftTrussNewTask extends AbstractAcsTask {
|
||||||
|
private final String THIS_CLASS = UpShaftTrussNewTask.class.getName();
|
||||||
|
@Autowired
|
||||||
|
private IschBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private IPdmBiSlittingproductionplanService slittingproductionplanService;
|
||||||
|
@Autowired
|
||||||
|
private IBstIvtCutpointivtService bcutpointivtService;
|
||||||
|
@Autowired
|
||||||
|
private IstIvtCutpointivtService cutpointivtService;
|
||||||
|
@Autowired
|
||||||
|
private IDeliverycachepointivtService deliverycachepointivtService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask() {
|
||||||
|
/*
|
||||||
|
* 下发给ACS时需要特殊处理
|
||||||
|
*/
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
String agv_system_type = "2";
|
||||||
|
List<SchBaseTask> taskList = taskService.getIssueTasks(THIS_CLASS);
|
||||||
|
for (SchBaseTask task : taskList) {
|
||||||
|
String requestParam = task.getRequest_param();
|
||||||
|
JSONObject requestParamObj = JSONObject.parseObject(requestParam);
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(task.getTask_id())
|
||||||
|
.task_code(task.getTask_code())
|
||||||
|
.task_type(task.getAcs_task_type())
|
||||||
|
.start_device_code(task.getPoint_code1())
|
||||||
|
.next_device_code(task.getPoint_code2())
|
||||||
|
.start_device_code2(task.getPoint_code3())
|
||||||
|
.next_device_code2(task.getPoint_code4())
|
||||||
|
.vehicle_code(task.getVehicle_code())
|
||||||
|
.agv_system_type(agv_system_type)
|
||||||
|
.truss_type(requestParamObj.getString("truss_type"))
|
||||||
|
.empty_site(requestParamObj.getString("empty_site"))
|
||||||
|
.priority(task.getPriority())
|
||||||
|
.remark(task.getRemark())
|
||||||
|
.product_area(task.getProduct_area())
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单任务下发,业务逻辑与无参 addTask 保持一致
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AcsTaskDto> addTask(SchBaseTask task) {
|
||||||
|
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||||
|
String agv_system_type = "2";
|
||||||
|
if (task != null) {
|
||||||
|
String requestParam = task.getRequest_param();
|
||||||
|
JSONObject requestParamObj = JSONObject.parseObject(requestParam);
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.ext_task_id(task.getTask_id())
|
||||||
|
.task_code(task.getTask_code())
|
||||||
|
.task_type(task.getAcs_task_type())
|
||||||
|
.start_device_code(task.getPoint_code1())
|
||||||
|
.next_device_code(task.getPoint_code2())
|
||||||
|
.start_device_code2(task.getPoint_code3())
|
||||||
|
.next_device_code2(task.getPoint_code4())
|
||||||
|
.vehicle_code(task.getVehicle_code())
|
||||||
|
.agv_system_type(agv_system_type)
|
||||||
|
.truss_type(requestParamObj.getString("truss_type"))
|
||||||
|
.empty_site(requestParamObj.getString("empty_site"))
|
||||||
|
.priority(task.getPriority())
|
||||||
|
.remark(task.getRemark())
|
||||||
|
.product_area(task.getProduct_area())
|
||||||
|
.build();
|
||||||
|
resultList.add(dto);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
task.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
// 点位内容更新
|
||||||
|
// 1是缓存架位,2是分切机下料位
|
||||||
|
String pointCode1 = task.getPoint_code1();
|
||||||
|
Deliverycachepointivt point1 = deliverycachepointivtService.getOneByPointCode(pointCode1, false);
|
||||||
|
String pointCode2 = task.getPoint_code2();
|
||||||
|
StIvtCutpointivt point2 = cutpointivtService.getPintByUpOrDownCode(pointCode2, false);
|
||||||
|
// 可能不存在
|
||||||
|
String pointCode3 = task.getPoint_code1();
|
||||||
|
Deliverycachepointivt point3 = deliverycachepointivtService.getOneByPointCode(pointCode3, false);
|
||||||
|
|
||||||
|
// 交换数据
|
||||||
|
point2.setUp_qzzno(task.getVehicle_code());
|
||||||
|
point2.setDown_qzzno(task.getVehicle_code2());
|
||||||
|
point2.setUpdate_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||||
|
point2.setUpdate_optname(SecurityUtils.getCurrentUsername());
|
||||||
|
point2.setUpdate_time(DateUtil.now());
|
||||||
|
|
||||||
|
|
||||||
|
// 分切计划修改状态04->05
|
||||||
|
List<String> collect = Stream.of(task.getVehicle_code(), task.getVehicle_code2())
|
||||||
|
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||||
|
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNos(collect);
|
||||||
|
PdmBiSlittingproductionplan pp = plans.get(0);
|
||||||
|
String weightStr = SlitterTaskUtil.getPaperWeightStr(plans);
|
||||||
|
if (pp.getContainer_name().contains("虚拟")) {
|
||||||
|
// 如果是虚拟卷,需要执行删除标记,并且清空数据
|
||||||
|
// 将分切计划删除,设备禁用
|
||||||
|
plans.forEach(p1 -> {
|
||||||
|
p1.setIs_delete("1");
|
||||||
|
p1.setQzzno("");
|
||||||
|
p1.setUpdate_time(DateUtil.now());
|
||||||
|
p1.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||||
|
p1.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||||
|
});
|
||||||
|
slittingproductionplanService.updateBatchById(plans);
|
||||||
|
// 设备禁用
|
||||||
|
point2.setUp_qzzno("");
|
||||||
|
point2.setDown_qzzno("");
|
||||||
|
} else {
|
||||||
|
PdmBiSlittingproductionplan p = new PdmBiSlittingproductionplan();
|
||||||
|
p.setStatus("05");
|
||||||
|
TaskUtils.updateOptMessageBySlitterPlan(p);
|
||||||
|
slittingproductionplanService.update(p, new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.in(PdmBiSlittingproductionplan::getQzzno, collect));
|
||||||
|
}
|
||||||
|
|
||||||
|
point2.setRemark(weightStr);
|
||||||
|
cutpointivtService.updateById(point2);
|
||||||
|
|
||||||
|
point1.setQzzno("");
|
||||||
|
point1.setPoint_status("01");
|
||||||
|
TaskUtils.updateOptMessageByCachePoint(point1);
|
||||||
|
point3.setQzzno("");
|
||||||
|
point3.setPoint_status("01");
|
||||||
|
TaskUtils.updateOptMessageByCachePoint(point3);
|
||||||
|
deliverycachepointivtService.updateBatchById(Stream.of(point1, point3).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
// 取消
|
||||||
|
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||||
|
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||||
|
|
||||||
|
// 分切计划修改状态回退04 -> 03
|
||||||
|
List<String> collect = Stream.of(task.getVehicle_code(), task.getVehicle_code2())
|
||||||
|
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||||
|
PdmBiSlittingproductionplan p = new PdmBiSlittingproductionplan();
|
||||||
|
p.setStatus("03");
|
||||||
|
TaskUtils.updateOptMessageBySlitterPlan(p);
|
||||||
|
slittingproductionplanService.update(p, new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.in(PdmBiSlittingproductionplan::getQzzno, collect));
|
||||||
|
}
|
||||||
|
TaskUtils.updateOptMessageByTask(task);
|
||||||
|
taskService.updateById(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
|
SchBaseTask task = new SchBaseTask();
|
||||||
|
task.setTask_id(IdUtil.getStringId());
|
||||||
|
task.setTask_code(IdUtil.getStringId());
|
||||||
|
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
|
||||||
|
task.setPoint_code1(form.getString("point_code1"));
|
||||||
|
task.setPoint_code2(form.getString("point_code2"));
|
||||||
|
task.setPoint_code3(form.getString("point_code3"));
|
||||||
|
task.setPoint_code4(form.getString("point_code4"));
|
||||||
|
task.setVehicle_code(form.getString("vehicle_code1"));
|
||||||
|
task.setVehicle_code2(form.getString("vehicle_code2"));
|
||||||
|
task.setAcs_task_type("6");
|
||||||
|
task.setIs_delete("0");
|
||||||
|
task.setRequest_param(form.toJSONString());
|
||||||
|
task.setTask_type(form.getString("task_type"));
|
||||||
|
task.setProduct_area(form.getString("product_area"));
|
||||||
|
task.setCreate_id(currentUserId);
|
||||||
|
task.setCreate_name(currentUsername);
|
||||||
|
task.setCreate_time(DateUtil.now());
|
||||||
|
task.setHandle_class(THIS_CLASS);
|
||||||
|
//根据类型获取对应的任务优先级
|
||||||
|
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", task.getTask_type()).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||||
|
task.setPriority("1");
|
||||||
|
} else {
|
||||||
|
task.setPriority(priority_jo.getString("value"));
|
||||||
|
}
|
||||||
|
taskService.save(task);
|
||||||
|
// 分切计划修改状态 03->04
|
||||||
|
List<String> collect = Stream.of(task.getVehicle_code(), task.getVehicle_code2())
|
||||||
|
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||||
|
PdmBiSlittingproductionplan p = new PdmBiSlittingproductionplan();
|
||||||
|
p.setStatus("04");
|
||||||
|
TaskUtils.updateOptMessageBySlitterPlan(p);
|
||||||
|
slittingproductionplanService.update(p, new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.in(PdmBiSlittingproductionplan::getQzzno, collect));
|
||||||
|
this.immediateTaskNotifyAcs(task);
|
||||||
|
return task.getTask_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
this.updateTaskStatus(taskObj, "0");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ public enum SlitterEnum {
|
|||||||
, "拼单送轴", "010817", "拆单两点移动任务", "010818", "拆单四点移动任务", "010819"
|
, "拼单送轴", "010817", "拆单两点移动任务", "010818", "拆单四点移动任务", "010819"
|
||||||
, "满轴拼单桁架任务", "010820", "送空轴AGV任务", "010821", "人工叫空轴桁架任务", "010822"
|
, "满轴拼单桁架任务", "010820", "送空轴AGV任务", "010821", "人工叫空轴桁架任务", "010822"
|
||||||
, "备货区托盘入库", "010823", "备货区托盘出库", "010824", "送轴拆单任务", "010825"
|
, "备货区托盘入库", "010823", "备货区托盘出库", "010824", "送轴拆单任务", "010825"
|
||||||
, "拆单桁架任务", "010826")
|
, "拆单桁架任务", "010826", "分切合单下卷任务", "010827", "缓存上空轴任务", "010828")
|
||||||
),
|
),
|
||||||
/**
|
/**
|
||||||
* 二次请求
|
* 二次请求
|
||||||
|
|||||||
@@ -84,4 +84,6 @@ public interface SlitterMapper {
|
|||||||
List<Deliverycachepointivt> getReadyShaftCachePoint(StIvtCutpointivt actualDevice);
|
List<Deliverycachepointivt> getReadyShaftCachePoint(StIvtCutpointivt actualDevice);
|
||||||
|
|
||||||
List<SlitterDownNewDto> getCanDownPoints(StIvtCutpointivt actualDevice);
|
List<SlitterDownNewDto> getCanDownPoints(StIvtCutpointivt actualDevice);
|
||||||
|
|
||||||
|
List<Deliverycachepointivt> getReadyShaftCachePointByDevice(StIvtCutpointivt extCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,4 +471,39 @@
|
|||||||
ORDER BY base_id,
|
ORDER BY base_id,
|
||||||
truss_code
|
truss_code
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getReadyShaftCachePointByDevice"
|
||||||
|
resultType="org.nl.wms.pdm.ivt.deliverycache.service.dao.Deliverycachepointivt">
|
||||||
|
SELECT sd.*
|
||||||
|
FROM `st_ivt_deliverycachepointivt` sd
|
||||||
|
WHERE sd.product_area = #{product_area}
|
||||||
|
AND sd.point_location = #{point_location}
|
||||||
|
AND sd.point_status = '02'
|
||||||
|
AND EXISTS (SELECT 1
|
||||||
|
FROM pdm_bi_slittingproductionplan p
|
||||||
|
WHERE p.qzzno = sd.qzzno
|
||||||
|
AND p.resource_name = #{ext_code}
|
||||||
|
AND p.is_delete = '0')
|
||||||
|
AND NOT EXISTS (SELECT 1
|
||||||
|
FROM (SELECT point_code1 AS code
|
||||||
|
FROM sch_base_task
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND task_status <![CDATA[ < ]]> '07'
|
||||||
|
UNION ALL
|
||||||
|
SELECT point_code2 AS code
|
||||||
|
FROM sch_base_task
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND task_status <![CDATA[ < ]]> '07'
|
||||||
|
UNION ALL
|
||||||
|
SELECT point_code3 AS code
|
||||||
|
FROM sch_base_task
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND task_status <![CDATA[ < ]]> '07'
|
||||||
|
UNION ALL
|
||||||
|
SELECT point_code4 AS code
|
||||||
|
FROM sch_base_task
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND task_status <![CDATA[ < ]]> '07') t
|
||||||
|
WHERE t.code = sd.point_code)
|
||||||
|
ORDER BY sd.update_time
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
* 套轴区域
|
* 套轴区域
|
||||||
*/
|
*/
|
||||||
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
|
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
|
||||||
/** 合单配送 */
|
/**
|
||||||
|
* 合单配送
|
||||||
|
*/
|
||||||
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
||||||
@Autowired
|
@Autowired
|
||||||
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
||||||
@@ -170,6 +172,8 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
private IDeliverycachepointivtService deliverycachepointivtService;
|
private IDeliverycachepointivtService deliverycachepointivtService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SlitterDownNewTrussTask slitterDownNewTrussTask;
|
private SlitterDownNewTrussTask slitterDownNewTrussTask;
|
||||||
|
@Autowired
|
||||||
|
private UpShaftTrussNewTask upShaftTrussNewTask;
|
||||||
|
|
||||||
// 预编译正则表达式,提升性能
|
// 预编译正则表达式,提升性能
|
||||||
private static final Pattern GX_PATTERN = Pattern.compile("^GX(0[1-9]|[1-9]\\d)$");
|
private static final Pattern GX_PATTERN = Pattern.compile("^GX(0[1-9]|[1-9]\\d)$");
|
||||||
@@ -384,6 +388,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
* completeShaftLoading() - 完成套轴
|
* completeShaftLoading() - 完成套轴
|
||||||
* tryCombineOrder() - 尝试拼单逻辑
|
* tryCombineOrder() - 尝试拼单逻辑
|
||||||
* handleNormalProcess() - 处理正常业务流程
|
* handleNormalProcess() - 处理正常业务流程
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -926,14 +931,14 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
throw new BadRequestException("错误表达式");
|
throw new BadRequestException("错误表达式");
|
||||||
}
|
}
|
||||||
// 创建任务
|
// 创建任务
|
||||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料桁架任务"));
|
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切合单下卷任务"));
|
||||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||||
// taskParam.put("d_containers", currentPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
// taskParam.put("d_containers", currentPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||||
// taskParam.put("u_containers", filterNextPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
// taskParam.put("u_containers", filterNextPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||||
JSONArray array = new JSONArray();
|
JSONArray array = new JSONArray();
|
||||||
array.add(taskParam);
|
array.add(taskParam);
|
||||||
if (ObjectUtil.isNotEmpty(taskParam2)) {
|
if (ObjectUtil.isNotEmpty(taskParam2)) {
|
||||||
taskParam2.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料桁架任务"));
|
taskParam2.put("task_type", SlitterEnum.TASK_TYPE.code("分切合单下卷任务"));
|
||||||
taskParam2.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
taskParam2.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||||
// taskParam2.put("d_containers", currentPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
// taskParam2.put("d_containers", currentPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||||
// taskParam2.put("u_containers", filterNextPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
// taskParam2.put("u_containers", filterNextPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||||
@@ -2346,38 +2351,132 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
JSONObject res = new JSONObject();
|
JSONObject res = new JSONObject();
|
||||||
res.put("status", HttpStatus.HTTP_OK);
|
res.put("status", HttpStatus.HTTP_OK);
|
||||||
res.put("message", "创建桁架任务成功!");
|
res.put("message", "创建桁架任务成功!");
|
||||||
|
RLock open = redissonClient.getLock("lock:doUpShaftToSlitterByDevice");
|
||||||
|
boolean openLock = false;
|
||||||
|
try {
|
||||||
|
openLock = open.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (openLock) {
|
||||||
// param: area, device_code
|
// param: area, device_code
|
||||||
String area = param.getString("area");
|
String area = param.getString("area");
|
||||||
String deviceCode = param.getString("device_code");
|
String deviceCode = param.getString("device_code");
|
||||||
// 获取当前分切机的下一组分切计划(最多四条分切计划)
|
StIvtCutpointivt extCode = cutpointivtService.getPintByExtCode(deviceCode, true);
|
||||||
// hint: 获取到的分切可能是不同组的但具有一定时间顺序, 可能是以前的脏数据
|
if (ObjectUtil.isEmpty(extCode)) {
|
||||||
List<PdmBiSlittingproductionplan> timePlans = slittingproductionplanService.list(
|
throw new BadRequestException("该设备不存在或者被禁用,请检查!");
|
||||||
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
}
|
||||||
.eq(PdmBiSlittingproductionplan::getResource_name, deviceCode)
|
List<Deliverycachepointivt> cachePoints = slitterMapper.getReadyShaftCachePointByDevice(extCode);
|
||||||
.eq(PdmBiSlittingproductionplan::getStatus, "03")
|
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
|
||||||
.orderByAsc(PdmBiSlittingproductionplan::getUpdate_time));
|
|
||||||
log.info("获取下一组分切计划:{}", timePlans);
|
|
||||||
if (timePlans.size() > 0) {
|
|
||||||
// 寻找备好轴的对接点位
|
|
||||||
List<BstIvtCutpointivt> cutPointList = slitterMapper.getReadyShaftPoint(deviceCode);
|
List<BstIvtCutpointivt> cutPointList = slitterMapper.getReadyShaftPoint(deviceCode);
|
||||||
if (cutPointList.size() == 0) {
|
if (cachePoints.size() > 0) {
|
||||||
throw new BadRequestException("没有为设备[" + deviceCode + "]套好轴的位置!");
|
// 在缓存架子上
|
||||||
} else {
|
doUpShaftToSlitterByNew(param, cachePoints, extCode);
|
||||||
|
} else if (cutPointList.size() > 0) {
|
||||||
|
// 在对接位
|
||||||
// 找到该分切计划的点位
|
// 找到该分切计划的点位
|
||||||
BstIvtCutpointivt newCutPoint = cutPointList.get(0);
|
BstIvtCutpointivt newCutPoint = cutPointList.get(0);
|
||||||
// 创建任务
|
// 创建任务
|
||||||
JSONObject taskParam = new JSONObject();
|
JSONObject taskParam = new JSONObject();
|
||||||
taskParam.put("point_code", newCutPoint.getPoint_code());
|
taskParam.put("point_code", newCutPoint.getPoint_code());
|
||||||
doUpShaftToSlitter(taskParam);
|
doUpShaftToSlitter(taskParam);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new BadRequestException("没有为设备[" + deviceCode + "]套好轴的位置!");
|
throw new BadRequestException("没有为设备[" + deviceCode + "]套好轴的位置!");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (openLock) {
|
||||||
|
open.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的上轴任务
|
||||||
|
*
|
||||||
|
* @param param 参数(区域,设备号)
|
||||||
|
* @param cachePoints 气胀轴存放位置
|
||||||
|
* @param device 设备实体
|
||||||
|
*/
|
||||||
|
public void doUpShaftToSlitterByNew(JSONObject param, List<Deliverycachepointivt> cachePoints, StIvtCutpointivt device) {
|
||||||
|
List<Deliverycachepointivt> actualPoints = cachePoints;
|
||||||
|
if (cachePoints.size() > 2) {
|
||||||
|
// todo: 需要过滤(正常不会出现,先不考虑)
|
||||||
|
throw new BadRequestException("计划冗余,请检查!");
|
||||||
|
}
|
||||||
|
// 获取计划数据
|
||||||
|
List<String> qzznos = cachePoints.stream().map(Deliverycachepointivt::getQzzno).collect(Collectors.toList());
|
||||||
|
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNos(qzznos);
|
||||||
|
if (plans.isEmpty()) {
|
||||||
|
throw new BadRequestException("计划不存在!请检查点位:"
|
||||||
|
+ cachePoints.stream().map(Deliverycachepointivt::getPoint_code).collect(Collectors.toList())
|
||||||
|
+ "的数据!");
|
||||||
|
}
|
||||||
|
JSONObject taskParam = new JSONObject();
|
||||||
|
// 根据计划筛选上下轴任务,并构建任务参数
|
||||||
|
PdmBiSlittingproductionplan nextUpPlan = plans.stream()
|
||||||
|
.filter(p -> SlitterConstant.SLITTER_SHAFT_UP.equals(p.getUp_or_down()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
PdmBiSlittingproductionplan nextDownPlan = plans.stream()
|
||||||
|
.filter(p -> SlitterConstant.SLITTER_SHAFT_DOWN.equals(p.getUp_or_down()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
Deliverycachepointivt upNeedPoint = actualPoints.stream()
|
||||||
|
.filter(p -> {
|
||||||
|
assert nextUpPlan != null;
|
||||||
|
return p.getQzzno().equals(nextUpPlan.getQzzno());
|
||||||
|
})
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
Deliverycachepointivt downNeedPoint = actualPoints.stream()
|
||||||
|
.filter(p -> {
|
||||||
|
assert nextDownPlan != null;
|
||||||
|
return p.getQzzno().equals(nextDownPlan.getQzzno());
|
||||||
|
})
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (ObjectUtil.isNotEmpty(nextUpPlan) && ObjectUtil.isNotEmpty(nextDownPlan)) {
|
||||||
|
// 上轴都不会空
|
||||||
|
// 双轴任务参数构建
|
||||||
|
assert downNeedPoint != null;
|
||||||
|
taskParam.put("point_code1", downNeedPoint.getPoint_code());
|
||||||
|
taskParam.put("point_code2", device.getDown_point_code());
|
||||||
|
assert upNeedPoint != null;
|
||||||
|
taskParam.put("point_code3", upNeedPoint.getPoint_code());
|
||||||
|
taskParam.put("point_code4", device.getUp_point_code());
|
||||||
|
taskParam.put("vehicle_code1", upNeedPoint.getQzzno());
|
||||||
|
taskParam.put("vehicle_code2", downNeedPoint.getQzzno());
|
||||||
|
} else {
|
||||||
|
// 单轴任务参数构建
|
||||||
|
if (ObjectUtil.isNotEmpty(nextUpPlan)) {
|
||||||
|
// 上轴任务
|
||||||
|
assert upNeedPoint != null;
|
||||||
|
taskParam.put("point_code1", upNeedPoint.getPoint_code());
|
||||||
|
taskParam.put("point_code2", device.getUp_point_code());
|
||||||
|
taskParam.put("vehicle_code1", upNeedPoint.getQzzno());
|
||||||
|
} else {
|
||||||
|
// 下轴任务
|
||||||
|
assert downNeedPoint != null;
|
||||||
|
taskParam.put("point_code1", downNeedPoint.getPoint_code());
|
||||||
|
taskParam.put("point_code2", device.getDown_point_code());
|
||||||
|
taskParam.put("vehicle_code2", downNeedPoint.getQzzno());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建任务的其他参数
|
||||||
|
taskParam.put("truss_type", "1");
|
||||||
|
taskParam.put("empty_site", "0");
|
||||||
|
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("缓存上空轴任务"));
|
||||||
|
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||||
|
taskParam.put("u_containers", plans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
||||||
|
// 创建任务
|
||||||
|
upShaftTrussNewTask.createTask(taskParam);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject doUpShaftToSlitterByDeviceTip(JSONObject param) {
|
public JSONObject doUpShaftToSlitterByDeviceTip(JSONObject param) {
|
||||||
JSONObject res = new JSONObject();
|
JSONObject res = new JSONObject();
|
||||||
@@ -3852,6 +3951,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建拼单任务
|
* 创建拼单任务
|
||||||
|
*
|
||||||
* @param cutPoint 分切点位
|
* @param cutPoint 分切点位
|
||||||
* @param startPoint 穿拔轴点位
|
* @param startPoint 穿拔轴点位
|
||||||
* @param demoPlan 分切计划
|
* @param demoPlan 分切计划
|
||||||
|
|||||||
Reference in New Issue
Block a user