| | |
| | | @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("单据编号已存在"); |
| | |
| | | now, // 添加时间 |
| | | getUserId(), // 修改人员 |
| | | now, // 修改时间 |
| | | null // 备注 |
| | | null, // 备注 |
| | | status |
| | | ); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("保存订单主档失败"); |
| | |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(0.0D); |
| | | orderDetl.setPakinPakoutStatus(status); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("保存订单明细档失败"); |
| | | } |