add: 手持创建桁架任务
This commit is contained in:
@@ -163,4 +163,16 @@ public class SlitterPdaController {
|
||||
public ResponseEntity<Object> doSubRollWeightBinding(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.doSubRollWeightBinding(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/doUpShaftToSlitter")
|
||||
@Log("手持分切机上气胀轴")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> doUpShaftToSlitter(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.doUpShaftToSlitter(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getUpShaftTip")
|
||||
@Log("手持分切机上气胀轴-查询信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getUpShaftTip(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.getUpShaftTip(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.b_lms.sch.task.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
@@ -79,6 +80,13 @@ public interface IschBaseTaskService extends IService<SchBaseTask> {
|
||||
*校验相同任务类型
|
||||
*/
|
||||
List<SchBaseTask> getExistTasks(List<String> taskTypes);
|
||||
|
||||
/**
|
||||
* 查找暂存位置是否有任务,包括桁架任务
|
||||
* @param point /
|
||||
* @return /
|
||||
*/
|
||||
Boolean checkHaveTaskByZcPoint(BstIvtCutpointivt point);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
/**
|
||||
@@ -143,6 +145,21 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkHaveTaskByZcPoint(BstIvtCutpointivt point) {
|
||||
LambdaQueryWrapper<SchBaseTask> lam = new QueryWrapper<SchBaseTask>().lambda();
|
||||
lam.lt(SchBaseTask::getTask_status, "07")
|
||||
.and(la -> la.eq(SchBaseTask::getPoint_code1, point.getTruss_point_code1()).or()
|
||||
.eq(SchBaseTask::getPoint_code1, point.getTruss_point_code2()).or()
|
||||
.eq(SchBaseTask::getPoint_code2, point.getTruss_point_code1()).or()
|
||||
.eq(SchBaseTask::getPoint_code2, point.getTruss_point_code2()).or()
|
||||
.eq(SchBaseTask::getPoint_code3, point.getTruss_point_code1()).or()
|
||||
.eq(SchBaseTask::getPoint_code3, point.getTruss_point_code2()).or()
|
||||
.eq(SchBaseTask::getPoint_code4, point.getTruss_point_code1()).or()
|
||||
.eq(SchBaseTask::getPoint_code4, point.getTruss_point_code2()).or());
|
||||
return list(lam).size() > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ public class AutoCallAirShaftTask {
|
||||
empty.setQzz_size(qzzSize);
|
||||
TaskUtils.updateOptMessageByBShaftPoint(empty);
|
||||
for (PdmBiSlittingproductionplan plan : needPlans) {
|
||||
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
|
||||
if (needPlans.size() == 1 || SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
|
||||
// 左卷
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
empty.setTube_code1(plan.getPaper_tube_material());
|
||||
|
||||
@@ -251,4 +251,18 @@ public interface SlitterService {
|
||||
JSONObject markingFoilSlittingToCache(JSONObject param);
|
||||
|
||||
JSONObject doSubRollWeightBinding(JSONObject param);
|
||||
|
||||
/**
|
||||
* 上气涨轴
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject doUpShaftToSlitter(JSONObject param);
|
||||
|
||||
/**
|
||||
* 分切上气胀轴的提示
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject getUpShaftTip(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -117,6 +118,8 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
private SendNBJExceptionPointTask sendNBJExceptionPointTask;
|
||||
@Autowired
|
||||
private IpdmBiSubpackagerelationService subpackagerelationService;
|
||||
@Autowired
|
||||
private UpShaftTrussTask upShaftTrussTask;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -168,8 +171,13 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
: "");
|
||||
con.put("number", ObjectUtil.isNotEmpty(point.getTube_code1()) && ObjectUtil.isNotEmpty(point.getTube_code2())
|
||||
? "2" : "1");
|
||||
|
||||
String containers = Stream.of(point.getContainer_name1(), point.getContainer_name2())
|
||||
.filter(ObjectUtil::isNotEmpty)
|
||||
.collect(Collectors.joining(","));
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "任务请求成功!");
|
||||
res.put("msg", "对应子卷号:" + containers);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -210,6 +218,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
log.error("查询不到气胀轴编码「" + qzzNo + "」对应状态[结束]的子卷信息!");
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
String containers = plans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.joining(","));
|
||||
// 反馈 纸管尺寸
|
||||
JSONObject r = new JSONObject();
|
||||
res.put("data", r);
|
||||
@@ -217,6 +226,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
SlitterTaskUtil.putCurrentPaperSpec(r, plans);
|
||||
r.put("pullCount", plans.size());
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("msg", containers);
|
||||
res.put("message", "请求成功");
|
||||
return res;
|
||||
}
|
||||
@@ -1591,4 +1601,156 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("message", "重量更新成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject doUpShaftToSlitter(JSONObject param) {
|
||||
log.info("手持申请分切上料参数:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "创建桁架任务成功!");
|
||||
// param: point_code
|
||||
String pointCode = param.getString("point_code");
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
if (!"3".equals(point.getPoint_type())) {
|
||||
throw new BadRequestException("该点位不是分切对接位,无法创建任务!");
|
||||
}
|
||||
if (Objects.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测无货,请确保点位是气胀轴后触发!");
|
||||
}
|
||||
if (ObjectUtil.equals(point.getPoint_status(), "3")) {
|
||||
// 如果是子卷
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测有子卷,请确保点位是气胀轴后触发!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point.getQzz_no1()) && ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + " 的气胀轴编码为空!");
|
||||
}
|
||||
// 校验是否存在任务
|
||||
Boolean haveTaskByZcPoint = taskService.checkHaveTaskByZcPoint(point);
|
||||
if (haveTaskByZcPoint) {
|
||||
throw new BadRequestException("操作失败,点位[" + pointCode + "]存在未完成的任务!");
|
||||
}
|
||||
// 根据套好的轴去找分切计划,然后找到对应设备: 最多两根气胀轴
|
||||
List<String> qzzNos = Stream.of(point.getQzz_no1(), point.getQzz_no2()).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||
// 查找分切计划: 最多四个子卷
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNos(qzzNos, "03");
|
||||
if (CollectionUtil.isEmpty(plans)) {
|
||||
throw new BadRequestException("找不到气胀轴:" + qzzNos + "对应状态是[配送完成]的分切计划,请重新绑定!");
|
||||
}
|
||||
String containers = plans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.joining(","));
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
String resourceName = demoPlan.getResource_name();
|
||||
StIvtCutpointivt device = cutpointivtService.getPintByExtCode(resourceName, false);
|
||||
// 判断对应的位置是否为空
|
||||
if (ObjectUtil.isNotEmpty(device.getUp_qzzno()) || ObjectUtil.isNotEmpty(device.getDown_qzzno())) {
|
||||
throw new BadRequestException("分切机 [" + resourceName + "] 存在气胀轴信息,如果实际已经无轴,请到分切子卷维护清除信息!");
|
||||
}
|
||||
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);
|
||||
if (ObjectUtil.isNotEmpty(nextUpPlan) && ObjectUtil.isNotEmpty(nextDownPlan)) {
|
||||
// 双轴任务参数构建
|
||||
taskParam.put("point_code1", point.getTruss_point_code2());
|
||||
taskParam.put("point_code2", device.getDown_point_code());
|
||||
taskParam.put("point_code3", point.getTruss_point_code1());
|
||||
taskParam.put("point_code4", device.getUp_point_code());
|
||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||
taskParam.put("vehicle_code2", point.getQzz_no2());
|
||||
} else {
|
||||
// 单轴任务参数构建
|
||||
if (ObjectUtil.isNotEmpty(nextUpPlan)) {
|
||||
// 上轴任务
|
||||
taskParam.put("point_code1", point.getTruss_point_code1());
|
||||
taskParam.put("point_code2", device.getUp_point_code());
|
||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||
} else {
|
||||
// 下轴任务
|
||||
taskParam.put("point_code1", point.getTruss_point_code2());
|
||||
taskParam.put("point_code2", device.getDown_point_code());
|
||||
taskParam.put("vehicle_code2", point.getQzz_no2());
|
||||
}
|
||||
}
|
||||
|
||||
// 构建任务的其他参数
|
||||
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);
|
||||
|
||||
// 创建任务
|
||||
upShaftTrussTask.createTask(taskParam);
|
||||
res.put("msg", containers);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getUpShaftTip(JSONObject param) {
|
||||
// param: point_code
|
||||
JSONObject res = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("data", data);
|
||||
String pointCode = param.getString("point_code");
|
||||
List<String> tips = new ArrayList<>();
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
if (!"3".equals(point.getPoint_type())) {
|
||||
tips.add("该点位不是分切对接位,不能生成上轴任务");
|
||||
} else if ("3".equals(point.getPoint_status())) {
|
||||
tips.add("该点位有子卷,不能生成上轴任务");
|
||||
} else if ("1".equals(point.getPoint_status())) {
|
||||
tips.add("该点位是空位,不能生成上轴任务");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("只能选择B1,B2,B3,B4区域的暂存位");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point.getQzz_no1())) {
|
||||
data.put("a_point", "系统无气胀轴信息");
|
||||
} else {
|
||||
List<PdmBiSlittingproductionplan> byQzzNo = slittingproductionplanService.getByQzzNoByNoStatus(point.getQzz_no1());
|
||||
if (byQzzNo.size() == 0) {
|
||||
data.put("a_point", "对应的分切计划不存在!");
|
||||
} else {
|
||||
String collect = byQzzNo
|
||||
.stream()
|
||||
.map(PdmBiSlittingproductionplan::getContainer_name)
|
||||
.collect(Collectors.joining(","));
|
||||
data.put("a_point", collect);
|
||||
PdmBiSlittingproductionplan qzz1 = byQzzNo.get(0);
|
||||
if (!"03".equals(qzz1.getStatus())) {
|
||||
// 状态不满足
|
||||
tips.add("A位置指定的子卷:" + collect + " 的当前状态不是配送完成,无法创建任务");
|
||||
} else if ("2".equals(point.getPoint_status())) {
|
||||
tips.add("A位置的轴配送给分切机:" + qzz1.getResource_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point.getQzz_no2())) {
|
||||
data.put("b_point", "系统无气胀轴信息");
|
||||
} else {
|
||||
List<PdmBiSlittingproductionplan> byQzzNo = slittingproductionplanService.getByQzzNoByNoStatus(point.getQzz_no2());
|
||||
if (byQzzNo.size() == 0) {
|
||||
data.put("b_point", "对应的分切计划不存在!");
|
||||
} else {
|
||||
String collect = byQzzNo
|
||||
.stream()
|
||||
.map(PdmBiSlittingproductionplan::getContainer_name)
|
||||
.collect(Collectors.joining(","));
|
||||
data.put("b_point", collect);
|
||||
PdmBiSlittingproductionplan qzz1 = byQzzNo.get(0);
|
||||
if (!"03".equals(qzz1.getStatus())) {
|
||||
// 状态不满足
|
||||
tips.add("B位置指定的子卷:" + collect + " 的当前状态不是配送完成,无法创建任务");
|
||||
} else if ("2".equals(point.getPoint_status())) {
|
||||
tips.add("B位置的轴配送给分切机:" + qzz1.getResource_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tips.size() == 0) tips.add("无提示信息,如果数据不一致请维护数据!");
|
||||
data.put("tip", String.join(",", tips));
|
||||
// 判断
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user