Преглед изворни кода

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun

ccjgmwz пре 3 година
родитељ
комит
0c50305513
19 измењених фајлова са 478 додато и 67 уклоњено
  1. 11 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/SalesClosingReportController.java
  2. 4 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FreightReceivingDispatching.java
  3. 11 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FreightReceivingDispatchingCar.java
  4. 3 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchaseClosingReport.java
  5. 1 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchaseReceiptReport.java
  6. 3 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SalesClosingReport.java
  7. 4 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SalesDeliveryReport.java
  8. 3 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ISalesClosingReportService.java
  9. 28 6
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FreightReceivingDispatchingServiceImpl.java
  10. 56 10
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseClosingReportServiceImpl.java
  11. 24 24
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseOrderServiceImpl.java
  12. 28 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseReceiptReportServiceImpl.java
  13. 24 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SaleOrderServiceImpl.java
  14. 70 10
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SalesClosingReportServiceImpl.java
  15. 54 10
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SalesDeliveryReportServiceImpl.java
  16. 26 4
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranCarInfoServiceImpl.java
  17. 27 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java
  18. 50 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/SaleCloseReportListener.java
  19. 51 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/SaleOutReportListener.java

+ 11 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/SalesClosingReportController.java

@@ -3,6 +3,7 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseClosingReport;
 import com.yh.saas.plugin.yiliangyiyun.entity.SalesClosingReport;
 import com.yh.saas.plugin.yiliangyiyun.service.ISalesClosingReportService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,16 @@ public class SalesClosingReportController {
     public Page<SalesClosingReport> selectSalesClosingOrder(SalesClosingReport salesClosingReport){
         return salesClosingReportService.selectSalesClosingOrder(salesClosingReport);
     }
+
+    /**
+     * 编辑采购平仓统计
+     * @param salesClosingReport
+     * @return
+     */
+    @PostMapping("/api/editSalesCloseReport")
+    public String editSalesCloseReport(@RequestBody SalesClosingReport salesClosingReport){
+        return salesClosingReportService.editSalesCloseReport(salesClosingReport);
+    }
     /**
      * 出纳付款
      * @param salesClosingReport

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FreightReceivingDispatching.java

@@ -40,6 +40,10 @@ public class FreightReceivingDispatching extends BaseModel<FreightReceivingDispa
      * 公司id
      */
     private String compId;
+    /**
+     * 个人id
+     */
+    private String commonId;
     /**
      * 业务编号
      */

+ 11 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FreightReceivingDispatchingCar.java

@@ -124,6 +124,17 @@ public class FreightReceivingDispatchingCar extends BaseModel<FreightReceivingDi
      * 批次号
      */
     private String batch;
+    /**
+     * 本次付款
+     */
+    @TableField(exist = false)
+    private Float money;
+    /**
+     * flag(0扣运费1付运费)
+     */
+    @TableField(exist = false)
+    private String flag;
+
 
 
     @Override

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchaseClosingReport.java

@@ -158,6 +158,9 @@ public class PurchaseClosingReport extends BaseModel<PurchaseClosingReport> {
     @TableField(exist = false)
     private String searchKeyWord;
 
+
+    @TableField(exist = false)
+    private String taskId;
     /**
      *查询类型
      */

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchaseReceiptReport.java

@@ -184,7 +184,7 @@ public class PurchaseReceiptReport extends BaseModel<PurchaseReceiptReport> {
      */
     private String approveStatus;
     /**
-     * 客户确认状态标识(1是3否)
+     * 客户确认状态标识(1否3是
      */
     private String customerConfirmationStatusFlag;
     /**

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SalesClosingReport.java

@@ -161,6 +161,9 @@ public class SalesClosingReport extends BaseModel<SalesClosingReport> {
     @TableField(exist = false)
     private String searchKeyWord;
 
+    @TableField(exist = false)
+    private String taskId;
+
     /**
      *查询类型
      */

+ 4 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SalesDeliveryReport.java

@@ -152,7 +152,7 @@ public class SalesDeliveryReport extends BaseModel<SalesDeliveryReport> {
      */
     private String approveStatus;
     /**
-     * 客户确认状态标识(1是3否)
+     * 客户确认状态标识(1否3是
      */
     private String customerConfirmationStatusFlag;
     /**
@@ -180,6 +180,9 @@ public class SalesDeliveryReport extends BaseModel<SalesDeliveryReport> {
     @TableField(exist = false)
     private String roleFlag;
 
+    @TableField(exist = false)
+    private String taskId;
+
     /**
      * flag(1通过2驳回)
      */

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ISalesClosingReportService.java

@@ -48,4 +48,7 @@ public interface ISalesClosingReportService extends IService<SalesClosingReport>
      */
     List<ContractManagementInfo> selectContractNoList(String compId);
 
+
+    String editSalesCloseReport(SalesClosingReport salesClosingReport);
+
 }

+ 28 - 6
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FreightReceivingDispatchingServiceImpl.java

@@ -34,6 +34,8 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
     private IFreightReceivingDispatchingCarService freightReceivingDispatchingCarService;
     @Autowired
     private IReceivingUserService receivingUserService;
+    @Autowired
+    private IIdentityAuthenticationInfoService iIdentityAuthenticationInfoService;
 
 
     /**
@@ -119,6 +121,9 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
         freightReceivingDispatching.setId(IdGenerator.generateUUID());
         freightReceivingDispatching.setStatusFlag("2");
         freightReceivingDispatching.setStatus("收货");
+//        IdentityAuthenticationInfo identityAuthenticationInfo=iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<>()
+//        .eq("cover","0")
+//        .eq(""))
         freightReceivingDispatching.setBatch(batch);
         this.insert(freightReceivingDispatching);
         return freightReceivingDispatching.getId();
@@ -136,7 +141,6 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
         freightReceivingDispatchingCar.setId(IdGenerator.generateUUID());
         freightReceivingDispatchingCar.setStatusFlag("1");
         freightReceivingDispatchingCar.setStatus("待签收");
-        freightReceivingDispatchingCarService.insert(freightReceivingDispatchingCar);
         List<FreightReceivingDispatching> freightReceivingDispatchingList=this.selectList(new EntityWrapper<FreightReceivingDispatching>()
                 .eq("batch",freightReceivingDispatchingCar.getBatch())
                 .eq("delete_flag","0"));
@@ -145,12 +149,15 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
                 freightReceivingDispatching.setSignedFor(String.valueOf(Float.valueOf(freightReceivingDispatching.getSignedFor()) + 1));
                 this.updateById(freightReceivingDispatching);
             }
+            freightReceivingDispatchingCar.setGoodsIngPayable(freightReceivingDispatchingCar.getReciveNetWeight()*freightReceivingDispatchingList.get(0).getGoodsPrice());
+            freightReceivingDispatchingCar.setFreightIngPayable(freightReceivingDispatchingCar.getReciveNetWeight()*freightReceivingDispatchingList.get(0).getFreightUnitPrice()-freightReceivingDispatchingCar.getFreightDeductionAmount());
         }
 //        FreightReceivingDispatching freightReceivingDispatching = this.selectById(freightReceivingDispatchingCar.getInfoId());
 //        if (freightReceivingDispatching != null) {
 //            freightReceivingDispatching.setSignedFor(String.valueOf(Float.valueOf(freightReceivingDispatching.getSignedFor()) + 1));
 //            this.updateById(freightReceivingDispatching);
 //        }
+        freightReceivingDispatchingCarService.insert(freightReceivingDispatchingCar);
         return freightReceivingDispatchingCar.getId();
     }
 
@@ -164,10 +171,15 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
     @Override
     public String paymentAndDeductionfreight(FreightReceivingDispatchingCar freightReceivingDispatchingCar) {
         FreightReceivingDispatchingCar freightReceivingDispatchingCar1 = freightReceivingDispatchingCarService.selectById(freightReceivingDispatchingCar.getId());
-        freightReceivingDispatchingCar1.setFreightIngPayable(freightReceivingDispatchingCar.getFreightIngPayable());
-        // 付款金额 用已付这个字段  然后累加
-        freightReceivingDispatchingCar1.setFreightEdPayable(freightReceivingDispatchingCar1.getFreightEdPayable() + freightReceivingDispatchingCar.getFreightEdPayable());
-        freightReceivingDispatchingCar1.setFreightDeductionAmount(freightReceivingDispatchingCar.getFreightDeductionAmount());
+        if ("0".equals(freightReceivingDispatchingCar.getFlag())){
+            freightReceivingDispatchingCar1.setFreightIngPayable(freightReceivingDispatchingCar1.getFreightIngPayable()-freightReceivingDispatchingCar.getFreightDeductionAmount());
+            freightReceivingDispatchingCar1.setFreightDeductionAmount(freightReceivingDispatchingCar.getFreightDeductionAmount());
+        }
+        else{
+            freightReceivingDispatchingCar1.setFreightIngPayable(freightReceivingDispatchingCar.getFreightIngPayable());
+            // 付款金额 用已付这个字段  然后累加
+            freightReceivingDispatchingCar1.setFreightEdPayable(freightReceivingDispatchingCar1.getFreightEdPayable() + freightReceivingDispatchingCar.getMoney());
+        }
         freightReceivingDispatchingCarService.updateById(freightReceivingDispatchingCar1);
         return freightReceivingDispatchingCar.getId();
     }
@@ -184,7 +196,7 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
         FreightReceivingDispatchingCar freightReceivingDispatchingCar1 = freightReceivingDispatchingCarService.selectById(freightReceivingDispatchingCar.getId());
         freightReceivingDispatchingCar1.setGoodsIngPayable(freightReceivingDispatchingCar.getGoodsIngPayable());
         // 付款金额 用已付这个字段  然后累加
-        freightReceivingDispatchingCar1.setFreightEdPayable(freightReceivingDispatchingCar1.getFreightEdPayable() + freightReceivingDispatchingCar.getFreightEdPayable());
+        freightReceivingDispatchingCar1.setFreightEdPayable(freightReceivingDispatchingCar1.getFreightEdPayable() + freightReceivingDispatchingCar.getMoney());
         freightReceivingDispatchingCar1.setGoodsDeductionAmount(freightReceivingDispatchingCar.getGoodsDeductionAmount());
         if (freightReceivingDispatchingCar1.getGoodsIngPayable() == freightReceivingDispatchingCar1.getGoodsEdPayable()) {
             freightReceivingDispatchingCar1.setStatusFlag("5");
@@ -228,6 +240,16 @@ public class FreightReceivingDispatchingServiceImpl extends ServiceImpl<FreightR
                 freightReceivingDispatching.setToSettled(String.valueOf(Integer.valueOf(freightReceivingDispatching.getToSettled()) + 1));
                 this.updateById(freightReceivingDispatching);
             }
+            //发货净重小
+            if (freightReceivingDispatchingCar.getReciveNetWeight()< freightReceivingDispatchingCar.getDispatchNetWeight()){
+                freightReceivingDispatchingCar.setGoodsIngPayable(freightReceivingDispatchingCar.getReciveNetWeight()*freightReceivingDispatchingList.get(0).getGoodsPrice());
+                freightReceivingDispatchingCar.setFreightIngPayable(freightReceivingDispatchingCar.getReciveNetWeight()*freightReceivingDispatchingList.get(0).getFreightUnitPrice()-freightReceivingDispatchingCar.getFreightDeductionAmount());
+            }
+            else{
+                freightReceivingDispatchingCar.setGoodsIngPayable(freightReceivingDispatchingCar.getDispatchNetWeight()*freightReceivingDispatchingList.get(0).getGoodsPrice());
+                freightReceivingDispatchingCar.setFreightIngPayable(freightReceivingDispatchingCar.getDispatchNetWeight()*freightReceivingDispatchingList.get(0).getFreightUnitPrice()-freightReceivingDispatchingCar.getFreightDeductionAmount());
+
+            }
         }
 //        FreightReceivingDispatching freightReceivingDispatching = this.selectById(freightReceivingDispatchingCar.getInfoId());
 //        if (freightReceivingDispatching != null) {

+ 56 - 10
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseClosingReportServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.alipay.sofa.runtime.api.annotation.SofaReference;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
@@ -8,14 +9,18 @@ import com.winsea.svc.base.base.entity.CommonRoleResource;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.base.workflow.entity.Workflow;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseClosingReport;
+import com.yh.saas.plugin.yiliangyiyun.exception.YException;
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.PurchaseClosingReportMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IPurchaseClosingReportService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.yh.saas.toolkit.workflow.service.IWorkflowService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -56,14 +61,14 @@ public class PurchaseClosingReportServiceImpl extends ServiceImpl<PurchaseClosin
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("startRecord", (purchaseClosingReport.getCurrentPage() - 1)
                 * purchaseClosingReport.getPageSize());
-//        List<String> businessKeys = null;
-//        businessKeys = workflowService.getTaskBusinessKeysByCode("PURCHASE-CLOSE-REPORT");
-//        List<String> statusSet = new ArrayList<>();
-//        List<String> resourceIdList = this.getResourceIdList();
-//        if (resourceIdList.contains("PURCHAS")) { // 填写,提交    权限做完以后替换
-//            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
-//            statusSet.addAll(statusList);
-//        }
+        List<String> businessKeys = null;
+        businessKeys = workflowService.getTaskBusinessKeysByCode("PROCUREMENT-CLOSE-REPORT");
+        List<String> statusSet = new ArrayList<>();
+        List<String> resourceIdList = this.getResourceIdList();
+        if (resourceIdList.contains("procurementCloseReport-Edit")) { // 填写,提交    权限做完以后替换
+            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
+            statusSet.addAll(statusList);
+        }
 
         //公司id
         pageView.put("compId", purchaseClosingReport.getCompId());
@@ -74,13 +79,27 @@ public class PurchaseClosingReportServiceImpl extends ServiceImpl<PurchaseClosin
         pageView.put("contractNo", purchaseClosingReport.getContractNo());
         pageView.put("roleFlag", purchaseClosingReport.getRoleFlag());
         pageView.put("statusFlag", purchaseClosingReport.getStatusFlag());
-//        pageView.put("businessKeys", businessKeys);
-//        pageView.put("statusSet", statusSet);
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("statusSet", statusSet);
 
 
         // 查询采购订单总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);
         List<PurchaseClosingReport> dataList = baseMapper.getListByCondition(pageView);
+
+        if(!CollectionUtils.isEmpty(dataList)){
+            dataList.forEach(PurchaseClosingReport1 -> {
+
+                String taskId = "";
+                // 只有待审核状态才有taskId
+                if (StringUtils.isNotBlank(PurchaseClosingReport1.getWorkflowId())) {
+                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(PurchaseClosingReport1.getWorkflowId()), PurchaseClosingReport1.getId());
+                    taskId = jsonObject.getString("taskId");
+                    PurchaseClosingReport1.setTaskId(taskId);
+                }
+            });
+
+        }
         Page<PurchaseClosingReport> page = new Page<>();
         page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
         page.setTotal(dataCount == null ? 0 : dataCount);
@@ -185,6 +204,33 @@ public class PurchaseClosingReportServiceImpl extends ServiceImpl<PurchaseClosin
     @Override
     public String editProcurementReceiptReport(PurchaseClosingReport purchaseClosingReport) {
         boolean one = this.updateById(purchaseClosingReport);
+
+        if(purchaseClosingReport.getStatusFlag().equals(StatusEnum.TASK_RETURN.getFlag())){
+            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(purchaseClosingReport.getWorkflowId());
+            // 不是退回的单子
+            if (isStartWorkflow) {
+                Workflow workflow = workflowService
+                        .findLatestWorkflowByBusinessCode("PROCUREMENT-CLOSE-REPORT");
+                // 没配置审核流程,直接结束并处理信息
+                if (workflow == null) {
+                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                }
+                // 开启审核流
+                else {
+
+                    // 设置状态 已提交审核
+                    purchaseClosingReport.setWorkflowId(workflow.getId());
+                    this.updateById(purchaseClosingReport);
+                    workflowService.startInstance(workflow.getId(), purchaseClosingReport.getId());
+                }
+            }
+            // 退回的单子 再启用
+            else {
+
+                this.updateById(purchaseClosingReport);
+                workflowService.activateInstance(purchaseClosingReport.getWorkflowId(), purchaseClosingReport.getId());
+            }
+        }
         if (one) {
             return "OK";
         } else {

+ 24 - 24
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseOrderServiceImpl.java

@@ -147,30 +147,30 @@ public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, P
         }
         purchaseClosingReportService.insert(purchaseClosingReport);
 
-//        boolean isStartWorkflow = StringUtils.isBlank(purchaseClosingReport.getWorkflowId());
-//        // 不是退回的单子
-//        if (isStartWorkflow) {
-//            Workflow workflow = workflowService
-//                    .findLatestWorkflowByBusinessCode("PURCHASE-CLOSE-REPORT");
-//            // 没配置审核流程,直接结束并处理信息
-//            if (workflow == null) {
-//                throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
-//            }
-//            // 开启审核流
-//            else {
-//
-//                // 设置状态 已提交审核
-//                purchaseClosingReport.setWorkflowId(workflow.getId());
-//                purchaseClosingReportService.updateById(purchaseClosingReport);
-//                workflowService.startInstance(workflow.getId(), purchaseClosingReport.getId());
-//            }
-//        }
-//        // 退回的单子 再启用
-//        else {
-//
-//            purchaseClosingReportService.updateById(purchaseClosingReport);
-//            workflowService.activateInstance(purchaseClosingReport.getWorkflowId(), purchaseClosingReport.getId());
-//        }
+        boolean isStartWorkflow = StringUtils.isBlank(purchaseClosingReport.getWorkflowId());
+        // 不是退回的单子
+        if (isStartWorkflow) {
+            Workflow workflow = workflowService
+                    .findLatestWorkflowByBusinessCode("PROCUREMENT-CLOSE-REPORT");
+            // 没配置审核流程,直接结束并处理信息
+            if (workflow == null) {
+                throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+            }
+            // 开启审核流
+            else {
+
+                // 设置状态 已提交审核
+                purchaseClosingReport.setWorkflowId(workflow.getId());
+                purchaseClosingReportService.updateById(purchaseClosingReport);
+                workflowService.startInstance(workflow.getId(), purchaseClosingReport.getId());
+            }
+        }
+        // 退回的单子 再启用
+        else {
+
+            purchaseClosingReportService.updateById(purchaseClosingReport);
+            workflowService.activateInstance(purchaseClosingReport.getWorkflowId(), purchaseClosingReport.getId());
+        }
         if (one && two) {
             return "OK";
         } else {

+ 28 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchaseReceiptReportServiceImpl.java

@@ -9,6 +9,7 @@ import com.winsea.svc.base.base.entity.CommonRoleResource;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.base.workflow.entity.Workflow;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
@@ -116,6 +117,32 @@ public class PurchaseReceiptReportServiceImpl extends ServiceImpl<PurchaseReceip
     @Override
     public String editProcurementReceiptReport(PurchaseReceiptReport purchaseReceiptReport) {
         boolean one = this.updateById(purchaseReceiptReport);
+        if(purchaseReceiptReport.getStatusFlag().equals(StatusEnum.TASK_RETURN.getFlag())){
+            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(purchaseReceiptReport.getWorkflowId());
+            // 不是退回的单子
+            if (isStartWorkflow) {
+                Workflow workflow = workflowService
+                        .findLatestWorkflowByBusinessCode("PROCUREMENT-RECEIPT-REPORT");
+                // 没配置审核流程,直接结束并处理信息
+                if (workflow == null) {
+                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                }
+                // 开启审核流
+                else {
+
+                    // 设置状态 已提交审核
+                    purchaseReceiptReport.setWorkflowId(workflow.getId());
+                    this.updateById(purchaseReceiptReport);
+                    workflowService.startInstance(workflow.getId(), purchaseReceiptReport.getId());
+                }
+            }
+            // 退回的单子 再启用
+            else {
+
+                this.updateById(purchaseReceiptReport);
+                workflowService.activateInstance(purchaseReceiptReport.getWorkflowId(), purchaseReceiptReport.getId());
+            }
+        }
         if (one) {
             return "OK";
         } else {
@@ -130,7 +157,7 @@ public class PurchaseReceiptReportServiceImpl extends ServiceImpl<PurchaseReceip
      */
     @Override
     public String replenishment(PurchaseReceiptReport purchaseReceiptReport) {
-        if ("1".equals(purchaseReceiptReport.getCustomerConfirmationStatusFlag())) {
+        if ("3".equals(purchaseReceiptReport.getCustomerConfirmationStatusFlag())) {
             // 未付金额不等0 可补货结转
             if (purchaseReceiptReport.getAmountNotPayable() != 0) {
                 this.updateById(purchaseReceiptReport);

+ 24 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SaleOrderServiceImpl.java

@@ -201,6 +201,30 @@ public class SaleOrderServiceImpl extends ServiceImpl<SaleOrderMapper, SaleOrder
             salesClosingReport.setWarehouseName(salePlanInfo.getSendWarehouse());
         }
         salesClosingReportService.insert(salesClosingReport);
+        boolean isStartWorkflow = StringUtils.isBlank(salesClosingReport.getWorkflowId());
+        // 不是退回的单子
+        if (isStartWorkflow) {
+            Workflow workflow = workflowService
+                    .findLatestWorkflowByBusinessCode("SALE-CLOSE-REPORT");
+            // 没配置审核流程,直接结束并处理信息
+            if (workflow == null) {
+                throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+            }
+            // 开启审核流
+            else {
+
+                // 设置状态 已提交审核
+                salesClosingReport.setWorkflowId(workflow.getId());
+                salesClosingReportService.updateById(salesClosingReport);
+                workflowService.startInstance(workflow.getId(), salesClosingReport.getId());
+            }
+        }
+        // 退回的单子 再启用
+        else {
+
+            salesClosingReportService.updateById(salesClosingReport);
+            workflowService.activateInstance(salesClosingReport.getWorkflowId(), salesClosingReport.getId());
+        }
         if (one && two) {
             return "OK";
         } else {

+ 70 - 10
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SalesClosingReportServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.alipay.sofa.runtime.api.annotation.SofaReference;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
@@ -8,14 +9,19 @@ import com.winsea.svc.base.base.entity.CommonRoleResource;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.base.workflow.entity.Workflow;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.SalesClosingReport;
+import com.yh.saas.plugin.yiliangyiyun.entity.SalesDeliveryReport;
+import com.yh.saas.plugin.yiliangyiyun.exception.YException;
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.SalesClosingReportMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.ISalesClosingReportService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.yh.saas.toolkit.workflow.service.IWorkflowService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -57,14 +63,14 @@ public class SalesClosingReportServiceImpl extends ServiceImpl<SalesClosingRepor
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("startRecord", (salesClosingReport.getCurrentPage() - 1)
                 * salesClosingReport.getPageSize());
-//        List<String> businessKeys = null;
-//        businessKeys = workflowService.getTaskBusinessKeysByCode("PURCHASE-CLOSE-REPORT");
-//        List<String> statusSet = new ArrayList<>();
-//        List<String> resourceIdList = this.getResourceIdList();
-//        if (resourceIdList.contains("PURCHAS")) { // 填写,提交    权限做完以后替换
-//            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
-//            statusSet.addAll(statusList);
-//        }
+        List<String> businessKeys = null;
+        businessKeys = workflowService.getTaskBusinessKeysByCode("SALE-CLOSE-REPORT");
+        List<String> statusSet = new ArrayList<>();
+        List<String> resourceIdList = this.getResourceIdList();
+        if (resourceIdList.contains("saleCloseReport-Edit")) { // 填写,提交    权限做完以后替换
+            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
+            statusSet.addAll(statusList);
+        }
 
         //公司id
         pageView.put("compId", salesClosingReport.getCompId());
@@ -74,13 +80,26 @@ public class SalesClosingReportServiceImpl extends ServiceImpl<SalesClosingRepor
         pageView.put("currentPage", salesClosingReport.getCurrentPage());
         pageView.put("contractNo", salesClosingReport.getContractNo());
         pageView.put("roleFlag", salesClosingReport.getRoleFlag());
-//        pageView.put("businessKeys", businessKeys);
-//        pageView.put("statusSet", statusSet);
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("statusSet", statusSet);
 
 
         // 查询销售订单总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);
         List<SalesClosingReport> dataList = baseMapper.getListByCondition(pageView);
+        if(!CollectionUtils.isEmpty(dataList)){
+            dataList.forEach(salesClosingReport1 -> {
+
+                String taskId = "";
+                // 只有待审核状态才有taskId
+                if (StringUtils.isNotBlank(salesClosingReport1.getWorkflowId())) {
+                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(salesClosingReport1.getWorkflowId()), salesClosingReport1.getId());
+                    taskId = jsonObject.getString("taskId");
+                    salesClosingReport1.setTaskId(taskId);
+                }
+            });
+
+        }
         Page<SalesClosingReport> page = new Page<>();
         page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
         page.setTotal(dataCount == null ? 0 : dataCount);
@@ -89,6 +108,47 @@ public class SalesClosingReportServiceImpl extends ServiceImpl<SalesClosingRepor
         return page;
     }
 
+    /**
+     * 最终结算价
+     * @param salesClosingReport
+     */
+    @Override
+    public String editSalesCloseReport(SalesClosingReport salesClosingReport) {
+        boolean one = this.updateById(salesClosingReport);
+        if(salesClosingReport.getStatusFlag().equals(StatusEnum.TASK_RETURN.getFlag())) {
+            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesClosingReport.getWorkflowId());
+            // 不是退回的单子
+            if (isStartWorkflow) {
+                Workflow workflow = workflowService
+                        .findLatestWorkflowByBusinessCode("SALE-CLOSE-REPORT");
+                // 没配置审核流程,直接结束并处理信息
+                if (workflow == null) {
+                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                }
+                // 开启审核流
+                else {
+
+                    // 设置状态 已提交审核
+                    salesClosingReport.setWorkflowId(workflow.getId());
+                    this.updateById(salesClosingReport);
+                    workflowService.startInstance(workflow.getId(), salesClosingReport.getId());
+                }
+            }
+            // 退回的单子 再启用
+            else {
+
+                this.updateById(salesClosingReport);
+                workflowService.activateInstance(salesClosingReport.getWorkflowId(), salesClosingReport.getId());
+            }
+        }
+        if (one) {
+            return "OK";
+        } else {
+            return "NG";
+        }
+    }
+
+
     /**
      * 出纳付款
      *

+ 54 - 10
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/SalesDeliveryReportServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.alipay.sofa.runtime.api.annotation.SofaReference;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
@@ -8,8 +9,11 @@ import com.winsea.svc.base.base.entity.CommonRoleResource;
 import com.winsea.svc.base.base.service.ICommonRoleResourceService;
 import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.base.workflow.entity.Workflow;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
+import com.yh.saas.plugin.yiliangyiyun.exception.YException;
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.SalesDeliveryReportMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IContractManagementInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.ISaleOrderService;
@@ -17,6 +21,7 @@ import com.yh.saas.plugin.yiliangyiyun.service.ISalesDeliveryReportService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.yh.saas.plugin.yiliangyiyun.service.IWarehouseInOutInfoService;
 import com.yh.saas.toolkit.workflow.service.IWorkflowService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -57,14 +62,14 @@ public class SalesDeliveryReportServiceImpl extends ServiceImpl<SalesDeliveryRep
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("startRecord", (salesDeliveryReport.getCurrentPage() - 1)
                 * salesDeliveryReport.getPageSize());
-//        List<String> businessKeys = null;
-//        businessKeys = workflowService.getTaskBusinessKeysByCode("PURCHASE-RECEIPT-REPORT");
-//        List<String> statusSet = new ArrayList<>();
-//        List<String> resourceIdList = this.getResourceIdList();
-//        if (resourceIdList.contains("PURCHAS")) { // 填写,提交    权限做完以后替换
-//            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
-//            statusSet.addAll(statusList);
-//        }
+        List<String> businessKeys = null;
+        businessKeys = workflowService.getTaskBusinessKeysByCode("SALE-RECEIPT-REPORT");
+        List<String> statusSet = new ArrayList<>();
+        List<String> resourceIdList = this.getResourceIdList();
+        if (resourceIdList.contains("saleOutReport-Edit")) { // 填写,提交    权限做完以后替换
+            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
+            statusSet.addAll(statusList);
+        }
         //公司id
         pageView.put("compId", salesDeliveryReport.getCompId());
         pageView.put("searchKeyWord", salesDeliveryReport.getSearchKeyWord());
@@ -73,11 +78,24 @@ public class SalesDeliveryReportServiceImpl extends ServiceImpl<SalesDeliveryRep
         pageView.put("currentPage", salesDeliveryReport.getCurrentPage());
         pageView.put("contractNo", salesDeliveryReport.getContractNo());
         pageView.put("roleFlag", salesDeliveryReport.getRoleFlag());
-//        pageView.put("businessKeys", businessKeys);
-//        pageView.put("statusSet", statusSet);
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("statusSet", statusSet);
         // 查询销售出库总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);
         List<SalesDeliveryReport> dataList = baseMapper.getListByCondition(pageView);
+        if(!CollectionUtils.isEmpty(dataList)){
+            dataList.forEach(salesDeliveryReport1 -> {
+
+                String taskId = "";
+                // 只有待审核状态才有taskId
+                if (StringUtils.isNotBlank(salesDeliveryReport1.getWorkflowId())) {
+                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(salesDeliveryReport1.getWorkflowId()), salesDeliveryReport1.getId());
+                    taskId = jsonObject.getString("taskId");
+                    salesDeliveryReport1.setTaskId(taskId);
+                }
+            });
+
+        }
         Page<SalesDeliveryReport> page = new Page<>();
         page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
         page.setTotal(dataCount == null ? 0 : dataCount);
@@ -174,6 +192,32 @@ public class SalesDeliveryReportServiceImpl extends ServiceImpl<SalesDeliveryRep
     @Override
     public String editSalesDeliveryReport(SalesDeliveryReport salesDeliveryReport) {
         boolean one = this.updateById(salesDeliveryReport);
+        if(salesDeliveryReport.getStatusFlag().equals(StatusEnum.TASK_RETURN.getFlag())) {
+            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesDeliveryReport.getWorkflowId());
+            // 不是退回的单子
+            if (isStartWorkflow) {
+                Workflow workflow = workflowService
+                        .findLatestWorkflowByBusinessCode("SALE-RECEIPT-REPORT");
+                // 没配置审核流程,直接结束并处理信息
+                if (workflow == null) {
+                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                }
+                // 开启审核流
+                else {
+
+                    // 设置状态 已提交审核
+                    salesDeliveryReport.setWorkflowId(workflow.getId());
+                    this.updateById(salesDeliveryReport);
+                    workflowService.startInstance(workflow.getId(), salesDeliveryReport.getId());
+                }
+            }
+            // 退回的单子 再启用
+            else {
+
+                this.updateById(salesDeliveryReport);
+                workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
+            }
+        }
         if (one) {
             return "OK";
         } else {

+ 26 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranCarInfoServiceImpl.java

@@ -8,11 +8,8 @@ import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.exception.*;
 import com.yh.saas.plugin.yiliangyiyun.mapper.TranCarInfoMapper;
-import com.yh.saas.plugin.yiliangyiyun.service.IDriverViewInfoService;
-import com.yh.saas.plugin.yiliangyiyun.service.IProcurementPlanInfoService;
-import com.yh.saas.plugin.yiliangyiyun.service.ITranCarInfoService;
+import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.yh.saas.plugin.yiliangyiyun.service.IWarehouseInOutInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -37,6 +34,10 @@ public class TranCarInfoServiceImpl extends ServiceImpl<TranCarInfoMapper, TranC
     private IWarehouseInOutInfoService warehouseInOutInfoService;
     @Autowired
     private IProcurementPlanInfoService procurementPlanInfoService;
+    @Autowired
+    private IPurchaseReceiptReportService purchaseReceiptReportService;
+    @Autowired
+    private ISalesDeliveryReportService salesDeliveryReportService;
 
     /**
      * 添加发车信息
@@ -110,6 +111,27 @@ public class TranCarInfoServiceImpl extends ServiceImpl<TranCarInfoMapper, TranC
             // 插入操作历史
             this.billOperateHisService.saveBillOperateHis(tranCarInfo.getId(), NumberConstant.CONSTANT_TRAN, staffName, null,
                     tranCarInfo.getStatus(), null, "");
+            //更新报表客户确认状态
+            //采购
+            PurchaseReceiptReport purchaseReceiptReport=purchaseReceiptReportService.selectOne(new EntityWrapper<PurchaseReceiptReport>()
+            .eq("tran_car_no",tranCarInfo.getTranCarNo())
+            .eq("car_no",tranCarInfo.getCarNo())
+            .eq("contract_no",tranCarInfo.getContractNo()));
+            if(purchaseReceiptReport!=null){
+                purchaseReceiptReport.setCustomerConfirmationStatus("是");
+                purchaseReceiptReport.setCustomerConfirmationStatusFlag("3");
+                purchaseReceiptReportService.updateById(purchaseReceiptReport);
+            }
+            //销售
+            SalesDeliveryReport salesDeliveryReport=salesDeliveryReportService.selectOne(new EntityWrapper<SalesDeliveryReport>()
+                    .eq("tran_car_no",tranCarInfo.getTranCarNo())
+                    .eq("car_no",tranCarInfo.getCarNo())
+                    .eq("contract_no",tranCarInfo.getContractNo()));
+            if(salesDeliveryReport!=null){
+                salesDeliveryReport.setCustomerConfirmationStatus("是");
+                salesDeliveryReport.setCustomerConfirmationStatusFlag("3");
+                salesDeliveryReportService.updateById(salesDeliveryReport);
+            }
             return "OK";
         }
         return "NG";

+ 27 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -383,6 +383,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                     purchaseReceiptReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
                     purchaseReceiptReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
                     purchaseReceiptReport.setCarNo(warehouseInOutInfo.getCarNo());
+                    purchaseReceiptReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
                     purchaseReceiptReport.setWarehousingDate(warehouseInOutInfo.getInOutDate());
                     purchaseReceiptReport.setProtein(warehouseInOutDetail.getProtein());
                     purchaseReceiptReport.setWaterContent(warehouseInOutDetail.getWaterContent());
@@ -479,6 +480,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                     salesDeliveryReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
                     salesDeliveryReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
                     salesDeliveryReport.setCarNo(warehouseInOutInfo.getCarNo());
+                    salesDeliveryReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
                     salesDeliveryReport.setRetrievalDate(warehouseInOutInfo.getInOutDate());
                     salesDeliveryReport.setProtein(warehouseInOutDetail.getProtein());
                     salesDeliveryReport.setWaterContent(warehouseInOutDetail.getWaterContent());
@@ -506,6 +508,31 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         salesDeliveryReport.setCustomerConfirmationStatus("否");
                     }
                     salesDeliveryReportService.insert(salesDeliveryReport);
+
+                    boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesDeliveryReport.getWorkflowId());
+                    // 不是退回的单子
+                    if (isStartWorkflow) {
+                        Workflow workflow = workflowService
+                                .findLatestWorkflowByBusinessCode("SALE-RECEIPT-REPORT");
+                        // 没配置审核流程,直接结束并处理信息
+                        if (workflow == null) {
+                            throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                        }
+                        // 开启审核流
+                        else {
+
+                            // 设置状态 已提交审核
+                            salesDeliveryReport.setWorkflowId(workflow.getId());
+                            salesDeliveryReportService.updateById(salesDeliveryReport);
+                            workflowService.startInstance(workflow.getId(), salesDeliveryReport.getId());
+                        }
+                    }
+                    // 退回的单子 再启用
+                    else {
+
+                        salesDeliveryReportService.updateById(salesDeliveryReport);
+                        workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
+                    }
                 }
                 warehouseInOutInfo.setStatusFlag(StatusEnum.SUBMITTED.getFlag());
                 warehouseInOutInfo.setStatus(StatusEnum.SUBMITTED.getName());

+ 50 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/SaleCloseReportListener.java

@@ -0,0 +1,50 @@
+package com.yh.saas.plugin.yiliangyiyun.workflow;
+
+import com.yh.saas.common.support.workflow.AbstractWorkflowTaskListener;
+import com.yh.saas.common.support.workflow.annotation.WorkflowTaskListener;
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseClosingReport;
+import com.yh.saas.plugin.yiliangyiyun.entity.SalesClosingReport;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchaseClosingReportService;
+import com.yh.saas.plugin.yiliangyiyun.service.ISalesClosingReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@WorkflowTaskListener(name = "统计报表", group = "销售平仓统计")
+public class SaleCloseReportListener extends AbstractWorkflowTaskListener {
+
+    private static final long serialVersionUID = 4103656734835351132L;
+
+    @Autowired
+    private ISalesClosingReportService salesClosingReportService;
+
+    @Override
+    public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
+        SalesClosingReport salesClosingReport = salesClosingReportService.selectById(businessKey);
+        if (salesClosingReport == null) {
+            return;
+        }
+        if (processIsEnd) {
+            salesClosingReport.setStatusFlag(StatusEnum.ORDER_PASSED.getFlag());
+            salesClosingReport.setStatus(StatusEnum.ORDER_PASSED.getName());
+            salesClosingReport.setWorkflowId(null);
+            salesClosingReport.setApproveStatus(null);
+        } else {
+            salesClosingReport.setApproveStatus(status);
+        }
+        salesClosingReportService.updateAllColumnById(salesClosingReport);
+    }
+
+    @Override
+    public void handleRejectApplicationRepulsed(String workflowId, String businessKey, boolean needReapply) {
+        SalesClosingReport salesClosingReport = salesClosingReportService.selectById(businessKey);
+        if (salesClosingReport == null) {
+            return;
+        }
+        salesClosingReport.setStatusFlag(StatusEnum.TASK_RETURN.getFlag());
+        salesClosingReport.setStatus(StatusEnum.TASK_RETURN.getName());
+        salesClosingReport.setApproveStatus(null);
+        salesClosingReportService.updateAllColumnById(salesClosingReport);
+
+    }
+
+}

+ 51 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/SaleOutReportListener.java

@@ -0,0 +1,51 @@
+package com.yh.saas.plugin.yiliangyiyun.workflow;
+
+import com.yh.saas.common.support.workflow.AbstractWorkflowTaskListener;
+import com.yh.saas.common.support.workflow.annotation.WorkflowTaskListener;
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseReceiptReport;
+import com.yh.saas.plugin.yiliangyiyun.entity.SalesDeliveryReport;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchaseReceiptReportService;
+import com.yh.saas.plugin.yiliangyiyun.service.ISalesDeliveryReportService;
+import com.yh.saas.plugin.yiliangyiyun.service.ISearchRecordsInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@WorkflowTaskListener(name = "统计报表", group = "销售出库统计")
+public class SaleOutReportListener extends AbstractWorkflowTaskListener {
+
+    private static final long serialVersionUID = 4103656734835351132L;
+
+    @Autowired
+    private ISalesDeliveryReportService salesDeliveryReportService;
+
+    @Override
+    public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
+        SalesDeliveryReport salesDeliveryReport = salesDeliveryReportService.selectById(businessKey);
+        if (salesDeliveryReport == null) {
+            return;
+        }
+        if (processIsEnd) {
+            salesDeliveryReport.setStatusFlag(StatusEnum.ORDER_PASSED.getFlag());
+            salesDeliveryReport.setStatus(StatusEnum.ORDER_PASSED.getName());
+            salesDeliveryReport.setWorkflowId(null);
+            salesDeliveryReport.setApproveStatus(null);
+        } else {
+            salesDeliveryReport.setApproveStatus(status);
+        }
+        salesDeliveryReportService.updateAllColumnById(salesDeliveryReport);
+    }
+
+    @Override
+    public void handleRejectApplicationRepulsed(String workflowId, String businessKey, boolean needReapply) {
+        SalesDeliveryReport salesDeliveryReport = salesDeliveryReportService.selectById(businessKey);
+        if (salesDeliveryReport == null) {
+            return;
+        }
+        salesDeliveryReport.setStatusFlag(StatusEnum.TASK_RETURN.getFlag());
+        salesDeliveryReport.setStatus(StatusEnum.TASK_RETURN.getName());
+        salesDeliveryReport.setApproveStatus(null);
+        salesDeliveryReportService.updateAllColumnById(salesDeliveryReport);
+
+    }
+
+}