From 290e5fd2e74efe19326f56e38c3391aaae23ffc5 Mon Sep 17 00:00:00 2001
From: IZCD4L12RTSW0VZ\Administrator <skyouc>
Date: 星期三, 24 十二月 2025 17:14:09 +0800
Subject: [PATCH] Merge branch 'jsxswms' of http://47.97.1.152:5880/r/zy-asrs into jsxswms
---
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 179 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 137 insertions(+), 42 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index b938865..b07baec 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -700,13 +700,13 @@
OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),
elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
- DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
+ DetlDto detlDto = new DetlDto(order.getOrderNo(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
elem.getStandby2(), elem.getStandby3(),
elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
elem.getThreeCode());
detlDto.setOrderId(order.getId());
detlDto.setOrderNo(order.getOrderNo());
- if (DetlDto.has(detlDtos, detlDto)) {
+ if (DetlDto.hasOrder(detlDtos, detlDto)) {
DetlDto one = DetlDto.findDto(detlDtos, detlDto);
assert one != null;
one.setAnfme(one.getAnfme() + detlDto.getAnfme());
@@ -991,7 +991,7 @@
try {
response = new HttpHandler.Builder()
.setUri(MesConstant.URL)
- .setPath(MesConstant.PACK_DOWN_URL)
+ .setPath(MesConstant.IN_DISPATCH_RESULT)
.setJson(JSON.toJSONString(mesCombParam))
.build()
.doPost();
@@ -999,11 +999,11 @@
if (jsonObject.getInteger("code").equals(200)) {
success = true;
} else if (jsonObject.getInteger("code").equals(500)) {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
JSON.toJSONString(mesCombParam), response);
throw new CoolException(jsonObject.getString("msg"));
} else {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
JSON.toJSONString(mesCombParam), response);
throw new CoolException("涓婃姤mes绯荤粺澶辫触");
}
@@ -1015,7 +1015,7 @@
// 淇濆瓨鎺ュ彛鏃ュ織
apiLogService.save(
"鎵撳寘涓嬬嚎甯墭涓婃姤",
- MesConstant.URL + MesConstant.PACK_DOWN_URL,
+ MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
null,
"127.0.0.1",
JSON.toJSONString(mesCombParam),
@@ -1540,7 +1540,7 @@
station.setModiTime(new Date());
station.setModiUser(userId);
if (!basStationService.updateById(station)) {
- throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+ throw new CoolException("鏇存柊鐩爣绔欑偣鐘舵�佸け璐�");
}
} else {
throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
@@ -1741,6 +1741,7 @@
throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
}
station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
+ station.setBarcode("");
if (!basStationService.updateById(station)) {
throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
}
@@ -1785,6 +1786,7 @@
}
station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
+ station.setBarcode("");
if (!basStationService.updateById(station)) {
throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐�!");
}
@@ -1806,6 +1808,13 @@
generateCrnInTask(waitPakins, station, param.getLocType1(), userId);
}
+ /**
+ * SO/EO 鍖虹粍鎵�
+ * @author Ryan
+ * @date 2025/12/18 15:19
+ * @param params
+ * @return com.core.common.R
+ */
@Override
@Transactional(rollbackFor = Exception.class)
public R collectionPakin(CollectionPakinParams params, Long userId) {
@@ -2178,18 +2187,24 @@
// 鍒ゆ柇鏍规嵁鍒嗘嫞鍑哄簱鍚�,杩橀渶瑕佸嚭澶氬皯鎵樼洏鎴栨枡绠�;濡傛灉浣欐枡澶т簬0, 鍑烘柊鎵樼洏鎴栨枡绠�
if (totalOut.get().compareTo(0.0) > 0) {
- generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
- //TODO 缁嗗寲鍖哄垎锛屽綋鍓嶅嚭搴撴墭鐩樻槸婊炴弧瓒虫嫞璐ф暟閲�
+ generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
+ //TODO 缁嗗寲鍖哄垎锛屽綋鍓嶅嚭搴撴墭鐩樻槸婊¤冻鎷h揣鏁伴噺
} else {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
// todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
.eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
.orderAsc(Arrays.asList("row1", "bay1", "lev1"))
.last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+
+ if (Objects.isNull(locMast)) {
+ throw new CoolException("鏈煡璇㈠埌鍙敤鐨勭┖鏉夸俊鎭紒锛�");
+ }
+
CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls);
locMasts.add(crnTaskDetlDTO);
+
// 绌烘澘鍑哄簱
- generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
+ generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
}
}
@@ -2197,11 +2212,12 @@
* 鐢熸垚鍫嗗灈鏈哄嚭搴撲换鍔�
*
* @param locMasts
+ * @param station
* @author Ryan
* @date 2025/12/6 14:44
*/
@Transactional(rollbackFor = Exception.class)
- public void generateTask(List<CrnTaskDetlDTO> locMasts, Integer ioType, BasDevp devp, Long userId) {
+ public void generateTask(List<CrnTaskDetlDTO> locMasts, Integer ioType, BasDevp devp, Long userId, BasStation station) {
Date now = new Date();
for (CrnTaskDetlDTO crnTaskDetlDTO : locMasts) {
@@ -2228,6 +2244,9 @@
wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 婧愮珯
wrkMast.setStaNo(staDesc.getStnNo() + ""); // 鐩爣绔�
wrkMast.setSourceLocNo(locMast.getLocNo()); // 婧愬簱浣�
+ //灏忔澗椤圭洰锛岀紦瀛樺嚭搴揂GV绔欑偣锛岀敤浜庢竻绌虹紦瀛樺尯搴撳瓨
+ wrkMast.setPauseMk(station.getDevNo());
+// wrkMast.setAvgSta(station.getDevNo());;
wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
@@ -2251,6 +2270,8 @@
wrkDetl.setOrderNo(""); // 鎵嬪姩鍑哄簱涓嶉渶瑕佸甫鍑哄簱瀛樹腑鐨勫崟鎹紪鍙�
wrkDetl.setWrkNo(workNo);
wrkDetl.setIoTime(now);
+ wrkDetl.setZpallet(null);
+ wrkDetl.setBarcode(null);
wrkDetl.setAppeTime(now);
wrkDetl.setAppeUser(userId);
wrkDetl.setModiTime(now);
@@ -2289,7 +2310,7 @@
Task task = new Task();
task.setWrkNo(workNo)
.setIoTime(new Date())
- .setWrkSts(11L) // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+ .setWrkSts(301L) // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
.setIoType(loc.getLocSts().equals("D") ? 110 : 101) // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
.setTaskType("agv")
.setIoPri(10D)
@@ -2366,11 +2387,6 @@
*/
@Transactional(rollbackFor = Exception.class)
public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
- List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
- if (Objects.isNull(pakins) || pakins.isEmpty()) {
- throw new CoolException("缁勬墭淇℃伅涓嶅瓨鍦紒锛�");
- }
-
List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
if (!tasks.isEmpty()) {
throw new CoolException("鎵樼洏宸插湪浠诲姟鎵ц涓�..");
@@ -2381,7 +2397,7 @@
Task task = new Task();
task.setWrkNo(workNo)
.setIoTime(new Date())
- .setWrkSts(1L) // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+ .setWrkSts(201L) // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
.setIoType(1) // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
.setTaskType("agv")
.setIoPri(10D)
@@ -2401,32 +2417,39 @@
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
- for (WaitPakin pakin : pakins) {
- TaskDetl wrkDetl = new TaskDetl();
- BeanUtils.copyProperties(pakin, wrkDetl);
- wrkDetl.setId(null).setWrkNo(workNo)
- .setIoTime(new Date())
- .setOrderNo(pakin.getOrderNo())
- .setAnfme(pakin.getAnfme())
- .setZpallet(pakin.getZpallet())
- .setBatch(pakin.getBatch())
- .setMatnr(pakin.getMatnr())
- .setMaktx(pakin.getMaktx())
- .setAppeUser(userId)
- .setUnit(pakin.getUnit())
- .setModel(pakin.getModel())
- .setAppeTime(new Date())
- .setModiUser(userId);
- if (!taskDetlService.insert(wrkDetl)) {
- throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ if (!type.equals("agv_back")) {
+ List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
+ if (Objects.isNull(pakins) || pakins.isEmpty()) {
+ throw new CoolException("缁勬墭淇℃伅涓嶅瓨鍦紒锛�");
}
- }
+ for (WaitPakin pakin : pakins) {
+ TaskDetl wrkDetl = new TaskDetl();
+ BeanUtils.copyProperties(pakin, wrkDetl);
+ wrkDetl.setId(null).setWrkNo(workNo)
+ .setIoTime(new Date())
+ .setOrderNo(pakin.getOrderNo())
+ .setAnfme(pakin.getAnfme())
+ .setZpallet(pakin.getZpallet())
+ .setBatch(pakin.getBatch())
+ .setMatnr(pakin.getMatnr())
+ .setMaktx(pakin.getMaktx())
+ .setAppeUser(userId)
+ .setUnit(pakin.getUnit())
+ .setModel(pakin.getModel())
+ .setAppeTime(new Date())
+ .setModiUser(userId);
+ if (!taskDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ }
- for (WaitPakin pakin : pakins) {
- pakin.setIoStatus("Y");
- if (!waitPakinService.updateById(pakin)) {
- throw new CoolException("鏇存柊缁勬墭淇℃伅澶辫触");
+ }
+
+ for (WaitPakin pakin : pakins) {
+ pakin.setIoStatus("Y");
+ if (!waitPakinService.updateById(pakin)) {
+ throw new CoolException("鏇存柊缁勬墭淇℃伅澶辫触");
+ }
}
}
@@ -2448,7 +2471,7 @@
throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
}
- if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+ if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type) || station.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
station.setLocSts("R"); // S.鍏ュ簱棰勭害
station.setBarcode(barcode);
station.setModiTime(new Date());
@@ -2514,4 +2537,76 @@
}
return result;
}
+
+ /**
+ * 鍛煎彨AGV绌哄彴杞﹁繑鍥�
+ * @author Ryan
+ * @date 2025/9/24
+ * @param callAgvBackParam
+ * @return com.core.common.R
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R agvCallback(AgvCallParams callAgvBackParam, Long userId) {
+ if (Objects.isNull(callAgvBackParam.getOrgSite())) {
+ return R.error("鍙傛暟涓嶈兘涓虹┖!!");
+ }
+
+ // 鎸夊綋鍓嶆煡鎵惧簱浣嶉『搴忥紝鏌ュ埌涓�涓悗锛屼笉鍐嶅線涓嬫煡璇�
+ LocCache locCache = findPriorityLocCache();
+
+ if (Objects.isNull(locCache)) {
+ return R.error("鏈煡璇㈠埌鍙敤搴撲綅");
+ }
+
+ // 淇敼鐩爣绔欑偣淇℃伅
+ BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite()));
+ if (Objects.isNull(station)) {
+ throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
+ }
+
+ try {
+ //绌哄彴杞﹀洖搴�
+ generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error(e.getMessage());
+ }
+
+ return R.ok(locCache);
+ }
+
+ /**
+ * 鎸変紭鍏堢骇鏌ユ壘鍙敤搴撲綅
+ * 椤哄簭锛氬叆搴撶紦瀛樺尯 -> SO鍖� -> EO鍖�
+ */
+ private LocCache findPriorityLocCache() {
+ // 1. Try Inbound Cache Area
+ LocCache loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_IN_CACHE);
+ if (loc != null) return loc;
+
+ // 2. Try SO Area
+ loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_SO);
+ if (loc != null) return loc;
+
+ // 3. Try EO Area
+ loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_EO);
+ return loc;
+ }
+
+ /**
+ * 鏍规嵁鍖哄煙绫诲瀷鏌ユ壘鍙敤搴撲綅
+ */
+ private LocCache findAvailableLocByAreaType(LocAreaType areaType) {
+ BasAreas area = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", areaType.type));
+ if (area == null) {
+ return null;
+ }
+ return locCacheService.selectOne(new EntityWrapper<LocCache>()
+ .eq("area_id", area.getId())
+ .eq("frozen", 0)
+ .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
+ .orderAsc(Arrays.asList("loc_no"))
+ .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+ }
}
--
Gitblit v1.9.1