|
@@ -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("取刀位转动其他任务已占用");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|