From 9d7718b8acf9770d7b9335019b19aeed7320483b Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期一, 03 十一月 2025 12:58:39 +0800
Subject: [PATCH] 定时任务订单上报使用orderThreadPool线程池
---
src/main/java/com/zy/common/service/CommonService.java | 86 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 76 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index e4003f1..73609c5 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -3,16 +3,14 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.Arith;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
-import com.zy.asrs.entity.result.KeyValueVo;
+import com.zy.asrs.mapper.LocMastMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocTypeDto;
-import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
@@ -20,11 +18,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
+import javax.annotation.Resource;
import java.util.List;
+import java.util.Optional;
/**
* 璐ф灦鏍稿績鍔熻兘
@@ -56,6 +52,9 @@
private SlaveProperties slaveProperties;
@Autowired
private WrkDetlService wrkDetlService;
+
+ @Resource
+ private LocMastMapper locMastMapper;
/**
* 鐢熸垚宸ヤ綔鍙�
@@ -150,7 +149,74 @@
}catch (Exception e){
log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�",sourceStaNo);
}
- return null;
+ throw new CoolException("鑾峰彇搴撲綅寮傚父");
+ }
+
+ /**
+ * 鑾峰彇搴撲綅锛屾澃涓婃澃鐢�
+ * @param ioType 1鍏ㄦ澘鍏ュ簱锛�10绌烘墭鐩樼粍鍏ュ簱
+ * @param sourceSite 婧愮珯鐐�
+ * @param locType 搴撲綅妫�娴嬩俊鎭� 0绌烘墭1鍒楋紝1涓�灞傦紝2.2-4灞傦紝3.5-9灞�
+ * @return 鐩爣搴撲綅淇℃伅
+ */
+ @Transactional
+ public StartupDto getLocNoRunNew(Integer ioType, Integer sourceSite, Integer locType) {
+
+ // 鏍规嵁鍏ュ簱绫诲瀷鍜屾簮绔欑偣鑾峰彇宸ヤ綔璺緞
+ StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("type_no", ioType).eq("crn_stn", sourceSite));
+ if (staDesc == null) {
+ throw new CoolException("鑾峰彇宸ヤ綔璺緞寮傚父锛�" + ioType + " , " + sourceSite);
+ }
+
+ // 瀵绘壘鍒扮殑搴撲綅
+ LocMast locMast = null;
+
+ // 鎸夊簱浣嶇被鍨嬭幏鍙栧簱浣�
+ List<LocMast> locMasts = locMastMapper.selectLocByTypeToList(locType, staDesc.getCrnNo());
+
+ // todo 濡傛灉褰撳墠绫诲瀷搴撲綅鍓╀綑涓嶅锛屾槸涓�鐩存斁婊★紝杩樻槸鍏煎鍒颁笅涓�绉嶅簱浣嶇被鍨�
+ // 鑰冭檻绉诲簱闇�瑕佸悓绫诲瀷搴撲綅锛岃繖閲岄檺鍒朵笉鑳芥斁婊★紝鍏煎涓嬩竴绉嶅簱浣嶇被鍨�
+ if (locMasts.size() <= 4) {
+ switch (locType) {
+ case 0:
+ return getLocNoRunNew(ioType, sourceSite, 1);
+ case 1:
+ return getLocNoRunNew(ioType, sourceSite, 2);
+ case 2:
+ return getLocNoRunNew(ioType, sourceSite, 3);
+ case 3:
+ throw new CoolException("褰撳墠搴撲綅鍓╀綑鍥涗釜鐢ㄤ簬绉诲簱锛屾棤娉曞崰鐢細" + locType);
+ default:
+ }
+ }
+
+ // 鍏堝彇娣卞簱浣�
+ Optional<LocMast> first = locMasts.stream().filter(o -> o.getRow1() == 1 || o.getRow1() == 4 || o.getRow1() == 5 || o.getRow1() == 8).findFirst();
+ if (first.isPresent()) {
+ locMast = first.get();
+ } else {
+ // 娣卞簱浣嶉噷闈㈡病鏈変粠娴呭簱浣嶉噷闈㈠彇
+ Optional<LocMast> first2 = locMasts.stream().filter(o -> o.getRow1() == 2 || o.getRow1() == 3 || o.getRow1() == 6 || o.getRow1() == 7).findFirst();
+ if(first2.isPresent()) {
+ locMast = first2.get();
+ }
+ }
+
+ if (locMast == null) {
+ throw new CoolException("娌℃湁鎵惧埌鍚堥�傜┖搴撲綅");
+ }
+
+ // 鐢熸垚宸ヤ綔鍙�
+ int workNo = getWorkNo(0);
+ // 杩斿洖dto
+ StartupDto startupDto = new StartupDto();
+ startupDto.setWorkNo(workNo);
+ startupDto.setCrnNo(staDesc.getCrnNo());
+ startupDto.setSourceStaNo(staDesc.getStnNo());
+ startupDto.setStaNo(sourceSite);
+ startupDto.setLocNo(locMast.getLocNo());
+
+ return startupDto;
}
/**
@@ -409,13 +475,13 @@
locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
.eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("whs_type",rowLastnoType.getType().longValue()));
if (!Cools.isEmpty(locMast2)) {
- locMast = locMast2;
+ locMast = locMast1;
break;
} else {
locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
.eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("whs_type",rowLastnoType.getType().longValue()));
if (!Cools.isEmpty(locMast2)) {
- locMast = locMast2;
+ locMast = locMast1;
break;
}
}
--
Gitblit v1.9.1