zhangyuewww 3 lat temu
rodzic
commit
80f12c6299

+ 33 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractManagementInfoServiceImpl.java

@@ -169,7 +169,8 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
         boolean one = this.insert(contractManagementInfo);
         // 根据类型进入审核
         if("1".equals(contractManagementInfo.getGoodsType())) {
-            if ("1".equals(contractManagementInfo.getContractType())) {
+            //销售合同
+            if ("1".equals(contractManagementInfo.getContractType())&&!"代储合同".equals(contractManagementInfo.getAgreementType())) {
                 boolean isStartWorkflow = StringUtils.isBlank(contractManagementInfo.getWorkflowId());
                 // 不是退回的单子
                 if (isStartWorkflow) {
@@ -195,8 +196,35 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                     workflowService.activateInstance(contractManagementInfo.getWorkflowId(), contractManagementInfo.getId());
                 }
             }
-            else if("2".equals(contractManagementInfo.getContractType())){
+            //代储合同
+            if ("1".equals(contractManagementInfo.getContractType())&&"代储合同".equals(contractManagementInfo.getAgreementType())) {
+                boolean isStartWorkflow = StringUtils.isBlank(contractManagementInfo.getWorkflowId());
+                // 不是退回的单子
+                if (isStartWorkflow) {
+                    Workflow workflow = workflowService
+                            .findLatestWorkflowByBusinessCodeByApp(contractManagementInfo.getCompId(), "DAICHU-CONTRACT-APPROVE ");
+                    // 没配置审核流程,直接结束并处理信息
+                    if (workflow == null) {
+                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                    }
+                    // 开启审核流
+                    else {
+
+                        // 设置状态 已提交审核
+                        contractManagementInfo.setWorkflowId(workflow.getId());
+                        this.updateById(contractManagementInfo);
+                        workflowService.startInstance(workflow.getId(), contractManagementInfo.getId());
+                    }
+                }
+                // 退回的单子 再启用
+                else {
 
+                    this.updateById(contractManagementInfo);
+                    workflowService.activateInstance(contractManagementInfo.getWorkflowId(), contractManagementInfo.getId());
+                }
+            }
+            //采购合同
+            else if("2".equals(contractManagementInfo.getContractType())){
                 boolean isStartWorkflow = StringUtils.isBlank(contractManagementInfo.getWorkflowId());
                 // 不是退回的单子
                 if (isStartWorkflow) {
@@ -223,6 +251,7 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                 }
 
             }
+            //代收合同
             else {
                 boolean isStartWorkflow = StringUtils.isBlank(contractManagementInfo.getWorkflowId());
                 // 不是退回的单子
@@ -1587,6 +1616,8 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                     contractManagementInfo.getId(), null);
             noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "DAISHOU-CONTRACT-APPROVE",
                     contractManagementInfo.getId(), null);
+            noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "DAICHU-CONTRACT-APPROVE",
+                    contractManagementInfo.getId(), null);
             //货物信息
             ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, id));
             //流程信息