From 997c3f99757ba9488da232ada5c176da0f6a3cb3 Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期四, 12 三月 2026 10:51:29 +0800
Subject: [PATCH] no message
---
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java | 105 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 87 insertions(+), 18 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 459bbe2..4078f98 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -12,6 +12,7 @@
import com.zy.asrs.service.impl.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
+import com.zy.common.service.CommonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,6 +66,8 @@
private BasStationDetlService basStationDetlService;
@Autowired
private BasAreasService basAreasService;
+ @Autowired
+ private CommonService commonService;
public ReturnT<String> start(WrkMast wrkMast) {
// 4.鍏ュ簱瀹屾垚
@@ -192,7 +195,7 @@
}
}
} catch (Exception ignore) {
-
+
}
}
// 淇敼搴撲綅鐘舵�� S ====>> F
@@ -496,9 +499,9 @@
locDetl.setAnfme(checkOrderDetl.getDiffQty()
.compareTo(BigDecimal.ZERO) == 0
|| checkOrderDetl.getDiffQty()
- .compareTo(BigDecimal.ZERO) > 0
- ? oriAnfme.doubleValue()
- : oriAnfme.add(checkOrderDetl.getDiffQty()).doubleValue());
+ .compareTo(BigDecimal.ZERO) > 0
+ ? oriAnfme.doubleValue()
+ : oriAnfme.add(checkOrderDetl.getDiffQty()).doubleValue());
locDetl.setBookQty(oriAnfme);
locDetl.setDiffQty(checkOrderDetl.getDiffQty());
if (!locDetlService.updateById(locDetl)) {
@@ -816,10 +819,11 @@
*/
@Transactional(rollbackFor = Exception.class)
public ReturnT<String> agvDoOut(Task task) {
+ LocCache locMast = locCacheService
+ .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo()));
+ Date now = new Date();
+
if (task.getIoType().equals(101)) {
- Date now = new Date();
- LocCache locMast = locCacheService
- .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo()));
if (Objects.isNull(locMast)) {
throw new RuntimeException("鏁版嵁閿欒锛氬簱浣嶄俊鎭笉鑳戒负绌猴紒锛�");
}
@@ -830,7 +834,6 @@
return FAIL.setMsg(
"鍏ㄦ澘鍑哄簱 ===>> 宸ヤ綔鏄庣粏妗d负绌�; [workNo=" + task.getWrkNo() + "],[locNo=" + task.getSourceLocNo() + "]");
}
-
BasStation devNo = basStationService
.selectOne(new EntityWrapper<BasStation>().eq("dev_no", task.getStaNo()));
if (Objects.isNull(devNo)) {
@@ -905,9 +908,6 @@
throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
} else if (task.getIoType().equals(110)) {
- Date now = new Date();
- LocCache locMast = locCacheService
- .selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo()));
if (Objects.isNull(locMast)) {
throw new RuntimeException("鏁版嵁閿欒锛氬簱浣嶄俊鎭笉鑳戒负绌猴紒锛�");
}
@@ -940,8 +940,77 @@
if (!taskService.updateById(task)) {
throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
- } else {
+ } else if (task.getIoType().equals(103)) {
+ List<TaskDetl> wrkDetls103 = taskDetlService
+ .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
+ if (wrkDetls103.isEmpty()) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg("鎷f枡鍑哄簱 ===>> 宸ヤ綔鏄庣粏妗d负绌�; [workNo=" + task.getWrkNo() + "],[locNo="
+ + task.getSourceLocNo() + "]");
+ }
+ for (TaskDetl wrkDetl : wrkDetls103) {
+ // 鏇存柊璁㈠崟瀹屾垚鏁伴噺
+ OrderDetlPakout orderDetlPakout = orderDetlPakoutService.
+ selectOne(new EntityWrapper<OrderDetlPakout>()
+ .eq("matnr", wrkDetl.getMatnr())
+ .eq("supp_code", wrkDetl.getSuppCode())
+ .eq("order_no", wrkDetl.getOrderNo()));
+ try {
+ if (!Cools.isEmpty(orderDetlPakout)) {
+ if (!orderDetlPakoutService.increaseQtyByOrderNo(wrkDetl.getOrderNo(),
+ wrkDetl.getMatnr(),
+ orderDetlPakout.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(),
+ wrkDetl.getStandby2(), wrkDetl.getStandby3(),
+ wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(),
+ wrkDetl.getAnfme())) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg("鎷f枡鍑哄簱 ===>> 鏇存柊璁㈠崟瀹屾垚鏁伴噺澶辫触; [workNo=" + task.getWrkNo()
+ + "],[locNo=" + task.getSourceLocNo() + "]");
+ }
+ }
+ //TODO 淇敼绔欑偣鐘舵�侀绾︾洰鏍囧簱浣�,浠ュ強绔欑偣搴撲綅淇℃伅
+ LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>()
+ .eq("matnr", wrkDetl.getMatnr())
+ .eq("supp_code", wrkDetl.getSuppCode())
+ .eq("loc_no", task.getSourceLocNo()));
+ if (Objects.isNull(locDetl) ) {
+ throw new CoolException("搴撳瓨鏁版嵁閿欒锛岃鑱旂郴绠$悊鍛橈紒锛�");
+ }
+ Double sulp = Math.round((locDetl.getAnfme() - wrkDetl.getAnfme()) * 10000) / 10000.0;
+ locDetl.setAnfme(sulp);
+ if (!locDetlService.update(locDetl, new EntityWrapper<LocDetl>().eq("loc_no", locDetl.getLocNo())
+ .eq("matnr", locDetl.getMatnr())
+ .eq("supp_code", locDetl.getSuppCode()))) {
+ return FAIL.setMsg("鎷f枡鍑哄簱 ===>> 鏇存柊璁㈠崟瀹屾垚鏁伴噺澶辫触; [workNo=" + task.getWrkNo()
+ + "],[locNo=" + task.getSourceLocNo() + "]");
+ }
+ } catch (Exception ignore) {
+ log.error(ignore.getMessage());
+ }
+ }
+// int workNo = commonService.getWorkNo(0);
+ task.setIoType(task.getIoType() - 50);
+ task.setLocNo(task.getSourceLocNo());
+ task.setWrkSts(TaskStatusType.AGV_IN_START.type);
+ if (!taskService.update(task, new EntityWrapper<Task>().eq("wrk_no", task.getWrkNo()))) {
+ throw new CoolException("浠诲姟鎷h揣瀹屾垚鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+
+ // 淇敼婧愬簱浣嶇姸鎬� R ===>> O
+ if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+ locMast.setLocSts(LocStsType.LOC_STS_TYPE_S.type);
+ locMast.setBarcode("");
+ locMast.setModiTime(now);
+ locMast.setIoTime(now);
+ if (!locCacheService.updateById(locMast)) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg("鎷f枡鍑哄簱 ===>> 淇敼婧愬簱浣嶇姸鎬佸け璐�; [workNo=" + task.getWrkNo() + "],[locNo="
+ + task.getSourceLocNo() + "]");
+ }
+ } else {
+ throw new CoolException("褰撳墠搴撲綅鐘舵��" + locMast.getLocSts() + ", 鏃犳硶鎵ц鍑哄簱鎿嶄綔锛侊紒");
+ }
}
return SUCCESS;
}
@@ -958,13 +1027,13 @@
station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
}
station.setBarcode("");
- if (!basStationService.updateById(station)) {
- basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
- }
+ if (!basStationService.updateById(station)) {
+ basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
+ }
}
}
- if(wrkMast.getIoType().equals(1)){
+ if (wrkMast.getIoType().equals(1)) {
if (Objects.isNull(locCache)) {
throw new CoolException("鏁版嵁閿欒锛屽簱浣嶄笉瀛樺湪锛侊紒");
}
@@ -1052,7 +1121,7 @@
List<WaitPakin> apallets = waitPakinService
.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()));
- for (WaitPakin pakin : apallets){
+ for (WaitPakin pakin : apallets) {
WaitPakinLog waitPakinLog = new WaitPakinLog();
BeanUtils.copyProperties(pakin, waitPakinLog);
waitPakinLogService.insert(waitPakinLog);
@@ -1064,7 +1133,7 @@
// if (Objects.isNull(pakins) || pakins.isEmpty()) {
//// throw new CoolException("鍗曟嵁涓嶅瓨鍦紒锛�");
// }
- }else if(wrkMast.getIoType().equals(53)){
+ } else if (wrkMast.getIoType().equals(53)) {
// 鏍规嵁宸ヤ綔鍙凤紝鏌ヨ宸ヤ綔鏄庣粏妗�
List<TaskDetl> wrkDetls53 = taskDetlService
.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkMast.getWrkNo()));
--
Gitblit v1.9.1