From 2f4505f4e2a36245a49b87840b711ad00729891e Mon Sep 17 00:00:00 2001
From: ZY <zc857179121@qq.com>
Date: 星期一, 19 八月 2024 08:46:12 +0800
Subject: [PATCH] 1
---
src/main/java/com/zy/asrs/controller/OutController.java | 63 +++++++++++++++++++++++++++----
1 files changed, 54 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
index 671d359..cf01421 100644
--- a/src/main/java/com/zy/asrs/controller/OutController.java
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -53,21 +53,66 @@
@PostMapping("/out/pakout/preview/auth")
@ManagerAuth
public R pakoutPreview(@RequestBody List<Long> ids) {
+// if (Cools.isEmpty(ids)) {
+// return R.parse(BaseRes.PARAM);
+// }
+// List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids);
+// //鐢ㄦ埛纭鍑哄叆搴撻兘浠gno涓哄噯锛岄偅涔堜笉鑰冭檻鏁伴噺浜�
+// List<LocDto> locDtos = new ArrayList<>();
+// if (orderDetls != null && !orderDetls.isEmpty()) {
+// List<LocDetl> locDetls = locDetlService.queryStock(orderDetls.get(0).getSPgNO());
+// for (LocDetl locDetl : locDetls) {
+// LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetls.get(0).getOrderNo(),
+// locDetl.getAnfme());
+// List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), 101);
+// locDto.setStaNos(staNos);
+// locDto.setZpallet(locDetl.getZpallet());
+// locDto.setSPgNO(orderDetls.get(0).getSPgNO());
+// locDtos.add(locDto);
+// }
+// }
+// return R.ok().add(locDtos);
+
if (Cools.isEmpty(ids)) {
return R.parse(BaseRes.PARAM);
}
List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids);
- //鐢ㄦ埛纭鍑哄叆搴撻兘浠gno涓哄噯锛岄偅涔堜笉鑰冭檻鏁伴噺浜�
List<LocDto> locDtos = new ArrayList<>();
- if (orderDetls != null && !orderDetls.isEmpty()) {
- List<LocDetl> locDetls = locDetlService.queryStock(orderDetls.get(0).getSPgNO());
+
+ Set<String> exist = new HashSet<>();
+
+ for (OrderDetl orderDetl : orderDetls) {
+ double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
+ if (issued <= 0.0D) {
+ continue;
+ }
+ List<LocDetl> locDetls;
+ if (Cools.isEmpty(orderDetls.get(0).getSPgNO())) {
+ locDetls = locDetlService.queryStockByModel(orderDetl.getModel());
+ } else {
+ locDetls = locDetlService.queryStock(orderDetl.getSPgNO());
+ }
for (LocDetl locDetl : locDetls) {
- LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetls.get(0).getOrderNo(),
- locDetl.getAnfme());
- List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), 101);
- locDto.setStaNos(staNos);
- locDto.setZpallet(locDetl.getZpallet());
- locDto.setSPgNO(orderDetls.get(0).getSPgNO());
+ if (locDetl.getMatnr().equals(orderDetl.getMatnr())) {
+ if (issued > 0) {
+ LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(),
+ issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued);
+ List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103);
+ locDto.setStaNos(staNos);
+ locDto.setModel(locDetl.getModel());
+ locDtos.add(locDto);
+ exist.add(locDetl.getLocNo());
+ // 鍓╀綑寰呭嚭鏁伴噺閫掑噺
+ issued = issued - locDetl.getAnfme();
+ } else {
+ break;
+ }
+ }
+ }
+ if (issued > 0) {
+ LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued);
+ locDto.setLack(Boolean.TRUE);
+ locDto.setModel(orderDetl.getModel());
locDtos.add(locDto);
}
}
--
Gitblit v1.9.1