Jelajahi Sumber

后台代码更新处理

oyq28 6 bulan lalu
induk
melakukan
54c525806f

+ 1 - 0
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/authority/config/AuthorityWebConfiguration.java

@@ -87,6 +87,7 @@ public class AuthorityWebConfiguration extends BaseConfig implements WebMvcConfi
                 "/",
                 "/csrf",
                 "/agv/agvCallbackService/agvCallback",
+                "/toolbar/agvTaskNotice",
                 "/cud/**",
                 "/META-INF/resources/**",
                 "/resources/**",

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

@@ -1488,6 +1488,7 @@ public class TaskWorkNode {
             String targetNo = stockInfoService.getTargetNo(agvGoalZone.getNo(), bomzZone.getNo());
             Map paramMap = Maps.newHashMap();
             paramMap.put("targetNo", targetNo);
+            paramMap.put("no", "CT_01");
             //获取目标线边库
             xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
             xbkValidList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());

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

@@ -148,11 +148,8 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
 
     @Override
     public String getUnionCode(String completeBatchNo) {
-        List<TWorkpiece> workpieceList = baseMapper.selectList(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,completeBatchNo));
-        if(CollectionUtil.isNotEmpty(workpieceList)) {
-            TWorkpiece workpiece = workpieceList.get(0);
-            return workpiece.getUniqueCode();
-        }
+        TWorkpiece workpiece = baseMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,completeBatchNo).eq(TWorkpiece::getIsEnd, "0").last("limit 1"));
+        if(null!= workpiece) return workpiece.getUniqueCode();
         return "";
     }
 

+ 5 - 5
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java

@@ -255,16 +255,16 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 
                     Order order = orderMapper.selectById(task.getOrderId());
                     TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()));
-                    tWorkpiece.setProductNo(unionCode);
+                    tWorkpiece.setProductNo(order.getSource().equals("2")? order.getBatchNo()+"-"+ String.format("%03d", tWorkpiece.getSerialNo()) : unionCode.substring(0, 12));
                     workpieceService.updateById(tWorkpiece);
 
                     BomProcedureVersion procedure = bomProcedureVersionService.getById(task.getProcedureId());
 
                     JSONObject data = new JSONObject();
-                    //默认配置  后期可改可去
-                    // TODO工件增加流水号
-                    data.put("typeNo", "C");
-                    data.put("smallTypeNo", procedure.getLabelMachineConf().equals("1")? Integer.parseInt(procedure.getLabelMachinePrograme()):  1);
+                    //解析打标检测程序
+                    String[] labelConfArr = procedure.getLabelMachinePrograme().split("_");
+                    data.put("typeNo", labelConfArr[0]);
+                    data.put("smallTypeNo", Integer.parseInt(labelConfArr[1]));
                     data.put("orderNo", order.getOrderNo());
                     data.put("taskNo", task.getTaskNo());
                     data.put("productNo", unionCode);

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -1178,6 +1178,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 String targetNo = stockInfoService.getTargetNo(agvGoalZone.getNo(), bomzZone.getNo());
                 Map paramMap = Maps.newHashMap();
                 paramMap.put("targetNo", targetNo);
+                paramMap.put("no", "CT_02");
                 //获取目标线边库
                 xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
                 xbkValidList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());

+ 27 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java

@@ -21,6 +21,8 @@ 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.externalApi.dto.ManualInfo;
+import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
+import com.github.zuihou.business.externalApi.service.AgvHikOrderDetailInfoService;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.operationManagementCenter.dto.TTaskPageDTO;
 import com.github.zuihou.business.operationManagementCenter.dto.TTaskSaveDTO;
@@ -41,6 +43,7 @@ import com.github.zuihou.common.constant.BizConstant;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.constant.ParameterKey;
+import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
@@ -112,6 +115,8 @@ public class ToolbarController {
     private BomProcedureProductionresourceService bomProcedureProductionresourceService;
     @Autowired
     private OrderService orderService;
+    @Autowired
+    private AgvHikOrderDetailInfoService agvHikOrderDetailInfoService;
 
     @ApiOperation(value = "更新库位位置", notes = "更新库位位置")
     @PostMapping("/updateStorge")
@@ -795,5 +800,27 @@ public class ToolbarController {
         return R.success();
     }
 
+    @ApiOperation(value = "AGV任务执行通知", notes = "AGV任务执行通知")
+    @PostMapping("/agvTaskNotice")
+    public R agvTaskNotice(@RequestBody Map data) {
+        BaseContextHandler.setTenant("0000");
+        String taskCode = data.containsKey("taskCode")? data.get("taskCode").toString() : null;
+        if(StringUtils.isEmpty(taskCode)) return R.fail("数据传参为空");
+        //判断是否允许继续执行任务 默认位true
+        boolean bool = true;
+        if(bool){
+            AgvHikOrderDetailInfo agvHikOrderDetailInfo = agvHikOrderDetailInfoService.getOne(new LbqWrapper<AgvHikOrderDetailInfo>().eq(AgvHikOrderDetailInfo::getTaskCode, taskCode).last("limit 1"));
+            if(null == agvHikOrderDetailInfo) return R.fail("任务编码传参有误");
+            String reqCode = agvHikOrderDetailInfo.getReqCode();
+            String agvContinueTaskUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.CONTINUETASK).toString());
+            if(StringUtils.isEmpty(agvContinueTaskUrl)) return R.fail("继续执行任务接口地址为空");
+            JSONObject params = new JSONObject();
+            params.put("reqCode", reqCode);
+            params.put("taskCode", taskCode);
+            msgUtil.httpForPost(agvContinueTaskUrl,  params.toString());
+        }
+        return R.success();
+    }
+
 }
 

+ 2 - 0
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/ParameterKey.java

@@ -52,6 +52,8 @@ public interface ParameterKey {
     String TODOWNGOODS = "toDownGoods";
     // AGV下达任务请求地址
     String ADDTASK = "add_task";
+    // AGV任务执行通知地址
+    String CONTINUETASK = "continue_task";
     // agv状态
     String GET_AGV_STATUS = "get_agv_status";