自动化立体仓库 - WMS系统
zjj
2023-06-09 3e015fc9d05c451d34fd33e846349d4b2bd7b600
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -34,6 +34,10 @@
    private WrkDetlService wrkDetlService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private LocOwnerService locOwnerService;
    @Autowired
    private OrderLogService orderLogService;
    @RequestMapping(value = "/order/nav/list/auth")
    @ManagerAuth
@@ -90,17 +94,21 @@
    @ManagerAuth(memo = "手动添加订单")
    @Transactional
    public R formAdd(@RequestBody OrderDomainParam param){
        String prefix = "";
        DocType docType = docTypeService.selectById(param.getDocType());
        if(!Cools.isEmpty(docType)){
            prefix = docType.getPakin() == 1 ? "RK" : "CK";
        }
        if(Cools.isEmpty(param.getOrderNo())){
            String prefix = "";
            DocType docType = docTypeService.selectById(param.getDocType());
            if(!Cools.isEmpty(docType)){
                prefix = docType.getPakin() == 1 ? "RK" : "CK";
            }
            param.setOrderNo(prefix + snowflakeIdWorker.nextId());
        }
        Order order = orderService.selectByNo(param.getOrderNo());
        OrderLog orderLog = orderLogService.selectByNo(param.getOrderNo());
        if (order != null) {
            return R.error("单据编号已存在");
        }
        if (orderLog != null) {
            return R.error("单据编号在历史档中已存在");
        }
        Date now = new Date();
        order = new Order(
@@ -144,6 +152,14 @@
        }
        List<DetlDto> list = new ArrayList<>();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            if (Cools.isEmpty(orderDetl.getOwner())){
                throw new CoolException("保存订单明细档失败,请输入货主编号");
            }else {
                LocOwner locOwner = locOwnerService.selectById(orderDetl.getOwner());
                if (Cools.isEmpty(locOwner)){
                    throw new CoolException("保存订单明细档失败,请输入存在的货主编号(整数)");
                }
            }
            if (orderDetl.getBatch() == null) {
                orderDetl.setBatch("");
            }
@@ -164,6 +180,10 @@
                orderDetl.setUpdateTime(now);
                orderDetl.setStatus(1);
                orderDetl.setQty(0.0D);
                if(orderDetl.getPayment() == null){
                    orderDetl.setPayment(0);
                }
                orderDetl.setUuid(String.valueOf(System.currentTimeMillis()));
                if (!orderDetlService.insert(orderDetl)) {
                    throw new CoolException("保存订单明细档失败");
                }