From 4d178decb3f57cb6208a211d9421e427f28efb0a Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 04 十二月 2024 08:46:36 +0800
Subject: [PATCH] 1、fixbug:玻璃出片顺序错乱、 2、调整任务和对列表保存顺序、确保现有队列数据后有任务,防止先生成任务没有出片队列任务被自动完成的情况发生 3、定时任务更新已出片对数
---
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 54 insertions(+), 3 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 b2b37e3..fb42c44 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
@@ -4,6 +4,7 @@
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
@@ -19,7 +20,10 @@
import com.mes.hollow.entity.HollowBigStorageCageDetails;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.HollowGlassRelationInfo;
-import com.mes.hollow.entity.dto.*;
+import com.mes.hollow.entity.dto.BigStorageSequenceDTO;
+import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO;
+import com.mes.hollow.entity.dto.HollowBigStorageDTO;
+import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO;
import com.mes.hollow.service.HollowBigStorageCageDetailsService;
import com.mes.hollow.service.HollowBigStorageCageService;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
@@ -532,6 +536,7 @@
noDealOutTask(v);
}
});
+
for (BigStorageCageTask item : outTaskList) {
//鏇存柊鍘嗗彶浠诲姟琛ㄤ腑鐨勪换鍔$姸鎬�
hollowBigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<HollowBigStorageCageHistoryTask>()
@@ -552,7 +557,41 @@
// 绌烘墽琛�
}
}
- //鏇存柊鏁伴噺
+ try {
+ //鏇存柊鏁伴噺
+ //鎸夌収鐜荤拑id鑾峰彇闇�瑕佸嚭鐗囧鍒楄〃涓殑鏁版嵁
+ if(finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT) ){
+ HollowGlassQueueInfo hollowGlassQueueInfo = hollowGlassQueueInfoService.getOne(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+ .eq(HollowGlassQueueInfo::getGlassId, outTaskList.get(0).getGlassId())
+ .orderByDesc(HollowGlassQueueInfo::getUpdateTime).last("limit 1"));
+ List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+ .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId())
+ .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell())
+ .eq(HollowGlassQueueInfo::getIsPair, 1)
+ .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+ );
+ if (CollectionUtil.isEmpty(list)){
+// 浠诲姟鏇存柊涓哄凡瀹屾垚
+ hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
+ .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
+ .eq("cell",hollowGlassQueueInfo.getCell())
+ .setSql("pair_quantity = total_pair_quantity")
+ .set("state",Const.HOLLOW_FLOW_CARD_SUCCESS)
+ );
+ }else{
+// 璁$畻鍓╀綑鐜荤拑瀵规暟锛岀敤浠诲姟鎬婚槦鏁板噺鍓╀綑瀵规暟
+ int remainCount = list.size() / hollowGlassQueueInfo.getTotalLayer();
+ hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
+ .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
+ .eq("cell",hollowGlassQueueInfo.getCell())
+ .setSql("pair_quantity = total_pair_quantity -"+remainCount)
+ );
+ }
+ }
+ }catch (Exception e){
+ log.info("璁$畻鐜荤拑鏁伴噺杩囩▼涓嚭鐜伴敊璇紝閿欒淇℃伅{}",e.getMessage());
+ }
+
// hollowGlassOutRelationInfoService.update
// 閲嶇疆浠诲姟琛ㄦ暟鎹�
bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
@@ -666,17 +705,29 @@
private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) {
List<T> resultList = new ArrayList<>();
+ List<T> tempList = new ArrayList<>();
int taskType = Const.BIG_STORAGE_AFTER_OUT;
int taskState = Const.GLASS_STATE_OUT_ING;
for (T t : list) {
if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) {
- resultList.add(t);
+ tempList.add(t);
+ }else{
+ break;
}
}
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){
+ HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+ .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+ targetSlot = storageCage.getSlot();
+ }
totalLayer = 0;
+ }else{
+ resultList = tempList;
}
return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce);
}
--
Gitblit v1.8.0