| | |
| | | private void validateItemReceiptSaveData(MesWmItemReceiptSaveReqVO reqVO) { |
| | | // 校验编码唯一 |
| | | validateCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | // 校验供应商存在(采购入库使用 ERP 供应商) |
| | | srmSupplierApi.getSupplier(reqVO.getVendorId()); |
| | | // 校验供应商存在(采购入库使用 ERP 供应商);供应商已改为可选,允许手工填写名称,此时不校验主数据 |
| | | if (reqVO.getVendorId() != null) { |
| | | srmSupplierApi.getSupplier(reqVO.getVendorId()); |
| | | } |
| | | // 校验到货通知单存在 |
| | | if (reqVO.getNoticeId() != null) { |
| | | MesWmArrivalNoticeDO notice = arrivalNoticeService.validateArrivalNoticeReadyForReceipt(reqVO.getNoticeId()); |
| | | if (ObjUtil.notEqual(notice.getVendorId(), reqVO.getVendorId())) { |
| | | // 仅在选择了供应商主数据时才比对与到货通知单的一致性;手填供应商名称时跳过 |
| | | if (reqVO.getVendorId() != null && ObjUtil.notEqual(notice.getVendorId(), reqVO.getVendorId())) { |
| | | throw exception(WM_ARRIVAL_NOTICE_VENDOR_MISMATCH); |
| | | } |
| | | } |
| | |
| | | |
| | | // 2. 创建 BPM 流程实例 |
| | | Long userId = getCurrentUserId(); |
| | | // 全局免审批:业务校验通过后直接执行审批通过逻辑,无需流程模型。 |
| | | if (processInstanceApi.isGlobalAutoApprove()) { |
| | | itemReceiptMapper.updateById(new MesWmItemReceiptDO() |
| | | .setId(id) |
| | | .setStatus(MesWmItemReceiptStatusEnum.APPROVING.getStatus()) |
| | | .setProcessInstanceId("")); |
| | | updateItemReceiptAuditStatus(id, cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum.APPROVE.getStatus()); |
| | | return; |
| | | } |
| | | |
| | | String processInstanceId = processInstanceApi.createProcessInstance(userId, |
| | | new BpmProcessInstanceCreateReqDTO() |
| | | .setProcessDefinitionKey(processDefinitionKey) |