wangming vor 1 Jahr
Ursprung
Commit
367a9f7b0c

+ 5 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpDao.java

@@ -33,13 +33,16 @@ public interface ZhcxOutsideInspectionItpDao extends BaseMapper<ZhcxOutsideInspe
     @Select("<script>" +
             "SELECT  " +
             " itp.*,zoiisd.SUPERVISION, zoiisd.INSPECTIONCONCLUSION, zoiisd.REFUSEREASON,  " +
-            " zipn.ISSUPP, zsm.\"TYPE\" AS subcontractortype, so.FULLNAME as threelevel, zsm.COMPANY_NAME as fourbase " +
+            " zipn.ISSUPP, zsm.\"TYPE\" AS subcontractortype, so.FULLNAME as threelevel, zsm.COMPANY_NAME as fourbase," +
+            " bo.FULLNAME as companyname " +
             "FROM  " +
             " ZHCX_OUTSIDE_INSPECTION_ITP itp  " +
             "JOIN ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH zoiisd ON zoiisd.ITPID = itp.ID " +
             "LEFT JOIN ZHCX_ITP_PROJECT_NODES zipn on zipn.ID = itp.INSPECTIONCONTENTID  " +
             "LEFT JOIN ZHCX_SUBCONTRACTOR_MANAGE zsm ON zsm.ID = itp.SUBCONTRACTORID " +
-            "left join SYS_ORGANIZATION so on so.ID = itp.WORKSHOPID" +
+            "left join SYS_ORGANIZATION so on so.ID = itp.WORKSHOPID " +
+            "left join SYS_ORGANIZATION co on co.ID = itp.DEPARTID " +
+            "left join SYS_ORGANIZATION bo on bo.ID = co.PID " +
             "<where>" +
             "<if test='startTime != null and endTime != null'>" +
             "   AND RESERVATIONINSPECTIONTIME BETWEEN #{startTime} AND #{endTime}  and LIFECYCLE = '10'" +

+ 20 - 4
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -781,13 +781,29 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
      * @return
      */
     private ZhcxInsideInspectionDo changeSupervision(InsideOperDto inOper, InsideInspectionDispatchRequest req) {
-        List<Map<String, String>> laboratoryList = dao.getLaboratoryByCheckId(req.getSupervisionId());
-        if(ObjectUtil.isEmpty(laboratoryList)) {
+        ZhcxInsideInspectionDo laboratory = getLaboratoryByCheckId(req.getSupervisionId());
+
+        if(ObjectUtil.isNull(laboratory)) {
             throw new CustomException("单据号:".concat(inOper.getInspection().getInspectioncode()).concat("分配检验员暂无检验室"));
         }
-        ZhcxInsideInspectionDo inspection = new ZhcxInsideInspectionDo();
-        inspection.setId(inOper.getInspection().getId());
+        laboratory.setId(inOper.getInspection().getId());
+        return laboratory;
+    }
 
+    /**
+     * 获取检验室班组信息
+     *
+     * @param checkerId
+     * @return
+     */
+    private ZhcxInsideInspectionDo getLaboratoryByCheckId(String checkerId) {
+        List<Map<String, String>> laboratoryList = dao.getLaboratoryByCheckId(checkerId);
+
+        if(ObjectUtil.isEmpty(laboratoryList)) {
+            return null;
+        }
+
+        ZhcxInsideInspectionDo inspection = new ZhcxInsideInspectionDo();
         Map<String, String> row30 = null;
         for(Map<String, String> row : laboratoryList) {
             if("30".equals(row.get("ORGTYPE"))) {

+ 56 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionItpServiceImpl.java

@@ -11,6 +11,7 @@ import cn.hutool.core.util.ZipUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.rongwei.bscommon.sys.dao.ZhcxInsideInspectionDao;
 import com.rongwei.bscommon.sys.feign.BsPlatformService;
 import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
@@ -104,6 +105,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Autowired
     private ZhcxOutsideInspectionSyncRecordService syncRecordService;
 
+    @Autowired
+    private ZhcxInsideInspectionDao insideInspectionDao;
+
     /**
      * 保存外部报验单
      *
@@ -113,6 +117,8 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Transactional
     public void insertInspection(OutsideInspectionInsertRequest req) {
 
+
+
         //保存单据
         try {
             sysGeneralCRUDService.generalMsInsert(req.getInsert());
@@ -888,7 +894,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         ZhcxOutsideInspectionItpDo updateEntity = new ZhcxOutsideInspectionItpDo();
         updateEntity.setId(itpDo.getId());
         updateEntity.setInspectioncode(genCode());
-        //构件
+        //设值构件
         ZhcxItpProjectNodesDo structre = itpProjectNodesService.getById(itpDo.getStructureid());
         if(ObjectUtil.isNotNull(structre)) {
             StringBuilder sb = new StringBuilder();
@@ -908,11 +914,16 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
             }
 
         }
-        //报验点
+
+        //设值报验点
         ZhcxItpProjectNodesDo inspectionContentPoint = itpProjectNodesService.getById(itpDo.getInspectioncontentid());
         if(ObjectUtil.isNotNull(inspectionContentPoint) && ObjectUtil.isNotEmpty(inspectionContentPoint.getNodename())) {
             updateEntity.setInspectionenpoint(inspectionContentPoint.getEnname());
         }
+
+        //设值检验员班组检验室
+        updateSetLaboratoryByCheckerId(itpDo.getCheckerid(), updateEntity);
+
         updateById(updateEntity);
 
         //操作记录
@@ -921,6 +932,48 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         zhcxOutsideInspectionItpOperLogService.save(itpLog);
     }
 
+    /**
+     * 设置检验室和班组
+     *
+     * @param checkerId
+     * @param updateEntity
+     */
+    private void updateSetLaboratoryByCheckerId(String checkerId, ZhcxOutsideInspectionItpDo updateEntity) {
+        List<Map<String, String>> laboratoryList = insideInspectionDao.getLaboratoryByCheckId(checkerId);
+        if(ObjectUtil.isEmpty(laboratoryList)) {
+            throw new CustomException("检验员暂无检验室");
+        }
+
+        Map<String, String> row30 = null;
+        for(Map<String, String> row : laboratoryList) {
+            if("30".equals(row.get("ORGTYPE"))) {
+                row30 = row;
+                break;
+            }
+        }
+
+        //不存在班组,按检验室处理
+        if(ObjectUtil.isNull(row30)) {
+            //检验室
+            updateEntity.setLaboratoryid(laboratoryList.get(0).get("ID"));
+            updateEntity.setLaboratoryname(laboratoryList.get(0).get("SHORTNAME"));
+            updateEntity.setLaboratorypathid(laboratoryList.get(0).get("FULLPID"));
+            //班组
+            updateEntity.setTeamgroupid("");
+            updateEntity.setTeamgroupname("");
+            updateEntity.setTeamgrouppathid("");
+        } else {
+            //检验室
+            updateEntity.setLaboratoryid(row30.get("PID"));
+            updateEntity.setLaboratoryname(row30.get("PSHORTNAME"));
+            updateEntity.setLaboratorypathid(row30.get("PFULLPID"));
+            //班组
+            updateEntity.setTeamgroupid(row30.get("ID"));
+            updateEntity.setTeamgroupname(row30.get("SHORTNAME"));
+            updateEntity.setTeamgrouppathid(row30.get("FULLPID"));
+        }
+    }
+
     /**
      * 生成派单
      * 1、校验是否已存在
@@ -1160,7 +1213,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 sync.setIssupp("n");
             }
 
-            sync.setBase("长兴分公司");
+            sync.setBase(sync.getCompanyname());
 
             //同步信息
             ZhcxOutsideInspectionSyncRecordDo record = new ZhcxOutsideInspectionSyncRecordDo();

+ 3 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/OutsideInspactionSyncDto.java

@@ -202,4 +202,7 @@ public class OutsideInspactionSyncDto {
     @TableField("LAUNCHTYPE")
     @JsonIgnore
     private String launchtype;
+
+    @JsonIgnore
+    private String companyname;
 }