From 786e52f559698f57a1e91aad2abc16c5453bd140 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期四, 16 五月 2024 14:14:05 +0800
Subject: [PATCH] # 手动移库生成
---
src/main/java/com/zy/common/service/AgvCommonService.java | 27 +++++++++++++
src/main/java/com/zy/asrs/task/AutoMoveScheduler.java | 3 +
src/main/java/com/zy/asrs/controller/AgvBasDevpController.java | 11 +++++
src/main/java/com/zy/asrs/task/handler/AutoMoveHandler.java | 75 +++++++++++++++++++++++++++++++++++--
4 files changed, 111 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java b/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
index 968f3eb..e8b9a8e 100644
--- a/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
+++ b/src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
@@ -34,6 +34,8 @@
AgvWaitPakinService agvWaitPakinService;
@Autowired
AgvWorkService agvWorkService;
+ @Autowired
+ AgvLocDetlService agvLocDetlService;
@RequestMapping(value = "/basDevp/list/auth")
@ManagerAuth
@@ -177,6 +179,15 @@
AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>()
.eq("loc_no", agvBasDevp.getDevNo())
.or().eq("source_loc_no",agvBasDevp.getDevNo()));
+ if (Cools.isEmpty(agvWrkMast)) {
+ Page<AgvLocDetl> agvLocDetlPage = agvLocDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvLocDetl>()
+ .eq("supp_code", agvBasDevp.getBarcode()));
+ if (agvLocDetlPage.getRecords().size() > 0) {
+ return R.ok(agvLocDetlPage);
+ } else {
+ return R.error("褰撳墠璐ф灦鐮佸紓甯革紒");
+ }
+ }
Page<AgvWrkDetl> agvWrkDetlPage = agvWrkDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvWrkDetl>()
.eq("wrk_no", agvWrkMast.getWrkNo()));
diff --git a/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java b/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
index 8e08e43..c1d9027 100644
--- a/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
+++ b/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
@@ -22,7 +22,7 @@
@Autowired
private AutoMoveHandler autoMoveHandler;
-
+ // 璋冩嫧鍑哄簱
@Scheduled(cron = "0/2 * * * * ? ")
private void execute(){
List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(
@@ -40,6 +40,7 @@
}
+ // 绌烘澘鑷姩鍥炲簱
@Scheduled(cron = "0/2 * * * * ? ")
private void autoEmptyBack(){
// 鏌ヨ 涓嶄负1妤肩殑绌鸿揣鏋�
diff --git a/src/main/java/com/zy/asrs/task/handler/AutoMoveHandler.java b/src/main/java/com/zy/asrs/task/handler/AutoMoveHandler.java
index 256f695..901757f 100644
--- a/src/main/java/com/zy/asrs/task/handler/AutoMoveHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/AutoMoveHandler.java
@@ -5,10 +5,7 @@
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
-import com.zy.asrs.service.AgvLocDetlService;
-import com.zy.asrs.service.AgvLocMastService;
-import com.zy.asrs.service.AgvWrkDetlService;
-import com.zy.asrs.service.AgvWrkMastService;
+import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.common.service.AgvCommonService;
@@ -35,6 +32,8 @@
private AgvLocDetlService agvLocDetlService;
@Autowired
private AgvWrkDetlService agvWrkDetlService;
+ @Autowired
+ AgvBasDevpService agvBasDevpService;
public ReturnT<String> start(AgvLocMast agvLocMast) {
// locType 1. 鑷姩锛� 2. 鎵嬪姩
@@ -107,6 +106,65 @@
}
private ReturnT<String> doHandMove(AgvLocMast agvLocMast) {
+ Date now = new Date();
+ //鏌ヨ宸ヤ綔妗�
+ AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode());
+ if(!Cools.isEmpty(agvWrkMast)){
+ throw new CoolException("褰撳墠"+agvLocMast.getBarcode()+"璐ф灦鐮佸凡鍦ㄥ伐浣滄。涓�");
+ }
+// //妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅
+// AgvLocMast LocMast = agvCommonService.getLocNo(3,agvLocMast.getLocType3());
+ // 妫�绱gv鎺ラ┏浣�
+ AgvBasDevp devpNo = agvCommonService.getDevpNo(3, 1);
+ //鐢熸垚宸ヤ綔妗�
+ AgvWrkMast mast = new AgvWrkMast();
+ //宸ヤ綔鐘舵��
+ mast.setWrkSts(201L);
+ //鍏ュ嚭搴撶被鍨�
+ mast.setIoType(111);
+ mast.setIoTime(now);
+ //浼樺厛绾�
+ mast.setIoPri(300.0);
+ //婧愮珯鐐�
+ mast.setSourceLocNo(agvLocMast.getLocNo());
+ //鐩爣绔欑偣
+ mast.setLocNo(devpNo.getDevNo());
+ //瀹瑰櫒缂栫爜
+ mast.setBarcode(agvLocMast.getBarcode());
+ //瀹瑰櫒绫诲瀷
+ mast.setWhsType(30);
+ // 鐩爣妤煎眰
+ mast.setPreHave(agvLocMast.getLocType3().toString());
+
+ mast.setAppeUser(9527L);
+ mast.setAppeTime(now);
+ mast.setModiUser(9527L);
+ mast.setModiTime(now);
+ if (!agvWrkMastService.insertByIncrease(mast)) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+ }
+
+ AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devpNo.getDevNo()).eq("source_loc_no",agvLocMast.getLocNo()));
+ //鐢熸垚宸ヤ綔妗f槑缁�
+ List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo()));
+ agvLocDetls.forEach(agvLocDetl -> {
+ AgvWrkDetl wrkDetl = new AgvWrkDetl();
+ wrkDetl.setWrkNo(mast1.getWrkNo());
+ wrkDetl.sync(agvLocDetl);
+ wrkDetl.setSpecs("1-" + agvLocMast.getLocType3());
+ wrkDetl.setSuppCode(agvLocDetl.getSuppCode());
+ wrkDetl.setIoTime(now);
+ wrkDetl.setAppeUser(9527L);
+ wrkDetl.setAppeTime(now);
+ wrkDetl.setModiUser(9527L);
+ wrkDetl.setModiTime(now);
+ if (!agvWrkDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
+ }
+ });
+ //鏇存柊鐩爣搴撲綅鐘舵��
+ updateAgvLocMast(agvLocMast,"R");
+ updateAgvBasDevp(devpNo,"S");
return SUCCESS;
}
@@ -117,6 +175,15 @@
locMast.setLocSts(locSts);
agvLocMastService.updateById(locMast);
}
+ /*
+ 鏇存柊婧愮珯鐐逛俊鎭�
+ */
+ private void updateAgvBasDevp(AgvBasDevp agvBasDevp, String locSts){
+ if(!Cools.isEmpty(agvBasDevp)){
+ agvBasDevp.setLocSts(locSts);
+ agvBasDevpService.updateById(agvBasDevp);
+ }
+ }
public ReturnT<String> autoEmptyBack(AgvLocMast agvLocMast) {
Date now = new Date();
diff --git a/src/main/java/com/zy/common/service/AgvCommonService.java b/src/main/java/com/zy/common/service/AgvCommonService.java
index ccf1f43..d8e1dff 100644
--- a/src/main/java/com/zy/common/service/AgvCommonService.java
+++ b/src/main/java/com/zy/common/service/AgvCommonService.java
@@ -31,6 +31,8 @@
private MatService matService;
@Autowired
private LocRuleService locRuleService;
+ @Autowired
+ AgvBasDevpService agvBasDevpService;
public int getWorkNo(Integer wrkMk) {
AgvWrkLastno wrkLastno = agvWrkLastnoService.selectById(wrkMk);
@@ -233,6 +235,31 @@
.eq("floor",floor)
.eq("loc_type1",type));
}
+ /**
+ * 妫�绱㈠簱浣嶅彿
+ * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
+ */
+ public AgvBasDevp getDevpNo(int type, int floor) {
+ // 鐩爣搴撲綅
+ AgvBasDevp basDevp = null;
+ // 寮�濮嬫煡鎵惧簱浣� ==============================>>
+ basDevp = getDevpNoRule(type,floor);
+ if (basDevp != null) {
+ return basDevp;
+ }
+
+ //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
+ throw new CoolException("璇ユゼ灞傛病鏈夌┖搴撲綅");
+ }
+
+ //闅忔満鍙栦竴涓揣浣�
+ private AgvBasDevp getDevpNoRule(int type,int floor){
+ return agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>()
+ .eq("loc_sts","O")
+ .eq("floor",floor)
+ .eq("loc_type1",type)
+ .like("dev_no","DB"));
+ }
}
--
Gitblit v1.9.1