From 9eec77f03187db772ac109345d980f8319676047 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期一, 15 十二月 2025 11:17:55 +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 | 164 ++++++++++++++++++++++++++----------------------------
1 files changed, 80 insertions(+), 84 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 1f89f19..d309d42 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -6,8 +6,6 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.*;
import com.core.exception.CoolException;
-import com.zy.api.enums.MatLocType;
-import com.zy.api.enums.MatType;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.FindLocNoAttributeVo;
@@ -29,7 +27,6 @@
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.MesCombParam;
import com.zy.common.model.StartupDto;
-import com.zy.common.model.enums.IoWorkType;
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
@@ -656,6 +653,7 @@
waitPakin.setAnfme(detlDto.getAnfme());
waitPakin.setThreeCode(detlDto.getThreeCode());
waitPakin.setStatus("Y");
+ waitPakin.setSuppCode(detlDto.getStandby1());
waitPakin.setStandby1(detlDto.getStandby1());
waitPakin.setStandby2(detlDto.getStandby2());
waitPakin.setStandby3(detlDto.getStandby3());
@@ -760,6 +758,7 @@
waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮�
waitPakin.setThreeCode(detlDto.getThreeCode());
waitPakin.setSuppCode(detlDto.getStandby1());
+ waitPakin.setStandby1(detlDto.getStandby1());
waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
waitPakin.setStatus("Y"); // 鐘舵��
@@ -1331,23 +1330,15 @@
@Override
@Transactional(rollbackFor = Exception.class)
public R OutCallAgv(AgvCallParams params, Long userId) {
-
- BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
- .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
- .eq("dev_no", params.getTarSite()));
- if (Objects.isNull(station)) {
- throw new CoolException("璇锋鏌ョ珯鐐逛俊鎭紒");
+ BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
+ if (Objects.isNull(basAreas)) {
+ throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
}
-
- /** 鑾峰彇鍏ュ簱鏈�鏃╃殑涓�鏉℃暟鎹� **/
+ /**鑾峰彇鍏ュ簱鏈�鏃╃殑涓�鏉℃暟鎹�**/
List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
.eq("loc_sts", LocStsType.LOC_STS_TYPE_F.type)
+ .eq("area_id", basAreas.getId())
.eq("frozen", 0)
- .in("loc_no", new EntityWrapper<LocDetl>()
- .setSqlSelect("DISTINCT loc_no")
- .in("matnr", new EntityWrapper<Mat>()
- .setSqlSelect("matnr")
- .eq("tag_id", station.getCtnType())))
.orderDesc(Arrays.asList("sort", "first_time")));
if (locCaches.isEmpty()) {
@@ -1355,13 +1346,8 @@
}
for (LocCache locCache : locCaches) {
- // 鑾峰彇缂撳瓨鍖轰俊鎭�
- BasAreas basAreas = basAreasService.selectOne(
- new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
- if (Objects.isNull(basAreas)) {
- throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
- }
-
+ //鑾峰彇缂撳瓨鍖轰俊鎭�
+// BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
.eq("area_id", basAreas.getId())
.eq("loc_no", locCache.getLocNo()));
@@ -1381,19 +1367,18 @@
Mat mat = matList.stream().findFirst().get();
-// BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
-// .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-// .eq("ctn_type", mat.getTagId())
-// .eq("dev_no", params.getTarSite()));
-
- if (mat.getTagId() != station.getCtnType().longValue()){
+ BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
+ .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
+ .eq("ctn_type", mat.getTagId())
+ .eq("dev_no", params.getTarSite()));
+ if (Objects.isNull(station)) {
continue;
}
- /** 鐢熸垚缂撳瓨鍖哄嚭搴撲换鍔� */
+ /**鐢熸垚缂撳瓨鍖哄嚭搴撲换鍔�*/
generateCacheOutTask(station, locCache, userId);
- /** 鐢熸垚绔嬪簱鍑哄簱浠诲姟 */
+ /**鐢熸垚绔嬪簱鍑哄簱浠诲姟*/
generateCRNOutTask(station, locCache, userId);
return R.ok();
@@ -1667,7 +1652,7 @@
throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
}
// 杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
- Integer suplus = container.getMixMax();
+ Double suplus = container.getMixMax();
Date now = new Date();
for (DetlDto detlDto : detlDtos) {
Mat mat = matService.selectByMatnr(detlDto.getMatnr());
@@ -1694,7 +1679,7 @@
throw new CoolException("鏄庣粏鍐呭涓嶅瓨鍦紒锛�");
}
- Double v = stationDetl.getAnfme() - stationDetl.getWorkQty();
+ Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0;
if (detlDto.getAnfme().compareTo(v) > 0) {
throw new CoolException("缁勬墭涓婇檺涓猴細" + stationDetl.getAnfme() + ", 宸茬粍鎵橈細" + stationDetl.getWorkQty() + ", 杩樺彲缁勬墭锛�" + v);
}
@@ -1725,19 +1710,31 @@
throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
}
- Double v1 = stationDetl.getWorkQty() + detlDto.getAnfme();
+ Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0;
stationDetl.setWorkQty(v1);
if (!basStationDetlService.updateById(stationDetl)) {
throw new CoolException("绔欑偣鏄庣粏淇敼澶辫触");
}
- if (v1.compareTo(stationDetl.getWorkQty()) >= 0) {
+ if (v1.compareTo(stationDetl.getAnfme()) >= 0) {
if (!basStationDetlService.deleteById(stationDetl)) {
throw new CoolException("鍘熷鏁版嵁绉婚櫎澶辫触锛�");
}
}
+ List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
+ .eq("dev_no", stationDetl.getDevNo()));
+ if (Objects.isNull(stas) || stas.isEmpty()) {
+ BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo()));
+ if (Objects.isNull(station)) {
+ throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
+ }
+ station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
+ if (!basStationService.updateById(station)) {
+ throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+ }
}
}
@@ -1758,21 +1755,21 @@
if (Objects.isNull(param.getStation())) {
throw new CoolException("绔欑偣涓嶈兘涓虹┖!!");
}
- // TODO 淇敼缂撳瓨绔欑偣鐘舵�佸強鏁版嵁
- Task task = taskService.selectOne(new EntityWrapper<Task>()
- .eq("wrk_sts", 14L)
- .eq("barcode", param.getCarBarcode()));
- if (Objects.isNull(task)) {
- throw new CoolException("鏁版嵁閿欒,浠诲姟涓嶅瓨鍦�!!");
- }
- List<TaskDetl> taskDetls = taskDetlService
- .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
- if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
- throw new CoolException("鏁版嵁閿欒,浠诲姟鏄庣粏涓嶅瓨鍦�!!");
- }
+// // TODO 淇敼缂撳瓨绔欑偣鐘舵�佸強鏁版嵁
+// Task task = taskService.selectOne(new EntityWrapper<Task>()
+// .eq("wrk_sts", 14L)
+// .eq("barcode", param.getCarBarcode()));
+// if (Objects.isNull(task)) {
+// throw new CoolException("鏁版嵁閿欒,浠诲姟涓嶅瓨鍦�!!");
+// }
+// List<TaskDetl> taskDetls = taskDetlService
+// .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
+// if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
+// throw new CoolException("鏁版嵁閿欒,浠诲姟鏄庣粏涓嶅瓨鍦�!!");
+// }
BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
- .eq("dev_no", task.getStaNo()));
+ .eq("dev_no", param.getStation()));
if (Objects.isNull(station)) {
throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
}
@@ -1783,12 +1780,12 @@
}
basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
- // 浠诲姟瀹屾垚
- task.setWrkSts(15L);
-
- if (!taskService.updateById(task)) {
- throw new CoolException("AGV浠诲姟瀹屾垚澶辫触!!");
- }
+// // 浠诲姟瀹屾垚
+// task.setWrkSts(15L);
+//
+// if (!taskService.updateById(task)) {
+// throw new CoolException("AGV浠诲姟瀹屾垚澶辫触!!");
+// }
List<WaitPakin> waitPakins = waitPakinService
.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
@@ -1838,10 +1835,13 @@
Mat mat = matService.selectByMatnr(combMat.getMatnr());
BeanUtils.copyProperties(mat, basStationDetl);
basStationDetl
+ .setId(null)
.setOrderNo(orderPakin.getOrderNo())
.setDevNo(basStation.getDevNo())
.setBarcode(params.getTarBarcode())
+ .setZpallet(params.getTarBarcode())
.setBatch(combMat.getBatch())
+ .setSuppCode(combMat.getStandby1())
.setStandby1(combMat.getStandby1())
.setAnfme(combMat.getWorkQty().doubleValue());
if (!basStationDetlService.insert(basStationDetl)) {
@@ -1854,7 +1854,6 @@
if (!basStationDetlService.updateById(basStationDetl)) {
throw new CoolException("鏇存柊鏄庣粏鏁版嵁澶辫触");
}
-
}
}
if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)
@@ -1953,7 +1952,7 @@
wrkMast.setSourceStaNo(dto.getSourceStaNo() + "");
wrkMast.setStaNo(dto.getStaNo() + "");
wrkMast.setLocNo(dto.getLocNo());
- wrkMast.setBarcode(pakin.getBarcode()); // 鎵樼洏鐮�
+ wrkMast.setBarcode(pakin.getZpallet()); // 鎵樼洏鐮�
wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
@@ -1981,16 +1980,16 @@
throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
}
});
- // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y
- Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
- .eq("zpallet", pakin.getZpallet());
- WaitPakin setParam = new WaitPakin();
- setParam.setLocNo(dto.getLocNo());
- setParam.setIoStatus("Y");
- setParam.setModiTime(now);
- if (!waitPakinService.update(setParam, wrapper)) {
- throw new CoolException("鏇存柊閫氱煡妗eけ璐�");
- }
+// // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y
+// Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
+// .eq("zpallet", pakin.getZpallet());
+// WaitPakin setParam = new WaitPakin();
+// setParam.setLocNo(dto.getLocNo());
+// setParam.setIoStatus("Y");
+// setParam.setModiTime(now);
+// if (!waitPakinService.update(setParam, wrapper)) {
+// throw new CoolException("鏇存柊閫氱煡妗eけ璐�");
+// }
// 鏇存柊婧愮珯鐐逛俊鎭�
sourceStaNo.setWrkNo(workNo);
sourceStaNo.setModiTime(now);
@@ -2076,13 +2075,14 @@
BasDevp basDevp = devps.stream().findFirst().get();
List<LocMast> locMasts = new ArrayList<>();
Map<String, List<LocDetl>> listMap = locDetls.stream().collect(Collectors.groupingBy(LocDetl::getMatnr));
- AtomicReference<Double> totalOut = new AtomicReference<>(
- locDetls.stream().mapToDouble(LocDetl::getAnfme).sum());
+ //鑾峰彇鏌ュ簱瀛樻�绘暟閲�
+ AtomicReference<Double> totalOut = new AtomicReference<>(0.0);
listMap.forEach((matnr, detls) -> {
- // 鏍规嵁supId(渚涘簲鍟�)鍒嗙被锛屽緱鍒板嚭搴撴�绘暟
Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
supIds.forEach((supId, sups) -> {
+ // 鏍规嵁supId(渚涘簲鍟�)鍒嗙被锛屽緱鍒伴渶瑕佸瓨鏀剧殑鎬荤┖搴撳瓨鏁伴噺
Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
+ AtomicReference<Double> itemed = new AtomicReference<>(0.0);
// 鑾峰彇褰撳墠渚涘簲鍟�+ 鐗╂枡鍦ㄥ簱
List<LocDetl> detlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
.eq("matnr", matnr)
@@ -2105,17 +2105,20 @@
Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
// 鍒ゆ柇瀹瑰櫒鏄惁杩樺彲娣锋斁,鍙婂綋鍓嶇墿鏂欏彲鏀惧灏�
if (container.getMixMax() > sets.size()) {
- int suplus = container.getMixMax() - sets.size();
+ //浣欎笅鍙贩鏀剧绫�
+ long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
Mat mats = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
if (Objects.isNull(mats)) {
throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
}
- Double v = mats.getUpQty() * suplus;
- // 灏忎簬闆�
- if (sum.compareTo(v) <= 0) {
+ //浣欎笅鏈�澶у彲鏀炬暟閲�
+ Double v = Math.round((mats.getUpQty() * suplus) * 10000) / 10000.0;
+ // 鍏ュ簱鏁伴噺灏忎簬闆朵笖鍏ュ簱鏁伴噺鍑忓幓宸插嚭鏁伴噺澶т簬闆讹紙锛�
+ if (sum.compareTo(v) <= 0 && sum.compareTo(itemed.get()) > 0) {
+ itemed.set(Math.round((itemed.get() + v) * 10000) / 10000.0);
// 鍙斁涓�
locMasts.add(locMast);
- totalOut.set(Math.round((totalOut.get() - sum) * 10000) / 10000.0);
+ totalOut.set(Math.round((totalOut.get() + itemed.get()) * 10000) / 10000.0);
}
}
});
@@ -2125,10 +2128,9 @@
// 鍒ゆ柇鏍规嵁鍒嗘嫞鍑哄簱鍚�,杩橀渶瑕佸嚭澶氬皯鎵樼洏鎴栨枡绠�;濡傛灉浣欐枡澶т簬0, 鍑烘柊鎵樼洏鎴栨枡绠�
if (totalOut.get().compareTo(0.0) > 0) {
- // Set<String> matnrs =
- // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
- // List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr",
- // matnrs));
+ generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
+ //TODO 缁嗗寲鍖哄垎锛屽綋鍓嶅嚭搴撴墭鐩樻槸婊炴弧瓒虫嫞璐ф暟閲�
+ } else {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
// todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
.eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
@@ -2137,12 +2139,6 @@
locMasts.add(locMast);
// 绌烘澘鍑哄簱
generateTask(locMasts, TaskIOType.EMPTY_OUT.type, basDevp, userId);
- } else {
- // 鐢熸垚鍫嗗灈鏈哄嚭搴撲换鍔�
- generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId);
- // if (!locMasts.isEmpty()) {
- //
- // }
}
}
--
Gitblit v1.9.1