Bläddra i källkod

Merge remote-tracking branch 'origin/master'

wang.sq@aliyun.com 4 dagar sedan
förälder
incheckning
26417ebb67

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

@@ -15,6 +15,7 @@ import com.github.zuihou.business.centralToolMagazine.entity.ToolTask;
 import com.github.zuihou.business.centralToolMagazine.service.ToolManagementService;
 import com.github.zuihou.business.centralToolMagazine.dao.ToolManagementMapper;
 import com.github.zuihou.business.centralToolMagazine.dto.ToolManagementSaveDTO;
+import com.github.zuihou.business.cuttercategories.entity.CutterCategories;
 import com.github.zuihou.business.edgeLibrary.dto.ShelvesUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.dao.PlanProductMapper;
 import com.github.zuihou.business.operationManagementCenter.dao.ToolTaskMapper;
@@ -26,12 +27,17 @@ import com.github.zuihou.business.productionReadyCenter.dao.CuttingToolMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.*;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureToolService;
+import com.github.zuihou.business.productionReadyCenter.service.MachineCuttingToolService;
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
+import com.github.zuihou.business.productionResourceCenter.service.CutterCategoriesService;
+import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.injection.annonation.InjectionResult;
-import com.github.zuihou.tenant.entity.Productionresource;
+
 import com.github.zuihou.utils.BeanPlusUtil;
+import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.compress.utils.Lists;
@@ -90,6 +96,18 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
     @Autowired
     private DictionaryMapper dictionaryMapper;
 
+    @Autowired
+    private CutterCategoriesService cutterCategoriesService;
+
+    @Autowired
+    private MachineCuttingToolService machineCuttingToolService;
+
+    @Autowired
+    private ProductionresourceBizService productionresourceBizService;
+
+    //默认机床刀位数
+    private final int DEVICE_CUTTER_POSITION = 40;
+
 
     @Override
     protected String getRegion() {
@@ -199,6 +217,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
 
             //产品所需所有的类别集合
             List<String> toolId=new ArrayList<>();
+            Map<String, List<String>> toolMaps = Maps.newConcurrentMap();
 
             //所有可执行设备资源
             List<BomProcedureProductionresource> resourceList=new ArrayList<>();
@@ -211,12 +230,22 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                 List<BomProcedureProductionresource> resourcelist = bomProcedureProductionresourceService.getResourcelist(bomProcedureVersion);
                 resourceList.addAll(resourcelist);
 
-                List<BBomProcedureTool> toolList = bomProcedureToolService.list(Wraps.<BBomProcedureTool>lbQ().eq(BBomProcedureTool::getProcedureId,vo.getId()));
+                BBomProcedureTool bomProcedureTool = bomProcedureToolService.getOne(Wraps.<BBomProcedureTool>lbQ().eq(BBomProcedureTool::getProcedureId,vo.getId()).last("limit 1"));
+                //List<BBomProcedureTool> toolList = bomProcedureToolService.list(Wraps.<BBomProcedureTool>lbQ().eq(BBomProcedureTool::getProcedureId,vo.getId()));
                 /*List<String> toolIdList = toolList.stream()
                         .map(BBomProcedureTool::getCuttingToolCategory)
                         .collect(Collectors.toList()); */
-                List<String> toolIdList = Lists.newArrayList();
+                List<String> toolIdList = null;
+                if (null == bomProcedureTool){
+                    toolIdList = Lists.newArrayList();
+                }else{
+                    String[] conditions = bomProcedureTool.getCuttingToolCategory().split("_");
+                    List<CutterCategories> toolList = cutterCategoriesService.list(new LbqWrapper<CutterCategories>().eq(CutterCategories::getPartsNo, conditions[0]).eq(CutterCategories::getProcedureNo, conditions[1]));
+                    toolIdList = toolList.stream().map(obj->obj.getCutterT())
+                            .collect(Collectors.toList());
+                }
                 toolId.addAll(toolIdList);
+                toolMaps.put(vo.getId().toString(), toolId);
             });
             if(CollectionUtil.isEmpty(toolId)){
                 log.info("刀具校验:未配置工艺刀具");
@@ -235,30 +264,43 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                 ToolCheckDTO toolCheckDTO=new ToolCheckDTO();
 
                 //机床现有刀具集合
-                List<Long> realToolId = toolManagementMapper.getToolManagementToolId(vo.getResourceId());
-                Integer freeCount = toolManagementMapper.getFreeStorge(vo.getResourceId());
+                //List<Long> realToolId = toolManagementMapper.getToolManagementToolId(vo.getResourceId());
+                //Integer freeCount = toolManagementMapper.getFreeStorge(vo.getResourceId());
+                Productionresource productionresource = productionresourceBizService.getById(vo.getResourceId());
+                List<String> realToolId = null;
+                Integer freeCount = 0;
+                //判断是否机床
+                if(StringUtils.isNotEmpty(productionresource.getModeSpecification())){
+                    realToolId = machineCuttingToolService.list(new LbqWrapper<MachineCuttingTool>().eq(MachineCuttingTool::getMachineId, vo.getResourceId())).stream().map(obj->obj.getCuttingToolId()).collect(Collectors.toList());
+                    freeCount = DEVICE_CUTTER_POSITION - realToolId.size();
+                }else{
+                    realToolId = Lists.newArrayList();
+                }
+
                 //Integer freeCount=0;
                 //if(!realToolId.containsAll(toolId)){
                 //需要的类别
                 //List<String> toolCategory = cuttingToolMapper.getToolCategory(toolId);
 
                 //机床现有的类别
-                List<String> realToolCategory = cuttingToolMapper.getToolCategory(realToolId);
+                //List<String> realToolCategory = cuttingToolMapper.getToolCategory(realToolId);
 
                 //比较 刀具类别  是否存在
-                if(!realToolCategory.containsAll(toolId)){
+                if(freeCount > 0){
+                    List<String> finalRealToolId = realToolId;
                     List<String> differenceCategory = toolId.stream()
-                            .filter(id -> !realToolCategory.contains(id))
+                            .filter(id -> !finalRealToolId.contains(id))
                             .collect(Collectors.toList());
-                    List<String> dicName = dictionaryMapper.getDicName(toolId);
+                    List<CutterCategories> cutterCategories = cutterCategoriesService.list(new LbqWrapper<CutterCategories>().in(CutterCategories::getCutterT, differenceCategory)).stream().collect(Collectors.toList());
+                    //List<String> dicName = dictionaryMapper.getDicName(toolId);
                     /*List<Long> differenceTool = toolId.stream()
                             .filter(id -> !realToolId.contains(id))
                             .collect(Collectors.toList());
                     List<CuttingTool> cuttingTools = cuttingToolMapper.selectList(Wraps.<CuttingTool>lbQ().in(CuttingTool::getId, differenceTool));*/
                     //true 机床刀库空闲个数大于缺刀个数
                     Boolean isFree=freeCount > differenceCategory.size();
-                    ToolTask findToolTask = toolTaskMapper.selectOne(Wraps.<ToolTask>lbQ().eq(ToolTask::getPlanId, item));
-                    toolCheckDTO.setIsTask(Objects.isNull(findToolTask)?"否":"是");
+                    //ToolTask findToolTask = toolTaskMapper.selectOne(Wraps.<ToolTask>lbQ().eq(ToolTask::getPlanId, item));
+                    toolCheckDTO.setIsTask(differenceCategory.size()>0?"是":"否");
                     toolCheckDTO.setId(vo.getResourceId());
                     toolCheckDTO.setDeviceName(vo.getName());
                     toolCheckDTO.setName(bBom.getName());
@@ -266,7 +308,7 @@ public class ToolManagementServiceImpl extends SuperCacheServiceImpl<ToolManagem
                     toolCheckDTO.setIsFree(isFree);
                     toolCheckDTO.setHasCuttingToolsFlag(CollectionUtil.isEmpty(differenceCategory) ? "是" : "否" );
                     toolCheckDTO.setMsg(CollectionUtil.isNotEmpty(differenceCategory) ?
-                            "缺少:"+dicName.stream().collect(Collectors.joining(","))+(isFree ? ",机床刀库空闲个数大于缺刀个数":""):"");
+                            "缺少:"+cutterCategories.stream().map(obj->obj.getCutterName()).collect(Collectors.joining(","))+(isFree ? ",机床刀库空闲个数大于缺刀个数":"") +(" 缺刀总数:"+ differenceCategory.size() +"个"):"校验成功" );
                     toolCheckDTO.setPlanId(item);
                     returnList.add(toolCheckDTO);
                 }

+ 3 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -432,6 +432,9 @@ public class TaskWorkNode {
                                     //删除自动生成零件库位信息
                                     stockInfoMapper.delete(new LbqWrapper<StockInfo>().eq(StockInfo::getCompleteBatchNo, orderTask.getConfBatchNo()));
                                 }
+                                //刀具换刀后续刀架取刀
+                                //
+
 
                                 //天轨刀具换刀重新出发取操作流程
                                 if(StringUtils.isNotEmpty(orderTask.getConfBatchNo()) && orderTask.getIsMachine().equals("0")){

+ 1 - 2
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/cuttercategories/CutterCategoriesMapper.xml

@@ -9,7 +9,6 @@
         <result column="create_user" jdbcType="BIGINT" property="createUser"/>
         <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
         <result column="update_user" jdbcType="BIGINT" property="updateUser"/>
-        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
         <result column="parts_no" jdbcType="VARCHAR" property="partsNo"/>
         <result column="procedure_no" jdbcType="VARCHAR" property="procedureNo"/>
         <result column="program_name" jdbcType="VARCHAR" property="programName"/>
@@ -21,7 +20,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id,order_no,parts_no,procedure_no,program_name,cutter_t,cutter_name,cutter_specification,cutter_sort
+        id,parts_no,procedure_no,program_name,cutter_t,cutter_name,cutter_specification,cutter_sort
     </sql>
 
     <select id="pageList" parameterType="String" resultMap="BaseResultMap">

+ 22 - 8
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionReadyCenter/CutterCategoriesController.java

@@ -8,12 +8,18 @@ import com.github.zuihou.base.R;
 import com.github.zuihou.base.controller.SuperSimpleController;
 import com.github.zuihou.base.request.PageParams;
 import com.github.zuihou.business.cuttercategories.entity.CutterCategories;
+import com.github.zuihou.business.productionReadyCenter.entity.BBomProcedureTool;
+import com.github.zuihou.business.productionReadyCenter.entity.MMeterial;
+import com.github.zuihou.business.productionReadyCenter.service.BomProcedureToolService;
 import com.github.zuihou.business.productionResourceCenter.service.CutterCategoriesService;
+import com.github.zuihou.common.constant.BizConstant;
+import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.log.annotation.SysLog;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.cxf.common.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -34,21 +40,29 @@ public class CutterCategoriesController extends SuperSimpleController<CutterCate
     @Autowired
     private CutterCategoriesService cutterCategoriesService;
 
+    @Autowired
+    private BomProcedureToolService bomProcedureToolService;
+
     @ApiOperation(value = "查询对话调度记录", notes = "查询对话调度记录")
     @PostMapping("/page")
     public R<IPage<CutterCategories>> page(@RequestBody @Validated PageParams<CutterCategories> params) {
-        IPage<CutterCategories> page = new Page<CutterCategories>(1L, 999L);
+        IPage<CutterCategories> page = params.buildPage();
         LbqWrapper<CutterCategories> lbqWrapper = new LbqWrapper<CutterCategories>();
-        Map<String, Object> map = BeanUtil.beanToMap(params.getModel());
-        if(map.containsKey("partsNo") && ObjectUtil.isNotEmpty(map.get("partsNo"))){
-            lbqWrapper.eq(CutterCategories::getPartsNo, map.get("partsNo").toString());
-        }
-        if(map.containsKey("procedureNo") && ObjectUtil.isNotEmpty(map.get("procedureNo"))){
-            lbqWrapper.eq(CutterCategories::getProcedureNo, map.get("procedureNo").toString());
-        }
+        CutterCategories model = params.getModel();
+        if(StringUtils.isEmpty(model.getPartsNo()) || StringUtil.isEmpty(model.getProcedureNo()))
+            return R.fail("传参有错误");
+        lbqWrapper.eq(CutterCategories::getPartsNo, model.getPartsNo())
+                .eq(CutterCategories::getProcedureNo, model.getProcedureNo());
         lbqWrapper.orderByAsc(CutterCategories::getCutterSort);
         cutterCategoriesService.pageList(page, lbqWrapper);
         return this.success(page);
     }
 
+    @ApiOperation(value = "获取刀具分组信息", notes = "获取刀具分组信息")
+    @PostMapping("/get")
+    public R<BBomProcedureTool> getBomProcedureTool(@RequestBody BBomProcedureTool model) {
+        BBomProcedureTool bBomProcedureTool = bomProcedureToolService.getById(model.getId());
+        return success(bBomProcedureTool);
+    }
+
 }

+ 0 - 6
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/cuttercategories/dto/CutterCategoriesDto.java

@@ -29,12 +29,6 @@ public class CutterCategoriesDto implements Serializable {
 
     private Long id;
 
-    @ApiModelProperty(value = "订单编号")
-    @Length(max = 128, message = "名称长度不能超过128")
-    @TableField(value = "order_no", condition = LIKE)
-    @Excel(name = "订单编号")
-    private  String orderNo;
-
     @ApiModelProperty(value = "零件编号")
     @Length(max = 128, message = "名称长度不能超过128")
     @TableField(value = "parts_no", condition = LIKE)

+ 0 - 6
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/cuttercategories/entity/CutterCategories.java

@@ -35,12 +35,6 @@ public class CutterCategories  extends Entity<Long> {
 
     private Long id;
 
-    @ApiModelProperty(value = "订单编号")
-    @Length(max = 128, message = "名称长度不能超过128")
-    @TableField(value = "order_no", condition = LIKE)
-    @Excel(name = "订单编号")
-    private  String orderNo;
-
     @ApiModelProperty(value = "零件编号")
     @Length(max = 128, message = "名称长度不能超过128")
     @TableField(value = "parts_no", condition = LIKE)