From fcbb4059f11d1e2b320d581bf6f960d9965142c6 Mon Sep 17 00:00:00 2001 From: pjb <123456> Date: 星期二, 08 七月 2025 08:58:18 +0800 Subject: [PATCH] Merge branch 'ycds-wms-dev' of http://47.97.1.152:5880/r/zy-asrs-master into ycds-wms-dev --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java | 106 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 65 insertions(+), 41 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java index e659c7c..ff53c59 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java @@ -92,6 +92,11 @@ @Override @Transactional(rollbackFor = Exception.class) public boolean batchMergeOrders(BatchMergeOrdersParam ordersParam) { + Loc locServiceOne = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, ordersParam.getMergeNo()), false); + if (!Objects.isNull(locServiceOne)) { + throw new CoolException("鎵樼洏宸插叆搴擄紝涓嶈兘鍐嶇粍鎵橈紒锛�"); + } + Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, ordersParam.getOrderNo())); if (Objects.isNull(order)) { throw new CoolException("璁㈠崟涓嶅瓨鍦紒锛�"); @@ -170,7 +175,6 @@ if (!locService.updateById(loc)) { throw new CoolException("搴撲綅鏇存柊澶辫触锛侊紒"); } - List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, shelvesParams.getBarcode())); if (waitPakins.isEmpty()) { throw new CoolException("褰撳墠鎷栫洏娌℃湁缁勬嫋妗�!!"); @@ -198,6 +202,16 @@ } //淇敼鐘舵�佷负鍏ュ簱涓� pakin.setIoStatus(1); + + OrderDetl detl = orderDetlService.getById(pakin.getDetlId()); + if (Objects.isNull(detl)) { + throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗕笉瀛樺湪锛侊紒"); + } + Double qty = Math.round((detl.getQty() + pakin.getAnfme()) * 1000) / 1000.0; + detl.setQty(qty); + if (!orderDetlService.updateById(detl)) { + throw new CoolException("鍗曟嵁鏄庣粏淇敼澶辫触锛侊紒"); + } }); //鍒犻櫎缁勬嫋妗o紝鍔犲叆鍘嗗彶缁勬嫋妗� @@ -211,53 +225,63 @@ } }); - if (!waitPakinService.removeBatchByIds(waitPakins)) { - throw new CoolException("缁勬嫋妗e垹闄ゅけ璐ワ紒锛�"); - } //閫氳繃缁勬嫋璁㈠崟ID鑾峰彇璁㈠崟锛屽苟鍒犻櫎鍘熷崟鎹紝鍔犲叆鍗曟嵁鍘嗗彶妗� Set<Long> list = waitPakins.stream().map(WaitPakin::getOrderId).collect(Collectors.toSet()); List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getId, list)); - //璁㈠崟鍏ュ巻鍙叉。 orders.forEach(order -> { - if (order.getOrderType() != OrderType.PK_IN_ORDER.id) { - throw new CoolException("褰撳墠璁㈠崟绫诲瀷:" + order.getOrderType() + ",涓嶅彲鍋氬钩搴撲笂鏋舵搷浣滐紒锛�"); - } - //淇敼璁㈠崟鐘舵�佷负宸插畬鎴� - order.setOrderSettle(OrderSettleType.COMPLETE.val()); - OrderLog orderLog = new OrderLog(); - BeanUtils.copyProperties(order, orderLog); - orderLog.setId(null); - if (!orderLogService.save(orderLog)) { - throw new CoolException("鍘嗗彶鍗曟嵁鏇存柊澶辫触锛侊紒"); + List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId())); + Double sum = detls.stream().mapToDouble(OrderDetl::getQty).sum(); + Double summed = detls.stream().mapToDouble(OrderDetl::getWorkQty).sum(); + Double v = Math.round((sum + summed) * 1000) / 1000.0; + Double anfme = detls.stream().mapToDouble(OrderDetl::getAnfme).sum(); + if (v.compareTo(anfme) == 0.0) { + order.setOrderSettle(OrderSettleType.COMPLETE.val()); + if (! orderService.updateById(order)) { + throw new CoolException("鍗曟嵁鐘舵�佷慨鏀瑰け璐ワ紒锛�"); + } } }); - //鍒犻櫎璁㈠崟鏁版嵁 - if (!orderService.removeBatchByIds(orders)) { - throw new CoolException("璁㈠崟鍒犻櫎澶辫触锛侊紒"); +// //璁㈠崟鍏ュ巻鍙叉。 +// orders.forEach(order -> { +//// if (order.getOrderType() != OrderType.PK_IN_ORDER.id) { +//// throw new CoolException("褰撳墠璁㈠崟绫诲瀷:" + order.getOrderType() + ",涓嶅彲鍋氬钩搴撲笂鏋舵搷浣滐紒锛�"); +//// } +// //淇敼璁㈠崟鐘舵�佷负宸插畬鎴� +// order.setOrderSettle(OrderSettleType.COMPLETE.val()); +// OrderLog orderLog = new OrderLog(); +// BeanUtils.copyProperties(order, orderLog); +// orderLog.setId(null); +// if (!orderLogService.save(orderLog)) { +// throw new CoolException("鍘嗗彶鍗曟嵁鏇存柊澶辫触锛侊紒"); +// } +// }); +// //鍒犻櫎璁㈠崟鏁版嵁 +// if (!orderService.removeBatchByIds(orders)) { +// throw new CoolException("璁㈠崟鍒犻櫎澶辫触锛侊紒"); +// } +// List<OrderDetl> detls = orderDetlMapper.selectList(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list)); +// List<OrderDetlLog> detlLogs = new ArrayList<>(); +// detls.forEach(delt ->{ +// OrderDetlLog detlLog = new OrderDetlLog(); +// BeanUtils.copyProperties(delt, detlLog); +// detlLog.setQty(delt.getWorkQty()); +// detlLog.setWorkQty(0.0); +// detlLog.setId(null); +// detlLogs.add(detlLog); +// }); +// //璁㈠崟鏄庣粏杞巻鍙叉。 +// if (!orderDetlLogService.saveBatch(detlLogs)) { +// throw new CoolException("璁㈠崟鏄庣粏杞巻鍙插け璐ワ紒锛�"); +// } +// +// //鍒犻櫎璁㈠崟鏄庣粏鏁版嵁 +// if (!orderDetlService.remove(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list))) { +// throw new CoolException("璁㈠崟鏄庣粏鍒犻櫎澶辫触锛侊紒"); +// } + if (!waitPakinService.removeBatchByIds(waitPakins)) { + throw new CoolException("缁勬嫋妗e垹闄ゅけ璐ワ紒锛�"); } - - List<OrderDetl> detls = orderDetlMapper.selectList(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list)); - List<OrderDetlLog> detlLogs = new ArrayList<>(); - detls.forEach(delt ->{ - OrderDetlLog detlLog = new OrderDetlLog(); - BeanUtils.copyProperties(delt, detlLog); - detlLog.setQty(delt.getWorkQty()); - detlLog.setWorkQty(0.0); - detlLog.setId(null); - detlLogs.add(detlLog); - }); - - //璁㈠崟鏄庣粏杞巻鍙叉。 - if (!orderDetlLogService.saveBatch(detlLogs)) { - throw new CoolException("璁㈠崟鏄庣粏杞巻鍙插け璐ワ紒锛�"); - } - - //鍒犻櫎璁㈠崟鏄庣粏鏁版嵁 - if (!orderDetlService.remove(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list))) { - throw new CoolException("璁㈠崟鏄庣粏鍒犻櫎澶辫触锛侊紒"); - } - return true; } @@ -491,7 +515,7 @@ throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦紒锛�"); } } else { //閮ㄥ垎鎷h揣 - byId.setQty(order.getWorkQty() + byId.getQty()); + byId.setQty(Math.round((order.getWorkQty() + byId.getQty()) * 1000) / 1000.0); byId.setWorkQty(0.0); if (!orderDetlService.updateById(byId)) { throw new CoolException("閮ㄥ垎鎷f枡鏄庣粏鏇存柊澶辫触锛侊紒"); -- Gitblit v1.9.1