浏览代码

刀具校验

oyq28 1 年之前
父节点
当前提交
ff8195dc98

+ 5 - 0
imcs-admin-boot/imcs-authority-biz/src/main/java/com/github/zuihou/authority/dao/common/DictionaryMapper.java

@@ -2,8 +2,11 @@ package com.github.zuihou.authority.dao.common;
 
 import com.github.zuihou.authority.entity.common.Dictionary;
 import com.github.zuihou.base.mapper.SuperMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  * Mapper 接口
@@ -16,4 +19,6 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface DictionaryMapper extends SuperMapper<Dictionary> {
 
+    List<String> getDicName(@Param("list") List<String> code);
+
 }

+ 6 - 0
imcs-admin-boot/imcs-authority-biz/src/main/resources/mapper_authority/base/common/DictionaryMapper.xml

@@ -21,4 +21,10 @@
         type_, name, describe_, status_
     </sql>
 
+    <select id="getDicName" parameterType="String" resultType="String">
+        select name from c_common_dictionary_item where dictionary_type='CUTTING_TOOL_CATEGORY' and code in
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
+            #{id}
+        </foreach>
+    </select>
 </mapper>

+ 13 - 9
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/centralToolMagazine/service/impl/ToolManagementServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.zuihou.authority.dao.common.DictionaryMapper;
 import com.github.zuihou.authority.service.auth.UserService;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.service.SuperCacheServiceImpl;
@@ -86,6 +87,9 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
     @Autowired
     private ToolTaskMapper toolTaskMapper;
 
+    @Autowired
+    private DictionaryMapper dictionaryMapper;
+
 
     @Override
     protected String getRegion() {
@@ -193,8 +197,8 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
             List<BomProcedure> bomProcedures = bomProcedureMapper.selectList(Wraps.<BomProcedure>lbQ()
                     .eq(BomProcedure::getBomId, bomId).eq(BomProcedure::getType,"设备序"));
 
-            //产品所需所有刀具集合
-            List<Long> toolId=new ArrayList<>();
+            //产品所需所有的类别集合
+            List<String> toolId=new ArrayList<>();
 
             //所有可执行设备资源
             List<BomProcedureProductionresource> resourceList=new ArrayList<>();
@@ -208,8 +212,8 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                 resourceList.addAll(resourcelist);
 
                 List<BBomProcedureTool> toolList = bomProcedureToolService.list(Wraps.<BBomProcedureTool>lbQ().eq(BBomProcedureTool::getProcedureId,vo.getId()));
-                List<Long> toolIdList = toolList.stream()
-                        .map(BBomProcedureTool::getToolId)
+                List<String> toolIdList = toolList.stream()
+                        .map(BBomProcedureTool::getCuttingToolCategory)
                         .collect(Collectors.toList());
                 toolId.addAll(toolIdList);
             });
@@ -235,17 +239,17 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                 //Integer freeCount=0;
                 //if(!realToolId.containsAll(toolId)){
                 //需要的类别
-                List<String> toolCategory = cuttingToolMapper.getToolCategory(toolId);
+                //List<String> toolCategory = cuttingToolMapper.getToolCategory(toolId);
 
                 //机床现有的类别
                 List<String> realToolCategory = cuttingToolMapper.getToolCategory(realToolId);
 
                 //比较 刀具类别  是否存在
-                if(!realToolCategory.containsAll(toolCategory)){
-                    List<String> differenceCategory = toolCategory.stream()
+                if(!realToolCategory.containsAll(toolId)){
+                    List<String> differenceCategory = toolId.stream()
                             .filter(id -> !realToolCategory.contains(id))
                             .collect(Collectors.toList());
-
+                    List<String> dicName = dictionaryMapper.getDicName(toolId);
                     /*List<Long> differenceTool = toolId.stream()
                             .filter(id -> !realToolId.contains(id))
                             .collect(Collectors.toList());
@@ -261,7 +265,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                     toolCheckDTO.setIsFree(isFree);
                     toolCheckDTO.setHasCuttingToolsFlag(CollectionUtil.isEmpty(differenceCategory) ? "是" : "否" );
                     toolCheckDTO.setMsg(CollectionUtil.isNotEmpty(differenceCategory) ?
-                            "缺少:"+differenceCategory.stream().collect(Collectors.joining(","))+(isFree ? ",机床刀库空闲个数大于缺刀个数":""):"");
+                            "缺少:"+dicName.stream().collect(Collectors.joining(","))+(isFree ? ",机床刀库空闲个数大于缺刀个数":""):"");
                     toolCheckDTO.setPlanId(item);
                     returnList.add(toolCheckDTO);
                 }