自动化立体仓库 - WMS系统
#
lsh
2024-12-27 b23125070f478fe9e0ab773b1ba1a3cfd8ab7a25
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -98,14 +98,22 @@
    @ManagerAuth(memo = "手动添加订单")
    @Transactional
    public R formAdd(@RequestBody OrderDomainParam param){
        int status = 0;
        if(Cools.isEmpty(param.getOrderNo())){
            String prefix = "";
            DocType docType = docTypeService.selectById(param.getDocType());
            if(!Cools.isEmpty(docType)){
                prefix = docType.getPakin() == 1 ? "RK" : "CK";
                status = (prefix == "RK" ? 1 : (prefix == "CK" ? 2 : 0));
            }
            param.setOrderNo(prefix + snowflakeIdWorker.nextId());
        } else {
            DocType docType = docTypeService.selectById(param.getDocType());
            if(!Cools.isEmpty(docType)){
                status = (docType.getPakin() == 1 ? 1 :  2 );
            }
        }
        Order order = orderService.selectByNo(param.getOrderNo());
        if (order != null) {
            return R.error("单据编号已存在");
@@ -145,7 +153,8 @@
                now,    // 添加时间
                getUserId(),    // 修改人员
                now,    // 修改时间
                null    // 备注
                null,    // 备注
                status
        );
        if (!orderService.insert(order)) {
            throw new CoolException("保存订单主档失败");
@@ -172,6 +181,7 @@
                orderDetl.setUpdateTime(now);
                orderDetl.setStatus(1);
                orderDetl.setQty(0.0D);
                orderDetl.setPakinPakoutStatus(status);
                if (!orderDetlService.insert(orderDetl)) {
                    throw new CoolException("保存订单明细档失败");
                }