Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

ezhizao_zx před 10 měsíci
rodič
revize
d75ec980f3
19 změnil soubory, kde provedl 951 přidání a 56 odebrání
  1. 99 49
      src/main/java/cn/ezhizao/project/business/product/controller/BizCarrierController.java
  2. 1 0
      src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkController.java
  3. 107 0
      src/main/java/cn/ezhizao/project/business/product/controller/BizInspectionChamberController.java
  4. 494 4
      src/main/java/cn/ezhizao/project/business/product/controller/BizProcessInspecionController.java
  5. 2 2
      src/main/java/cn/ezhizao/project/business/product/domain/BizDaywork.java
  6. 35 0
      src/main/java/cn/ezhizao/project/business/product/domain/BizInspectionChamber.java
  7. 2 0
      src/main/java/cn/ezhizao/project/business/product/domain/BizLot.java
  8. 12 0
      src/main/java/cn/ezhizao/project/business/product/domain/BizProcessInspecion.java
  9. 31 0
      src/main/java/cn/ezhizao/project/business/product/mapper/BizInspectionChamberMapper.java
  10. 2 0
      src/main/java/cn/ezhizao/project/business/product/mapper/BizProcessInspecionMapper.java
  11. 32 0
      src/main/java/cn/ezhizao/project/business/product/service/IBizInspectionChamberService.java
  12. 2 0
      src/main/java/cn/ezhizao/project/business/product/service/IBizProcessInspecionService.java
  13. 45 0
      src/main/java/cn/ezhizao/project/business/product/service/impl/BizInspectionChamberServiceImpl.java
  14. 10 0
      src/main/java/cn/ezhizao/project/business/product/service/impl/BizProcessInspecionServiceImpl.java
  15. 7 0
      src/main/java/cn/ezhizao/project/system/controller/SysLoginController.java
  16. 11 0
      src/main/java/cn/ezhizao/project/system/domain/SysUser.java
  17. 30 0
      src/main/resources/mybatis/business/product/BizInspectionChamberMapper.xml
  18. 28 0
      src/main/resources/mybatis/business/product/BizProcessInspecionMapper.xml
  19. 1 1
      src/main/resources/mybatis/business/technologicalProcessDetailDrawing/BizTechnologicalProcessDetailDrawingMapper.xml

+ 99 - 49
src/main/java/cn/ezhizao/project/business/product/controller/BizCarrierController.java

@@ -16,6 +16,7 @@ import cn.ezhizao.project.business.carrierReject.service.IBizCarrierRejectServic
 import cn.ezhizao.project.business.product.domain.*;
 import cn.ezhizao.project.business.product.service.*;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -195,42 +196,91 @@ public class BizCarrierController extends BaseController {
 
         //是否是一箱多批
         if(bizDayworks.size() == 1){
-            //查询该批批次的序捡状态
-            BizProcessInspecion processInspecion =new BizProcessInspecion();
-            processInspecion.setCarrierId(bizDayworks.get(0).getId());
-
-            //根据报工信息查询说否有已完成的序检
-            List<BizProcessInspecion> processInspecions = bizProcessInspecionService.query().eq("daywork_id",bizDayworks.get(0).getId()).orderByDesc("create_time").list();
-            boolean perform = true;
-
-            //如果存在判断是是否有当前序的完成
-            if(processInspecions.size()>0) {
-                BizProcessInspecion inspection = processInspecions.get(0);
-                //如果存在判断是是否有当前序的完成
-                if (inspection.getStatus() != 1) {
-                    if (inspection.getStatus() == 0) {
-                        return AjaxResult.error("该批次序检未完成,不能周转。");
+            //判断检查
+            List<BizProcessInspecion> processInspectionList = bizProcessInspecionService.query().eq("daywork_id", bizDayworks.get(0).getId()).list();
+            if(!processInspectionList.isEmpty()) {
+                    //巡检
+                    List<BizProcessInspecion> patrolInspectionList = processInspectionList.stream()
+                            .filter(item -> item.getType().equals("patrolInspection") && item.getStatus() != 1 && item.getProcessStepNumber().equals(bizDaywork.getCurrentProcess().getProcessStepNumber()))
+                            .sorted(Comparator.comparing(BizProcessInspecion::getCreateTime).reversed())
+                            .collect(Collectors.toList());
+                    if (!patrolInspectionList.isEmpty()) {
+                       if(patrolInspectionList.get(0).getStatus().equals(0)) {
+                           return AjaxResult.error("该批次巡检未完成,不能周转。");
+                       }else {
+                           return AjaxResult.error("该批次巡检未合格,不能周转。");
+                       }
                     }
-                    if (inspection.getStatus() == 2) {
-                        return AjaxResult.error("该批次序检不合格,不能周转。");
+                    //交检
+                List<BizProcessInspecion> deliveryInspectionList = processInspectionList.stream()
+                        .filter(item -> item.getType().equals("deliveryInspection") && item.getAdoptStatus() != 1 && item.getProcessStepNumber().equals(bizDaywork.getCurrentProcess().getProcessStepNumber()))
+                        .sorted(Comparator.comparing(BizProcessInspecion::getCreateTime).reversed())
+                        .collect(Collectors.toList());
+                if (!deliveryInspectionList.isEmpty()) {
+                    if(deliveryInspectionList.get(0).getAdoptStatus().equals(0)) {
+                        return AjaxResult.error("该批次交检审核未完成,不能周转。");
+                    }else {
+                        return AjaxResult.error("该批次交检审核未合格,不能周转。");
                     }
-                    return AjaxResult.error("该批次序检未合格,不能周转。");
                 }
+
             }
+
+//            //查询该批批次的序捡状态
+//            BizProcessInspecion processInspecion =new BizProcessInspecion();
+//            processInspecion.setCarrierId(bizDayworks.get(0).getId());
+//
+//            //根据报工信息查询说否有已完成的序检
+//            List<BizProcessInspecion> processInspecions = bizProcessInspecionService.query().eq("daywork_id",bizDayworks.get(0).getId()).orderByDesc("create_time").list();
+//            boolean perform = true;
+//
 //            //如果存在判断是是否有当前序的完成
-//            if(processInspecions.size()>0){
-//                boolean isExist = bizDayworkItems.stream()
-//                        .filter(v -> v.getIsProcessInspection().equals(1))
-//                        .anyMatch(v -> v.getId().equals(processInspecion.getDayworkItemId()));
-//                if(!isExist){
+//            if(processInspecions.size()>0) {
+//                BizProcessInspecion inspection = processInspecions.get(0);
+//                //如果存在判断是是否有当前序的完成
+//                if (inspection.getStatus() != 1) {
+//                    if (inspection.getStatus() == 0) {
+//                        return AjaxResult.error("该批次序检未完成,不能周转。");
+//                    }
+//                    if (inspection.getStatus() == 2) {
+//                        return AjaxResult.error("该批次序检不合格,不能周转。");
+//                    }
 //                    return AjaxResult.error("该批次序检未合格,不能周转。");
 //                }
-//            }else{
-//                return AjaxResult.error("该批次序检未合格,不能周转。");
 //            }
+
         }else{
-            if(!selectProcessInspecion(bizDayworks,bizDayworkItems)){
-                return AjaxResult.error("该周转箱中批次序检未全部合格,不能周转。");
+            //判断检查
+            List<BizProcessInspecion> processInspectionList = bizProcessInspecionService.query().in("daywork_id", bizDayworks.stream().map(BizDaywork::getId).collect(Collectors.toList())).list();
+            if(!processInspectionList.isEmpty()) {
+                for (BizDaywork daywork : bizDayworks) {
+                    BizDayworkItem lastDayworkItem = bizDayworkItems.stream().filter(item -> item.getDayworkId().equals(bizDaywork.getId())).sorted(Comparator.comparing(BizDayworkItem::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
+                    //巡检
+                    List<BizProcessInspecion> patrolInspectionList = processInspectionList.stream()
+                            .filter(item -> item.getDayworkId().equals(daywork.getId()) && item.getType().equals("patrolInspection") &&  item.getStatus() != 1 && item.getProcessStepNumber().equals(lastDayworkItem.getProcessStepNumber()))
+                            .sorted(Comparator.comparing(BizProcessInspecion::getCreateTime).reversed())
+                            .collect(Collectors.toList());
+                    if (!patrolInspectionList.isEmpty()) {
+                        if (patrolInspectionList.get(0).getStatus().equals(0)) {
+                            return AjaxResult.error("该周转箱存在巡检未完成的批次,不能周转。");
+                        } else {
+                            return AjaxResult.error("该周转箱存在巡检未合格的批次,不能周转。");
+                        }
+                    }
+                    //交检
+                    List<BizProcessInspecion> deliveryInspectionList = processInspectionList.stream()
+                            .filter(item -> item.getType().equals("deliveryInspection") && item.getAdoptStatus() != 1 && item.getProcessStepNumber().equals(bizDaywork.getCurrentProcess().getProcessStepNumber()))
+                            .sorted(Comparator.comparing(BizProcessInspecion::getCreateTime).reversed())
+                            .collect(Collectors.toList());
+                    if (!deliveryInspectionList.isEmpty()) {
+                        if (deliveryInspectionList.get(0).getAdoptStatus().equals(0)) {
+                            return AjaxResult.error("该周转箱存在交检审核未合格的批次,不能周转。");
+                        } else {
+                            return AjaxResult.error("该周转箱存在交检审核未合格的批次,不能周转。");
+                        }
+                    }
+
+                }
             }
 
         }
@@ -241,28 +291,28 @@ public class BizCarrierController extends BaseController {
     }
 
     //查询一箱多批是否可以周转
-    private boolean selectProcessInspecion (List<BizDaywork> bizDayworks,List<BizDayworkItem> bizDayworkItems){
-        boolean perform = true;
-        for (BizDaywork bizDaywork : bizDayworks) {
-            //查询该批批次的序捡状态
-            BizProcessInspecion processInspecion =new BizProcessInspecion();
-            processInspecion.setCarrierId(bizDaywork.getId());
-
-            //根据报工信息查询序检查信息
-            List<BizProcessInspecion> processInspecions = bizProcessInspecionService.query().eq("daywork_id",bizDaywork.getId()).orderByDesc("create_time").list();
-            if(processInspecions.size()>0) {
-                BizProcessInspecion inspecion = processInspecions.get(0);
-                if (inspecion.getStatus() != 1) {
-                    perform = false;
-                }
-                //如果存在判断是是否有当前序的完成
-                else {
-                    perform = true;
-                }
-            }
-        }
-        return perform;
-    }
+//    private boolean selectProcessInspecion (List<BizDaywork> bizDayworks,List<BizDayworkItem> bizDayworkItems){
+//        boolean perform = true;
+//        for (BizDaywork bizDaywork : bizDayworks) {
+//            //查询该批批次的序捡状态
+//            BizProcessInspecion processInspecion =new BizProcessInspecion();
+//            processInspecion.setCarrierId(bizDaywork.getId());
+//
+//            //根据报工信息查询序检查信息
+//            List<BizProcessInspecion> processInspecions = bizProcessInspecionService.query().eq("daywork_id",bizDaywork.getId()).orderByDesc("create_time").list();
+//            if(processInspecions.size()>0) {
+//                BizProcessInspecion inspecion = processInspecions.get(0);
+//                if (inspecion.getStatus() != 1) {
+//                    perform = false;
+//                }
+//                //如果存在判断是是否有当前序的完成
+//                else {
+//                    perform = true;
+//                }
+//            }
+//        }
+//        return perform;
+//    }
 
     @Log(title = "检测箱号", businessType = BusinessType.SELECT)
     @PostMapping("/checkCarrier")

+ 1 - 0
src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkController.java

@@ -832,6 +832,7 @@ public class BizDayworkController extends BaseController {
     @Transactional
     @PostMapping
     public AjaxResult add(@RequestBody BizDaywork bizDaywork) throws NoSuchFieldException, IllegalAccessException {
+        System.out.println("新增报工数据:"+bizDaywork);
         if (bizDaywork.getId() == null) {
             //查询出该生产计划的投产总批数
             Integer lotNumber = bizDayworkService.getLotNumber(bizDaywork.getProductionPlanDetailId());

+ 107 - 0
src/main/java/cn/ezhizao/project/business/product/controller/BizInspectionChamberController.java

@@ -0,0 +1,107 @@
+package cn.ezhizao.project.business.product.controller;
+
+import java.util.List;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+import cn.ezhizao.project.business.product.domain.BizInspectionChamber;
+import cn.ezhizao.project.business.product.service.IBizInspectionChamberService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * 检测室配置Controller
+ *
+ * @author ezhizao
+ * @date 2024-08-06
+ */
+@RestController
+@RequestMapping("/business/inspectionChamber")
+public class BizInspectionChamberController extends BaseController
+{
+    @Resource
+    private IBizInspectionChamberService bizInspectionChamberService;
+
+    /**
+     * 查询检测室配置列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BizInspectionChamber bizInspectionChamber) throws NoSuchFieldException, IllegalAccessException
+    {
+        List<BizInspectionChamber> list = bizInspectionChamberService.getList(bizInspectionChamber);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出检测室配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:inspectionChamber:export')")
+    @Log(title = "检测室配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizInspectionChamber bizInspectionChamber) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizInspectionChamber);
+        List<BizInspectionChamber> list = bizInspectionChamberService.getList(bizInspectionChamber);
+        ExcelUtil<BizInspectionChamber> util = new ExcelUtil<BizInspectionChamber>(BizInspectionChamber.class);
+        util.exportExcel(response, list, "检测室配置数据");
+    }
+
+    /**
+     * 获取检测室配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:inspectionChamber:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(bizInspectionChamberService.getById(id));
+    }
+
+    /**
+     * 新增检测室配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:inspectionChamber:add')")
+    @Log(title = "检测室配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BizInspectionChamber bizInspectionChamber) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizInspectionChamber);
+        return toAjax(bizInspectionChamberService.save(bizInspectionChamber));
+    }
+
+    /**
+     * 修改检测室配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:inspectionChamber:edit')")
+    @Log(title = "检测室配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BizInspectionChamber bizInspectionChamber) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizInspectionChamber);
+        return toAjax(bizInspectionChamberService.updateById(bizInspectionChamber));
+    }
+
+    /**
+     * 删除检测室配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:inspectionChamber:remove')")
+    @Log(title = "检测室配置", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
+        return toAjax(bizInspectionChamberService.removeBatchByIds(ids));
+    }
+}

+ 494 - 4
src/main/java/cn/ezhizao/project/business/product/controller/BizProcessInspecionController.java

@@ -16,6 +16,8 @@ import cn.ezhizao.framework.redis.RedisCache;
 import cn.ezhizao.framework.web.controller.BaseController;
 import cn.ezhizao.framework.web.domain.AjaxResult;
 import cn.ezhizao.framework.web.page.TableDataInfo;
+import cn.ezhizao.project.business.BizInspectionStandardsCheck.domain.BizInspectionStandardsCheck;
+import cn.ezhizao.project.business.BizInspectionStandardsCheck.service.IBizInspectionStandardsCheckService;
 import cn.ezhizao.project.business.carrierReject.domain.BizCarrierReject;
 import cn.ezhizao.project.business.carrierReject.service.IBizCarrierRejectService;
 import cn.ezhizao.project.business.outsource.domain.BizOutsourcedOrderDetail;
@@ -24,6 +26,9 @@ import cn.ezhizao.project.business.outsource.service.IBizOutsourcedOrderDetailPr
 import cn.ezhizao.project.business.outsource.service.IBizOutsourcedOrderDetailService;
 import cn.ezhizao.project.business.product.domain.*;
 import cn.ezhizao.project.business.product.service.*;
+import cn.ezhizao.project.business.resourceGroup.domain.BizProductionResourceGroupDetail;
+import cn.ezhizao.project.business.resourceGroup.service.IBizProductionResourceGroupDetailService;
+import cn.ezhizao.project.business.resourceGroup.service.IBizProductionResourceGroupService;
 import cn.ezhizao.project.business.technologicalProcessDetail.domain.BizTechnologicalProcessDetail;
 import cn.ezhizao.project.business.technologicalProcessDetail.service.IBizTechnologicalProcessDetailService;
 import cn.ezhizao.project.system.domain.SysUser;
@@ -99,6 +104,12 @@ public class BizProcessInspecionController extends BaseController {
     private IBizDayworkItemConsultPictureService bizDayworkItemConsultPictureService;
     @Resource
     private RedisCache redisCache;
+    @Resource
+    private IBizProductionResourceGroupDetailService bizProductionResourceGroupDetailService;
+    @Resource
+    private IBizProductionResourceGroupService bizProductionResourceGroupService;
+    @Resource
+    private IBizInspectionStandardsCheckService bizInspectionStandardsCheckService;
 
     final private String processInspectionNoKey = "processInspectionCode";
 
@@ -118,12 +129,76 @@ public class BizProcessInspecionController extends BaseController {
             bizProcessInspecion.setStartTimeString(time + " 00:00:00");
             bizProcessInspecion.setEndTimeString(time + " 23:59:59");
         }
-
-
         List<BizProcessInspecion> list = bizProcessInspecionService.getList(bizProcessInspecion);
         return getDataTable(list);
     }
+//交检审核列表
+@PostMapping("/examineList")
+public TableDataInfo examineList(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
+
+    if (bizProcessInspecion.getStartTime() != null) {
+        Date startTimeDate = bizProcessInspecion.getStartTime();
+        // 使用 SimpleDateFormat 格式化 Date 对象为特定格式的字符串
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
+        String time = dateFormat.format(startTimeDate);
+
+        bizProcessInspecion.setStartTimeString(time + " 00:00:00");
+        bizProcessInspecion.setEndTimeString(time + " 23:59:59");
+    }
+    //交检审核人能看到的是交检操作者是自己所在的资源组的内容,且该批次未周转下道工序
+    //当前登陆者所在的资源组
+    Long loginUserId = SecurityUtils.getLoginUser().getUserId();
+    List<BizProductionResourceGroupDetail> resourceGroupDetailList = bizProductionResourceGroupDetailService.query()
+            .eq("dept_id", bizProcessInspecion.getDeptId())
+            .eq("common_id", loginUserId)
+            .eq("common_type", "person")
+            .list();
+    List<Long> resourceGroupIds = resourceGroupDetailList.stream().map(BizProductionResourceGroupDetail::getProductionResourceGroupId).collect(Collectors.toList());
+    if(resourceGroupIds.isEmpty()) {
+        return getDataTable(new ArrayList<>());
+    }
+    List<BizProcessInspecion> list = bizProcessInspecionService.getExaminList(bizProcessInspecion);
+    if(list.isEmpty()) {
+        return getDataTable(new ArrayList<>());
+    }
+    List<Long> dayworkIds = list.stream().map(BizProcessInspecion::getDayworkId).collect(Collectors.toList());
+    List<BizDayworkItem> dayworkItemList = bizDayworkItemService.query().in("daywork_id", dayworkIds).list();
+
+    List<Long> processInspectionUserIds = list.stream().map(BizProcessInspecion::getUserId).collect(Collectors.toList());
+    List<BizProductionResourceGroupDetail> resourceGroupList = bizProductionResourceGroupDetailService.query().eq("dept_id", bizProcessInspecion.getDeptId())
+            .in("common_id", processInspectionUserIds)
+            .eq("common_type", "person").list();
+    List<BizProcessInspecion> newList = new ArrayList<>();
+    for (BizProcessInspecion item : list) {
+        List<BizProductionResourceGroupDetail> detailList = resourceGroupList.stream()
+                .filter(resourceGroup -> resourceGroup.getCommonId().equals(item.getUserId()))
+                .collect(Collectors.toList());
+        for (BizProductionResourceGroupDetail info : detailList) {
+            if (resourceGroupIds.contains(info.getProductionResourceGroupId())) {
+                //判断如果已经转到下序,则列表不显示
+                BizDayworkItem lastDayworkItem = dayworkItemList.stream().filter(l -> item.getDayworkId().equals(l.getDayworkId())).sorted(Comparator.comparing(BizDayworkItem::getCreateTime).reversed()).collect(Collectors.toList()).get(0);
+                String lastProcessStepNumber = lastDayworkItem.getProcessStepNumber();
+                BizDayworkItem currentDayworkItem = dayworkItemList.stream().filter(l -> l.getId().equals(item.getDayworkItemId())).collect(Collectors.toList()).get(0);
+                String currentProcessStepNumber = currentDayworkItem.getProcessStepNumber();
+                if (lastProcessStepNumber.equals(currentProcessStepNumber)) {
+                    newList.add(item);
+                    break; // 退出内部的for循环
+                }
 
+            }
+        }
+    }
+    return getDataTable(newList);
+}
+    //修改交检审核状态
+    @PutMapping("/updateAdoptStatus")
+    public AjaxResult updateAdoptStatus(@RequestBody BizProcessInspecion bizProcessInspecion) {
+        Long userId = SecurityUtils.getLoginUser().getUserId();
+        bizProcessInspecion.setAdoptId(userId);
+        bizProcessInspecion.setAuditStatus(bizProcessInspecion.getAuditStatus());
+        bizProcessInspecionService.updateById(bizProcessInspecion);
+        return success();
+    }
     /**
      * 查询序检主列表(外协序检)
      */
@@ -218,13 +293,72 @@ public class BizProcessInspecionController extends BaseController {
         }
 
         lot.setAllCarrierName(dayworkItem.getCarrierName());
+        lot.setNickName(processInspecion.getNickName());
+        lot.setUserId(processInspecion.getUserId());
+        lot.setEquipmentDetailCode(processInspecion.getEquipmentDetailCode());
+        lot.setEquipmentDetailId(processInspecion.getEquipmentDetailId());
+        lot.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
+        lot.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
+        lot.setProcessId(dayworkItem.getProcessId());
         lot.setDayworkItemId(dayworkItem.getId());
-        lot.setCarrierCode(dayworkItem.getCarrierCode());
-        lot.setCarrierId(dayworkItem.getCarrierId());
+        lot.setCarrierCode(processInspecion.getCarrierCode());
+        lot.setCarrierId(processInspecion.getCarrierId());
         lot.setPudName(dayworkItem.getProdNum() == 0 ? lot.getProductionQuantity() : dayworkItem.getProdNum());
         processInspecion.setLot(lot);
         return success(processInspecion);
     }
+    //判断载具
+    @PostMapping("/checkCarrier")
+    public AjaxResult checkCarrier(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
+        String carrierCode = dayworkCarrier.getCarrierCode();
+        BizCarrier carrier = bizCarrierService.query().eq("code", carrierCode).eq("is_inspection",1).one();
+        if (carrier == null) {
+            return error("未找到该检测箱号");
+        }
+        //查询箱号是否废弃
+        BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).eq("is_abandoned", 1).last("limit 1").one();
+        if (carrierReject != null) {
+            return error("该检测载具已废弃");
+        }
+        //查找该箱号关联批次
+        List<BizDayworkCarrier> dayworkCarrierList = bizDayworkCarrierService.query().eq("carrier_id", carrier.getId()).eq("is_changed",0).list();
+        if (dayworkCarrierList.isEmpty()) {
+            return error("该检测载具未绑定批次");
+        }
+        return success();
+    }
+    //根据检测载具查询检测信息
+    @PostMapping("getInspectionInfoByInspectionCarrierCode")
+    public AjaxResult getInspectionInfoByInspectionCarrierCode(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
+        String carrierCode = dayworkCarrier.getCarrierCode();
+        BizCarrier carrier = bizCarrierService.query().eq("code", carrierCode).eq("is_inspection",1).one();
+        //查询箱号是否废弃
+        BizCarrierReject carrierReject = bizCarrierRejectService.query().eq("carrier_id", carrier.getId()).eq("deleted", 0).eq("is_abandoned", 1).last("limit 1").one();
+        //查找该箱号关联批次
+        List<BizDayworkCarrier> dayworkCarrierList = bizDayworkCarrierService.query().eq("carrier_id", carrier.getId()).eq("is_changed",0).list();
+        List<Long> processInspectionIds = dayworkCarrierList.stream().map(BizDayworkCarrier::getProcessInspectionId).collect(Collectors.toList());
+        List<BizProcessInspecion> processInspectionList = bizProcessInspecionService.getInfoByIds(processInspectionIds);
+
+        //咨询
+        List<BizDayworkItemConsult> itemConsults = bizDayworkItemConsultService.query().in("process_inspection_id", processInspectionIds).eq("is_process_inspection", 1).list();
+        //明细
+        List<BizProcessInspectionDetail> itemDetails = processInspectionDetailService.query().in("process_inspection_id", processInspectionIds).list();
+        //废品
+        List<BizDayworkItemReject> itemRejects = bizDayworkItemRejectService.query().in("process_inspection_id", processInspectionIds).list();
+        List<BizProcessInspecion> list = new ArrayList<>();
+        processInspectionIds.forEach(item ->{
+            BizProcessInspecion processInspection = new BizProcessInspecion();
+            processInspection = processInspectionList.stream().filter(x -> x.getId().equals(item)).collect(Collectors.toList()).get(0);
+            List<BizDayworkItemConsult> consults = itemConsults.stream().filter(x -> x.getProcessInspectionId().equals(item)).collect(Collectors.toList());
+            processInspection.setDayworkItemConsults(consults);
+            List<BizProcessInspectionDetail> details = itemDetails.stream().filter(x -> x.getProcessInspectionId().equals(item)).collect(Collectors.toList());
+            processInspection.setProcessInspectionDetails(details);
+            List<BizDayworkItemReject> rejects = itemRejects.stream().filter(x -> x.getProcessInspectionId().equals(item)).collect(Collectors.toList());
+            processInspection.setDayworkItemRejects(rejects);
+            list.add(processInspection);
+        });
+        return success(list);
+    }
 
 //    @PostMapping("/selectOutsourcedInspecion")
     public AjaxResult selectOutsourcedInspecion(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
@@ -957,6 +1091,7 @@ public class BizProcessInspecionController extends BaseController {
         processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
         processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
         processInspecion.setDayworkId(daywork.getId());
+        processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
         processInspecion.setProductionPlanId(daywork.getProductionPlanId());
         processInspecion.setDayworkItemId(dayworkItem.getId());
         processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
@@ -992,6 +1127,74 @@ public class BizProcessInspecionController extends BaseController {
 
         //保存
         bizProcessInspecionService.saveOrUpdate(processInspecion);
+        //移交仪器室
+        if(processInspecion.getFlag()) {
+            BizProcessInspecion inspection = new BizProcessInspecion();
+            inspection.setUserId(processInspecion.getLot().getUserId());
+            inspection.setNickName(processInspecion.getLot().getNickName());
+            inspection.setCarrierId(processInspecion.getCarrierId());
+            inspection.setCarrierCode(processInspecion.getCarrierCode());
+            inspection.setDayworkId(daywork.getId());
+            inspection.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
+            inspection.setProductionPlanId(daywork.getProductionPlanId());
+            inspection.setDayworkItemId(dayworkItem.getId());
+            inspection.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+            inspection.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+            inspection.setProductDescription(processInspecion.getLot().getProductDescription());
+            inspection.setLotId(processInspecion.getLot().getId());
+            inspection.setLotCode(processInspecion.getLot().getLotCode());
+            inspection.setDeptId(daywork.getDeptId());
+            inspection.setProductId(processInspecion.getLot().getProductId());
+            inspection.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
+            inspection.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
+            inspection.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
+            inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
+            inspection.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
+            inspection.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
+            inspection.setInspectionChamberId(processInspecion.getInspectionChamberId());
+            inspection.setReviewerId(SecurityUtils.getLoginUser().getUserId());
+            inspection.setProcessStepNumber(processInspecion.getProcessStepNumber());
+            inspection.setFromId(processInspecion.getId());
+            inspection.setType("instrumentRoomInspection");
+            if (inspection.getStartTime() == null) {
+                inspection.setStartTime(new Date());
+            }
+            bizProcessInspecionService.save(inspection);
+            //保存检查明细
+            List<BizInspectionStandardsCheck> inspectionStandardsCheckList = bizInspectionStandardsCheckService.query()
+                    .eq("inspection_code", "instrumentRoomInspection")
+                    .eq("product_id", inspection.getProductId())
+                    .eq("process_id", processInspecion.getLot().getProcessId()).list();
+            List<BizProcessInspectionDetail> detailList = new ArrayList<>();
+            inspectionStandardsCheckList.forEach(inspectionStandardsCheck -> {
+                BizProcessInspectionDetail detail = new BizProcessInspectionDetail();
+                detail.setId(null);
+                detail.setUserId(processInspecion.getLot().getUserId());
+                detail.setProcessInspectionId(inspection.getId());
+                detail.setDayworkId(0L);
+                detail.setProductionPlanId(daywork.getProductionPlanId());
+                detail.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+                detail.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+                detail.setLotId(processInspecion.getLot().getId());
+                detail.setDayworkItemId(dayworkItem.getId());
+                detail.setCheckStandard(inspectionStandardsCheck.getStandard());
+                detail.setInspectionStandardsId(inspectionStandardsCheck.getId());
+                detailList.add(detail);
+            });
+            if(!detailList.isEmpty()) {
+                processInspectionDetailService.saveBatch(detailList);
+            }
+            //绑定检测载具
+            BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
+            newDayworkCarrier.setDayworkId(inspection.getDayworkId());
+            newDayworkCarrier.setCarrierCode(inspection.getInspectionCarrierCode());
+            newDayworkCarrier.setCarrierId(inspection.getInspectionCarrierId());
+            newDayworkCarrier.setLotCode(inspection.getLotCode());
+            newDayworkCarrier.setLotId(inspection.getLotId());
+            newDayworkCarrier.setProductionPlanDetailId(inspection.getProductionPlanDetailId());
+            newDayworkCarrier.setProcessInspectionId(inspection.getId());
+            bizDayworkCarrierService.save(newDayworkCarrier);
+        }
 
         if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
             // 该检测载具需要绑定到当前批次
@@ -1077,6 +1280,12 @@ public class BizProcessInspecionController extends BaseController {
         dayworkItem.setIsProcessInspection(1);
         return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
     }
+    //查找该检查是否已经移交给了仪器室
+    @PostMapping("/getInstrumentRoomInspection")
+    public AjaxResult getInstrumentRoomInspection(@RequestBody BizProcessInspecion bizProcessInspecion) throws NoSuchFieldException, IllegalAccessException {
+        List<BizProcessInspecion> list = bizProcessInspecionService.query().eq("from_id", bizProcessInspecion.getId()).eq("type", "instrumentRoomInspection").list();
+        return success(list);
+    }
 
 
 //    /**
@@ -1161,7 +1370,276 @@ public class BizProcessInspecionController extends BaseController {
         }
         return success();
     }
+    //交检
+    @Transactional
+    @PostMapping("/saveDeliveryInspection")
+    public AjaxResult saveDeliveryInspection(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
+        //根据lot信息保存序检表
+        BizDaywork daywork = bizDayworkService.query().eq("lot_code", processInspecion.getLot().getLotCode()).one();
+        BizProduct product = bizProductService.getById(processInspecion.getLot().getProductId());
+        SysUser technicianUser = sysUserService.selectUserById(product.getTechnicianId());
+        BizDayworkItem dayworkItem = bizDayworkItemService.getById(processInspecion.getLot().getDayworkItemId());
+        processInspecion.setUserId(processInspecion.getLot().getUserId());
+        processInspecion.setNickName(processInspecion.getLot().getNickName());
+        processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
+        processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
+        processInspecion.setDayworkId(daywork.getId());
+        processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
+        processInspecion.setProductionPlanId(daywork.getProductionPlanId());
+        processInspecion.setDayworkItemId(dayworkItem.getId());
+        processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+        processInspecion.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+        processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
+        processInspecion.setLotId(processInspecion.getLot().getId());
+        processInspecion.setLotCode(processInspecion.getLot().getLotCode());
+        processInspecion.setDeptId(daywork.getDeptId());
+        processInspecion.setProductId(processInspecion.getLot().getProductId());
+        processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
+        processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
+        processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
+        processInspecion.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
+        processInspecion.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
+        processInspecion.setReviewerId(SecurityUtils.getLoginUser().getUserId());
+        processInspecion.setType("deliveryInspection");
+        if (processInspecion.getStartTime() == null) {
+            processInspecion.setStartTime(new Date());
+        }
+        if (processInspecion.getStatus() != 0) {
+            processInspecion.setEndTime(new Date());
+            processInspecion.setFirstUpdaterId(processInspecion.getFirstUpdaterId() == null || processInspecion.getFirstUpdaterId().equals(0L) ? SecurityUtils.getLoginUser().getUserId() : processInspecion.getFirstUpdaterId());
+        }
+        if (!checkDayworkItem(processInspecion.getLot().getDayworkItemId())) {
+            return error("编辑失败,下序已经生产加工");
+        }
+
+        //BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
+        List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", processInspecion.getInspectionCarrierId()).eq("is_changed", 0).list();
+        if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(processInspecion.getDayworkId()))) {
+            return error("检测载具已绑定其他批次");
+        }
+
+        //保存
+        bizProcessInspecionService.saveOrUpdate(processInspecion);
+
+        if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
+            // 该检测载具需要绑定到当前批次
+            BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
+            newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
+            newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
+            newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
+            newDayworkCarrier.setLotCode(processInspecion.getLotCode());
+            newDayworkCarrier.setLotId(processInspecion.getLotId());
+            newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
+            newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
+            bizDayworkCarrierService.save(newDayworkCarrier);
+        }
+
+        //保存废品信息
+        List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
+        //保存前先删除原先废品信息
+        BizDayworkItemReject rej = new BizDayworkItemReject();
+        rej.setProcessInspectionId(processInspecion.getId());
+        List<BizProcessInspectionDetail> processInspectionDetailList = processInspectionDetailService.query().eq("process_inspection_id", processInspecion.getId()).list();
+        processInspectionDetailService.removeBatchByIds(processInspectionDetailList);
 
+        if (rejects != null && rejects.size() > 0) {
+            for (BizProcessInspectionDetail reject : rejects) {
+                reject.setId(null);
+                reject.setUserId(processInspecion.getLot().getUserId());
+                reject.setProcessInspectionId(processInspecion.getId());
+                reject.setDayworkId(0L);
+                reject.setProductionPlanId(daywork.getProductionPlanId());
+                reject.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+                reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+                reject.setLotId(processInspecion.getLot().getId());
+                reject.setDayworkItemId(dayworkItem.getId());
+            }
+        }
+        processInspectionDetailService.saveBatch(rejects);
+        //保存咨询信息
+
+        List<BizDayworkItemConsult> consults = processInspecion.getDayworkItemConsults().stream().filter(item-> item.getId()==null).collect(Collectors.toList());
+        List<BizDayworkItemConsult> needAdd = new ArrayList<>();
+        if (consults != null && consults.size() > 0) {
+            for (BizDayworkItemConsult consult : consults) {
+                BizDayworkItemConsult consultInfo = new BizDayworkItemConsult();
+                consultInfo.setPictures(consult.getPictures());
+                consultInfo.setUserId(SecurityUtils.getLoginUser().getUserId());
+                consultInfo.setNickName(SecurityUtils.getLoginUser().getUser().getNickName());
+                consultInfo.setDayworkId(daywork.getId());
+                consultInfo.setContent(consult.getContent());
+                consultInfo.setConsultDepartment(consult.getConsultDepartment());
+                consultInfo.setProcessInspectionId(processInspecion.getId());
+                consultInfo.setProductionPlanId(daywork.getProductionPlanId());
+                consultInfo.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+                consultInfo.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+                consultInfo.setLotId(processInspecion.getLot().getId());
+                consultInfo.setLotCode(processInspecion.getLot().getLotCode());
+                consultInfo.setDayworkId(daywork.getId());
+                consultInfo.setDayworkItemId(dayworkItem.getId());
+                consultInfo.setProductId(processInspecion.getLot().getProductId());
+                consultInfo.setProductDescription(processInspecion.getLot().getProductDescription());
+                consultInfo.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
+                consultInfo.setTechnologicalProcessDetailId(dayworkItem.getTechnologicalProcessDetailId());
+                consultInfo.setProcessId(dayworkItem.getProcessId());
+                consultInfo.setIsProcessInspection(1);
+                consultInfo.setProcessAlias(processInspecion.getLot().getProcessAlias());
+                consultInfo.setTechnicianId(technicianUser == null ? 0L : technicianUser.getUserId());
+                needAdd.add(consultInfo);
+            }
+            bizDayworkItemConsultService.saveBatch(needAdd);
+            List<BizDayworkItemConsultPicture> pictures = new ArrayList<>();
+            needAdd.forEach(ne ->{
+                ne.getPictures().forEach(info ->{
+                    BizDayworkItemConsultPicture consultPicture = new BizDayworkItemConsultPicture();
+                    consultPicture.setDayworkItemConsultId(ne.getId());
+                    consultPicture.setPictureName(info.getPictureName());
+                    consultPicture.setUrl(info.getUrl());
+                    pictures.add(consultPicture);
+                });
+            });
+            bizDayworkItemConsultPictureService.saveBatch(pictures);
+        }
+
+        //修改daywaork信息
+        dayworkItem.setIsProcessInspection(1);
+        return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
+    }
+    //仪器室检
+    @Transactional
+    @PostMapping("/saveInstrumentRoomInspection")
+    public AjaxResult saveInstrumentRoomInspection(@RequestBody BizProcessInspecion processInspecion) throws NoSuchFieldException, IllegalAccessException {
+        //根据lot信息保存序检表
+        BizDaywork daywork = bizDayworkService.query().eq("lot_code", processInspecion.getLot().getLotCode()).one();
+        BizProduct product = bizProductService.getById(processInspecion.getLot().getProductId());
+        SysUser technicianUser = sysUserService.selectUserById(product.getTechnicianId());
+        BizDayworkItem dayworkItem = bizDayworkItemService.getById(processInspecion.getLot().getDayworkItemId());
+        processInspecion.setUserId(processInspecion.getLot().getUserId());
+        processInspecion.setNickName(processInspecion.getLot().getNickName());
+        processInspecion.setCarrierId(processInspecion.getLot().getCarrierId());
+        processInspecion.setCarrierCode(processInspecion.getLot().getCarrierCode());
+        processInspecion.setDayworkId(daywork.getId());
+        processInspecion.setProcessStepNumber(processInspecion.getLot().getProcessStepNumber());
+        processInspecion.setProductionPlanId(daywork.getProductionPlanId());
+        processInspecion.setDayworkItemId(dayworkItem.getId());
+        processInspecion.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+        processInspecion.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+        processInspecion.setProductDescription(processInspecion.getLot().getProductDescription());
+        processInspecion.setLotId(processInspecion.getLot().getId());
+        processInspecion.setLotCode(processInspecion.getLot().getLotCode());
+        processInspecion.setDeptId(daywork.getDeptId());
+        processInspecion.setProductId(processInspecion.getLot().getProductId());
+        processInspecion.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
+        processInspecion.setInspectionCarrierCode(processInspecion.getInspectionCarrierCode());
+        processInspecion.setInspectionCarrierId(processInspecion.getInspectionCarrierId());
+        processInspecion.setEquipmentDetailCode(processInspecion.getLot().getEquipmentDetailCode());
+        processInspecion.setEquipmentDetailId(processInspecion.getLot().getEquipmentDetailId());
+        processInspecion.setReviewerId(SecurityUtils.getLoginUser().getUserId());
+        processInspecion.setType("instrumentRoomInspection");
+        if (processInspecion.getStartTime() == null) {
+            processInspecion.setStartTime(new Date());
+        }
+        if (processInspecion.getStatus() != 0) {
+            processInspecion.setEndTime(new Date());
+            processInspecion.setFirstUpdaterId(processInspecion.getFirstUpdaterId() == null || processInspecion.getFirstUpdaterId().equals(0L) ? SecurityUtils.getLoginUser().getUserId() : processInspecion.getFirstUpdaterId());
+        }
+        if (!checkDayworkItem(processInspecion.getLot().getDayworkItemId())) {
+            return error("编辑失败,下序已经生产加工");
+        }
+
+        //BizCarrier carrier = bizCarrierService.query().eq("id", processInspecion.getInspectionCarrierId()).one();
+//        List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.query().eq("carrier_id", processInspecion.getInspectionCarrierId()).eq("is_changed", 0).list();
+//        if (dayworkCarriers.stream().anyMatch(v -> !v.getDayworkId().equals(processInspecion.getDayworkId()))) {
+//            return error("检测载具已绑定其他批次");
+//        }
+
+        //保存
+        bizProcessInspecionService.saveOrUpdate(processInspecion);
+
+//        if (dayworkCarriers.stream().noneMatch(v -> v.getDayworkId().equals(processInspecion.getDayworkId())) && (processInspecion.getIsInspectionCarrierChanged() == null || processInspecion.getIsInspectionCarrierChanged().equals(0))) {
+//            // 该检测载具需要绑定到当前批次
+//            BizDayworkCarrier newDayworkCarrier = new BizDayworkCarrier();
+//            newDayworkCarrier.setDayworkId(processInspecion.getDayworkId());
+//            newDayworkCarrier.setCarrierCode(processInspecion.getInspectionCarrierCode());
+//            newDayworkCarrier.setCarrierId(processInspecion.getInspectionCarrierId());
+//            newDayworkCarrier.setLotCode(processInspecion.getLotCode());
+//            newDayworkCarrier.setLotId(processInspecion.getLotId());
+//            newDayworkCarrier.setProductionPlanDetailId(processInspecion.getProductionPlanDetailId());
+//            newDayworkCarrier.setProcessInspectionId(processInspecion.getId());
+//            bizDayworkCarrierService.save(newDayworkCarrier);
+//        }
+
+        //保存废品信息
+        List<BizProcessInspectionDetail> rejects = processInspecion.getProcessInspectionDetails();
+        //保存前先删除原先废品信息
+        BizDayworkItemReject rej = new BizDayworkItemReject();
+        rej.setProcessInspectionId(processInspecion.getId());
+        List<BizProcessInspectionDetail> processInspectionDetailList = processInspectionDetailService.query().eq("process_inspection_id", processInspecion.getId()).list();
+        processInspectionDetailService.removeBatchByIds(processInspectionDetailList);
+
+        if (rejects != null && rejects.size() > 0) {
+            for (BizProcessInspectionDetail reject : rejects) {
+                reject.setId(null);
+                reject.setUserId(processInspecion.getLot().getUserId());
+                reject.setProcessInspectionId(processInspecion.getId());
+                reject.setDayworkId(0L);
+                reject.setProductionPlanId(daywork.getProductionPlanId());
+                reject.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+                reject.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+                reject.setLotId(processInspecion.getLot().getId());
+                reject.setDayworkItemId(dayworkItem.getId());
+            }
+        }
+        processInspectionDetailService.saveBatch(rejects);
+        //保存咨询信息
+
+        List<BizDayworkItemConsult> consults = processInspecion.getDayworkItemConsults().stream().filter(item-> item.getId()==null).collect(Collectors.toList());
+        List<BizDayworkItemConsult> needAdd = new ArrayList<>();
+        if (consults != null && consults.size() > 0) {
+            for (BizDayworkItemConsult consult : consults) {
+                BizDayworkItemConsult consultInfo = new BizDayworkItemConsult();
+                consultInfo.setPictures(consult.getPictures());
+                consultInfo.setUserId(SecurityUtils.getLoginUser().getUserId());
+                consultInfo.setNickName(SecurityUtils.getLoginUser().getUser().getNickName());
+                consultInfo.setDayworkId(daywork.getId());
+                consultInfo.setContent(consult.getContent());
+                consultInfo.setConsultDepartment(consult.getConsultDepartment());
+                consultInfo.setProcessInspectionId(processInspecion.getId());
+                consultInfo.setProductionPlanId(daywork.getProductionPlanId());
+                consultInfo.setProductionPlanDetailId(daywork.getProductionPlanDetailId());
+                consultInfo.setProductionPlanDetailSubDetailId(daywork.getProductionPlanDetailSubDetailId());
+                consultInfo.setLotId(processInspecion.getLot().getId());
+                consultInfo.setLotCode(processInspecion.getLot().getLotCode());
+                consultInfo.setDayworkId(daywork.getId());
+                consultInfo.setDayworkItemId(dayworkItem.getId());
+                consultInfo.setProductId(processInspecion.getLot().getProductId());
+                consultInfo.setProductDescription(processInspecion.getLot().getProductDescription());
+                consultInfo.setTechnologicalProcessId(processInspecion.getLot().getTechnologicalProcessId());
+                consultInfo.setTechnologicalProcessDetailId(dayworkItem.getTechnologicalProcessDetailId());
+                consultInfo.setProcessId(dayworkItem.getProcessId());
+                consultInfo.setIsProcessInspection(1);
+                consultInfo.setProcessAlias(processInspecion.getLot().getProcessAlias());
+                consultInfo.setTechnicianId(technicianUser == null ? 0L : technicianUser.getUserId());
+                needAdd.add(consultInfo);
+            }
+            bizDayworkItemConsultService.saveBatch(needAdd);
+            List<BizDayworkItemConsultPicture> pictures = new ArrayList<>();
+            needAdd.forEach(ne ->{
+                ne.getPictures().forEach(info ->{
+                    BizDayworkItemConsultPicture consultPicture = new BizDayworkItemConsultPicture();
+                    consultPicture.setDayworkItemConsultId(ne.getId());
+                    consultPicture.setPictureName(info.getPictureName());
+                    consultPicture.setUrl(info.getUrl());
+                    pictures.add(consultPicture);
+                });
+            });
+            bizDayworkItemConsultPictureService.saveBatch(pictures);
+        }
+
+        //修改daywaork信息
+        dayworkItem.setIsProcessInspection(1);
+        return success(bizDayworkItemService.saveOrUpdate(dayworkItem));
+    }
     /**
      * 根据箱号查询批次信息
      */
@@ -1260,6 +1738,17 @@ public class BizProcessInspecionController extends BaseController {
         return success(lot);
     }
 
+    //解绑检测载具
+    @PostMapping("/unbindInspectionCarrier")
+    public AjaxResult unbindInspectionCarrier(@RequestBody BizDayworkCarrier dayworkCarrier) throws NoSuchFieldException, IllegalAccessException {
+        List<BizDayworkCarrier> carrierList = bizDayworkCarrierService.query().eq("carrier_code", dayworkCarrier.getCarrierCode()).list();
+        carrierList.forEach(item -> {
+            item.setIsChanged(1);
+        });
+        return success(bizDayworkCarrierService.updateBatchById(carrierList));
+    }
+
+
     /**
      * 根据箱号查询批次信息
      */
@@ -1338,6 +1827,7 @@ public class BizProcessInspecionController extends BaseController {
         }).collect(Collectors.toList()));
         lot.setDeptName(item.getDeptName());
         lot.setDayworkItemId(item.getId());
+        lot.setProcessStepNumber(item.getProcessStepNumber());
         lot.setCarrierCode(dayworkCarrier.getCarrierCode());
         lot.setCarrierId(dayworkCarrier.getCarrierId());
         lot.setPudName(item.getProdNum() == 0 ? lot.getProductionQuantity() : item.getProdNum());

+ 2 - 2
src/main/java/cn/ezhizao/project/business/product/domain/BizDaywork.java

@@ -215,8 +215,8 @@ public class BizDaywork extends BaseEntity
     private String protemProcessStepNumber;
     @TableField(exist = false)
     private List<BizEquipmentDetail> equipmentDetails;
-//    @TableField(exist = false)
-//    private List<BizInspectionChamber> inspectionChambers;
+    @TableField(exist = false)
+    private List<BizInspectionChamber> inspectionChambers;
     @TableField(exist = false)
     private Integer prodNum;
 }

+ 35 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizInspectionChamber.java

@@ -0,0 +1,35 @@
+package cn.ezhizao.project.business.product.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 检测室配置对象 biz_inspection_chamber
+ *
+ * @author ezhizao
+ * @date 2024-08-06
+ */
+@Data
+@TableName(value = "biz_inspection_chamber")
+public class BizInspectionChamber extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 检查室名称 */
+    @Excel(name = "检查室名称")
+    @ApiModelProperty(value = "检查室名称")
+    private String chamberName;
+
+    /** 检查室编码 */
+    @Excel(name = "检查室编码")
+    @ApiModelProperty(value = "检查室编码")
+    private String chamberCode;
+
+    /** 所在车间 */
+    @ApiModelProperty(value = "检查室编码")
+    private Long workShopId;
+
+}

+ 2 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizLot.java

@@ -152,5 +152,7 @@ public class BizLot extends BaseEntity
     private String inspectionCarrierCode;
     @TableField(exist = false)
     private Long inspectionCarrierId;
+    @TableField(exist = false)
+    private String processStepNumber;
 
 }

+ 12 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizProcessInspecion.java

@@ -208,6 +208,18 @@ public class BizProcessInspecion extends BaseEntity
     private Long equipmentDetailId;
     @TableField(exist = false)
     private String technicianName;
+    private Long adoptId;
+    private Integer adoptStatus;
+    private String processStepNumber;
+    private Long fromId;
+    private Long inspectionChamberId;
+    @TableField(exist = false)
+    private String technologyVersion;
+    @TableField(exist = false)
+    private String drawingNumber;
+    //是否移交仪器室
+    @TableField(exist = false)
+    private Boolean flag;
 
     public BizProcessInspecion() {
     }

+ 31 - 0
src/main/java/cn/ezhizao/project/business/product/mapper/BizInspectionChamberMapper.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.product.mapper;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.product.domain.BizInspectionChamber;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+/**
+ * 检测室配置Mapper接口
+ *
+ * @author ezhizao
+ * @date 2024-08-06
+ */
+public interface BizInspectionChamberMapper extends BaseMapper<BizInspectionChamber>
+{
+    /**
+     * 查询检测室配置列表
+     *
+     * @param bizInspectionChamber 检测室配置
+     * @return 检测室配置集合
+     */
+    public List<BizInspectionChamber> getList(BizInspectionChamber bizInspectionChamber);
+
+    /**
+     * 物理删除
+     * @param bizInspectionChamber
+     * @return 删除结果
+    */
+    public int physicalDelete(BizInspectionChamber bizInspectionChamber);
+}

+ 2 - 0
src/main/java/cn/ezhizao/project/business/product/mapper/BizProcessInspecionMapper.java

@@ -22,6 +22,8 @@ public interface BizProcessInspecionMapper extends BaseMapper<BizProcessInspecio
      * @return 序检主集合
      */
     public List<BizProcessInspecion> getList(BizProcessInspecion bizProcessInspecion);
+    public List<BizProcessInspecion> getInfoByIds(List<Long> ids);
+    public List<BizProcessInspecion> getExaminList(BizProcessInspecion bizProcessInspecion);
     public List<BizProcessInspectionDetail> getInspectionByDayworkId(BizProcessInspecion bizProcessInspecion);
 
     /**

+ 32 - 0
src/main/java/cn/ezhizao/project/business/product/service/IBizInspectionChamberService.java

@@ -0,0 +1,32 @@
+package cn.ezhizao.project.business.product.service;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.product.domain.BizInspectionChamber;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+
+/**
+ * 检测室配置Service接口
+ *
+ * @author ezhizao
+ * @date 2024-08-06
+ */
+public interface IBizInspectionChamberService extends IService<BizInspectionChamber>
+{
+    /**
+     * 查询检测室配置列表
+     *
+     * @param bizInspectionChamber 检测室配置
+     * @return 检测室配置集合
+     */
+    public List<BizInspectionChamber> getList(BizInspectionChamber bizInspectionChamber);
+
+    /**
+     * 物理删除
+     * @param bizInspectionChamber
+     * @return 删除结果
+     */
+    public int physicalDelete(BizInspectionChamber bizInspectionChamber);
+
+}

+ 2 - 0
src/main/java/cn/ezhizao/project/business/product/service/IBizProcessInspecionService.java

@@ -22,6 +22,8 @@ public interface IBizProcessInspecionService extends IService<BizProcessInspecio
      * @return 序检主集合
      */
     public List<BizProcessInspecion> getList(BizProcessInspecion bizProcessInspecion);
+    public List<BizProcessInspecion> getExaminList(BizProcessInspecion bizProcessInspecion);
+    public List<BizProcessInspecion> getInfoByIds(List<Long> ids);
     public List<BizProcessInspectionDetail> getInspectionByDayworkId(BizProcessInspecion bizProcessInspecion);
 
     /**

+ 45 - 0
src/main/java/cn/ezhizao/project/business/product/service/impl/BizInspectionChamberServiceImpl.java

@@ -0,0 +1,45 @@
+package cn.ezhizao.project.business.product.service.impl;
+
+import java.util.List;
+import javax.annotation.Resource;
+
+import cn.ezhizao.project.business.product.domain.BizInspectionChamber;
+import cn.ezhizao.project.business.product.mapper.BizInspectionChamberMapper;
+import cn.ezhizao.project.business.product.service.IBizInspectionChamberService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 检测室配置Service业务层处理
+ *
+ * @author ezhizao
+ * @date 2024-08-06
+ */
+@Service
+public class BizInspectionChamberServiceImpl  extends ServiceImpl<BizInspectionChamberMapper, BizInspectionChamber> implements IBizInspectionChamberService
+{
+    @Resource
+    private BizInspectionChamberMapper bizInspectionChamberMapper;
+
+    /**
+     * 查询检测室配置列表
+     *
+     * @param bizInspectionChamber 检测室配置
+     * @return 检测室配置
+     */
+    @Override
+    public List<BizInspectionChamber> getList(BizInspectionChamber bizInspectionChamber)
+    {
+        return bizInspectionChamberMapper.getList(bizInspectionChamber);
+    }
+
+    /**
+     * 物理删除
+     * @param bizInspectionChamber
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizInspectionChamber bizInspectionChamber){ return bizInspectionChamberMapper.physicalDelete(bizInspectionChamber); };
+
+}

+ 10 - 0
src/main/java/cn/ezhizao/project/business/product/service/impl/BizProcessInspecionServiceImpl.java

@@ -35,6 +35,16 @@ public class BizProcessInspecionServiceImpl  extends ServiceImpl<BizProcessInspe
         return bizProcessInspecionMapper.getList(bizProcessInspecion);
     }
 
+    @Override
+    public List<BizProcessInspecion> getExaminList(BizProcessInspecion bizProcessInspecion) {
+        return bizProcessInspecionMapper.getExaminList(bizProcessInspecion);
+    }
+
+    @Override
+    public List<BizProcessInspecion> getInfoByIds(List<Long> ids) {
+        return bizProcessInspecionMapper.getInfoByIds(ids);
+    }
+
     @Override
     public List<BizProcessInspectionDetail> getInspectionByDayworkId(BizProcessInspecion bizProcessInspecion) {
         return bizProcessInspecionMapper.getInspectionByDayworkId(bizProcessInspecion);

+ 7 - 0
src/main/java/cn/ezhizao/project/system/controller/SysLoginController.java

@@ -7,6 +7,8 @@ import cn.ezhizao.framework.security.service.SysLoginService;
 import cn.ezhizao.framework.security.service.SysPermissionService;
 import cn.ezhizao.framework.web.controller.BaseController;
 import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.project.business.takeStockPeriod.domain.BizTakeStockPeriod;
+import cn.ezhizao.project.business.takeStockPeriod.service.IBizTakeStockPeriodService;
 import cn.ezhizao.project.system.domain.SysMenu;
 import cn.ezhizao.project.system.domain.SysUser;
 import cn.ezhizao.project.system.service.ISysMenuService;
@@ -37,6 +39,8 @@ public class SysLoginController extends BaseController
 
     @Resource
     private SysPermissionService permissionService;
+    @Resource
+    private IBizTakeStockPeriodService bizTakeStockPeriodService;
 
     /**
      * 登录方法
@@ -60,6 +64,9 @@ public class SysLoginController extends BaseController
         // 权限集合
         Set<String> permissions = permissionService.getMenuPermission(user);
         user.setPermissions(permissions);
+        //当前是否处于盘点状态
+        List<BizTakeStockPeriod> takeStockList = bizTakeStockPeriodService.query().eq("status", 1).list();
+        user.setTakeStock(takeStockList.size() > 0 ? true : false);
         return AjaxResult.success(user);
     }
     /**

+ 11 - 0
src/main/java/cn/ezhizao/project/system/domain/SysUser.java

@@ -1,5 +1,6 @@
 package cn.ezhizao.project.system.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import cn.ezhizao.common.xss.Xss;
 import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
@@ -368,4 +369,14 @@ public class SysUser extends BaseEntity {
     public void setPermissions(Set<String> permissions) {
         this.permissions = permissions;
     }
+    @TableField(exist = false)
+    private Boolean isTakeStock;
+
+    public Boolean getTakeStock() {
+        return isTakeStock;
+    }
+
+    public void setTakeStock(Boolean takeStock) {
+        isTakeStock = takeStock;
+    }
 }

+ 30 - 0
src/main/resources/mybatis/business/product/BizInspectionChamberMapper.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.ezhizao.project.business.product.mapper.BizInspectionChamberMapper">
+
+    <resultMap type="cn.ezhizao.project.business.product.domain.BizInspectionChamber" id="BizInspectionChamberResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizInspectionChamber" resultMap="BizInspectionChamberResult">
+        SELECT * FROM biz_inspection_chamber
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="chamberName != null  and chamberName != ''"> AND chamber_name like concat('%', #{chamberName}, '%')</if>
+            <if test="chamberCode != null  and chamberCode != ''"> AND chamber_code = #{chamberCode}</if>
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_inspection_chamber
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>

+ 28 - 0
src/main/resources/mybatis/business/product/BizProcessInspecionMapper.xml

@@ -48,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="endTimeString != null and endTimeString!='' ">AND t1.start_time &lt;= #{endTimeString}</if>
             <if test="type != null  ">AND t1.type = #{type}</if>
             <if test="status != null ">AND t1.status = #{status}</if>
+            <if test="inspectionChamberId != null ">AND t1.inspection_chamber_id = #{inspectionChamberId}</if>
             <if test="keyword != null  and keyword != '' ">AND (t1.lot_code LIKE CONCAT('%',#{keyword},'%') OR carrier_code LIKE CONCAT('%',#{keyword},'%') OR
             t1.product_description LIKE CONCAT('%',#{keyword},'%'))
             </if>
@@ -56,6 +57,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         order by ( case when t1.status = 0 then 3 else t1.status end) desc, t1.create_time asc
     </select>
+    <select id="getInfoByIds" resultMap="BizProcessInspecionResult">
+        select t1.*,t3.id as process_id,t3.process_alias,t4.technology_version,t5.drawing_number from biz_process_inspecion t1
+        left join biz_daywork_item t2 on t1.daywork_item_id = t2.id
+        left join biz_process t3 on t2.process_id = t3.id
+        left join biz_lot t4 on t1.lot_id = t4.id
+        left join biz_production_plan_detail t5 on t1.production_plan_detail_id = t5.id
+        where t1.deleted = 0 and t2.deleted = 0 and t4.deleted = 0 and  t1.id in
+        <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+    <select id="getExaminList" resultMap="BizProcessInspecionResult">
+        SELECT t1.*,t2.nick_name as technicianName FROM biz_process_inspecion t1 left join sys_user t2 on t1.reviewer_id = t2.user_id
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            t1.deleted = 0 and t1.status != 0
+            AND t1.return_receipt_detail_id =0
+            <if test="deptId != null  ">AND t1.dept_id = #{deptId}</if>
+            <if test="startTimeString != null and startTimeString!=''">AND t1.start_time &gt;= #{startTimeString}</if>
+            <if test="endTimeString != null and endTimeString!='' ">AND t1.start_time &lt;= #{endTimeString}</if>
+            <if test="type != null  ">AND t1.type = #{type}</if>
+            <if test="keyword != null  and keyword != '' ">AND (t1.lot_code LIKE CONCAT('%',#{keyword},'%') OR carrier_code
+                LIKE CONCAT('%',#{keyword},'%') OR
+                t1.product_description LIKE CONCAT('%',#{keyword},'%'))
+            </if>
+        </trim>
+        order by ( case when t1.status = 0 then 3 else t1.status end) desc, t1.create_time asc
+    </select>
 
     <select id="getOutsourcedlist" parameterType="BizProcessInspecion" resultMap="BizProcessInspecionResult">
         SELECT * FROM biz_process_inspecion

+ 1 - 1
src/main/resources/mybatis/business/technologicalProcessDetailDrawing/BizTechnologicalProcessDetailDrawingMapper.xml

@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getList" parameterType="BizTechnologicalProcessDetailDrawing" resultMap="BizTechnologicalProcessDetailDrawingResult">
         SELECT * FROM biz_technological_process_detail_drawing
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
-            deleted = 0
+            deleted = 0 and abandoned = 0 and status = 2
             <if test="url != null  and url != ''"> AND url = #{url}</if>
             <if test="productId != null">and product_id = #{productId} </if>
             <if test="productVersion != null and productVersion !=''">AND product_version = #{productVersion}</if>