From fb65ffe3606482e15bcdf1fd5adfb1acb1b8e846 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 16 八月 2023 11:24:49 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmMes

---
 server/src/main/java/doumeemes/api/ext/PlansExtController.java                          |    1 
 server/src/main/java/doumeemes/service/business/impl/WOutboundServiceImpl.java          |    3 +
 server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java |   34 ++++++++--------
 server/src/main/java/doumeemes/api/ext/SalaryParamExtController.java                    |    2 
 server/src/main/java/doumeemes/dao/ext/vo/PlansExtListVO.java                           |    6 +++
 server/src/main/java/doumeemes/config/shiro/ShiroRealm.java                             |   12 +++---
 server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java                |   23 ++++++++++-
 server/src/main/resources/mappers/PlansExtMapper.xml                                    |    4 +-
 server/src/main/resources/mappers/WorkPlansExtMapper.xml                                |    2 
 9 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/server/src/main/java/doumeemes/api/ext/PlansExtController.java b/server/src/main/java/doumeemes/api/ext/PlansExtController.java
index 7741d95..27cc2d0 100644
--- a/server/src/main/java/doumeemes/api/ext/PlansExtController.java
+++ b/server/src/main/java/doumeemes/api/ext/PlansExtController.java
@@ -223,7 +223,6 @@
         return ApiResponse.success(plansExtService.pageCount(param));
     }
 
-
     @ApiOperation("涓�閿姤宸�")
     @PostMapping("/autoWorkReport")
     public ApiResponse autoWorkReport (@RequestBody AutoWorkReportDTO autoWorkReportDTO) {
diff --git a/server/src/main/java/doumeemes/api/ext/SalaryParamExtController.java b/server/src/main/java/doumeemes/api/ext/SalaryParamExtController.java
index 8d38ddf..4eec3eb 100644
--- a/server/src/main/java/doumeemes/api/ext/SalaryParamExtController.java
+++ b/server/src/main/java/doumeemes/api/ext/SalaryParamExtController.java
@@ -79,7 +79,7 @@
     @ApiOperation("鏍规嵁瀵硅薄淇℃伅鏌ヨ")
     @PostMapping("/queryOne")
     @RequiresPermissions("business:salaryparam:query")
-    public ApiResponse queryOne(@RequestBody SalaryParam salaryParam) {
+    public ApiResponse<SalaryParam> queryOne(@RequestBody SalaryParam salaryParam) {
         SalaryParam data = salaryParamService.findOne(salaryParam);
         return ApiResponse.success(data);
     }
diff --git a/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java b/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
index e130db9..ab1dcf7 100644
--- a/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
+++ b/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
@@ -131,9 +131,9 @@
             if(com == null){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヨ处鎴峰紓甯革紒");
             }
-            if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氬凡杩囩鐢紒");
-            }
+//            if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){
+//                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氬凡杩囩鐢紒");
+//            }
             if(com.getOepnValidDate() != null && com.getOepnValidDate().before(new Date())){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氬凡杩囦娇鐢ㄦ湁鏁堟湡锛�");
             }
@@ -146,9 +146,9 @@
             if(cu == null){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱敤鎴蜂笉瀛樺湪锛�");
             }
-            if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱敤鎴峰凡绂佺敤锛�");
-            }
+//            if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){
+//                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱敤鎴峰凡绂佺敤锛�");
+//            }
             rootDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getRootDepartId());
             comDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getComDepartId());
             depart = departmentExtService.getModelById(c.getCompanyId(),cu.getDepartmentId());
diff --git a/server/src/main/java/doumeemes/dao/ext/vo/PlansExtListVO.java b/server/src/main/java/doumeemes/dao/ext/vo/PlansExtListVO.java
index a9387d4..bd47d2a 100644
--- a/server/src/main/java/doumeemes/dao/ext/vo/PlansExtListVO.java
+++ b/server/src/main/java/doumeemes/dao/ext/vo/PlansExtListVO.java
@@ -189,4 +189,10 @@
 
     @ApiModelProperty(value = "宸茬敓浜ф暟閲�")
     private Integer produceNum;
+
+    @ApiModelProperty(value = "鏄惁鏈塨om閰嶇疆 0鏃� 1鏈�", example = "1")
+    private Integer hasBom;
+    @ApiModelProperty(value = "bom鎶曟枡鏂瑰紡 0鎺ㄥ紡 1鎷夊紡", example = "1")
+    private Integer bomType;
+
 }
diff --git a/server/src/main/java/doumeemes/service/business/impl/WOutboundServiceImpl.java b/server/src/main/java/doumeemes/service/business/impl/WOutboundServiceImpl.java
index d82226a..67abb5c 100644
--- a/server/src/main/java/doumeemes/service/business/impl/WOutboundServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/business/impl/WOutboundServiceImpl.java
@@ -2126,6 +2126,9 @@
             WOutboundInBodyBean wOutboundInBodyBean = wOutboundInBodyBeans.get(Constants.ZERO);
             //绱鍏ュ簱鏁伴噺
             wOutboundInBodyBean.setNum(wOutboundInBodyBeans.stream().map(s -> s.getNum()).reduce(BigDecimal.ZERO, BigDecimal::add));
+            if(wOutboundInBodyBean.getNum().compareTo(BigDecimal.ZERO)<=Constants.ZERO){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鏁伴噺寮傚父,璇锋鏌ユ暟閲�!");
+            }
             WOutboundDetail wOutboundDetail = new WOutboundDetail();
             //鏌ヨ鐗╂枡鏁版嵁
             MaterialDistribute materialDistribute = materialDistributeMapper.selectById(wOutboundInBodyBean.getMaterialId());
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 10f2345..4bb8e2c 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
@@ -16,6 +16,7 @@
 import doumeemes.core.utils.excel.EasyExcelUtil;
 import doumeemes.core.utils.redis.RedisUtil;
 import doumeemes.dao.business.PlansMapper;
+import doumeemes.dao.business.WorkorderMapper;
 import doumeemes.dao.business.dto.*;
 import doumeemes.dao.business.model.*;
 import doumeemes.dao.ext.*;
@@ -65,7 +66,8 @@
     private WorkorderHistoryExtMapper workorderHistoryExtMapper;
     @Autowired
     private WorkorderRecordExtMapper workorderRecordExtMapper;
-
+    @Autowired
+    private WorkorderMapper workorderMapper;
     @Autowired
     private RouteProcedureExtMapper routeProcedureExtMapper;
     @Autowired
@@ -140,6 +142,19 @@
 //        //缁熻宸插畬宸ユ暟閲�
 //        param.setStatus(Constants.WORKORDER_STATUS.done);
 //        plan.setDoneNum(workorderExtMapper.sumOrderNum(param));
+        QueryBomExtDTO bb = new QueryBomExtDTO();
+        bb.setDepartId(plan.getDepartId());
+        bb.setDeleted(Constants.ZERO);
+        bb.setRootDepartId(user.getRootDepartment().getId());
+        bb.setMaterialId(plan.getMaterialId());
+        bb.setProcedureId(plan.getProcedureId());
+        BomExtListVO versionBom = bomExtMapper.selectByModel( bb);
+        if(versionBom == null || StringUtils.isBlank(versionBom.getVersion()) || versionBom.getBomVersionId() == null){
+            plan.setHasBom(Constants.ZERO);
+        }else {
+            plan.setBomType(Constants.formatIntegerNum(versionBom.getType()));
+            plan.setHasBom(Constants.ONE);
+        }
         return plan;
     }
 
@@ -601,7 +616,7 @@
         if(Constants.equalsInteger(mp.getPaused(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝璁″垝宸叉殏鍋滐紒");
         }
-        if(Constants.formatIntegerNum(mp.getDistributNum())+thisPlanNum > Constants.formatIntegerNum(mp.getNum())){
+        if(Constants.formatIntegerNum(mp.getWorkorderDistributNum())+thisPlanNum > Constants.formatIntegerNum(mp.getNum())){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝绱鍒嗛厤鏁伴噺澶т簬璁″垝鏁伴噺锛�");
         }
         if(!Constants.equalsInteger(mp.getStatus(),Constants.PLAN_STATUS.publish)&&!Constants.equalsInteger(mp.getStatus(),Constants.PLAN_STATUS.distribute)){
@@ -1582,7 +1597,8 @@
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍙傛暟閿欒锛氫骇鍑烘暟鎹�");
         }
         //鏌ヨ宸ュ簭璁″垝宸插垎閰嶆暟閲�
-        List<Workorder> workorderList = workorderExtMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId()).notIn("STATUS",7,8));
+        List<Workorder> workorderList = workorderMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId())
+                .notIn("STATUS",7,8));
         //鏈浜у嚭鏁伴噺
         BigDecimal num = autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum().add(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum());
         if(num.compareTo(BigDecimal.ZERO)<=Constants.ZERO){
@@ -1610,6 +1626,7 @@
             workorderRecordStandardService.createMaterialStandard(createMaterialDTO);
         }
         //宸ュ崟浜у嚭璁板綍
+        autoWorkReportDTO.getCreateWorkorderRecordDTO().setWorkorderId(workorder.getId());
         workorderRecordStandardService.createWorkorderRecord(autoWorkReportDTO.getCreateWorkorderRecordDTO(),user);
         //宸ュ崟鎶ュ伐
         workorderRecordStandardService.comfirmDone(workorder);
diff --git a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
index ffb5760..17b1c9d 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
@@ -669,13 +669,13 @@
             if (bomDetailList == null || bomDetailList.size() == 0) {
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝璇ョ敓浜х墿鏂欑殑bom閰嶇疆鏈夎锛岃鑱旂郴绠$悊鍛橈紒");
             }
-            for (BomDetailExtListVO i :bomDetailList) {
-                //鏌ヨ鏄惁鎶曟枡
-                if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>()
-                        .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏈姇鏂橞OM鐗╂枡锛屾棤娉曡繘琛屾姤宸�");
-                }
-            }
+//            for (BomDetailExtListVO i :bomDetailList) {
+//                //鏌ヨ鏄惁鎶曟枡
+//                if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>()
+//                        .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){
+//                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏈姇鏂橞OM鐗╂枡锛屾棤娉曡繘琛屾姤宸�");
+//                }
+//            }
         }
 
         WOutbound outbound = new WOutbound();
@@ -833,16 +833,16 @@
                 }
                 //濡傛灉鏄骇鍑�
                 mp.setHasProduceNum(Constants.formatBigdecimal(tModel.getNum()).intValue()+Constants.formatIntegerNum(mp.getHasProduceNum()));
-                if(tModel.getDoneType() == null){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝宸ヨ鍣ㄥ叿銆�"+tModel.getAmodel().getCode()+"銆戜骇鍑鸿川閲忓睘鎬т负绌猴紝鏃犳硶鎶ュ伐锛�");
-                }
-                if(!Constants.equalsInteger(tModel.getDoneType(),Constants.ZERO)){
-                    //濡傛灉涓嶈壇锛岀疮璁″伐鍗曠殑涓嶈壇浜у嚭
-                    mp.setUnqualifiedNum(Constants.formatIntegerNum(mp.getUnqualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
-                }else{
-                    //濡傛灉鏄悎鏍硷紝绱宸ュ崟鐨勫悎鏍兼暟閲�
-                    mp.setQualifiedNum(Constants.formatIntegerNum(mp.getQualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
-                }
+//                if(tModel.getDoneType() == null){
+//                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝宸ヨ鍣ㄥ叿銆�"+tModel.getAmodel().getCode()+"銆戜骇鍑鸿川閲忓睘鎬т负绌猴紝鏃犳硶鎶ュ伐锛�");
+//                }
+//                if(!Constants.equalsInteger(tModel.getDoneType(),Constants.ZERO)){
+//                    //濡傛灉涓嶈壇锛岀疮璁″伐鍗曠殑涓嶈壇浜у嚭
+//                    mp.setUnqualifiedNum(Constants.formatIntegerNum(mp.getUnqualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
+//                }else{
+//                    //濡傛灉鏄悎鏍硷紝绱宸ュ崟鐨勫悎鏍兼暟閲�
+//                    mp.setQualifiedNum(Constants.formatIntegerNum(mp.getQualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
+//                }
 
                 //鐗╂枡+鎵规+宸ュ簭+璐ㄩ噺灞炴�у幓閲�
                 WOutboundDetail detail =getWoutbondDetailByList(tModel,detailList);
diff --git a/server/src/main/resources/mappers/PlansExtMapper.xml b/server/src/main/resources/mappers/PlansExtMapper.xml
index 4714cc8..3ae57d4 100644
--- a/server/src/main/resources/mappers/PlansExtMapper.xml
+++ b/server/src/main/resources/mappers/PlansExtMapper.xml
@@ -123,7 +123,7 @@
   <select id="selectByModel" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultMap="PlansExtListVO">
   SELECT
   `a`.*
-    ,(  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status !=6) AS workorderDistributNum
+    ,ifnull((  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status not in (7,8) ),0) AS workorderDistributNum
     from plans a
     <where>
     <if test="id != null">
@@ -363,7 +363,7 @@
       `usermodel`.`SYSTEMID` AS USERMODEL_SYSTEMID,
       `usermodel`.`INVALID_TIME` AS USERMODEL_INVALID_TIME,
       `usermodel`.`TYPE` AS USERMODEL_TYPE
-    ,(  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0 AND b.PLAN_ID = a.id  and b.status !=6) AS workorderDistributNum ,
+    , ifnull((  SELECT sum( b.PLAN_NUM ) FROM  workorder b  WHERE b.deleted = 0  AND b.PLAN_ID = a.id  and b.status !=6),0) AS workorderDistributNum ,
     `mmodel`.name as materialName , `mmodel`.code as materialCode ,`fmodel`.name as factoryName , `pmodel`.name as produceName ,
       concat(`usermodel`.realname,' ',`usermodel`.mobile) as planUserName , `umodel`.name as unitName ,
       w.PLAN_CODE as workPlanCode , w.SALESORDER as salesOrder ,
diff --git a/server/src/main/resources/mappers/WorkPlansExtMapper.xml b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
index 5ff0a6b..56afe26 100644
--- a/server/src/main/resources/mappers/WorkPlansExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
@@ -168,7 +168,7 @@
         AND concat(#{planDateEnd},' 23:59:59') >= `a`.`PLAN_DATE`
       </if>
     </where>
-        order by a.PLAN_DATE desc, a.CREATE_TIME  desc
+        order by a.START_DATE desc, a.CREATE_TIME  desc
   </select>
 
 

--
Gitblit v1.9.3