自动化立体仓库 - WMS系统
#
zjj
2024-04-15 e061d201decb0c3344d1bfc2237081a7edc0aa0d
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -96,8 +96,8 @@
//        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
                eq("zpallet", param.getBarcode())) > 0) {
            throw new CoolException(param.getBarcode() + "条码已组托");
        }
        try{
            param.setOrderNo(param.getCombMats().get(0).getOrderNo());
@@ -899,6 +899,15 @@
            OrderDetl orderDetl = orderDetlService.selectOne(orderDetlWrapper);
            if (Cools.isEmpty(orderDetl)){
                return R.error("订单中未查询到下架数据");
            }
            EntityWrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<>();
            manLocDetlWrapper.eq("zpallet",jsonBarcode);
            manLocDetlWrapper.eq("matnr",jsonManLocDetl.getMatnr());
            ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper);
            if (Cools.isEmpty(manLocDetl)){
                return R.error("托盘码未查询到库存信息");
            }
            BigDecimal orderQty = new BigDecimal(orderDetl.getQty());
            BigDecimal orderWorkQty = new BigDecimal(orderDetl.getWorkQty());
@@ -911,15 +920,6 @@
            if (diffWorkQty.doubleValue() > orderDetl.getAnfme()){
                return R.error("工作数量大于订单数量");
            }
            orderDetl.setQty(diffQty.doubleValue());
            orderDetl.setWorkQty(diffWorkQty.doubleValue());
            if (!orderDetlService.updateById(orderDetl)){
                return R.error("订单明细更新失败");
            }
            EntityWrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<>();
            manLocDetlWrapper.eq("zpallet",jsonBarcode);
            manLocDetlWrapper.eq("matnr",jsonManLocDetl.getMatnr());
            ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper);
            BigDecimal locDetlAnfme = new BigDecimal(manLocDetl.getAnfme());
            BigDecimal diffAnfme = locDetlAnfme.subtract(anfme);
@@ -928,16 +928,18 @@
            }
            if (diffAnfme.doubleValue() == 0){
                if (!manLocDetlService.delete(manLocDetlWrapper)){
                    return R.error("删除库存明细失败");
                    throw new RuntimeException("删除库存明细失败");
                }
            } else if (diffAnfme.doubleValue() > 0) {
                manLocDetl.setAnfme(diffAnfme.doubleValue());
                if (!manLocDetlService.update(manLocDetl,manLocDetlWrapper)){
                    return R.error("更新库存明细失败");
                    throw new RuntimeException("更新库存明细失败");
                }
            }
            orderDetl.setQty(diffQty.doubleValue());
            orderDetl.setWorkQty(diffWorkQty.doubleValue());
            if (!orderDetlService.updateById(orderDetl)){
                return R.error("订单明细更新失败");
            }
            Order order = orderService.selectByNo(jsonOrderNo);
            if (IsOrderStatus(jsonOrderNo)){
@@ -949,7 +951,6 @@
                throw new RuntimeException("更新订单状态失败");
            }
        }
        return R.ok();
    }