自动化立体仓库 - WMS系统
zwl
2025-11-24 faed059302b334b39f247fa8bde5daa8f0b924f5
src/main/java/com/zy/third/task/handler/OrderHandler.java
@@ -219,17 +219,23 @@
                throw new CoolException(fbillno + "单据正在作业中,无法删除");
            }
            Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
            boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>()
                    .eq("order_no", order.getOrderNo())
            OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())
                    .eq("matnr", mat.getMatnr())
                    .eq("batch", exdInstockSource.getFbatchno())
                    .eq("anfme", exdInstockSource.getFqty()));
            if (delete) {
                log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                    .eq("anfme", exdInstockSource.getFqty()<0 ? -exdInstockSource.getFqty():exdInstockSource.getFqty()));
            if (orderDetl != null) {
                boolean delete = orderDetlService.deleteById(orderDetl.getId());
                if (delete) {
                    log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                }else {
                    log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                    throw new CoolException(fbillno + "单据明细删除失败");
                }
            }else {
                log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                throw new CoolException(fbillno + "单据明细删除失败");
                log.error("没有查询到订单明细,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                throw new CoolException(fbillno + "没有查询到订单明细");
            }
            int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
            if(orderNo==0){
                orderService.remove(order.getId());
@@ -353,16 +359,21 @@
                throw new CoolException(fbillno + "单据正在作业中,无法删除");
            }
            Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
            boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>()
                    .eq("order_no", order.getOrderNo())
            OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo())
                    .eq("matnr", mat.getMatnr())
                    .eq("batch", exdInstockSource.getFbatchno())
                    .eq("anfme", exdInstockSource.getFqty()));
            if (delete) {
                log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                    .eq("anfme", exdInstockSource.getFqty()<0 ? -exdInstockSource.getFqty():exdInstockSource.getFqty()));
            if (orderDetl != null) {
                boolean delete = orderDetlService.deleteById(orderDetl.getId());
                if (delete) {
                    log.info("删除订单明细成功,订单号={},物料号={},批号={},数量={}成功",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                }else {
                    log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                    throw new CoolException(fbillno + "单据明细删除失败");
                }
            }else {
                log.error("删除订单明细失败,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                throw new CoolException(fbillno + "单据明细删除失败");
                log.error("没有查询到订单明细,订单号={},物料号={},批号={},数量={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
                throw new CoolException(fbillno + "没有查询到订单明细");
            }
            int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
            if(orderNo==0){