From e3b98d055308762c55fd77bd79e332a3d2fd5606 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 08 一月 2025 13:39:21 +0800
Subject: [PATCH] 1、中空李赛克对接 订单号必须为10位且首位为0 2、除膜对接查询配方信息sql异常
---
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 144 +++++++++++++++++++++---------------------------
1 files changed, 63 insertions(+), 81 deletions(-)
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index aa5d790..f412f58 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -78,6 +78,10 @@
private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task";
private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task";
+ /**
+ * 鐩撮�氭牸瀛�
+ */
+ private static final Integer THROUGH_SLOT = 920;
@Autowired(required = false)
MiloService miloService;
@Resource
@@ -94,6 +98,11 @@
@Value("${mes.outCarMaxSize}")
private Integer outCarMaxSize;
+
+ @Value("${mes.slotMaxHeight}")
+ private Integer slotMaxHeight;
+ @Value("${mes.slotMaxthickness}")
+ private Integer slotMaxthickness;
@Scheduled(fixedDelay = 1000)
public void inBigStorageTask() throws Exception {
@@ -154,10 +163,40 @@
//todo:鍚憄lc鍙戦�佹姤璀�
return;
}
+ //鎸夌収鐜荤拑鍘氬害鍒嗙粍锛屽垽鏂墿浣欐牸瀛愭槸鍚﹀彲浠ュ瓨鏀�
+ Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting()));
+ for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) {
+ int count = hollowBigStorageCageService.count(new LambdaQueryWrapper<HollowBigStorageCage>()
+ .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+ .le(HollowBigStorageCage::getMinThickness, entry.getKey())
+ .ge(HollowBigStorageCage::getMaxThickness, entry.getKey()));
+ if (count < entry.getValue()) {
+ log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
+ }
+ //todo:瓒呭ぇ灏哄
+ if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() > slotMaxthickness) {
+ int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+ .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
+ .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
+ if (count > 0) {
+ log.info("鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝缁撴潫鏈杩涚墖");
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
+ }
+
+ log.info("灏嗛挗鍖栧皬鐗囪〃鍐呯殑鐘舵�佹敼涓洪挗鍖栫粨鏉燂紝鐜荤拑id鏈夛細{}", glassIdList);
//淇敼閽㈠寲浠诲姟琛ㄤ腑鐨勭姸鎬�
temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>()
.set(TemperingGlassInfo::getState, Const.TEMPERING_END).in(TemperingGlassInfo::getGlassId, glassIdList));
-
+ //鎶ュ伐
+ log.info("灏嗘帴鏀跺埌鐨勭幓鐠冭繘琛岄挗鍖栬嚜鍔ㄦ姤宸ワ紝鐜荤拑id鏈夛細{}", glassIdList);
+ for (String glass : glassIdList) {
+ damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "閽㈠寲", "杩涗腑绌虹悊鐗囩", 1);
+ }
Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId));
//璁$畻鐩爣鏍煎瓙
@@ -246,12 +285,11 @@
}
//鑾峰彇绌洪棽涓旈鍙栦换鍔$殑鏁版嵁淇℃伅锛屾病鏈変换鍔$洿鎺ヨ蛋鐜荤拑璋冨害
- ReadWriteEntity oneEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outOneRequest");
- ReadWriteEntity twoEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outTwoRequest");
- ReadWriteEntity threeEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outThreeRequest");
- int cell = -1;
+ ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree");
HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null;
- if ("1".equals(oneEntity.getValue() + "")) {
+ int cell = -1;
+ //鏉庤禌鍏嬬嚎闇�瑕佽幏鍙栭煩姹焢lc鐨勭嚎璺┖闂茬姸鎬侊細10000000绗�8浣嶄负 1琛ㄧず蹇欑 0琛ㄧず绌洪棽
+ if (null != oneEntity.getValue() && "1".equals(oneEntity.getValue() + "")) {
cell = 930;
hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
.getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -259,7 +297,9 @@
.eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
);
}
- if (1 == 1 || null == hollowGlassOutRelationInfo && "1".equals(twoEntity.getValue() + "")) {
+
+ ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
+ if (null == hollowGlassOutRelationInfo && null != twoEntity.getValue() && Boolean.parseBoolean(twoEntity.getValue() + "")) {
cell = 931;
hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
.getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -267,14 +307,7 @@
.eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
);
}
- if (null == hollowGlassOutRelationInfo && "1".equals(threeEntity.getValue() + "")) {
- cell = 932;
- hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
- .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
- .eq(HollowGlassOutRelationInfo::getCell, cell)
- .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
- );
- }
+
if (null != hollowGlassOutRelationInfo) {
//鏄惁鍏佽涓┖
//鏄惁鏈夋鍦ㄤ腑绌虹殑鐜荤拑:涓┖灏忕墖琛ㄧ瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
@@ -298,63 +331,6 @@
.eq(HollowGlassOutRelationInfo::getCell, hollowGlassOutRelationInfo.getCell())
.set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS));
}
-// if (redisUtil.getCacheObject("hollowSwitch")) {
-// List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService
-// .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-// .eq(HollowGlassOutRelationInfo::getCell, cell)
-// .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW));
-// for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) {
-// //涓┖浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
-// List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE);
-// if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) {
-// //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
-// //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆涓┖灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟 缁撴潫
-// for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) {
-// List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell);
-// int finalCell = cell;
-// List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
-// HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
-// BeanUtils.copyProperties(queue, queueInfo);
-// queueInfo.setState(Const.TEMPERING_NEW);
-// queueInfo.setCell(finalCell);
-// return queueInfo;
-// }).collect(Collectors.toList());
-//
-// List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
-// int isPairCount = glassInfo.getTotalLayer() * e.getTotalLayer();
-// List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
-// loop:
-// for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) {
-// HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
-// BeanUtils.copyProperties(queue, queueInfo);
-// queueInfo.setState(Const.TEMPERING_NEW);
-// queueInfo.setCell(cell);
-// hollowQueues.add(queueInfo);
-// if (queue.getIsPair() == 1){
-// isPairCount -=1;
-// if (isPairCount == 0){
-// break loop;
-// }
-// }
-// }
-//
-// if (CollectionUtil.isNotEmpty(hollowQueues)) {
-// hollowGlassQueueInfoService.saveBatch(hollowQueues);
-// Integer isPair = hollowQueues.get(0).getIsPair();
-// hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer());
-// //灏嗕腑绌轰换鍔$姸鎬佹敼涓哄紑濮�
-// hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
-// .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId())
-// .eq(HollowGlassOutRelationInfo::getCell, cell)
-// .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
-// Date endDate = new Date();
-// log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
-// return;
-// }
-// }
-// }
-// }
-// }
}
// redisUtil.setCacheObject("dispatchHollowSwitch",true);
//鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
@@ -564,6 +540,9 @@
hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT);
} else {
hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
+ //鎸夌収鏍煎瓙淇℃伅鏇存柊瀵瑰簲鐨勮澶噄d
+ List<Integer> slotList = storageCageDTOList.stream().map(UpdateHollowBigStorageCageDTO::getTargetSlot).distinct().collect(Collectors.toList());
+ hollowBigStorageCageDetailsService.updateDeviceIdBySlot(slotList);
}
log.info("4銆佸ぇ鐞嗙墖绗艰繘鐗囩姸鎬佸凡瀹屾垚宸插畬鎴愮殑鐜荤拑淇℃伅id:{}", v);
updateSlotRemainBySlots(outSuccessGlassSlot);
@@ -757,15 +736,21 @@
if (isPair == 0 && isForce != 1) {
taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
taskState = Const.GLASS_STATE_SCHEDULE_ING;
- resultList.add(list.get(0));
//鐩墠璋冨害浠诲姟totalLayer涓�0 鍑虹墖璋冨害浠诲姟鏈夊眰鍙凤紝鐢ㄤ簬鍖哄垎璋冨害鏂瑰紡
// 鍥犱负鍑虹墖瀛樺湪璋冨害锛屽鏋滀负璋冨害锛屾彁鍓嶅崰鐢ㄦ牸瀛愶紝鏇存柊鏍煎瓙鍓╀綑灏哄锛岄伩鍏嶈杩涚墖鐜荤拑鍗犵敤
if (totalLayer != 0) {
+ resultList.add(list.get(0));
HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
- .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+ .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON)
+ .le(HollowBigStorageCage::getMinThickness, list.get(0).getThickness())
+ .ge(HollowBigStorageCage::getMaxThickness, list.get(0).getThickness())
+ .eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+ .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
targetSlot = storageCage.getSlot();
hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
.set(HollowBigStorageCage::getRemainWidth, 0).eq(HollowBigStorageCage::getSlot, targetSlot));
+ } else {
+ resultList = tempList;
}
totalLayer = 0;
} else {
@@ -852,6 +837,9 @@
//鏄惁瀛樺湪鏈夋牸瀛愰潪绌虹殑鐜荤拑
if (CollectionUtils.isNotEmpty(inSlotGlassList)) {
//瀛樺湪 灏嗘牸瀛愬唴鐨勭幓鐠冨垎鍒繘琛屾洿鏂�
+// List<HollowBigStorageCage> hollowBigStorageCageList = hollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>()
+// .lt(HollowBigStorageCage::getRemainWidth, 0).in(HollowBigStorageCage::getSlot, slotList));
+// List<Integer> resultSlotList = hollowBigStorageCageList.stream().map(HollowBigStorageCage::getSlot).collect(Collectors.toList());
slotRemainMap = inSlotGlassList.stream()
.collect(Collectors.groupingBy(HollowBigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap)));
slotRemainMap.forEach((e, v) -> {
@@ -869,17 +857,11 @@
}
}
- private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
+ public ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
return ReadWriteEntity.builder()
.identifier(identifier)
//Kep涓槸Long绫诲瀷锛屽嵆锛欼nt32锛孞ava涓殑int绫诲瀷
.value(value)
.build();
}
-//
-// private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) {
-//// if (target == 931){}
-// if (taskList.get(0).get)
-// return null;
-// }
}
\ No newline at end of file
--
Gitblit v1.8.0