From 0da03950e4e26ed5e8a16d1a6e0d352734519846 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 13 十月 2025 18:25:13 +0800
Subject: [PATCH] 新增最新证书功能
---
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java | 138 ++++++++++++++++++++++++++-------------------
1 files changed, 80 insertions(+), 58 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
index 30cbf19..e85e389 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -8,11 +8,14 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.mapper.ReportQueryMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.PostMesDataUtils;
import com.zy.common.utils.HttpHandler;
+import com.zy.system.entity.Config;
+import com.zy.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -52,6 +55,13 @@
@Value("${mes.inPath}")
private String inpath;
+
+ @Autowired
+ private PackQualifiedService packQualifiedService;
+ @Autowired
+ private ReportQueryMapper reportQueryMapper;
+ @Autowired
+ private ConfigService configService;
public ReturnT<String> start(WrkMast wrkMast) {
// 4.鍏ュ簱瀹屾垚
@@ -154,6 +164,10 @@
locMast.setIoTime(now);
locMast.setModiTime(now);
locMast.setFireStatus(0);
+ //鍏ユ祴璇曞簱浣嶆椂缁欏簱浣嶆祴璇曠姸鎬佷负1寰呮祴
+ if(!Cools.isEmpty(locMast.getChannel())){
+ locMast.setPackStatus(1);//寰呮祴
+ }
if (locMast.getCrnNo()==1){
if (locMast.getLocType1()==1){
locMast.setPackStatus(1);
@@ -167,12 +181,23 @@
.eq("barcode",wrkDetl1.getMatnr())
.eq("status",4)
);
+ if (Cools.isEmpty(testMast)){
+ testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
+ .eq("barcode",wrkDetl1.getMatnr())
+ .eq("status",5)
+ );
+ }
+ if (Cools.isEmpty(testMast)){
+ throw new CoolException("鏇存敼娴嬭瘯鐘舵�佸け璐�,鏌ヨ娴嬭瘯妗f澶辫触");
+ }
testMast.setStatus(5);
testMast.setModiTime(new Date());
if (!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode",wrkDetl1.getMatnr()).eq("status",4))){
throw new CoolException("鏇存敼娴嬭瘯鐘舵�佸け璐�");
}
}
+ //鍏ュ簱鏍囪
+ packQualifiedService.insertPackQualified(true,new Date(),wrkDetls.get(0).getMatnr());
//2.鍏ュ簱瀹屾垚涓婃姤
CombParam combParam = new CombParam();
combParam.setPackNo(wrkDetls.get(0).getMatnr());
@@ -187,7 +212,7 @@
}
combParam.setRequestTime(DateUtils.convert(now));
- new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
+// new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
if (!locMastService.updateById(locMast)) {
// exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 淇敼搴撲綅鐘舵�佸け璐ワ紱[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -334,7 +359,6 @@
sourceLoc.setLocSts("O");
sourceLoc.setModiTime(now);
sourceLoc.setIoTime(now);
- sourceLoc.setFireStatus(0);
sourceLoc.setPackStatus(0);
if (!locMastService.updateById(sourceLoc)) {
// exceptionHandle("搴撲綅绉昏浆 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐ワ紱[workNo={0}],[sourceLoc={1}]", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
@@ -347,56 +371,64 @@
locMast.setBarcode(wrkMast.getBarcode());
locMast.setIoTime(now);
locMast.setModiTime(now);
- locMast.setFireStatus(0);
LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
-
- boolean sign =false;
if (locMast.getLocType1().equals(sourceLoc.getLocType1())){
locMast.setPackStatus(packStatus);
+
+ //寰呮祴搴撲綅杞祴璇曞簱浣�
}else if (locMast.getLocType1().equals((short)1) && sourceLoc.getLocType1().equals((short)3)){
locMast.setPackStatus(1);
- }else {
- if (locMast.getLocType1().equals((short)4)){
- locMast.setPackStatus(4); //4:NG
- }else {
- locMast.setPackStatus(5); //5:闈欑疆涓�
- }
- sign=true;
- if (locMast.getLocType1()==1 && sourceLoc.getLocType1()==2){
- TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
- .eq("loc_no",sourceLoc.getLocNo())
- .eq("barcode",locMast.getBarcode())
- .eq("status",4)
- );
- testMast.setStatus(5);
+ TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
+ .eq("loc_no",sourceLoc.getLocNo())
+ .eq("user_id",locMast.getBarcode())
+ .eq("barcode",locDetl.getMatnr())
+ );
+ if(!Cools.isEmpty(testMast)){
+ testMast.setChannel(locMast.getChannel());
+ testMast.setLocNo(wrkMast.getLocNo());
testMast.setModiTime(new Date());
- if (!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("loc_no",sourceLoc.getLocNo()).eq("barcode",locMast.getBarcode()).eq("status",4))){
+ testMast.setBarcode(locDetl.getMatnr());
+ if (!testMastService.update(testMast,new EntityWrapper<TestMast>()
+ .eq("loc_no",sourceLoc.getLocNo())
+ .eq("user_id",locMast.getBarcode())
+ .eq("barcode",locDetl.getMatnr()))){
throw new CoolException("鏇存敼娴嬭瘯鐘舵�佸け璐�");
}
+ }else {
+ throw new CoolException("寰呮祴搴撲綅鏃犵墿");
}
+ }else {
+ //娴嬭瘯搴撲綅杞潤缃簱浣嶅拰NG搴撲綅
+ if (locMast.getLocType1().equals((short)4)){
+ locMast.setPackStatus(4); //4:NG
+// //鍏ュ簱鏍囪
+// packQualifiedService.insertPackQualified(true,new Date(),locDetl.getMatnr());
+// //鍑哄簱鏍囪
+// packQualifiedService.insertPackQualified(false,new Date(),locDetl.getMatnr());
+ }else {
+ locMast.setPackStatus(5); //5:闈欑疆涓�
+// //鍏ュ簱鏍囪
+// packQualifiedService.insertPackQualified(true,new Date(),locDetl.getMatnr());
+// //鍑哄簱鏍囪
+// packQualifiedService.insertPackQualified(false,new Date(),locDetl.getMatnr());
+ }
+ TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
+ .eq("loc_no",sourceLoc.getLocNo())
+ .eq("barcode",locDetl.getMatnr())
+ .in("status",3,4)
+ );
+ testMast.setStatus(5);
+ testMast.setLocNo(locMast.getLocNo());
+ testMast.setModiTime(new Date());
+ if (!testMastService.updateById(testMast)){
+ throw new CoolException("鏇存敼娴嬭瘯鐘舵�佸け璐�");
+ }
}
if (!locMastService.updateById(locMast)) {
// exceptionHandle("搴撲綅绉昏浆 ===>> 淇敼鐩爣搴撲綅鐘舵�佸け璐ワ紱[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return FAIL.setMsg("搴撲綅绉昏浆 ===>> 淇敼鐩爣搴撲綅鐘舵�佸け璐�; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]");
- }
-
- if (locMast.getCrnNo()==1 && sign){
- //5.闈欑疆搴撲綅鍏ュ簱瀹屾垚涓婃姤
- CombParam combParam = new CombParam();
- combParam.setPackNo(locDetl.getMatnr());
- combParam.setLocNo(wrkMast.getLocNo());
- if (locMast.getPackStatus()==4){
- combParam.setPackSts(2);
- }else if (locMast.getPackStatus()==5){
- combParam.setPackSts(1);
- }else {
- combParam.setPackSts(0);
- }
- combParam.setStepSts(5);
- combParam.setRequestTime(DateUtils.convert(now));
- new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
}
break;
default:
@@ -470,31 +502,20 @@
locMast.setBarcode("");
locMast.setModiTime(now);
locMast.setIoTime(now);
- locMast.setFireStatus(0);
locMast.setPackStatus(0);
if (!locMastService.updateById(locMast)) {
// exceptionHandle("鍏ㄦ澘鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐ワ紱[workNo={0}],[sourceLocNo={1}]", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return FAIL.setMsg("鍏ㄦ澘鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐�; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
}else{
- //2.鍑哄簱瀹屾垚涓婃姤
- CombParam combParam = new CombParam();
- combParam.setPackNo(wrkDetls101.get(0).getMatnr());
- combParam.setLocNo(wrkMast.getLocNo());
- combParam.setBarcode(wrkMast.getBarcode());
- //鐩爣绔�206鍑哄簱
- if(wrkMast.getStaNo()==206){
- combParam.setPackSts(1);//OK
- combParam.setStepSts(7);//娴嬭瘯搴撳嚭搴撳畬鎴�
- }else if(wrkMast.getStaNo()==204){//NG 鍑哄簱
- combParam.setPackSts(2);//NG
- combParam.setStepSts(8);//NG鍑哄簱瀹屾垚
- }else if(wrkMast.getStaNo()==103){//鐩爣绔�103鍑哄簱
- combParam.setPackSts(1);//OK
- combParam.setStepSts(6);//闈欑疆搴撳嚭搴撳畬鎴�
+ Config config=configService.selectOne(new EntityWrapper<Config>().eq("code","OutTask"));
+ if(config.getValue().equals("Y")){
+ // 淇敼宸ヤ綔涓绘。鐘舵��
+ wrkMast.setWrkSts(30L);//绛夊緟缁檃gv涓嬪彂绌烘澘鎼繍浠诲姟
+ }else{
+ wrkMast.setWrkSts(15L);
}
- combParam.setRequestTime(DateUtils.convert(now));
- new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
+
}
}
break;
@@ -506,20 +527,21 @@
locMast.setBarcode("");
locMast.setModiTime(now);
locMast.setIoTime(now);
- locMast.setFireStatus(0);
locMast.setPackStatus(0);
if (!locMastService.updateById(locMast)) {
// exceptionHandle("绌烘澘鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐ワ紱[workNo={0}],[sourceLocNo={1}]", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return FAIL.setMsg("绌烘澘鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐�; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
+ }else{
+ // 淇敼宸ヤ綔涓绘。鐘舵��
+ wrkMast.setWrkSts(30L);//绛夊緟缁檃gv涓嬪彂绌烘澘鎼繍浠诲姟
}
}
break;
default:
break;
}
- // 淇敼宸ヤ綔涓绘。鐘舵��
- wrkMast.setWrkSts(15L);
+
wrkMast.setModiTime(now);
if (!wrkMastService.updateById(wrkMast)) {
// exceptionHandle("鏇存柊鍑哄簱瀹屾垚鐘舵�佸け璐�;[workNo={0}]", wrkMast.getWrkNo());
--
Gitblit v1.9.1