| | |
| | | supplierService.validateSupplier(createReqVO.getSupplierId()); |
| | | } |
| | | // 3. 生成申请单号 |
| | | String no = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_REQUEST_NO_PREFIX); |
| | | if (purchaseRequestMapper.selectByNo(no) != null) { |
| | | throw exception(PURCHASE_REQUEST_NO_EXISTS); |
| | | } |
| | | String no = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_REQUEST_NO_PREFIX, |
| | | candidate -> purchaseRequestMapper.selectByNo(candidate) != null); |
| | | |
| | | // 4. 获取当前用户信息 |
| | | Long userId = Long.parseLong(getCurrentUserId()); |
| | |
| | | } |
| | | |
| | | // 3. 单号:填了就用(校验唯一),没填自动生成 CGSQ... |
| | | String no = StrUtil.isNotBlank(head.getNo()) ? head.getNo().trim() |
| | | : noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_REQUEST_NO_PREFIX); |
| | | String no; |
| | | if (StrUtil.isNotBlank(head.getNo())) { |
| | | no = head.getNo().trim(); |
| | | if (purchaseRequestMapper.selectByNo(no) != null) { |
| | | throw new IllegalArgumentException("采购申请单号已存在:" + no); |
| | | } |
| | | } else { |
| | | no = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_REQUEST_NO_PREFIX, |
| | | candidate -> purchaseRequestMapper.selectByNo(candidate) != null); |
| | | } |
| | | |
| | | // 4. 申请人 / 申请部门:取当前登录用户及其部门 |
| | |
| | | } |
| | | |
| | | // 2. 生成采购订单号 |
| | | String orderNo = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_ORDER_NO_PREFIX); |
| | | if (purchaseOrderMapper.selectByNo(orderNo) != null) { |
| | | throw exception(PURCHASE_ORDER_NO_EXISTS); |
| | | } |
| | | String orderNo = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_ORDER_NO_PREFIX, |
| | | candidate -> purchaseOrderMapper.selectByNo(candidate) != null); |
| | | |
| | | // 3. 创建采购订单 |
| | | ErpPurchaseOrderDO purchaseOrder = new ErpPurchaseOrderDO(); |