From bfa307fb0fe82ce6f5a2ea354fcee43d9d1f0fa1 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期一, 13 四月 2026 09:53:06 +0800
Subject: [PATCH] no message
---
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 369 +++++++++++++++++++++++++++++++++-------------------
1 files changed, 235 insertions(+), 134 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 a900c9f..33137f2 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1454,7 +1454,13 @@
.eq("ctn_type", mat.getTagId())
.eq("dev_no", params.getTarSite()));
if (Objects.isNull(station)) {
+// throw new CoolException("锛侊紒");
continue;
+ }
+
+ Task task = taskService.selectOne(new EntityWrapper<Task>().eq("source_sta_no", station.getDevNo()).or().eq("sta_no", station.getDevNo()));
+ if (!Objects.isNull(task)) {
+ throw new CoolException("褰撳墠绔欑偣涓婁竴涓换鍔℃湭瀹屾垚锛侊紒");
}
/**鐢熸垚缂撳瓨鍖哄嚭搴撲换鍔�*/
@@ -1485,7 +1491,8 @@
List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
.eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
- .eq("area_id", basAreas.getId()));
+ .eq("area_id", basAreas.getId())
+ .orderAsc(Arrays.asList("modi_time")));
if (locCaches.isEmpty()) {
throw new CoolException("鏆傛棤绌烘澘搴撲綅");
}
@@ -1508,9 +1515,10 @@
if (Objects.isNull(params.getOrgSite())) {
throw new CoolException("婧愮珯鐐逛笉鑳戒负绌猴紒锛�");
}
-
BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getTarSite()));
-
+ if (Objects.isNull(basAreas)) {
+ return R.error("绔欑偣涓嶅瓨鍦紝璇锋鏌ョ珯鐐规槸鍚﹁緭鍏ユ纭紒锛�");
+ }
List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
.in("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
.eq("area_id", basAreas.getId()));
@@ -1531,12 +1539,6 @@
@Transactional(rollbackFor = Exception.class)
public void generateSOEOInTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
- List<BasStationDetl> basStationDetls = basStationDetlService
- .selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite));
- if (Objects.isNull(basStationDetls) || basStationDetls.isEmpty()) {
- throw new CoolException("绔欑偣淇℃伅涓嶅瓨鍦紒锛�");
- }
-
List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
if (!tasks.isEmpty()) {
throw new CoolException("鎵樼洏宸插湪浠诲姟鎵ц涓�..");
@@ -1567,7 +1569,9 @@
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
}
- for (BasStationDetl basStationDetl : basStationDetls) {
+ List<BasStationDetl> basStationDetls = basStationDetlService
+ .selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite));
+ basStationDetls.forEach(basStationDetl -> {
TaskDetl wrkDetl = new TaskDetl();
BeanUtils.copyProperties(basStationDetl, wrkDetl);
wrkDetl.setWrkNo(workNo)
@@ -1589,36 +1593,28 @@
if (!taskDetlService.insert(wrkDetl)) {
throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
}
- }
+ });
// 淇敼鐩爣搴撲綅鐘舵��
- if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
- loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.鍏ュ簱棰勭害
- loc.setModiTime(new Date());
- loc.setModiUser(userId);
- if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) {
- throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
- }
- } else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + loc.getLocSts$());
+ loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.鍏ュ簱棰勭害
+ loc.setModiTime(new Date());
+ loc.setModiUser(userId);
+ if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) {
+ throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
- // 淇敼鐩爣绔欑偣淇℃伅
+ // 淇敼鍘熺珯鐐逛俊鎭�
BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite));
if (Objects.isNull(station)) {
throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
}
- if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)) {
- station.setLocSts("R"); // S.鍏ュ簱棰勭害
- station.setBarcode(barcode);
- station.setModiTime(new Date());
- station.setModiUser(userId);
- if (!basStationService.updateById(station)) {
- throw new CoolException("鏇存柊鐩爣绔欑偣鐘舵�佸け璐�");
- }
- } else {
- throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
+ station.setLocSts("R"); // S.鍏ュ簱棰勭害
+ station.setBarcode(barcode);
+ station.setModiTime(new Date());
+ station.setModiUser(userId);
+ if (!basStationService.updateById(station)) {
+ throw new CoolException("鏇存柊鐩爣绔欑偣鐘舵�佸け璐�");
}
}
@@ -1740,7 +1736,7 @@
double val = Math.round((combMat.getAnfme() + wrkDetl.getAnfme()) * 10000) / 10000.0;
WrkDetl detl = new WrkDetl();
detl.setOrderNo(stationDetl.getOrderNo());
- detl.setBoxType1(wrkDetl.getBoxType1());
+ detl.setBoxType1(param.getBoxType1());
detl.setZpallet(param.getBarcode());
detl.setBarcode(param.getBarcode());
detl.setThreeCode(combMat.getThreeCode());
@@ -1888,36 +1884,41 @@
if (Cools.isEmpty(basStation)) {
throw new CoolException("璇疯緭鍏ユ纭殑绔欑偣鍙�");
}
-
- WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", params.getOrgBarcode()));
- if (Objects.isNull(wrkMast)) {
- throw new CoolException("鍑哄簱浠诲姟妗d俊鎭笉瀛樺湪锛侊紒");
- }
-
- for (CollectionPakinParams.CombMat combMat : params.getCombMats()) {
- if (combMat.getWorkQty().compareTo(BigDecimal.ZERO) == 0) {
- continue;
+ if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type) || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", params.getOrgBarcode()));
+ if (Objects.isNull(wrkMast)) {
+ throw new CoolException("鍑哄簱浠诲姟妗d俊鎭笉瀛樺湪锛侊紒");
}
- OrderPakin orderPakin = orderPakinService.selectByNo(combMat.getOrderNo());
- if (Cools.isEmpty(orderPakin)) {
- throw new CoolException("鏈壘鍒板璐у叆搴撳崟");
- }
+ for (CollectionPakinParams.CombMat combMat : params.getCombMats()) {
+ if (combMat.getWorkQty().compareTo(BigDecimal.ZERO) == 0) {
+ continue;
+ }
- UpdateDetailsOfPakin(orderPakin, combMat);
+ OrderPakin orderPakin = orderPakinService.selectByNo(combMat.getOrderNo());
+ if (Cools.isEmpty(orderPakin)) {
+ throw new CoolException("鏈壘鍒板璐у叆搴撳崟");
+ }
- BasStationDetl basStationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
- .eq("dev_no", basStation.getDevNo())
- .eq("matnr", combMat.getMatnr())
- .eq("order_no", combMat.getOrderNo())
- .eq(!Cools.isEmpty(combMat.getBatch()), "batch", combMat.getBatch())
- .eq(!Cools.isEmpty(combMat.getStandby1()), "standby1", combMat.getStandby1()));
+ try {
+ UpdateDetailsOfPakin(orderPakin, combMat);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw new CoolException(e.getMessage());
+ }
+
+ BasStationDetl basStationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
+ .eq("dev_no", basStation.getDevNo())
+ .eq("matnr", combMat.getMatnr())
+ .eq("order_no", combMat.getOrderNo())
+ .eq(!Cools.isEmpty(combMat.getBatch()), "batch", combMat.getBatch())
+ .eq(!Cools.isEmpty(combMat.getStandby1()), "standby1", combMat.getStandby1()));
- Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>()
- .eq("wrk_no", wrkMast.getWrkNo())
- .eq("matnr", combMat.getMatnr())
- .eq("supp_coode", combMat.getStandby1());
+ Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>()
+ .eq("wrk_no", wrkMast.getWrkNo())
+ .eq("matnr", combMat.getMatnr())
+ .eq("supp_coode", combMat.getStandby1());
//// .eq(!Objects.isNull(params.getBoxType1()), "boxType1", params.getBoxType1())
//
// if (!Objects.isNull(params.getBoxType1())) {
@@ -1926,42 +1927,45 @@
// WrkDetl wrkDetl = wrkDetlService.selectOne(wrapper);
- if (Cools.isEmpty(basStationDetl)) {
- basStationDetl = new BasStationDetl();
- 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())
- .setBoxType1(params.getBoxType1())
- .setSuppCode(combMat.getStandby1())
- .setStandby1(combMat.getStandby1())
- .setAnfme(combMat.getWorkQty().doubleValue());
+ if (Cools.isEmpty(basStationDetl)) {
+ basStationDetl = new BasStationDetl();
+ 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())
+ .setBoxType1(params.getBoxType1())
+ .setSuppCode(combMat.getStandby1())
+ .setStandby1(combMat.getStandby1())
+ .setAnfme(combMat.getWorkQty().doubleValue());
// if (!Objects.isNull(wrkDetl) && !wrkDetl.getMatnr().equals(combMat.getMatnr())) {
// throw new CoolException("璇锋鏌ラ殧灞傛槸鍚︾粦瀹氭纭紒锛�");
// }
- if (!basStationDetlService.insert(basStationDetl)) {
- throw new CoolException("鎻掑叆鏄庣粏澶辫触");
- }
+ if (!basStationDetlService.insert(basStationDetl)) {
+ throw new CoolException("鎻掑叆鏄庣粏澶辫触");
+ }
- } else {
- BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty());
- basStationDetl.setAnfme(anfme.doubleValue());
- if (!basStationDetlService.updateById(basStationDetl)) {
- throw new CoolException("鏇存柊鏄庣粏鏁版嵁澶辫触");
+ } else {
+ BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty());
+ basStationDetl.setAnfme(anfme.doubleValue());
+ if (!basStationDetlService.updateById(basStationDetl)) {
+ throw new CoolException("鏇存柊鏄庣粏鏁版嵁澶辫触");
+ }
}
}
- }
- if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)
- || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
- basStation.setBarcode(params.getTarBarcode());
- basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
- basStationService.updateById(basStation);
+ if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)
+ || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+ basStation.setBarcode(params.getTarBarcode());
+ basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
+ basStationService.updateById(basStation);
+ }
+ } else {
+ throw new CoolException("褰撳墠绔欑偣涓嶆槸鍦ㄥ簱鐘舵�侊紝鏃犳硶缁戝畾鍙拌溅锛侊紒");
}
return R.ok();
@@ -2250,7 +2254,16 @@
AtomicReference<Double> totalOut = new AtomicReference<>(0.0);
listMap.forEach((matnr, detls) -> {
Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
- supIds.forEach((supId, sups) -> {
+ for (String supId : supIds.keySet()) {
+ List<LocDetl> sups = supIds.get(supId);
+// }
+// supIds.forEach((supId, sups) -> {
+ Mat mats = matService.selectOne(new EntityWrapper<Mat>()
+ .eq("supp_code", supId)
+ .eq("matnr", matnr));
+ if (Objects.isNull(mats)) {
+ throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
+ }
// 鏍规嵁supId(渚涘簲鍟�)鍒嗙被锛屽緱鍒伴渶瑕佸瓨鏀剧殑鎬荤┖搴撳瓨鏁伴噺
Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
AtomicReference<Double> itemed = new AtomicReference<>(0.0);
@@ -2278,12 +2291,6 @@
if (container.getMixMax() > sets.size()) {
//浣欎笅鍙贩鏀剧绫�
long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
- Mat mats = matService.selectOne(new EntityWrapper<Mat>()
- .eq("supp_code", supId)
- .eq("matnr", matnr));
- if (Objects.isNull(mats)) {
- throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
- }
//浣欎笅鏈�澶у彲鏀炬暟閲�
Double v = Math.round((mats.getUpQty() * suplus) * 10000) / 10000.0;
// 鍏ュ簱鏁伴噺灏忎簬闆朵笖鍏ュ簱鏁伴噺鍑忓幓宸茶鍒掑嚭鏁伴噺澶т簬闆讹紙锛�
@@ -2296,16 +2303,68 @@
}
}
});
- }
- });
- });
+ } else {
+ // 鑾峰彇褰撳墠渚涘簲鍟�+ 鐗╂枡鍦ㄥ簱
+ List<String> locs = new ArrayList<>();
+ if (!locMasts.isEmpty()) {
+ locs = locMasts.stream().map(CrnTaskDetlDTO::getLocNo).collect(Collectors.toList());
+ }
+ LocMast notFullList = locMastService.selectNotFull(mats.getLocType(), one.getId(), locs);
+ if (Objects.isNull(notFullList)) {
+ continue;
+ }
+ BasContainer container = basContainerService
+ .selectOne(new EntityWrapper<BasContainer>().eq("barcode", notFullList.getBarcode()));
+ if (Objects.isNull(container)) {
+ throw new CoolException("鏁版嵁閿欒锛屽鍣ㄤ笉瀛樺湪锛侊紒");
+ }
+// notFullList.setLocSts(LocStsType.LOC_STS_TYPE_R.type);
+// if (!locMastService.update(notFullList, new EntityWrapper<LocMast>().eq("loc_no", notFullList.getLocNo()))) {
+// throw new CoolException("棰勭害鍑哄簱澶辫触锛侊紒");
+// }
+
+ List<LocDetl> adetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", notFullList.getLocNo()));
+ Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
+ List<LocDetl> locDtls = new ArrayList<>();
+ // 鍒ゆ柇瀹瑰櫒鏄惁杩樺彲娣锋斁,鍙婂綋鍓嶇墿鏂欏彲鏀惧灏�
+ if (container.getMixMax() > sets.size()) {
+ //浣欎笅鍙贩鏀剧绫�
+ long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
+ //浣欎笅鏈�澶у彲鏀炬暟閲�
+ 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);
+ // 鍙斁涓�
+ LocDetl locDetl = new LocDetl();
+ BeanUtils.copyProperties(mats, locDetl);
+ locDetl.setLocNo(notFullList.getLocNo());
+ locDetl.setAnfme(0.0);
+ locDetl.setMatnr(mats.getMatnr());
+ locDetl.setZpallet(notFullList.getBarcode());
+ locDetl.setSuppCode(mats.getSuppCode());
+ locDetl.setMaktx(mats.getMaktx());
+ locDtls.add(locDetl);
+ CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(notFullList.getLocNo()).setLocDetlList(locDtls);
+ locMasts.add(crnTaskDetlDTO);
+ totalOut.set(Math.round((totalOut.get() + itemed.get()) * 10000) / 10000.0);
+ }
+ }
+ }
+ }
+ });
+ Integer whyType = 2;
+ if (station.getId().equals(124L) || station.getId().equals(125L)) {
+ whyType = 1;
+ }
/**鏄惁浼樺厛绌烘澘鍑哄簱*/
Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "OutStockOrderByEmpty"));
if (!Objects.isNull(config) && Boolean.parseBoolean(config.getValue())) {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
// todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
.eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
+ .eq("whs_type", whyType)
.orderAsc(Arrays.asList("row1", "bay1", "lev1"))
.last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
@@ -2314,7 +2373,6 @@
}
CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(new ArrayList<>());
locMasts.add(crnTaskDetlDTO);
-
// 绌烘澘鍑哄簱
generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
} else {
@@ -2326,6 +2384,7 @@
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
// todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
.eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
+ .eq("whs_type", whyType)
.orderAsc(Arrays.asList("row1", "bay1", "lev1"))
.last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
@@ -2364,7 +2423,8 @@
if (Cools.isEmpty(wrkMast1)) {
Integer outSta = devp.getDevNo();
// 鑾峰彇璺緞
- StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
+ StaDesc staDesc = staDescService.queryCrnStnByLoc(ioType, locMast, outSta);
+// StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
// 鐢熸垚宸ヤ綔妗�
WrkMast wrkMast = new WrkMast();
@@ -2494,22 +2554,22 @@
loc.setModiUser(userId);
loc.setModiTime(new Date());
-// if (!) {
-// throw new CoolException("鏇存柊搴撲綅鐘舵�佷俊鎭紒锛�");
-// }
- locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()));
+ if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) {
+ throw new CoolException("鏇存柊搴撲綅鐘舵�佷俊鎭紒锛�");
+ }
// 淇敼鐩爣绔欑偣淇℃伅
- if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
- station.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.鍏ュ簱棰勭害
- station.setModiTime(new Date());
- station.setModiUser(userId);
- if (!basStationService.updateById(station)) {
- throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
- }
- } else {
- log.error("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
+// if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+//
+// } else {
+// log.error("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
// throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
+// }
+ station.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.鍏ュ簱棰勭害
+ station.setModiTime(new Date());
+ station.setModiUser(userId);
+ if (!basStationService.updateById(station)) {
+ throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
}
@@ -2616,6 +2676,7 @@
// 淇敼鐩爣搴撲綅鐘舵��
loc.setLocSts(LocStsType.LOC_STS_TYPE_D.type); // S.鍏ュ簱棰勭害
loc.setModiTime(new Date());
+ loc.setBarcode(barcode);
loc.setModiUser(userId);
if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) {
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
@@ -2627,13 +2688,14 @@
throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
}
- station.setLocSts("O"); // S.鍏ュ簱棰勭害
- station.setBarcode(barcode);
+ station.setLocSts(LocStsType.LOC_STS_TYPE_O.type); // S.鍏ュ簱棰勭害
+ station.setBarcode("");
station.setModiTime(new Date());
station.setModiUser(userId);
- if (!basStationService.updateById(station)) {
+ if (!basStationService.update(station, new EntityWrapper<BasStation>().eq("dev_no", orgSite))) {
throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
}
+ basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
}
}
@@ -2719,13 +2781,8 @@
throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
}
- try {
- //绌哄彴杞﹀洖搴�
- generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId, "M2");
- } catch (Exception e) {
- e.printStackTrace();
- return R.error(e.getMessage());
- }
+ //绌哄彴杞﹀洖搴�
+ generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId, "M2");
return R.ok(locCache);
}
@@ -2990,14 +3047,28 @@
.eq("dev_no", params.getOrgSite())
.eq("barcode", params.getCarBarcode()));
if (Objects.isNull(station)) {
- throw new CoolException("鍙拌溅涓庣珯鐐圭粦瀹氬叧绯讳笉瀛樺湪锛岃鑱旂郴绠$悊鍛橈紒");
+ LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>().eq("dev_no", params.getOrgSite()));
+ if (!Objects.isNull(locCache)) {
+ BasAreas whsTypeId = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
+ if (Objects.isNull(whsTypeId)) {
+ throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
+ }
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+ .eq("area_id", whsTypeId.getId())
+ .eq("dev_no", params.getOrgSite()));
+ if (!locDetls.isEmpty()) {
+ return R.ok().add(locDetls);
+ }
+ }
+ } else {
+ List<BasStationDetl> stationDetls = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
+ .like(!Cools.isEmpty(params.getMatnr()), "matnr", params.getMatnr())
+ .eq("dev_no", station.getDevNo()));
+ if (!stationDetls.isEmpty()) {
+ return R.ok().add(stationDetls);
+ }
}
- List<BasStationDetl> stationDetls = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
- .like(!Cools.isEmpty(params.getMatnr()), "matnr", params.getMatnr())
- .eq("dev_no", station.getDevNo()));
- if (!stationDetls.isEmpty()) {
- return R.ok().add(stationDetls);
- }
+
return R.ok();
}
@@ -3017,15 +3088,18 @@
if (Objects.isNull(combMat)) {
continue;
}
- OrderPakin order = orderPakinService.selectOne(new EntityWrapper<OrderPakin>().eq("order_no", combMat.getOrderNo()));
+ OrderPakin order = orderPakinService.selectOne(new EntityWrapper<OrderPakin>()
+ .lt("settle", 4)
+ .eq("order_no", combMat.getOrderNo()));
if (Objects.isNull(order)) {
- return R.error("涓烘煡璇㈠埌璁㈠崟锛岃纭鏄惁涓哄簱鍙g粍鎵樹俊鎭紒锛�");
+ return R.error("鏈煡璇㈠埌璁㈠崟锛岃纭鏄惁涓哄簱鍙g粍鎵樹俊鎭紒锛�");
}
//鍏ュ簱
OrderDetlPakin detlPakin = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
.eq("order_no", combMat.getOrderNo())
.eq("matnr", combMat.getMatnr())
- .eq("supp_code", combMat.getStandby1()));
+ .eq("supp_code", combMat.getStandby1())
+ .last("AND anfme != qty"));
if (!Objects.isNull(detlPakin)) {
Double v = Math.round((detlPakin.getWorkQty() - combMat.getAnfme()) * 10000) / 10000.0;
@@ -3037,10 +3111,37 @@
throw new CoolException("璁㈠崟鏄庣粏鏇存柊澶辫触锛侊紒");
}
- if (!basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("order_no", combMat.getOrderNo())
+ BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
+ .eq("order_no", combMat.getOrderNo())
.eq("matnr", combMat.getMatnr())
- .eq("supp_code", combMat.getStandby1()))) {
- throw new CoolException("绔欑偣鏁版嵁鍒犻櫎澶辫触锛侊紒");
+ .eq("supp_code", combMat.getStandby1()));
+ if (!Objects.isNull(stationDetl)) {
+ if (!basStationDetlService.delete(new EntityWrapper<BasStationDetl>()
+ .eq("order_no", combMat.getOrderNo())
+ .eq("matnr", combMat.getMatnr())
+ .eq("supp_code", combMat.getStandby1()))) {
+ throw new CoolException("瑙g粦澶辫触锛岀珯鐐瑰簱瀛樺垹闄ゅけ璐ワ紒");
+ }
+ }
+
+ 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("绔欑偣鏌ヨ澶辫触锛岃鑱旂郴绠$悊鍛橈紒锛�");
+ }
+
+ LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>()
+ .eq("area_id", basAreas.getId())
+ .eq("order_no", combMat.getOrderNo())
+ .eq("matnr", combMat.getMatnr())
+ .eq("supp_code", combMat.getStandby1()));
+ if (!Objects.isNull(locDetl)) {
+ if (!locDetlService.delete(new EntityWrapper<LocDetl>()
+ .eq("area_id", basAreas.getId())
+ .eq("order_no", combMat.getOrderNo())
+ .eq("matnr", combMat.getMatnr())
+ .eq("supp_code", combMat.getStandby1()))) {
+ throw new CoolException("瑙g粦澶辫触锛岀紦鍐插簱鍖哄簱瀛樺垹闄ゅけ璐ワ紒");
+ }
}
WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>()
@@ -3171,8 +3272,8 @@
detl.setSupp(combMat.getSuppCode());
if (!taskDetlService.update(detl, new EntityWrapper<TaskDetl>()
.eq("matnr", detl.getMatnr())
- .eq("order_no", detl.getOrderNo())
.eq("supp_code", detl.getSuppCode())
+ .eq("order_no", detl.getOrderNo())
.eq("wrk_no", task.getWrkNo()))) {
throw new CoolException("浠诲姟鍙蜂俊鎭洿鏂板け璐ワ紒锛�");
}
--
Gitblit v1.9.1