@@ -256,7 +256,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
route_plan_code = "normal";
|
route_plan_code = "normal";
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: 通过扩展(需要做成可以定义开发,比如说这里是个统一handle类,然后具体子类实现操作,通过判断类型去执行)
|
|
||||||
if (StrUtil.equals(task_type, "5")) {
|
if (StrUtil.equals(task_type, "5")) {
|
||||||
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||||
@@ -322,7 +321,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装参数保存数据库
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("task_id", IdUtil.simpleUUID());
|
jo.put("task_id", IdUtil.simpleUUID());
|
||||||
jo.put("task_code", task_code);
|
jo.put("task_code", task_code);
|
||||||
|
|||||||
@@ -329,29 +329,5 @@ public class SlitterPdaController {
|
|||||||
public ResponseEntity<Object> seeTaskByPoint(@RequestBody JSONObject param) {
|
public ResponseEntity<Object> seeTaskByPoint(@RequestBody JSONObject param) {
|
||||||
return new ResponseEntity<>(slitterService.seeTaskByPoint(param), HttpStatus.OK);
|
return new ResponseEntity<>(slitterService.seeTaskByPoint(param), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@PostMapping("/list-xn-area")
|
|
||||||
@Log("获取区域虚拟位置下拉框")
|
|
||||||
@SaIgnore
|
|
||||||
public ResponseEntity<Object> getXnAreaListByArea(@RequestBody JSONObject param) {
|
|
||||||
return new ResponseEntity<>(slitterService.getXnAreaListByArea(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
@PostMapping("/bind-xn-plan")
|
|
||||||
@Log("绑定虚拟计划")
|
|
||||||
@SaIgnore
|
|
||||||
public ResponseEntity<Object> bindXnPlan(@RequestBody JSONObject param) {
|
|
||||||
return new ResponseEntity<>(slitterService.bindXnPlan(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
@PostMapping("/get-unbind-plan")
|
|
||||||
@Log("待绑定虚拟计划")
|
|
||||||
@SaIgnore
|
|
||||||
public ResponseEntity<Object> getUnbindPlan(@RequestBody JSONObject param) {
|
|
||||||
return new ResponseEntity<>(slitterService.getUnbindPlan(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
@PostMapping("/do-bind-plan-device")
|
|
||||||
@Log("待绑定虚拟计划")
|
|
||||||
@SaIgnore
|
|
||||||
public ResponseEntity<Object> doBindPlanDevice(@RequestBody JSONObject param) {
|
|
||||||
return new ResponseEntity<>(slitterService.doBindPlanDevice(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package org.nl.b_lms.pda.controller.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合单区域下拉框
|
|
||||||
* @Author: liyongde
|
|
||||||
* @Date: 2026/7/30 18:00
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MergeAreaSelectVO {
|
|
||||||
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
}
|
|
||||||
@@ -170,6 +170,4 @@ public interface IPdmBiSlittingproductionplanService extends IService<PdmBiSlitt
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer getSameTripParentContainerPlanCount(PdmBiSlittingproductionplan demoPlan);
|
Integer getSameTripParentContainerPlanCount(PdmBiSlittingproductionplan demoPlan);
|
||||||
|
|
||||||
List<PdmBiSlittingproductionplan> getCurrentDayListByDevice(String deviceCode);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@
|
|||||||
p.manufacture_sort,
|
p.manufacture_sort,
|
||||||
p.qzz_size,
|
p.qzz_size,
|
||||||
p.qzz_generation,
|
p.qzz_generation,
|
||||||
MIN(p.call_time) AS start_time
|
MIN(p.start_time) AS start_time
|
||||||
FROM `pdm_bi_slittingproductionplan` p
|
FROM `pdm_bi_slittingproductionplan` p
|
||||||
WHERE p.`status` = '01'
|
WHERE p.`status` = '01'
|
||||||
AND p.is_child_tz_ok = '0'
|
AND p.is_child_tz_ok = '0'
|
||||||
@@ -191,9 +191,9 @@
|
|||||||
AND p.is_delete = '0'
|
AND p.is_delete = '0'
|
||||||
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
|
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
|
||||||
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
|
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
|
||||||
AND DATE ( p.call_time ) >= DATE_SUB( CURDATE()
|
AND DATE ( p.start_time ) >= DATE_SUB( CURDATE()
|
||||||
, INTERVAL #{day} DAY )
|
, INTERVAL #{day} DAY )
|
||||||
AND p.container_name LIKE 'Z虚拟B%'
|
AND p.container_name LIKE '%虚拟-B%'
|
||||||
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
||||||
GROUP BY
|
GROUP BY
|
||||||
p.resource_name,
|
p.resource_name,
|
||||||
@@ -204,7 +204,8 @@
|
|||||||
p.manufacture_sort,
|
p.manufacture_sort,
|
||||||
p.qzz_size,
|
p.qzz_size,
|
||||||
p.qzz_generation
|
p.qzz_generation
|
||||||
order by p.manufacture_sort desc,
|
order by p.qzz_size,
|
||||||
|
p.manufacture_sort desc,
|
||||||
p.start_time
|
p.start_time
|
||||||
</select>
|
</select>
|
||||||
<select id="getCountXN" resultType="java.lang.Integer">
|
<select id="getCountXN" resultType="java.lang.Integer">
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -256,16 +257,6 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
|
|||||||
return count(lam);
|
return count(lam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PdmBiSlittingproductionplan> getCurrentDayListByDevice(String deviceCode) {
|
|
||||||
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new LambdaQueryWrapper<>();
|
|
||||||
lam.eq(PdmBiSlittingproductionplan::getResource_name, deviceCode)
|
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
|
||||||
.apply("DATE(call_time) >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)")
|
|
||||||
.orderByAsc(PdmBiSlittingproductionplan::getCall_time, PdmBiSlittingproductionplan::getStatus);
|
|
||||||
return list(lam);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCountXN(String area, String location) {
|
public int getCountXN(String area, String location) {
|
||||||
return pdmBiSlittingproductionplanMapper.getCountXN(area, location);
|
return pdmBiSlittingproductionplanMapper.getCountXN(area, location);
|
||||||
|
|||||||
@@ -262,7 +262,9 @@ public class SlitterDownNewTrussTask extends AbstractAcsTask {
|
|||||||
public List<PdmBiSlittingproductionplan> updateDownRollPlan(JSONObject requestParam) {
|
public List<PdmBiSlittingproductionplan> updateDownRollPlan(JSONObject requestParam) {
|
||||||
// 下来的分切计划状态:06 -> 09, 不在需要设置重量
|
// 下来的分切计划状态:06 -> 09, 不在需要设置重量
|
||||||
JSONArray downContainers = requestParam.getJSONArray("down_roll");
|
JSONArray downContainers = requestParam.getJSONArray("down_roll");
|
||||||
List<String> downCons = downContainers.toJavaList(String.class);
|
List<String> downCons = downContainers.stream()
|
||||||
|
.map(obj -> ((JSONObject) obj).getString("container_name"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
log.info("即将下卷的上下轴的子卷号数据:{}", downCons);
|
log.info("即将下卷的上下轴的子卷号数据:{}", downCons);
|
||||||
List<PdmBiSlittingproductionplan> downPlans = slittingproductionplanService.getByContainerNames(downCons);
|
List<PdmBiSlittingproductionplan> downPlans = slittingproductionplanService.getByContainerNames(downCons);
|
||||||
// 下来的卷的集合
|
// 下来的卷的集合
|
||||||
|
|||||||
@@ -140,13 +140,13 @@ public class TrussDisassemblyCacheTask extends AbstractAcsTask {
|
|||||||
Deliverycachepointivt endPointObj = deliverycachepointivtService.getPintByCode(endPoint, false);
|
Deliverycachepointivt endPointObj = deliverycachepointivtService.getPintByCode(endPoint, false);
|
||||||
Deliverycachepointivt endPointObj2 = deliverycachepointivtService.getPintByCode(endPoint2, false);
|
Deliverycachepointivt endPointObj2 = deliverycachepointivtService.getPintByCode(endPoint2, false);
|
||||||
endPointObj.setQzzno(task.getVehicle_code());
|
endPointObj.setQzzno(task.getVehicle_code());
|
||||||
endPointObj.setPoint_status("05");
|
endPointObj.setPoint_status("02");
|
||||||
TaskUtils.updateOptMessageByCachePoint(endPointObj);
|
TaskUtils.updateOptMessageByCachePoint(endPointObj);
|
||||||
deliverycachepointivtService.updateById(endPointObj);
|
deliverycachepointivtService.updateById(endPointObj);
|
||||||
|
|
||||||
if (endPointObj2 != null) {
|
if (endPointObj2 != null) {
|
||||||
endPointObj2.setQzzno(task.getVehicle_code2());
|
endPointObj2.setQzzno(task.getVehicle_code2());
|
||||||
endPointObj2.setPoint_status("05");
|
endPointObj2.setPoint_status("02");
|
||||||
TaskUtils.updateOptMessageByCachePoint(endPointObj2);
|
TaskUtils.updateOptMessageByCachePoint(endPointObj2);
|
||||||
deliverycachepointivtService.updateById(endPointObj2);
|
deliverycachepointivtService.updateById(endPointObj2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class UpShaftTrussNewTask extends AbstractAcsTask {
|
|||||||
String pointCode2 = task.getPoint_code2();
|
String pointCode2 = task.getPoint_code2();
|
||||||
StIvtCutpointivt point2 = cutpointivtService.getPintByUpOrDownCode(pointCode2, false);
|
StIvtCutpointivt point2 = cutpointivtService.getPintByUpOrDownCode(pointCode2, false);
|
||||||
// 可能不存在
|
// 可能不存在
|
||||||
String pointCode3 = task.getPoint_code3();
|
String pointCode3 = task.getPoint_code1();
|
||||||
Deliverycachepointivt point3 = deliverycachepointivtService.getOneByPointCode(pointCode3, false);
|
Deliverycachepointivt point3 = deliverycachepointivtService.getOneByPointCode(pointCode3, false);
|
||||||
|
|
||||||
// 交换数据
|
// 交换数据
|
||||||
@@ -181,13 +181,10 @@ public class UpShaftTrussNewTask extends AbstractAcsTask {
|
|||||||
point1.setQzzno("");
|
point1.setQzzno("");
|
||||||
point1.setPoint_status("01");
|
point1.setPoint_status("01");
|
||||||
TaskUtils.updateOptMessageByCachePoint(point1);
|
TaskUtils.updateOptMessageByCachePoint(point1);
|
||||||
deliverycachepointivtService.updateById(point1);
|
point3.setQzzno("");
|
||||||
if (ObjectUtil.isNotEmpty(point3)) {
|
point3.setPoint_status("01");
|
||||||
point3.setQzzno("");
|
TaskUtils.updateOptMessageByCachePoint(point3);
|
||||||
point3.setPoint_status("01");
|
deliverycachepointivtService.updateBatchById(Stream.of(point1, point3).collect(Collectors.toList()));
|
||||||
TaskUtils.updateOptMessageByCachePoint(point3);
|
|
||||||
deliverycachepointivtService.updateById(point3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 取消
|
// 取消
|
||||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||||
|
|||||||
@@ -112,9 +112,7 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
public final static String TZ_DAY = "TZ_DAY";
|
public final static String TZ_DAY = "TZ_DAY";
|
||||||
public final static String USE_XN = "USE_XN";
|
public final static String USE_XN = "USE_XN";
|
||||||
public final static String BZ_CHECK_EMPTY = "BZ_CHECK_EMPTY";
|
public final static String BZ_CHECK_EMPTY = "BZ_CHECK_EMPTY";
|
||||||
/**
|
/** 合单配送 */
|
||||||
* 合单配送
|
|
||||||
*/
|
|
||||||
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
||||||
public List<String> stepErrorInfo = new ArrayList<>();
|
public List<String> stepErrorInfo = new ArrayList<>();
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -131,7 +129,7 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
RLock lock = redissonClient.getLock("TestTask");
|
RLock lock = redissonClient.getLock("TestTask");
|
||||||
boolean tryLock;
|
boolean tryLock = false;
|
||||||
try {
|
try {
|
||||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -187,18 +185,11 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
// 过滤
|
// 过滤
|
||||||
String value = paramObj.getValue();
|
String value = paramObj.getValue();
|
||||||
List<String> prefixList = Arrays.asList(value.split("[,,]"));
|
List<String> prefixList = Arrays.asList(value.split("[,,]"));
|
||||||
List<SlitterPlanDistinctDto> plans;
|
List<SlitterPlanDistinctDto> plans = planAll.stream()
|
||||||
|
.filter(p -> prefixList.stream()
|
||||||
// 虚拟计划不需要过滤
|
.anyMatch(prefix -> p.getResource_name().startsWith(prefix)) &&
|
||||||
if (ObjectUtil.isNotEmpty(useXn) && "1".equals(useXn.getValue())) {
|
checkComputationPoint(p, empty) && checkHasTask(p))
|
||||||
plans = planAll;
|
.collect(Collectors.toList());
|
||||||
} else {
|
|
||||||
plans = planAll.stream()
|
|
||||||
.filter(p -> prefixList.stream()
|
|
||||||
.anyMatch(prefix -> p.getResource_name().startsWith(prefix)) &&
|
|
||||||
checkComputationPoint(p, empty) && checkHasTask(p))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
log.info("SQL查询后过滤区域、是否有套过轴的数据:{}", plans);
|
log.info("SQL查询后过滤区域、是否有套过轴的数据:{}", plans);
|
||||||
if (plans.size() == 0) {
|
if (plans.size() == 0) {
|
||||||
stepErrorInfo.add("找不到需要套轴的信息,只做拔轴。");
|
stepErrorInfo.add("找不到需要套轴的信息,只做拔轴。");
|
||||||
@@ -291,6 +282,7 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
log.info("找到对应的另一半的计划 - {}", plans);
|
log.info("找到对应的另一半的计划 - {}", plans);
|
||||||
}
|
}
|
||||||
// 获取一个分切计划的Dto。如果是6寸,可以直接使用、如果是3寸,需要判断当前位置是否满足
|
// 获取一个分切计划的Dto。如果是6寸,可以直接使用、如果是3寸,需要判断当前位置是否满足
|
||||||
|
// todo: 需要校验分切设备是在对应的区域中
|
||||||
SlitterPlanDistinctDto planDto = plans.stream()
|
SlitterPlanDistinctDto planDto = plans.stream()
|
||||||
.filter(planD -> ("6".equals(planD.getQzz_size()) ||
|
.filter(planD -> ("6".equals(planD.getQzz_size()) ||
|
||||||
("3".equals(planD.getQzz_size()) && specification.equals(planD.getQzz_generation()))) &&
|
("3".equals(planD.getQzz_size()) && specification.equals(planD.getQzz_generation()))) &&
|
||||||
@@ -1267,7 +1259,6 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 检测 todo: 可以优化考虑任务,但似乎没太大作用
|
// 检测 todo: 可以优化考虑任务,但似乎没太大作用
|
||||||
// 检测缓存架子的点位是否够用
|
|
||||||
Integer num = iDeliverycachepointivtService.countPendingUseByDevice(dto.getResource_name());
|
Integer num = iDeliverycachepointivtService.countPendingUseByDevice(dto.getResource_name());
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class AutoSendAirShaftAgvTask {
|
|||||||
/** 合单配送 */
|
/** 合单配送 */
|
||||||
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
public final static String IS_COMBINED_ORDER = "IS_COMBINED_ORDER";
|
||||||
/** 合单超时时间 */
|
/** 合单超时时间 */
|
||||||
public final static String IS_COMBINED_ORDER_TIME = "IS_COMBINED_TIME";
|
public final static String IS_COMBINED_ORDER_TIME = "IS_COMBINED_ORDER_TIME";
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBstIvtCutpointivtService bcutpointivtService;
|
private IBstIvtCutpointivtService bcutpointivtService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -386,7 +386,7 @@
|
|||||||
AND p.qzzno = sd.qzzno
|
AND p.qzzno = sd.qzzno
|
||||||
WHERE sd.product_area = #{product_area}
|
WHERE sd.product_area = #{product_area}
|
||||||
AND sd.point_location = #{point_location}
|
AND sd.point_location = #{point_location}
|
||||||
AND sd.point_status = '03'
|
AND sd.point_status = '02'
|
||||||
AND sd.point_type = '02'
|
AND sd.point_type = '02'
|
||||||
AND sd.is_used = '1'
|
AND sd.is_used = '1'
|
||||||
AND NOT EXISTS (SELECT 1
|
AND NOT EXISTS (SELECT 1
|
||||||
@@ -474,7 +474,7 @@
|
|||||||
FROM `st_ivt_deliverycachepointivt` sd
|
FROM `st_ivt_deliverycachepointivt` sd
|
||||||
WHERE sd.product_area = #{product_area}
|
WHERE sd.product_area = #{product_area}
|
||||||
AND sd.point_location = #{point_location}
|
AND sd.point_location = #{point_location}
|
||||||
AND sd.point_status = '03'
|
AND sd.point_status = '02'
|
||||||
AND EXISTS (SELECT 1
|
AND EXISTS (SELECT 1
|
||||||
FROM pdm_bi_slittingproductionplan p
|
FROM pdm_bi_slittingproductionplan p
|
||||||
WHERE p.qzzno = sd.qzzno
|
WHERE p.qzzno = sd.qzzno
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.nl.b_lms.sch.tasks.slitter.service;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||||
import org.nl.b_lms.pda.controller.vo.MergeAreaSelectVO;
|
|
||||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -412,12 +411,4 @@ public interface SlitterService {
|
|||||||
JSONObject getTubeVehicleInfo(JSONObject param);
|
JSONObject getTubeVehicleInfo(JSONObject param);
|
||||||
|
|
||||||
List<SchBaseTask> seeTaskByPoint(JSONObject param);
|
List<SchBaseTask> seeTaskByPoint(JSONObject param);
|
||||||
|
|
||||||
List<MergeAreaSelectVO> getXnAreaListByArea(JSONObject param);
|
|
||||||
|
|
||||||
JSONObject bindXnPlan(JSONObject param);
|
|
||||||
|
|
||||||
List<MergeAreaSelectVO> getUnbindPlan(JSONObject param);
|
|
||||||
|
|
||||||
JSONObject doBindPlanDevice(JSONObject param);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.nl.b_lms.pda.controller.vo.MergeAreaSelectVO;
|
|
||||||
import org.nl.b_lms.sch.tasks.slitter.util.MdmDescriptionParseUtils;
|
import org.nl.b_lms.sch.tasks.slitter.util.MdmDescriptionParseUtils;
|
||||||
import org.nl.b_lms.sch.point.dao.mapper.StIvtCutpointivtMapper;
|
import org.nl.b_lms.sch.point.dao.mapper.StIvtCutpointivtMapper;
|
||||||
import org.nl.b_lms.sch.tasks.SlitterDownNewTrussTask;
|
import org.nl.b_lms.sch.tasks.SlitterDownNewTrussTask;
|
||||||
@@ -72,6 +71,8 @@ import org.redisson.api.RedissonClient;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -430,7 +431,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public JSONObject acsFinishLoadShaft(JSONObject param) {
|
public JSONObject acsFinishLoadShaft(JSONObject param) {
|
||||||
String msg = "";
|
String msg = "";
|
||||||
JSONObject res;
|
JSONObject res = new JSONObject();
|
||||||
// 穿拔轴位
|
// 穿拔轴位
|
||||||
String deviceCode = param.getString("device_code");
|
String deviceCode = param.getString("device_code");
|
||||||
List<String> stepTipLogs = getRedisListValue("ERROR" + deviceCode);
|
List<String> stepTipLogs = getRedisListValue("ERROR" + deviceCode);
|
||||||
@@ -478,7 +479,6 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 6. 尝试拼单
|
// 6. 尝试拼单
|
||||||
// Param xnParam = paramService.findByCode(USE_XN);
|
|
||||||
String end_point = tryCombineOrder(demoPlan, deviceCode, startPoint, qzzNo);
|
String end_point = tryCombineOrder(demoPlan, deviceCode, startPoint, qzzNo);
|
||||||
if (end_point == null) {
|
if (end_point == null) {
|
||||||
// 7. 正常业务流程(不拼单)
|
// 7. 正常业务流程(不拼单)
|
||||||
@@ -491,8 +491,26 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
return res;
|
return res;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
if (tryLock) {
|
||||||
lock.unlock();
|
// 使用 TransactionSynchronization 在事务提交后释放锁
|
||||||
|
// 避免锁释放但事务未提交导致的并发问题
|
||||||
|
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||||
|
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(int status) {
|
||||||
|
try {
|
||||||
|
lock.unlock();
|
||||||
|
log.debug("分布式锁已在事务完成后释放: doAcsFinishLoadShaft, 事务状态: {}",
|
||||||
|
status == STATUS_COMMITTED ? "已提交" : "已回滚");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("释放分布式锁失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 如果没有事务,直接释放锁
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -721,7 +739,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cutCachePointList.isEmpty()) {
|
if (cutCachePointList.size() > 0) {
|
||||||
// 如果在架子上 - 创建的是多条任务toCreateGroupDownRollTask
|
// 如果在架子上 - 创建的是多条任务toCreateGroupDownRollTask
|
||||||
List<String> qzzNos = cutCachePointList.stream().map(Deliverycachepointivt::getQzzno)
|
List<String> qzzNos = cutCachePointList.stream().map(Deliverycachepointivt::getQzzno)
|
||||||
.filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
.filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||||
@@ -780,13 +798,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam.put("vehicle_code2", demo2.getQzzno());
|
taskParam.put("vehicle_code2", demo2.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam.put("up_roll", nextUpPlan != null
|
taskParam.put("up_roll", nextUpPlan != null ? nextUpPlans : nextDownPlans);
|
||||||
? nextUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList())
|
|
||||||
: nextDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam.put("down_roll", currentUpPlan != null
|
taskParam.put("down_roll", currentUpPlan != null ? currentUpPlans : currentDownPlans);
|
||||||
? currentUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList())
|
|
||||||
: currentDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
|
||||||
taskParam.put("to_Task1_Axis_Type", demo.getQzz_size());
|
taskParam.put("to_Task1_Axis_Type", demo.getQzz_size());
|
||||||
break;
|
break;
|
||||||
case "01":
|
case "01":
|
||||||
@@ -811,9 +825,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam.put("up_roll", nextUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("up_roll", nextUpPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam.put("down_roll", currentUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("down_roll", currentUpPlans);
|
||||||
taskParam.put("flag", "1"); // 标记是上单下单的
|
taskParam.put("flag", "1"); // 标记是上单下单的
|
||||||
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
||||||
|
|
||||||
@@ -824,7 +838,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
taskParam2.put("groupId", groupId);
|
taskParam2.put("groupId", groupId);
|
||||||
// 上去的气胀轴编码
|
// 上去的气胀轴编码
|
||||||
taskParam2.put("vehicle_code", nextDownPlan.getQzzno());
|
taskParam2.put("vehicle_code", nextDownPlan.getQzzno());
|
||||||
taskParam2.put("up_roll", nextDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("up_roll", nextDownPlans);
|
||||||
taskParam2.put("flag", "3");
|
taskParam2.put("flag", "3");
|
||||||
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
||||||
}else {
|
}else {
|
||||||
@@ -840,9 +854,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam.put("vehicle_code2", currentDownPlan.getQzzno());
|
taskParam.put("vehicle_code2", currentDownPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam.put("up_roll", nextDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("up_roll", nextDownPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam.put("down_roll", currentDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("down_roll", currentDownPlans);
|
||||||
taskParam.put("flag", "1"); // 标记是上单下单的
|
taskParam.put("flag", "1"); // 标记是上单下单的
|
||||||
taskParam.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
taskParam.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
||||||
|
|
||||||
@@ -853,7 +867,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
taskParam2.put("groupId", groupId);
|
taskParam2.put("groupId", groupId);
|
||||||
// 上去的气胀轴编码
|
// 上去的气胀轴编码
|
||||||
taskParam2.put("vehicle_code", nextUpPlan.getQzzno());
|
taskParam2.put("vehicle_code", nextUpPlan.getQzzno());
|
||||||
taskParam2.put("up_roll", nextUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("up_roll", nextUpPlans);
|
||||||
taskParam2.put("flag", "3");
|
taskParam2.put("flag", "3");
|
||||||
taskParam2.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
taskParam2.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
||||||
}
|
}
|
||||||
@@ -886,9 +900,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam.put("up_roll", nextUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("up_roll", nextUpPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam.put("down_roll", currentUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("down_roll", currentUpPlans);
|
||||||
taskParam.put("flag", "1"); // 标记是上单下单的
|
taskParam.put("flag", "1"); // 标记是上单下单的
|
||||||
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
||||||
// 单下
|
// 单下
|
||||||
@@ -930,9 +944,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam2.put("vehicle_code2", currentDownPlan.getQzzno());
|
taskParam2.put("vehicle_code2", currentDownPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam2.put("up_roll", nextDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("up_roll", nextDownPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam2.put("down_roll", currentDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("down_roll", currentDownPlans);
|
||||||
taskParam2.put("flag", "1"); // 标记是上单下单的
|
taskParam2.put("flag", "1"); // 标记是上单下单的
|
||||||
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
||||||
}
|
}
|
||||||
@@ -964,9 +978,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
taskParam.put("vehicle_code2", currentUpPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam.put("up_roll", nextUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("up_roll", nextUpPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam.put("down_roll", currentUpPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam.put("down_roll", currentUpPlans);
|
||||||
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
taskParam.put("to_Task1_Axis_Type", nextUpPlan.getQzz_size());
|
||||||
|
|
||||||
taskParam2.put("point_code1", ivtDown.getPoint_code());
|
taskParam2.put("point_code1", ivtDown.getPoint_code());
|
||||||
@@ -983,9 +997,9 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
// 下来的子卷的气胀轴编码
|
// 下来的子卷的气胀轴编码
|
||||||
taskParam2.put("vehicle_code2", currentDownPlan.getQzzno());
|
taskParam2.put("vehicle_code2", currentDownPlan.getQzzno());
|
||||||
// 上去的子卷号
|
// 上去的子卷号
|
||||||
taskParam2.put("up_roll", nextDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("up_roll", nextDownPlans);
|
||||||
// 下来的子卷好
|
// 下来的子卷好
|
||||||
taskParam2.put("down_roll", currentDownPlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
taskParam2.put("down_roll", currentDownPlans);
|
||||||
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
taskParam2.put("to_Task1_Axis_Type", nextDownPlan.getQzz_size());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2657,15 +2671,16 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
if (cutPointList.size() == 0 && cachePointList.size() == 0) {
|
if (cutPointList.size() == 0 && cachePointList.size() == 0) {
|
||||||
tips.add("没有为设备[" + deviceCode + "]套好轴的位置!或者已经创建任务!");
|
tips.add("没有为设备[" + deviceCode + "]套好轴的位置!或者已经创建任务!");
|
||||||
} else {
|
} else {
|
||||||
|
String collect = timePlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.joining("','"));
|
||||||
if (cutPointList.size() > 0){
|
if (cutPointList.size() > 0){
|
||||||
String collect = timePlans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.joining("','"));
|
|
||||||
// 找到该分切计划的点位
|
// 找到该分切计划的点位
|
||||||
tips.add("为设备[" + deviceCode + "]套好轴的位置在[" + cutPointList.stream().map(BstIvtCutpointivt::getPoint_code).collect(Collectors.joining("','")) + "], " +
|
BstIvtCutpointivt newCutPoint = cutPointList.get(0);
|
||||||
|
tips.add("为设备[" + deviceCode + "]套好轴的位置在[" + newCutPoint.getPoint_code() + "], " +
|
||||||
"对应的计划: " + collect);
|
"对应的计划: " + collect);
|
||||||
} else {
|
} else {
|
||||||
List<PdmBiSlittingproductionplan> pdmBiSlittingproductionplans = slittingproductionplanService.getByQzzNos(cachePointList.stream().map(Deliverycachepointivt::getQzzno).collect(Collectors.toList()));
|
Deliverycachepointivt newCutPoint = cachePointList.get(0);
|
||||||
tips.add("为设备[" + deviceCode + "]套好轴的位置在[" + cachePointList.stream().map(Deliverycachepointivt::getPoint_code).collect(Collectors.joining("','")) + "], " +
|
tips.add("为设备[" + deviceCode + "]套好轴的位置在[" + newCutPoint.getPoint_code() + "], " +
|
||||||
"对应的计划: " + pdmBiSlittingproductionplans.stream().map(PdmBiSlittingproductionplan::getContainer_name).collect(Collectors.toList()));
|
"对应的计划: " + collect);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3873,304 +3888,6 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
.like(SchBaseTask::getPoint_code4, data)));
|
.like(SchBaseTask::getPoint_code4, data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MergeAreaSelectVO> getXnAreaListByArea(JSONObject param) {
|
|
||||||
String productArea = param.getString("area");
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(productArea)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return cutpointivtService.list(new LambdaQueryWrapper<StIvtCutpointivt>()
|
|
||||||
.eq(StIvtCutpointivt::getProduct_area, productArea)
|
|
||||||
.like(StIvtCutpointivt::getPoint_code, "XN")
|
|
||||||
.orderByAsc(StIvtCutpointivt::getSort_seq))
|
|
||||||
.stream()
|
|
||||||
.map(point -> {
|
|
||||||
MergeAreaSelectVO vo = new MergeAreaSelectVO();
|
|
||||||
vo.setLabel(point.getFull_point_code());
|
|
||||||
vo.setValue(point.getPoint_code());
|
|
||||||
return vo;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONObject bindXnPlan(JSONObject param) {
|
|
||||||
// param: area, device_code, up_left_size_k, up_right_size_k, up_left_size_v, up_right_size_v
|
|
||||||
// location, qzz_size, qzz_generation
|
|
||||||
// 虚拟设备:A1_XNFQ_01
|
|
||||||
String area = param.getString("area");
|
|
||||||
String device_code = param.getString("device_code");
|
|
||||||
Integer number = param.getInteger("qzz_num");
|
|
||||||
String qzz_generation = param.getString("qzz_generation");
|
|
||||||
StIvtCutpointivt xnDevice = cutpointivtService.getPintByPointCode(device_code, true);
|
|
||||||
if (ObjectUtil.isEmpty(xnDevice)) {
|
|
||||||
throw new BadRequestException("该半区的虚拟设备不存在或者已禁用!");
|
|
||||||
}
|
|
||||||
// mes的设备号
|
|
||||||
String deviceCode = xnDevice.getExt_code();
|
|
||||||
// todo: 判断位置是否够用
|
|
||||||
// // 判断还有没有位置(没有就不给创建)
|
|
||||||
// List<Deliverycachepointivt> canUsePoint = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>()
|
|
||||||
// .eq(Deliverycachepointivt::getProduct_area, area)
|
|
||||||
// .eq(Deliverycachepointivt::getPoint_location, location)
|
|
||||||
// .eq(Deliverycachepointivt::getIs_used, "1")
|
|
||||||
// .eq(Deliverycachepointivt::getPoint_status, "01")
|
|
||||||
// .like(Deliverycachepointivt::getCan_size, qzz_size));
|
|
||||||
// // 获取当前区域、位置的分切计划
|
|
||||||
// int planCount = pdmBiSlittingproductionplanService.getCountXN(area, location);
|
|
||||||
// if (canUsePoint.size() < (number + planCount)) {
|
|
||||||
// throw new BadRequestException("该半区该尺寸类型的位置剩余【" + canUsePoint.size() + "】个");
|
|
||||||
// }
|
|
||||||
// 当前轴需要的管芯名称 ...
|
|
||||||
String upLeftSizeK = param.getString("up_left_size_k");
|
|
||||||
String upRightSizeK = param.getString("up_right_size_k");
|
|
||||||
String upLeftSizeV = param.getString("up_left_size_v");
|
|
||||||
String upRightSizeV = param.getString("up_right_size_v");
|
|
||||||
String upLeftQzzSize = MdmDescriptionParseUtils.extractCommonTubeSize(upLeftSizeK);
|
|
||||||
String upRightQzzSize = MdmDescriptionParseUtils.extractCommonTubeSize(upRightSizeK);
|
|
||||||
// 判断管芯的长度是否超出
|
|
||||||
if (ObjectUtil.isNotEmpty(upLeftSizeK) && ObjectUtil.isNotEmpty(upRightSizeK)) {
|
|
||||||
// 判断是否超过长度
|
|
||||||
Integer tubeLen1 = SlitterTaskUtil.getPaperLengthByCodeInt(upLeftSizeK);
|
|
||||||
Integer tubeLen2 = SlitterTaskUtil.getPaperLengthByCodeInt(upRightSizeK);
|
|
||||||
if (tubeLen1 + tubeLen2 > 1700) {
|
|
||||||
throw new BadRequestException("两个管芯相加长度超出轴长度,请检查!");
|
|
||||||
}
|
|
||||||
// 判断两边选择尺寸是否一致
|
|
||||||
if (!StrUtil.equals(upLeftQzzSize, upRightQzzSize)) {
|
|
||||||
throw new BadRequestException("同一根轴的管芯尺寸必须一致!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 判断是单管还是双管
|
|
||||||
Integer paperNum = (ObjectUtil.isNotEmpty(upLeftSizeK) && ObjectUtil.isNotEmpty(upRightSizeK)) ? 2 : 1;
|
|
||||||
List<PdmBiSlittingproductionplan> plans = new ArrayList<>();
|
|
||||||
// 虚拟计划
|
|
||||||
// 轴数量
|
|
||||||
for (int i = 0; i < number; i++) {
|
|
||||||
String parentContainer = area + "M虚拟" + i + TaskUtils.getDateTime("yyMMddHHmmss");
|
|
||||||
String now = DateUtil.now();
|
|
||||||
// 没根轴有多少管芯
|
|
||||||
for (int j = 0; j < paperNum; j++) {
|
|
||||||
PdmBiSlittingproductionplan plan = new PdmBiSlittingproductionplan();
|
|
||||||
plan.setWorkorder_id(IdUtil.getStringId());
|
|
||||||
// 公共部分插入
|
|
||||||
plan.setOrder_type("1");
|
|
||||||
plan.setContainer_name("Z虚拟" + area + i + TaskUtils.getDateTime("yyMMddHHmmss") + j);
|
|
||||||
plan.setProduct_name("220890200000001");
|
|
||||||
plan.setDescription("虚拟卷");
|
|
||||||
plan.setParent_container_name(parentContainer);
|
|
||||||
plan.setRestruct_container_name("");
|
|
||||||
plan.setWare_house("1");
|
|
||||||
plan.setResource_name(deviceCode);
|
|
||||||
plan.setSplit_group("A");
|
|
||||||
plan.setManufacture_sort("P1");
|
|
||||||
plan.setMfg_order_name("-");
|
|
||||||
plan.setManufacture_date(DateUtil.format(DateUtil.date(), "yyyy-MM-dd"));
|
|
||||||
plan.setSplit_breadth(new BigDecimal("999"));
|
|
||||||
plan.setSplit_height(new BigDecimal("999"));
|
|
||||||
plan.setSplit_weight(new BigDecimal("999"));
|
|
||||||
plan.setStart_time(now);
|
|
||||||
plan.setEnd_time("");
|
|
||||||
plan.setStatus("01");
|
|
||||||
plan.setIs_parent_ok("0");
|
|
||||||
plan.setIs_child_tz_ok("0");
|
|
||||||
plan.setIs_child_ps_ok("0");
|
|
||||||
plan.setPaper_weight("0");
|
|
||||||
plan.setQzzno("");
|
|
||||||
plan.setIs_delete("0");
|
|
||||||
plan.setSale_order_name("-");
|
|
||||||
plan.setIs_call("1");
|
|
||||||
plan.setCall_time(now);
|
|
||||||
plan.setIs_paper_ok("1");
|
|
||||||
plan.setFRP_model("");
|
|
||||||
plan.setFRP_material("");
|
|
||||||
plan.setFRP_description("");
|
|
||||||
plan.setPaper_tube_model("");
|
|
||||||
plan.setPaper_tube_material("");
|
|
||||||
plan.setPaper_tube_description("");
|
|
||||||
plan.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
|
||||||
plan.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
|
||||||
plan.setUpdate_time(DateUtil.now());
|
|
||||||
plan.setQzz_generation(qzz_generation);
|
|
||||||
// 特殊数据
|
|
||||||
// 区分位置创建
|
|
||||||
if (ObjectUtil.isNotEmpty(upLeftSizeK) && j == 0) {
|
|
||||||
boolean frp = upLeftSizeK.contains("FRP");
|
|
||||||
// 上左
|
|
||||||
//设置是纸管还是frp管
|
|
||||||
plan.setQzz_size(upLeftQzzSize);
|
|
||||||
if (frp) {
|
|
||||||
plan.setPaper_tube_or_FRP("2");
|
|
||||||
plan.setPaper_tube_material(upLeftSizeV);
|
|
||||||
plan.setPaper_tube_model(upLeftSizeK);
|
|
||||||
plan.setPaper_tube_description(upLeftSizeK);
|
|
||||||
} else {
|
|
||||||
plan.setPaper_tube_or_FRP("1");
|
|
||||||
plan.setFRP_material(upLeftSizeV);
|
|
||||||
plan.setFRP_model(upLeftSizeK);
|
|
||||||
plan.setFRP_description(upLeftSizeK);
|
|
||||||
}
|
|
||||||
plan.setUp_or_down("1");
|
|
||||||
plan.setLeft_or_right("1");
|
|
||||||
}
|
|
||||||
if ( ObjectUtil.isNotEmpty(upRightSizeK) && j == 1) {
|
|
||||||
// 上右
|
|
||||||
boolean frp = upRightSizeK.contains("FRP");
|
|
||||||
plan.setQzz_size(upRightQzzSize);
|
|
||||||
if (frp) {
|
|
||||||
plan.setPaper_tube_or_FRP("2");
|
|
||||||
plan.setPaper_tube_material(upRightSizeV);
|
|
||||||
plan.setPaper_tube_model(upRightSizeK);
|
|
||||||
plan.setPaper_tube_description(upRightSizeK);
|
|
||||||
} else {
|
|
||||||
plan.setPaper_tube_or_FRP("1");
|
|
||||||
plan.setFRP_material(upRightSizeV);
|
|
||||||
plan.setFRP_model(upRightSizeK);
|
|
||||||
plan.setFRP_description(upRightSizeK);
|
|
||||||
}
|
|
||||||
plan.setUp_or_down("1");
|
|
||||||
plan.setLeft_or_right("2");
|
|
||||||
}
|
|
||||||
plans.add(plan);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
slittingproductionplanService.saveBatch(plans);
|
|
||||||
JSONObject res = new JSONObject();
|
|
||||||
res.put("status", HttpStatus.HTTP_OK);
|
|
||||||
res.put("plans", plans);
|
|
||||||
res.put("message", "呼叫送轴成功!");
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MergeAreaSelectVO> getUnbindPlan(JSONObject param) {
|
|
||||||
String deviceCode = param.getString("deviceCode");
|
|
||||||
|
|
||||||
List<PdmBiSlittingproductionplan> list =
|
|
||||||
slittingproductionplanService.getCurrentDayListByDevice(deviceCode);
|
|
||||||
return list.stream()
|
|
||||||
.map(point -> {
|
|
||||||
MergeAreaSelectVO vo = new MergeAreaSelectVO();
|
|
||||||
vo.setLabel(point.getContainer_name());
|
|
||||||
vo.setValue(point.getContainer_name());
|
|
||||||
return vo;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public JSONObject doBindPlanDevice(JSONObject param) {
|
|
||||||
log.info("{} 操作绑定分切计划与气胀轴,请求参数:{}", SecurityUtils.getCurrentNickName(), param.toJSONString());
|
|
||||||
String upShelf = param.getString("upShelf");
|
|
||||||
String upPlanCode = param.getString("upPlanCode");
|
|
||||||
String downShelf = param.getString("downShelf");
|
|
||||||
String downPlanCode = param.getString("downPlanCode");
|
|
||||||
String force = param.getString("force");
|
|
||||||
String device = param.getString("device");
|
|
||||||
if (upPlanCode.equals(downPlanCode)) {
|
|
||||||
throw new BadRequestException("不能绑定相同的两个计划");
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(upShelf)) {
|
|
||||||
doBindNewPlanInfo(upShelf, upPlanCode, force, device);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(downShelf)) {
|
|
||||||
doBindNewPlanInfo(downShelf, downPlanCode, force, device);
|
|
||||||
}
|
|
||||||
JSONObject res = new JSONObject();
|
|
||||||
res.put("status", HttpStatus.HTTP_OK);
|
|
||||||
res.put("message", "绑定成功!");
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 绑定新计划信息 */
|
|
||||||
private void doBindNewPlanInfo(String shelfCode, String containerName, String force, String device) {
|
|
||||||
Deliverycachepointivt shelf = deliverycachepointivtService.getPintByCode(shelfCode, true);
|
|
||||||
StIvtCutpointivt cutDevice = cutpointivtService.getPintByExtCode(device, false);
|
|
||||||
if (ObjectUtil.isNotEmpty(shelf)) {
|
|
||||||
if (!"05".equals(shelf.getPoint_status())) {
|
|
||||||
throw new BadRequestException("点位" + shelfCode + "已经绑定过分切计划");
|
|
||||||
}
|
|
||||||
if (!shelf.getProduct_area().equals(cutDevice.getProduct_area()) || !shelf.getPlan().equals(cutDevice.getPlan())) {
|
|
||||||
throw new BadRequestException("分切机的区域与架子不在同一个子区域!");
|
|
||||||
}
|
|
||||||
List<PdmBiSlittingproductionplan> qzzs = slittingproductionplanService.getByQzzNoNotDeleted(shelf.getQzzno());
|
|
||||||
log.info("{} 架子的气胀轴信息:{}", shelfCode, JSONObject.toJSONString(qzzs));
|
|
||||||
PdmBiSlittingproductionplan planOne = slittingproductionplanService.getByContainerName(containerName);
|
|
||||||
if (ObjectUtil.isEmpty(planOne)) {
|
|
||||||
throw new BadRequestException("子卷:" + containerName + " 计划信息不存在!");
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(planOne.getQzzno())) {
|
|
||||||
// 判断是不是绑定过的,就查一下这个气胀轴编码在缓存架子上存不存在
|
|
||||||
List<Deliverycachepointivt> list = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>()
|
|
||||||
.eq(Deliverycachepointivt::getQzzno, planOne.getQzzno()));
|
|
||||||
if (!list.isEmpty()) {
|
|
||||||
throw new BadRequestException("子卷:" + containerName + "已经绑定过气胀轴");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String resourceName = planOne.getResource_name();
|
|
||||||
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
|
||||||
.eq(PdmBiSlittingproductionplan::getParent_container_name, planOne.getParent_container_name())
|
|
||||||
.eq(PdmBiSlittingproductionplan::getResource_name, resourceName)
|
|
||||||
.eq(PdmBiSlittingproductionplan::getSplit_group, planOne.getSplit_group())
|
|
||||||
.eq(PdmBiSlittingproductionplan::getUp_or_down, planOne.getUp_or_down()));
|
|
||||||
if (!"1".equals(force)) {
|
|
||||||
// 如果不强制绑定,就需要判断轴的规格对不对
|
|
||||||
if (qzzs.size() != list.size()) {
|
|
||||||
throw new BadRequestException("轴的卷数不匹配,不允许绑定!");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
PdmBiSlittingproductionplan needPlan = list.get(i);
|
|
||||||
for (PdmBiSlittingproductionplan qzz : qzzs) {
|
|
||||||
if (qzz.getLeft_or_right().equals(needPlan.getLeft_or_right())) {
|
|
||||||
if (needPlan.getPaper_tube_or_FRP().equals("1")) {
|
|
||||||
// 纸管
|
|
||||||
if (!needPlan.getPaper_tube_material().equals(qzz.getPaper_tube_material())) {
|
|
||||||
throw new BadRequestException("管芯不匹配,无法绑定!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!needPlan.getFRP_material().equals(qzz.getFRP_material())) {
|
|
||||||
throw new BadRequestException("管芯不匹配,无法绑定!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String qzzNo = resourceName.substring(0, 2)
|
|
||||||
+ resourceName.substring(resourceName.length() - 2)
|
|
||||||
+ list.get(0).getSplit_group()
|
|
||||||
+ TaskUtils.getDateTime("yyMMddHHmmss") + "-"
|
|
||||||
+ list.get(0).getUp_or_down();
|
|
||||||
// 绑定气胀轴和纸管重量
|
|
||||||
list.forEach(plan -> {
|
|
||||||
plan.setQzzno(qzzNo);
|
|
||||||
for (int i = 0; i < qzzs.size(); i++) {
|
|
||||||
PdmBiSlittingproductionplan shelfQzz = qzzs.get(i);
|
|
||||||
if (plan.getLeft_or_right().equals(shelfQzz.getLeft_or_right())) {
|
|
||||||
plan.setPaper_weight(shelfQzz.getPaper_weight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plan.setIs_call("1");
|
|
||||||
plan.setStatus("03");
|
|
||||||
plan.setUpdate_time(DateUtil.now());
|
|
||||||
plan.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
|
||||||
plan.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
|
||||||
});
|
|
||||||
slittingproductionplanService.updateBatchById(list);
|
|
||||||
slittingproductionplanService.deleteAll(qzzs.stream().map(PdmBiSlittingproductionplan::getWorkorder_id).collect(Collectors.toSet()));
|
|
||||||
shelf.setQzzno(qzzNo);
|
|
||||||
shelf.setPoint_status("03");
|
|
||||||
shelf.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
|
||||||
shelf.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
|
||||||
shelf.setUpdate_time(DateUtil.now());
|
|
||||||
deliverycachepointivtService.updateById(shelf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getRedisListValue(String key) {
|
public List<String> getRedisListValue(String key) {
|
||||||
List<String> stepTipLogs = (List<String>) redisUtils.get(key);
|
List<String> stepTipLogs = (List<String>) redisUtils.get(key);
|
||||||
if (CollectionUtil.isEmpty(stepTipLogs)) {
|
if (CollectionUtil.isEmpty(stepTipLogs)) {
|
||||||
@@ -4356,7 +4073,7 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
List<BstIvtCutpointivt> emptyNotTaskPoint;
|
List<BstIvtCutpointivt> emptyNotTaskPoint = new ArrayList<>();
|
||||||
if (StrUtil.isEmpty(end_point)) {
|
if (StrUtil.isEmpty(end_point)) {
|
||||||
//如果找不到可以没有正在执行任务的点,就找一个新的点
|
//如果找不到可以没有正在执行任务的点,就找一个新的点
|
||||||
emptyNotTaskPoint = slitterMapper.getCombinedOrders(
|
emptyNotTaskPoint = slitterMapper.getCombinedOrders(
|
||||||
|
|||||||
Reference in New Issue
Block a user