From 533fd0d843792fc886771993a0d45b4e5876011c Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 17 八月 2023 15:02:32 +0800
Subject: [PATCH] 111

---
 server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
index d283106..cea6336 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
@@ -1585,6 +1585,12 @@
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
     @Override
     public void autoWorkReport(LoginUserInfo user, AutoWorkReportDTO autoWorkReportDTO){
+        if(Objects.isNull(autoWorkReportDTO)
+            || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO())
+            || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum())|| autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum().compareTo(BigDecimal.ZERO) < Constants.ZERO
+            || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum())|| autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum().compareTo(BigDecimal.ZERO) < Constants.ZERO){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
         //鏌ヨ宸ュ伐搴忚鍒掔姸鎬�
         Plans plans = plansExtMapper.selectById(autoWorkReportDTO.getPlansId());
         if(Objects.isNull(plans)){
@@ -1597,7 +1603,7 @@
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"宸ュ簭璁″垝宸叉殏鍋滐紝鏃犳硶鎿嶄綔");
         }
         if(Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO())){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍙傛暟閿欒锛氫骇鍑烘暟鎹�");
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鍙傛暟閿欒锛氫骇鍑烘暟鎹�");
         }
         //鏌ヨ宸ュ簭璁″垝宸插垎閰嶆暟閲�
         List<Workorder> workorderList = workorderMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId())
@@ -1620,7 +1626,7 @@
         param.setProUserList(autoWorkReportDTO.getProUserList());
         param.setPlanNum(num.intValue());
         //鐢熸垚宸ュ崟淇℃伅
-        Workorder workorder = this.distributeDone(user,param,plans.getNum());
+        Workorder workorder = this.distributeDone(user,param,num.intValue());
         //宸ュ崟鎶曟枡璁板綍
         CreateMaterialDTO createMaterialDTO = new CreateMaterialDTO();
         if(!Objects.isNull(autoWorkReportDTO.getRecordList())&&autoWorkReportDTO.getRecordList().size()>Constants.ZERO){
@@ -1632,7 +1638,7 @@
         autoWorkReportDTO.getCreateWorkorderRecordDTO().setWorkorderId(workorder.getId());
         WorkorderRecord workorderRecord = workorderRecordStandardService.createWorkorderRecord(autoWorkReportDTO.getCreateWorkorderRecordDTO(),user);
         //宸ュ崟鎶ュ伐
-        workorderRecordStandardService.comfirmDone(workorder);
+        workorderRecordStandardService.comfirmDone(workorder,false);
         //鏇存柊宸ュ崟鐘舵��
         if(num.compareTo(BigDecimal.valueOf(surplusNum))==Constants.ZERO){
             plans.setStatus(Constants.PLAN_STATUS.done);
@@ -1642,6 +1648,8 @@
             }
         }
         plansExtMapper.updateById(plans);
+        //鍙戦�佹秷鎭槦鍒楀鐞嗗垎浜搷浣�
+        workorderExtService.statisticNum(workorder);
         //瀛樺偍鎶ュ伐涓嶈壇椤规暟鎹�
         if(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum().compareTo(BigDecimal.ZERO)<=Constants.ZERO){
             if(!Objects.isNull(autoWorkReportDTO.getCreateUnqualifiedDTOList())&&autoWorkReportDTO.getCreateUnqualifiedDTOList().size()>Constants.ZERO){

--
Gitblit v1.9.3