3 次代码提交 33f8f727d0 ... 942136b422

作者 SHA1 备注 提交日期
  wang.sq@aliyun.com 942136b422 fix:优化自动化刀具 2 周之前
  wang.sq@aliyun.com 4cec074b8f Merge remote-tracking branch 'origin/master' 2 周之前
  wang.sq@aliyun.com 30367a65ab fix:优化自动化刀具 2 周之前

+ 20 - 5
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/impl/ToolRobotStrategy.java

@@ -154,15 +154,30 @@ public class ToolRobotStrategy implements RobotStrategy {
             //从机床刀具库取需要预置处理
             //从机床刀具库取需要预置处理
             Object cutToolAction = msgUtil.redis_get(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION);
             Object cutToolAction = msgUtil.redis_get(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION);
             if(ObjectUtil.isEmpty(cutToolAction)){
             if(ObjectUtil.isEmpty(cutToolAction)){
-                this.CNCTActionHandle(taskNode, false, pointId, orderTask);
-                msgUtil.redis_set(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION, taskNode.getId().toString(),10, TimeUnit.MINUTES);
-                dataMap.put("result", false);
-                dataMap.put("resultMsg","已下发CNC刀具口请求");
                 //机床内刀具库位信息同步到机床待取位
                 //机床内刀具库位信息同步到机床待取位
                 CuttingTool cuttingTool = cuttingToolService.getOne(new LbqWrapper<CuttingTool>().eq(CuttingTool::getCutterNo, orderTask.getCutStartNo()));
                 CuttingTool cuttingTool = cuttingToolService.getOne(new LbqWrapper<CuttingTool>().eq(CuttingTool::getCutterNo, orderTask.getCutStartNo()));
+                if(cuttingTool == null){
+                    throw new RuntimeException("刀具点位与刀具信息点位数据不对,起始刀位号:"+orderTask.getCutStartNo());
+                }
+                StockInfo one = stockInfoService.getOne(new LbqWrapper<StockInfo>().eq(StockInfo::getGoodsId, cuttingTool.getId()));
+                if(one !=null){
+                    throw new RuntimeException("刀具信息在库存中已存在,位置:"+one.getStorgeId());
+                }
+
+                // 调用plc 让plc把机床刀具转到待取位
+                this.CNCTActionHandle(taskNode, false, pointId, orderTask);
+
                 StockInfo stockInfo = StockInfo.builder().storgeId(startStore.getId()).lockStatus("1").num(1).uniqueCode(codeRuleService.getBillCode(CodeRuleModule.CODE_RULE_UNIQUE)).goodsType("6").specId(cuttingTool.getId()).goodsId(cuttingTool.getId()).build();
                 StockInfo stockInfo = StockInfo.builder().storgeId(startStore.getId()).lockStatus("1").num(1).uniqueCode(codeRuleService.getBillCode(CodeRuleModule.CODE_RULE_UNIQUE)).goodsType("6").specId(cuttingTool.getId()).goodsId(cuttingTool.getId()).build();
                 stockInfoService.save(stockInfo);
                 stockInfoService.save(stockInfo);
-                return null;
+
+                dataMap.put("result", false);
+                dataMap.put("resultMsg","已下发CNC刀具口请求");
+
+                msgUtil.redis_set(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION, taskNode.getId().toString(),10, TimeUnit.MINUTES);
+                return dataMap;
+            }else if(!cutToolAction.toString().equals(taskNode.getId().toString())){
+                // 判断是否为同一个任务
+                throw new RuntimeException("取刀位转动其他任务已占用");
             }
             }
         }
         }
 
 

+ 2 - 2
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ToolController.java

@@ -114,7 +114,7 @@ public class ToolController extends SuperController<ToolService, Long, Tool, Too
     @ApiOperation(value = "同步刀具", notes = "同步刀具")
     @ApiOperation(value = "同步刀具", notes = "同步刀具")
     @PostMapping("/synchronousTool")
     @PostMapping("/synchronousTool")
     public R<Boolean> synchronousTool() throws Exception {
     public R<Boolean> synchronousTool() throws Exception {
-        BaseContextHandler.setTenant("000");
+        BaseContextHandler.setTenant("0000");
         List<Productionresource> dataList = productionresourceBizService.list(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").ne(Productionresource::getOnlineStatus,"0").isNotNull(Productionresource::getModeSpecification));
         List<Productionresource> dataList = productionresourceBizService.list(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").ne(Productionresource::getOnlineStatus,"0").isNotNull(Productionresource::getModeSpecification));
         List<Long> ids = dataList.stream().map(Productionresource::getId).collect(Collectors.toList());
         List<Long> ids = dataList.stream().map(Productionresource::getId).collect(Collectors.toList());
         MachineCuttingTool machineCuttingTool = new MachineCuttingTool();
         MachineCuttingTool machineCuttingTool = new MachineCuttingTool();
@@ -133,7 +133,7 @@ public class ToolController extends SuperController<ToolService, Long, Tool, Too
             for(int i=0;i<cutToolList.size(); i++) {
             for(int i=0;i<cutToolList.size(); i++) {
                 MachineCuttingTool item = cutToolList.get(i);
                 MachineCuttingTool item = cutToolList.get(i);
                 //默认取刀具去刀架
                 //默认取刀具去刀架
-                boolean isWarn = item.getTl().equals("L")? true : false;
+                boolean isWarn = item.getDoc().equals("HD")? true : false;
                 //同步添加天轨处理订单
                 //同步添加天轨处理订单
                 Map<String, String> data = Maps.newHashMap();
                 Map<String, String> data = Maps.newHashMap();
                 //获取机床待取库位
                 //获取机床待取库位

+ 1 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/MachineCuttingTool.java

@@ -203,7 +203,7 @@ public class MachineCuttingTool extends Entity<Long> {
     /**
     /**
      * 锁定运行状态
      * 锁定运行状态
      */
      */
-    @ApiModelProperty(value = "换刀标识位(''-不需换刀 HD-需要换刀)")
+    @ApiModelProperty(value = "换刀标识位(''-不需换刀 HD-刀具寿命到期,FDJ-换刀,把刀放到中央刀库)")
     @TableField(value = "doc", condition = EQUAL)
     @TableField(value = "doc", condition = EQUAL)
     @Excel(name = "换刀标识位")
     @Excel(name = "换刀标识位")
     private String doc;
     private String doc;