自动化立体仓库 - WMS系统
zjj
2023-05-26 6cc705d10d7d0366eb7aa4797acdf137e4b7576f
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -36,6 +36,8 @@
    private WaitPakinService waitPakinService;
    @Autowired
    private LocOwnerService locOwnerService;
    @Autowired
    private OrderLogService orderLogService;
    @RequestMapping(value = "/order/nav/list/auth")
    @ManagerAuth
@@ -93,21 +95,25 @@
    @Transactional
    public R formAdd(@RequestBody OrderDomainParam param){
        int payment = 0;
        String prefix = "";
        DocType docType = docTypeService.selectById(param.getDocType());
        if(!Cools.isEmpty(docType)){
            prefix = docType.getPakin() == 1 ? "RK" : "CK";
        }
        if (prefix.equals("CK")){
            payment = 1;
        }
        if(Cools.isEmpty(param.getOrderNo())){
            String prefix = "";
            DocType docType = docTypeService.selectById(param.getDocType());
            if(!Cools.isEmpty(docType)){
                prefix = docType.getPakin() == 1 ? "RK" : "CK";
            }
            if (prefix.equals("CK")){
                payment = 1;
            }
            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(
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]