From 59f80df1e377e8775969ca4acadfa2eadd6e37ae Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期一, 04 十一月 2024 19:01:38 +0800
Subject: [PATCH] excel导出优化
---
src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java | 368 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 329 insertions(+), 39 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
index 4a624f1..3d635a7 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -9,6 +9,7 @@
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.service.*;
+import com.zy.asrs.utils.CodeDetectionUtil;
import com.zy.common.model.DetlDto;
import com.zy.common.service.AgvCommonService;
import lombok.Synchronized;
@@ -68,21 +69,29 @@
if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
throw new CoolException(BaseRes.PARAM);
}
+ if (!CodeDetectionUtil.barcodeDetection(param.getBarcode())){
+ throw new CoolException(param.getBarcode() + "璐ф灦鐮佹湁璇紝璇锋纭壂鐮侊紒锛侊紒");
+ }
param.setContainerType(Short.valueOf(param.getBarcode().substring(0,2)));
-// //妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鐨勬墭鐩樻潯鐮侊紝瀛樺湪鍒欐姏鍑哄紓甯�
+// //妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鐨勮揣鏋舵潯鐮侊紝瀛樺湪鍒欐姏鍑哄紓甯�
// if (agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().eq("supp_code", param.getBarcode())) > 0) {
// throw new CoolException(param.getBarcode() + "鏂欐兂鐮佸凡瀛樺湪AGV鍏ュ簱閫氱煡妗d腑");
// }
- //妫�鏌ュ簱瀛樻槸鍚︽湁鐩稿悓鏂欑锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
+ //妫�鏌ュ簱瀛樻槸鍚︽湁鐩稿悓璐ф灦锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
if(!Cools.isEmpty(agvLocDetlService.selectOne(new EntityWrapper<AgvLocDetl>().eq("supp_code",param.getBarcode())))){
- throw new CoolException(param.getBarcode() + "鏂欑鐮佸凡瀛樺湪AGV搴撳瓨鏄庣粏涓�");
+ throw new CoolException(param.getBarcode() + "璐ф灦鐮佸凡瀛樺湪AGV搴撳瓨鏄庣粏涓�");
}
- //鏌ョ湅宸ヤ綔妗f槸鍚︽湁鐩稿悓鏂欑锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
+ //妫�鏌ュ簱瀛樻槸鍚︽湁鐩稿悓璐ф灦锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
+ if(!Cools.isEmpty(agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("barcode",param.getBarcode())))){
+ throw new CoolException(param.getBarcode() + "璐ф灦鐮佸凡瀛樺湪AGV搴撳瓨涓绘。涓�");
+ }
+
+ //鏌ョ湅宸ヤ綔妗f槸鍚︽湁鐩稿悓璐ф灦锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
if(!Cools.isEmpty(agvWrkMastService.selectByContainerCode(param.getBarcode()))){
- throw new CoolException(param.getBarcode() + "鏂欑鐮佸凡瀛樺湪AGV宸ヤ綔妗d腑");
+ throw new CoolException(param.getBarcode() + "璐ф灦鐮佸凡瀛樺湪AGV宸ヤ綔妗d腑");
}
if (Cools.isEmpty(param.getOrderNo())) {
@@ -111,9 +120,16 @@
Date now = new Date();
List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", pickParams.getLocNo()));
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("wrk_no", pickParams.getWrkNo()));
+
+ if (Cools.isEmpty(agvWrkMast)){
+ return "澶辫触锛屾湭鏌ュ埌宸ヤ綔涓绘。锛屽伐浣滃彿锛�"+pickParams.getWrkNo();
+ }
for (PickParam.Pick pick : pickParams.getPicks()) {
if (pick.getCount().equals(0D)) continue;
- AgvWrkDetl agvWrkDetl = agvWrkDetlService.selectOne(new EntityWrapper<AgvWrkDetl>().eq("matnr", pick.getMatnr()).eq("three_code", pick.getThreeCode()));
+ Double count = 0.0D;
+ AgvWrkDetl agvWrkDetl = agvWrkDetlService.selectOne(new EntityWrapper<AgvWrkDetl>().eq("matnr", pick.getMatnr()).eq("three_code", pick.getThreeCode()).eq("supp_code",pick.getSuppCode()));
+
if (Cools.isEmpty(agvWrkDetl)) {
AgvWrkDetl wrkDetl = new AgvWrkDetl();
Mat mat = matService.selectByMatnr(pick.getMatnr());
@@ -123,9 +139,9 @@
wrkDetl.sync(mat);
wrkDetl.setWrkNo(pickParams.getWrkNo());
wrkDetl.setOrderNo(pick.getOrderNo());
- wrkDetl.setIoTime(now);
+ wrkDetl.setIoTime(agvWrkMast.getIoTime());
wrkDetl.setAnfme(pick.getCount()); // 鏁伴噺
- wrkDetl.setSuppCode(pick.getSuppCode()); // 鎵樼洏鏉$爜
+ wrkDetl.setSuppCode(pick.getSuppCode()); // 璐ф灦鏉$爜
wrkDetl.setAppeUser(userId);
wrkDetl.setAppeTime(now);
wrkDetl.setModiUser(userId);
@@ -134,8 +150,10 @@
agvWrkDetlService.insert(wrkDetl);
} else {
Double anfme = agvWrkDetl.getAnfme() + pick.getCount();
+ agvWrkDetl.setIoTime(agvWrkMast.getIoTime());
agvWrkDetl.setAnfme(anfme);
- agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>().eq("matnr",agvWrkDetl.getMatnr()).eq("three_code",agvWrkDetl.getThreeCode()));
+ agvWrkDetl.setModiTime(now);
+ agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>().eq("matnr",agvWrkDetl.getMatnr()).eq("three_code",agvWrkDetl.getThreeCode()).eq("supp_code",pick.getSuppCode()));
}
@@ -148,23 +166,21 @@
}
}
// 纭鏄惁鍏ㄩ儴鍑哄簱
- int sameNumber = 0;
+ double totleWrkdetl = 0.0;
+ double totleLocdetl = 0.0;
List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", pickParams.getWrkNo()));
for (AgvLocDetl agvLocDetl : agvLocDetls) {
- for (AgvWrkDetl agvWrkDetl : agvWrkDetls) {
- if (agvLocDetl.getMatnr().equals(agvWrkDetl.getMatnr())
- && agvLocDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())
- && agvLocDetl.getSuppCode().equals(agvWrkDetl.getSuppCode())
- && agvLocDetl.getAnfme().equals(agvWrkDetl.getAnfme())) {
- sameNumber++;
- }
- }
+ totleLocdetl = totleLocdetl + agvLocDetl.getAnfme();
}
- if (agvLocDetls.size() == sameNumber) {
- AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("wrk_no", pickParams.getWrkNo()));
+ for (AgvWrkDetl agvWrkDetl : agvWrkDetls) {
+ totleWrkdetl = totleWrkdetl + agvWrkDetl.getAnfme();
+ }
+ if (totleWrkdetl >= totleLocdetl) {
agvWrkMast.setIoType(101);
agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no", pickParams.getWrkNo()));
+
}
+// agvLocDetls.size() == 1
return "缁勬墭鎴愬姛锛岀粦瀹氱珯鐐规垚鍔�";
@@ -176,7 +192,7 @@
private void NoOrderComb(CombParam param, Long userId){
List<DetlDto> detlDtos = mappingDetlDtoByCombMat(param,null);
- //鐢ㄤ簬缁熶竴涓�涓墭鐩樹笅鐨勫叆搴撻�氱煡妗g殑鐢熸垚鏃堕棿
+ //鐢ㄤ簬缁熶竴涓�涓揣鏋朵笅鐨勫叆搴撻�氱煡妗g殑鐢熸垚鏃堕棿
Date now = new Date();
detlDtos.forEach(detlDto -> {
syncWaitPakin(detlDto,"",param.getBarcode(),userId,now);
@@ -200,7 +216,7 @@
}
// 鐢ㄤ簬鐢熸垚鍏ュ簱閫氱煡妗f墍闇�鍙傛暟
List<DetlDto> detlDtos = mappingDetlDtoByCombMat(param,order);
- //鐢ㄤ簬缁熶竴涓�涓墭鐩樹笅鐨勫叆搴撻�氱煡妗g殑鐢熸垚鏃堕棿
+ //鐢ㄤ簬缁熶竴涓�涓揣鏋朵笅鐨勫叆搴撻�氱煡妗g殑鐢熸垚鏃堕棿
Date now = new Date();
for (DetlDto detlDto : detlDtos) {
//鍚屾鐢熸垚鍏ュ簱閫氱煡妗�
@@ -222,8 +238,8 @@
checkOrderQty(order,combMat);
}
- DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType());
- //鍚屼竴鎵樼洏涓嬬浉鍚岀墿鏂欎俊鎭拰鎵瑰彿杞负涓�涓叆搴撻�氱煡妗�
+ DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType(),combMat.getProcessSts());
+ //鍚屼竴璐ф灦涓嬬浉鍚岀墿鏂欎俊鎭拰鎵瑰彿杞负涓�涓叆搴撻�氱煡妗�
if (DetlDto.has(detlDtos, detlDto)) {
DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCsocode(), detlDto.getIsoseq(),detlDto.getContainerCode());
assert one != null;
@@ -266,8 +282,8 @@
waitPakin.sync(mat);
waitPakin.setOrderNo(orderNo); // 鍗曟嵁缂栧彿
waitPakin.setBatch(detlDto.getBatch()); // 搴忓垪鐮�
- //waitPakin.setZpallet(zpallet); // 鎵樼洏鐮�
- waitPakin.setSuppCode(zpallet); // 鎵樼洏鐮�
+ //waitPakin.setZpallet(zpallet); // 璐ф灦鐮�
+ waitPakin.setSuppCode(zpallet); // 璐ф灦鐮�
waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
waitPakin.setStatus("Y"); // 鐘舵��
@@ -278,6 +294,8 @@
waitPakin.setDeadTime(detlDto.getIsoseq());
waitPakin.setLocType(detlDto.getLocType());
+
+ waitPakin.setProcessSts(detlDto.getProcessSts());
waitPakin.setAppeUser(userId);
@@ -312,7 +330,7 @@
}
if(Cools.isEmpty(agvWaitPakinService.selectByContainerCode(barcode))){
- throw new CoolException("璇ユ枡绠辨湭缁勬墭锛屾棤娉曠粦瀹氱珯鐐�");
+ throw new CoolException("璇ヨ揣鏋舵湭缁勬墭锛屾棤娉曠粦瀹氱珯鐐�");
}
AgvBasDevp agvBasDevp1 = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", barcode));
@@ -371,6 +389,20 @@
public String handControlLocMove(LocMoveParam param, Long userId) {
String fl = String.valueOf(param.getFloor());
short floor =(short)Integer.parseInt(fl.substring(0, 1));
+ switch (param.getFloor()) {
+ case "1F01":
+ floor = 1;
+ break;
+ case "1F02":
+ floor = 4;
+ break;
+ case "2F":
+ floor = 2;
+ break;
+ case "3F":
+ floor = 3;
+ break;
+ }
Integer ioType = 0;
AgvLocMast agvLocMast = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", param.getLocNo()));
if (Cools.isEmpty(agvLocMast)) {
@@ -387,7 +419,25 @@
ioType = 11;
}
} else {
- ioType = 12;
+ if (agvLocMast.getFloor() != floor) {
+ if (agvLocMast.getFloor() == 1 && (floor == 2 || floor == 3)) {
+ throw new CoolException("褰撳墠搴撲綅璇烽�夋嫨璋冩嫧鍗曡皟鎷紒");
+ } else if ((agvLocMast.getFloor() == 2 || agvLocMast.getFloor() == 3) && (floor == 1 || floor == 4)) {
+ throw new CoolException("褰撳墠搴撲綅璇烽�夋嫨璋冩嫧鍥炴祦鍗曞洖閫�锛�");
+ } else {
+ ioType = 12;
+ }
+ } else {
+ if (agvLocMast.getFloor() == 1) {
+ if (agvLocMast.getLev1() == 1 && floor == 1) {
+ ioType = 11;
+ } else {
+ ioType = 12;
+ }
+ } else {
+ ioType = 11;
+ }
+ }
}
Date now = new Date();
//鏌ヨ宸ヤ綔妗�
@@ -396,14 +446,32 @@
throw new CoolException("褰撳墠"+agvLocMast.getBarcode()+"璐ф灦鐮佸凡鍦ㄥ伐浣滄。涓�");
}
//妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅
- AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor);
+ AgvLocMast locMast = null;
+ if (floor == 1) {
+ locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,true,false);
+ } else {
+ locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,false);
+ }
+
+ // 鐩爣妤煎眰鍘� 鍚稿2妤�
+ if (floor == 4) {
+ if (locMast.getLev1() == 1) {
+ throw new CoolException("鍚稿涓�妤兼病鏈夌┖搴撲綅鍙互绉诲簱锛�");
+ }
+
+ }
+
if (Cools.isEmpty(locMast)) {
throw new CoolException("褰撳墠妤煎眰娌℃湁绌哄簱浣�");
}
//鐢熸垚宸ヤ綔妗�
AgvWrkMast mast = new AgvWrkMast();
//宸ヤ綔鐘舵��
- mast.setWrkSts(201L);
+ if (ioType==121) {
+ mast.setWrkSts(11L);
+ }else {
+ mast.setWrkSts(201L);
+ }
//鍏ュ嚭搴撶被鍨�
mast.setIoType(ioType);
mast.setIoTime(now);
@@ -413,19 +481,20 @@
mast.setSourceLocNo(agvLocMast.getLocNo());
//鐩爣绔欑偣
mast.setLocNo(locMast.getLocNo());
- //瀹瑰櫒缂栫爜
+ //璐ф灦缂栫爜
mast.setBarcode(agvLocMast.getBarcode());
- //瀹瑰櫒绫诲瀷
+ //璐ф灦绫诲瀷
mast.setWhsType(30);
mast.setAppeUser(userId);
mast.setAppeTime(now);
mast.setModiUser(userId);
mast.setModiTime(now);
+ mast.setLogErrMemo("handControlLocMove");
if (!agvWrkMastService.insertByIncrease(mast)) {
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
- if (!agvLocMast.getLocSts().equals("F")) {
+ if (agvLocMast.getLocSts().equals("F")) {
AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", locMast.getLocNo()).eq("source_loc_no",agvLocMast.getLocNo()));
//鐢熸垚宸ヤ綔妗f槑缁�
List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo()));
@@ -444,6 +513,30 @@
}
});
}
+
+// // 濡傛灉褰撳墠浠诲姟鏄澹充簩涓夋ゼ鍥為��涓�妤肩殑 鍥炴粴璋冩嫧鍗�
+// if (ioType == 12 && locMast.getFloor() == 1 && floor != 4 && agvLocMast.getFloor() != 1) {
+// List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo()));
+// for (AgvLocDetl agvLocDetl : agvLocDetls) {
+// OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("three_code", agvLocDetl.getThreeCode()).eq("matnr", agvLocDetl.getMatnr()).eq("source", 33));
+// if (Cools.isEmpty(orderDetl)) {
+// throw new CoolException("褰撳墠鐗╂枡鐨勮皟鎷ㄥ崟涓嶅瓨鍦紒");
+// }
+// Order order = orderService.selectByNo(orderDetl.getOrderNo());
+// if (Cools.isEmpty(order)) {
+// throw new CoolException("褰撳墠鐗╂枡鐨勮皟鎷ㄥ崟涓嶅瓨鍦紒");
+// }
+// if (order.getSettle() == 4L) {
+// if (!orderService.updateSettle(order.getId(),2L,userId)) {
+// throw new CoolException("璋冩嫧鍗曞洖婊氬紓甯�!");
+// }
+// }
+// orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme());
+// if (!orderDetlService.updateById(orderDetl)) {
+// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
+// }
+// }
+// }
//鏇存柊鐩爣搴撲綅鐘舵��
updateAgvLocMast(agvLocMast,"P");
updateAgvLocMast(locMast,"Q");
@@ -458,10 +551,39 @@
@Synchronized
public String allocationOut(AgvMobileStartPakin param, Long userId) {
Date now = new Date();
+ if(Cools.isEmpty(param.getBarcode())) {
+ throw new CoolException("璇疯緭鍏ヨ揣鏋剁爜");
+ }
AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", param.getDevNo()));
Integer oldWrkNo = agvWrkMast.getWrkNo();
if (Cools.isEmpty(agvWrkMast)) {
throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
+ }
+ if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
+ throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�");
+ }
+ if (!agvWrkMast.getWrkSts().equals(207L) && !agvWrkMast.getWrkSts().equals(205L)) {
+ throw new CoolException("褰撳墠宸ヤ綔鐘舵��:" + agvWrkMast.getWrkSts$() +"涓嶇鍚堢鍦烘潯浠�");
+ }
+ if (agvWrkMast.getWrkSts().equals(205L)) {
+ // 搴撲綅 -- 鎺ラ┏浣� / 搴撲綅
+ if (agvWrkMast.getLocNo().substring(0,2).equals("DB")) {
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getLocNo(),"F",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ // 鎺ラ┏浣� -- 搴撲綅
+ } else {
+ agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ }
+
+ // 鎺ラ┏浣� -- 搴撲綅
+ if (agvWrkMast.getSourceLocNo().substring(0,2).equals("DB")) {
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",(short)0);
+ // 搴撲綅 -- 鎺ラ┏浣� / 搴撲綅
+ } else {
+ //淇敼婧愬簱浣嶇姸鎬佷负O
+ agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",agvWrkMast.getWhsType().shortValue(),"",(short)0);
+ //鏇存柊鐩爣搴撲綅鏄庣粏 101.鍑哄簱 鍒犻櫎婧愬簱浣嶅簱瀛樻槑缁�
+ agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",agvWrkMast.getSourceLocNo()));
+ }
}
//鐢熸垚AGV宸ヤ綔鍘嗗彶妗� + 鐢熸垚AGV宸ヤ綔鏄庣粏鍘嗗彶妗�
@@ -479,12 +601,13 @@
agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
agvWrkDetl.setModiUser(userId);
agvWrkDetl.setModiTime(now);
+ agvWrkDetl.setIoTime(now);
if (!agvWrkDetlService.insert(agvWrkDetl)) {
throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
}
}
// 鏇存柊绔欑偣鐘舵��
- agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null);
+// agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null);
// 鏇存柊婧愬簱浣嶇姸鎬�
agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getLocNo(),"O","",agvWrkMast.getWhsType().shortValue());
@@ -500,6 +623,15 @@
public String allocationIn(AgvMobileStartPakin param, Long userId) {
Date now = new Date();
AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()));
+ if (Cools.isEmpty(agvWrkMast)) {
+ throw new CoolException("鏆傛棤褰撳墠璐ф灦鐮佺殑浠诲姟");
+ }
+ if (agvWrkMast.getIoType() != 111) {
+ throw new CoolException("闈炴墜鍔ㄨ皟鎷ㄤ换鍔★紝涓嶆敮鎸佹鍔熻兘");
+ }
+ if (!Cools.isEmpty(agvWrkMast.getSourceLocNo())) {
+ throw new CoolException("褰撳墠璐ф灦鐮佷换鏈夋簮搴撲綅锛岃纭");
+ }
AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(param.getDevNo());
if (Cools.isEmpty(agvWrkMast)) {
throw new CoolException("宸ヤ綔妗d腑娌℃湁姝よ揣鏋朵换鍔�");
@@ -507,6 +639,7 @@
if (agvWrkMast.getCrnNo() != agvBasDevp.getFloor()) {
throw new CoolException("璇风Щ鍔ㄥ埌->" + agvWrkMast.getCrnNo() + "妤煎叆搴撶偣鍏ュ簱");
}
+ AgvLocMast locNo = agvCommonService.getLocNo(3, 1,false,true);
//宸ヤ綔鐘舵��
agvWrkMast.setWrkSts(211L);
//鍏ュ嚭搴撶被鍨�
@@ -517,20 +650,176 @@
if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
}
+ //
+ agvLocMastService.updateLocStsByLocNo(locNo.getLocNo(),"S",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
// 鏇存柊婧愬簱浣嶇姸鎬�
- agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"F",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"R",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
//鍒犻櫎AGV宸ヤ綔妗�
return "ok";
}
/*
- * 绔欑偣鍥為��
+ 绌烘灦绂诲満
*/
@Override
@Transactional
+ @Synchronized
+ public String empOut(AgvMobileStartPakin param, Long userId) {
+ Date now = new Date();
+ if (Cools.isEmpty(param.getBarcode())) {
+ throw new CoolException("璇疯緭鍏ヨ揣鏋剁爜");
+ }
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
+ Integer oldWrkNo = agvWrkMast.getWrkNo();
+ if (Cools.isEmpty(agvWrkMast)) {
+ throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
+ }
+ if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
+ throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�");
+ }
+ agvWrkMast.setModiTime(new Date());
+ agvWrkMast.setWrkSts(213L);
+ agvWrkMast.setSourceLocNo("");
+ if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+ }
+ // 鏇存柊婧愬簱浣嶇姸鎬�
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"O","",agvWrkMast.getWhsType().shortValue());
+ return "ok";
+ }
+ /*
+ 绌烘灦杩涘満
+ */
+ @Override
+ @Transactional
+ @Synchronized
+ public String empIn(AgvMobileStartPakin param, Long userId) {
+ Date now = new Date();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()));
+ if (Cools.isEmpty(agvWrkMast)) {
+ throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
+ }
+ if (agvWrkMast.getIoType() != 113) {
+ throw new CoolException("褰撳墠宸ヤ綔绫诲瀷涓嶈兘绌烘灦杩涘満");
+ }
+ if (agvWrkMast.getWrkSts() != 213) {
+ throw new CoolException("褰撳墠宸ヤ綔绫诲瀷涓嶈兘绌烘灦杩涘満");
+ }
+ agvWrkMast.setWrkSts(214L);
+ agvWrkMast.setModiTime(new Date());
+ agvWrkMast.setSourceLocNo(param.getDevNo());
+ if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+ }
+ // 鏇存柊婧愬簱浣嶇姸鎬�
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"F",param.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ return "ok";
+ }
+ /*
+ * 杞墜鍔ㄥ洖娴�
+ */
+ @Override
+ @Transactional
+ public String handBack(AgvMobileStartPakin param, Long userId) {
+ Date now = new Date();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
+ agvWrkMast.setIoType(113);
+ agvWrkMast.setModiUser(userId);
+ agvWrkMast.setModiTime(now);
+ if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+ }
+ return "ok";
+ }
+
+ /*
+ * 纭鍔犲伐瀹屾垚
+ */
+ @Override
+ @Transactional
+ public String processed(AgvMobileStartPakin param, Long userId) {
+ Date now = new Date();
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()).eq("loc_no", param.getDevNo()));
+ if (Cools.isEmpty(agvWrkMast)) {
+ throw new CoolException("鏆傛棤褰撳墠璐ф灦鐨勫伐浣滄。");
+ }
+ if (agvWrkMast.getWrkSts() != 205) {
+ throw new CoolException("褰撳墠浠诲姟鏈畬鎴愶紝璇风‘璁�");
+ }
+ //鐢熸垚AGV宸ヤ綔鍘嗗彶妗� + 鐢熸垚AGV宸ヤ綔鏄庣粏鍘嗗彶妗�
+ agvWrkMastLogService.save(agvWrkMast);
+ agvWrkDetlLogService.save(agvWrkMast.getWrkNo());
+ String sourceLocNo = agvWrkMast.getSourceLocNo();
+ AgvLocMast newLocMast = agvCommonService.getLocNo(3, 1,false,false);
+ agvWrkMast.setSourceLocNo(agvWrkMast.getLocNo());
+ agvWrkMast.setLocNo(newLocMast.getLocNo());
+ agvWrkMast.setIoType(57);
+ agvWrkMast.setWrkSts(201L);
+ agvWrkMast.setModiUser(userId);
+ agvWrkMast.setModiTime(now);
+ agvWrkMast.setIoTime(now);
+
+
+
+ if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+ }
+
+ // 鏇存柊婧愮珯鐐� + 鐩爣搴撲綅鐘舵�� + 鍘嗗彶婧愬簱浣�
+ agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"R",param.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ agvLocMastService.updateLocStsByLocNo(newLocMast.getLocNo(),"S",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
+ agvLocMastService.updateLocStsByLocNo(sourceLocNo,"O","",(short)30);
+ agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",sourceLocNo));
+
+ List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code",param.getBarcode()));
+ agvWrkDetls.forEach(agvWrkDetl -> {
+ for (AgvWrkDetl wrkDetl : param.getWrkDetls()) {
+ if (wrkDetl.getMatnr().equals(agvWrkDetl.getMatnr()) && wrkDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())) {
+ agvWrkDetl.setAnfme(wrkDetl.getAnfme());
+ break;
+ }
+ }
+ agvWrkDetl.setProcessSts(2);
+ agvWrkDetl.setOrderNo(agvWrkDetl.getOrderNo().substring(2));
+ agvWrkDetl.setModiUser(userId);
+ agvWrkDetl.setModiTime(now);
+ agvWrkDetl.setIoTime(now);
+ if (!agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>()
+ .eq("matnr",agvWrkDetl.getMatnr())
+ .eq("three_code",agvWrkDetl.getThreeCode())
+ .eq("supp_code",param.getBarcode()))) {
+ throw new CoolException("鏇存柊宸ヤ綔鏄庣粏澶辫触");
+ }
+ });
+ return "ok";
+ }
+
+
+
+ /*
+ * 绔欑偣鍥為��
+ */
+ @Override
+ @Transactional
public String doBack(AgvMobileStartPakin param, Long userId) {
+ if (Cools.isEmpty(param.getBarcode()) || !CodeDetectionUtil.barcodeDetection(param.getBarcode())){
+ throw new CoolException(param.getBarcode() + "璐ф灦鐮佹湁璇紝璇锋纭壂鐮侊紒锛侊紒");
+ }
+ if (Cools.isEmpty(param.getDevNo()) || !CodeDetectionUtil.carCodeDetection(param.getDevNo())){
+ throw new CoolException(param.getDevNo() + "灏忚溅鍦扮爜鏈夎锛岃姝g‘鎵爜锛侊紒锛�");
+ }
Date now = new Date();
AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", param.getDevNo()));
+ AgvWrkMast agvWrkMastSource = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
+ if (!Cools.isEmpty(agvWrkMastSource)) {
+ throw new CoolException("褰撳墠绔欑偣宸叉湁閫�搴撲换鍔�");
+ }
Integer oldWrkNo = agvWrkMast.getWrkNo();
+ if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
+ throw new CoolException("鍥為��浠诲姟鐨勮揣鏋剁爜涓庡綋鍓嶈揣鏋剁爜涓嶄竴鑷�!");
+ }
+ if (agvWrkMast.getWrkSts() != 205) {
+ throw new CoolException("鍑哄簱浠诲姟鏈畬鎴�!");
+ }
// 鏂板缓鍥為��宸ヤ綔妗�
AgvWrkMast wrkMast = createWrkMast(58, 201L, agvWrkMast.getLocNo(), agvWrkMast.getSourceLocNo(), agvWrkMast.getBarcode(), now, userId, agvWrkMast.getWhsType(), 0);
// 鏇存柊鎺ラ┏浣嶏紝鏇存柊搴撲綅鐘舵��
@@ -542,6 +831,7 @@
agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
// 淇濇寔宸ヤ綔妗f槑缁�
agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
+ agvWrkDetl.setIoTime(now);
agvWrkDetl.setModiUser(userId);
agvWrkDetl.setModiTime(now);
if (!agvWrkDetlService.insert(agvWrkDetl)) {
@@ -588,9 +878,9 @@
wrkMast.setSourceLocNo(sourceLocNo);
//鐩爣绔欑偣
wrkMast.setLocNo(locNo);
- //瀹瑰櫒缂栫爜
+ //璐ф灦缂栫爜
wrkMast.setBarcode(barcode);
- //瀹瑰櫒绫诲瀷
+ //璐ф灦绫诲瀷
wrkMast.setWhsType(containerType);
// 鐩爣妤煎眰
wrkMast.setCrnNo(floor);
@@ -599,7 +889,7 @@
wrkMast.setAppeTime(now);
wrkMast.setModiUser(userId);
wrkMast.setModiTime(now);
-
+ wrkMast.setLogErrMemo("doBack");
if (!agvWrkMastService.insertByIncrease(wrkMast)) {
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
--
Gitblit v1.9.1