浏览代码

后台代码功能处理

oyq28 5 月之前
父节点
当前提交
60c28adc91

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/cutterdata/service/impl/CutterTestDataServiceImpl.java

@@ -256,7 +256,7 @@ public class CutterTestDataServiceImpl extends SuperServiceImpl<CutterTestDataMa
             if(imcsTOccsEnable){
                 s = restTemplate.postForObject(url, formEntity, String.class);
             }else {
-                s = "{\"taskID\":\"12313\",\"taskNodeID\":\"12313123\",\"result\":\"true\",\"resultMsg\":\"消费成功\",\"concurrency\":\"false\",\"data\":null}\n";
+                s = "{\"taskID\":\"1\",\"taskNodeID\":\"1\",\"result\":\"true\",\"resultMsg\":\"消费成功\",\"concurrency\":\"false\",\"data\":null}\n";
             }
         }catch (Exception e){
             throw new RuntimeException("调用接口报错:"+ e.getMessage());

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

@@ -21,6 +21,7 @@ import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.externalApi.service.ExternalApiService;
 import com.github.zuihou.business.operationManagementCenter.dao.*;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
+import com.github.zuihou.business.operationManagementCenter.service.OrderService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
@@ -402,6 +403,14 @@ public class TaskWorkNode {
                             Order order = orderMapper.selectById(tTask.getOrderId());
                             order.setCompleteNum(1).setProduceStatus("3");//完成
                             orderMapper.updateAllById(order);
+                            //自定义订单非刀具后续处理
+                            if(order.getSingleTaskFlag().equals("1") && !order.getOrderName().contains("cutToolOrder")){
+                                taskNodeService.remove(new LbqWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()));
+                                taskMapper.deleteById(tTask.getId());
+                                workpieceService.removeById(currWorkpiece.getId());
+                                planMapper.deleteById(plan.getId());
+                                orderMapper.deleteById(order.getId());
+                            }
 
                         }
                     } else {

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -2619,7 +2619,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                 // 清空机床刀具信息,把对应机床里面的刀具信息都清空,获取机床里面的刀具寿命等信息,更新到对刀仪表中
                 boolean b = false;
                 try {
-                    b = cutterTestDataService.pushPushToMachine(destLocationNo,cuttingTool.getCuttingToolNo(), taskNode, task);
+                    b = cutterTestDataService.pushPushToMachine(locationNo,cuttingTool.getCuttingToolNo(), taskNode, task);
                     if(!b){
                         throw new RuntimeException("给机床写入刀具失败");
                     }
@@ -2631,7 +2631,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                cuttingTool.setDeviceId(0L).setCutterNo(0L);
                cuttingToolService.updateById(cuttingTool);
                //刀具出库移动到目的位
-                stockInfo.setStorgeId(Long.parseLong(targetStorgeId)).setGoodsType("6").setGoodsId(cuttingTool.getId()).setLockStatus("1").setNum(1).setCompleteBatchNo(task.getCompleteBatchNo());
+                stockInfo.setStorgeId(Long.parseLong(targetStorgeId)).setGoodsType("6").setGoodsId(cuttingTool.getId()).setLockStatus("1").setNum(1).setCompleteBatchNo("");
                stockInfoService.updateById(stockInfo);
 
                return R.success("");

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

@@ -8,6 +8,7 @@ import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.DemoLine.YunjianConstant;
 import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
+import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.*;
@@ -15,6 +16,8 @@ import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.BBom;
 import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
+import com.github.zuihou.business.productionReadyCenter.entity.CuttingTool;
+import com.github.zuihou.business.productionReadyCenter.service.CuttingToolService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
@@ -25,10 +28,12 @@ import com.github.zuihou.business.productionResourceCenter.service.Productionres
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.productionResourceCenter.strategy.RobotStrategy;
 import com.github.zuihou.business.util.MsgUtil;
+import com.github.zuihou.common.constant.CodeRuleModule;
 import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.tenant.service.CodeRuleService;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
@@ -85,6 +90,15 @@ public class ToolRobotStrategy implements RobotStrategy {
     @Autowired
     private OrderTaskService orderTaskService;
 
+    @Autowired
+    private CuttingToolService cuttingToolService;
+
+    @Autowired
+    private StockInfoService stockInfoService;
+
+    @Autowired
+    private CodeRuleService codeRuleService;
+
     @Value("${imcs-to-ccs.enabled:true}")
     private Boolean imcsTOccsEnable;
 
@@ -144,6 +158,10 @@ public class ToolRobotStrategy implements RobotStrategy {
                 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()));
+                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);
                 return null;
             }
         }
@@ -344,9 +362,11 @@ public class ToolRobotStrategy implements RobotStrategy {
                 }
 
                 //todo 与ccs联调需要释放  $需要换地址$
-                String resultData = this.cutToolActionCondition("/api/getCutterDeviceIsPut", taskNode, pointId);
-                JSONObject resultObj = JSONObject.parseObject(resultData);
-                bool = resultObj.getBoolean("result");
+                if(imcsTOccsEnable) {
+                    String resultData = this.cutToolActionCondition("/api/getCutterDeviceIsPut", taskNode, pointId);
+                    JSONObject resultObj = JSONObject.parseObject(resultData);
+                    bool = resultObj.getBoolean("result");
+                }
                 if (!bool) {
                     msgUtil.createWarnLog("刀具节点目标位放置条件不满足", "DataException");
                     return null;