Pārlūkot izejas kodu

后台代码更新处理

oyq28 1 gadu atpakaļ
vecāks
revīzija
78c0f82cc3
22 mainītis faili ar 420 papildinājumiem un 154 dzēšanām
  1. 9 0
      imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java
  2. 6 6
      imcs-admin-boot/imcs-authority-server/src/main/resources/application-prod.yml
  3. 12 10
      imcs-admin-boot/imcs-authority-server/src/main/resources/application-test.yml
  4. 2 2
      imcs-admin-boot/imcs-authority-server/src/main/resources/bootstrap.yml
  5. 8 22
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java
  6. 45 34
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  7. 39 13
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java
  8. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/dao/MMeterialReceiveLogMapper.java
  9. 4 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/MMeterialReceiveLogService.java
  10. 8 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/MMeterialReceiveLogServiceImpl.java
  11. 22 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  12. 47 47
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  13. 113 4
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java
  14. 16 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/MMeterialReceiveLogMapper.xml
  15. 29 2
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java
  16. 7 1
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/BBomPageDTO.java
  17. 7 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/BBomSaveDTO.java
  18. 7 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/BBomUpdateDTO.java
  19. 14 1
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/BBom.java
  20. 2 2
      imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/BizConstant.java
  21. 4 3
      imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/DictionaryKey.java
  22. 17 6
      imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/util/SmbShareFileUtil.java

+ 9 - 0
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java

@@ -20,6 +20,7 @@ import com.github.zuihou.business.operationManagementCenter.service.PlanService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
+import com.github.zuihou.business.productionReadyCenter.service.MMeterialReceiveLogService;
 import com.github.zuihou.business.productionResourceCenter.entity.Repair;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.RepairService;
@@ -87,6 +88,9 @@ public class DashboardJob {
     @Autowired
     private RepairService repairService;
 
+    @Autowired
+    private MMeterialReceiveLogService meterialReceiveLogService;
+
     @Autowired
     private AAutoNodeLogMapper aAutoNodeLogMapper;
 
@@ -152,6 +156,11 @@ public class DashboardJob {
             Map orderStatistics = orderService.orderStatitcs();
             dataScreenMap.put("orderStatistics", orderStatistics);
 
+            List<Map> materialStatistics = meterialReceiveLogService.dataMap();
+            Map materialMap = Maps.newHashMap();
+            materialMap.put("materialData", materialStatistics);
+            dataScreenMap.put("materialMap", materialMap);
+
             //任务时长统计数据
             Map timeSpanStatistics = orderService.timeSpanStatistics();
             Map validTimeSpanStatistics = orderService.validTimeSpanStatistics();

+ 6 - 6
imcs-admin-boot/imcs-authority-server/src/main/resources/application-prod.yml

@@ -1,24 +1,24 @@
 zuihou:
   nginx:
-    ip: 192.168.11.240    # 正式环境需要将该ip设置成nginx对应的 公网ip
+    ip: 20.20.47.108    # 正式环境需要将该ip设置成nginx对应的 公网ip
     port: 80
   redis:
-    ip: 192.168.11.240
+    ip: 20.20.47.108
     port: 6379
     password: 123456
     database: 0
   rabbitmq:
     enabled: true
-    ip: 192.168.11.240
+    ip: 127.0.0.1
     port: 5672
     username: admin
     password: adminoyq
   mysql:
-    ip: 192.168.11.240
+    ip: 20.20.47.108
     port: 3306
     driverClassName: com.mysql.cj.jdbc.Driver
-    database: zuihou_defaults_yj
-    username: admin
+    database: imcs_defaults_300
+    username: root
     password: adminoyq
     url: jdbc:mysql://${zuihou.mysql.ip}:${zuihou.mysql.port}/${zuihou.mysql.database}?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
   database:

+ 12 - 10
imcs-admin-boot/imcs-authority-server/src/main/resources/application-test.yml

@@ -1,21 +1,21 @@
 zuihou:
   nginx:
     ip: 127.0.0.1     # 正式环境需要将该ip设置成nginx对应的 公网ip
-    port: 10000
+    port: 80
   redis:
-    ip: 192.168.50.111
+    ip: 127.0.0.1
     port: 6379
     password: 123456
     database: 0
   rabbitmq:
     enabled: true
     #ip: 106.15.38.8
-    ip: 192.168.50.111
+    ip: 127.0.0.1
     port: 5672
     #username: admin
     username: admin
     #password: adminoyq
-    password: admin1234
+    password: adminoyq
   mysql:
     #ip: 106.15.38.8
     ip: 127.0.0.1
@@ -23,15 +23,15 @@ zuihou:
     driverClassName: com.mysql.cj.jdbc.Driver
     database: imcs_defaults_300
     username: root
-    password: 123456
+    password: adminoyq
     url: jdbc:mysql://${zuihou.mysql.ip}:${zuihou.mysql.port}/${zuihou.mysql.database}?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
   database:
     isNotWrite: false
   smb:
-    userName: Administrator
-    password: Aa1
-    fileIp: 192.168.11.240
-    filePath: smb://192.168.11.240/report/
+    userName: measuring
+    password: 123456
+    fileIp: 20.20.47.191
+    filePath: smb://20.20.47.191/Program/
   file:
     remoteInputDataPath: smb://SOFLEX-PCS:SOFLEX-PCS@192.168.0.2/SOFLEX_PCS_iGen_CASC1_INPUT/ERP_DATA/
   machineCuttingTools:
@@ -59,4 +59,6 @@ zuihou:
         base-path: /api/file
 mybatis-plus:
   configuration:
-    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+imcs-to-ccs:
+  enabled: false

+ 2 - 2
imcs-admin-boot/imcs-authority-server/src/main/resources/bootstrap.yml

@@ -16,8 +16,8 @@ machine:
     ip: 20.20.47.108
     port: 21
     username: uploader
-    password: adminoyq
-    path: /cncFile
+    password: adminOyq28
+    path: /home/uploader
   #ip: 192.168.10.159
   #port: 21
   #username: lxb

+ 8 - 22
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -56,6 +56,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -623,9 +624,14 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
      */
     @Override
     public boolean szbStockHandle(boolean isFetched, TaskNode taskNode){
-        List<Storge> storgeList = baseMapper.selectList(new LbqWrapper<Storge>().in(Storge::getPointId, Arrays.asList(DictionaryKey.ZEISS_LOCATION.get("M"), DictionaryKey.ZEISS_LOCATION.get("L"))));
+        List<Storge> storgeList = baseMapper.selectList(new LbqWrapper<Storge>().eq(Storge::getLockStatus, "1").in(Storge::getPointId, Arrays.asList(DictionaryKey.ZEISS_LOCATION.get("M"))));
+        if(storgeList.isEmpty()){
+            // 没有可用的三坐标
+            return false;
+        }
+
         List<StockInfo> mPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(0).getId()));
-        List<StockInfo> lPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(1).getId()));
+        //List<StockInfo> lPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(1).getId()));
 
         JSONObject params = new JSONObject();
         //三坐标中间位取操作
@@ -636,16 +642,6 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
             //判断三坐标是否可取
             if (null != fetchObject && fetchObject.containsKey("result") && StringUtils.isNotEmpty(fetchObject.getString("result")) && !fetchObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() > 0) return true;
-                // M位可取但无零件工装且L位有零件工装
-                if (lPointList.size() > 0 && mPointList.size() == 0) {
-                    List<Long> ids = lPointList.stream().map(StockInfo::getId).collect(toList());
-                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
-                    //虚拟缓存位点位更新成为M点位
-                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(0).getId()).in(StockInfo::getId, ids);
-                    stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}取操作,虚拟缓存位点位更新成为M点位", taskNode.getId());
-                    return true;
-                }
             }
         }else{
             //三坐标中间放操作
@@ -654,16 +650,6 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
             logger.warn("三坐标节点{}放查询接口返回{}", taskNode.getId(), sendObject.toJSONString());
             if (null != sendObject && sendObject.containsKey("result") && StringUtils.isNotEmpty(sendObject.getString("result")) && !sendObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() == 0) return true;
-                // M位可放但有零件工装更新到虚拟L位
-                if (mPointList.size() > 0 && lPointList.size() == 0) {
-                    List<Long> ids = mPointList.stream().map(StockInfo::getId).collect(toList());
-                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
-                    //M点位更新为L虚拟点位
-                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(1).getId()).in(StockInfo::getId, ids);
-                    stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}放操作,M点位更新为L虚拟点位", taskNode.getId());
-                    return true;
-                }
             }
         }
         logger.warn("三坐标节点{}取放条件不通过", taskNode.getId());

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

@@ -30,13 +30,11 @@ import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureProgramMapper;
-import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
-import com.github.zuihou.business.productionReadyCenter.entity.BBom;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProgram;
+import com.github.zuihou.business.productionReadyCenter.entity.*;
 import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
+import com.github.zuihou.business.productionReadyCenter.service.TrayService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ResourceAutoCodeMapper;
@@ -169,6 +167,8 @@ public class TaskWorkNode {
 
     @Autowired
     private BomProcedureProgramMapper bomProcedureProgramMapper;
+    @Autowired
+    private TrayService trayService;
 
     @Value("${zuihou.file.storage-path}")
     private String storagePath;
@@ -494,12 +494,6 @@ public class TaskWorkNode {
                                        String jsonParam = getRequestParam(conMap);
                                        specialCallBackMyselfFlag = true;
                                     }else{
-                                           try {
-                                               Thread.sleep(1000);
-                                           } catch (InterruptedException e) {
-                                               e.printStackTrace();
-                                           }
-
                                            //组装接口参数
                                         HttpHeaders headers = new HttpHeaders();
                                         headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
@@ -1168,6 +1162,21 @@ public class TaskWorkNode {
 
             if(null != targetStorge){
 
+                //判断是否为机床上料
+                Object applyFeeding = msgUtil.redis_get("ApplyFeeding_"+ taskNode.getId());
+                if(returnMap.containsKey("preUpLoadFlag") && ObjectUtil.isEmpty(applyFeeding)){
+                    // 发送请求上料cnc程序。并启动
+                    boolean bool = this.asyncPredictUploadFile(task,taskNode);
+                    if(!bool){
+                        dataMap.put("resultmsg","申请上料条件不满足");
+                        msgUtil.redis_del("ApplyFeeding_"+ taskNode.getId());
+                    }else{
+                        dataMap.put("resultmsg","申请上料程序等待");
+                    }
+                    dataMap.put("result", false);
+                    return;
+                }
+
                 //锁定机械手
                 Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
                 jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
@@ -1201,15 +1210,6 @@ public class TaskWorkNode {
                 //出入库类型
                 dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 
-                //判断是否为机床上料
-                if(returnMap.containsKey("preUpLoadFlag")){
-
-                    // 发送请求上料cnc程序。并启动
-                    this.asyncPredictUploadFile(task,taskNode);
-                    //程序异步文件上传,因为异步问题,会导致上面程序还没执行,就会给覆盖,不进行程序的上传
-//                    this.asyncUploadFile(task,taskNode);
-                }
-
             }else{
                 dataMap.put("result", false);
             }
@@ -1232,8 +1232,10 @@ public class TaskWorkNode {
             procedureProgramList.forEach(i -> {
                 Map<String, String> m = new HashMap<>();
                 String filePath = i.getFilePath().replace(uriPath, storagePath);
-                //m.put("fileName", filePath.replace("/", "\\"));
-                m.put("fileName", filePath);
+                String fileName = i.getSubmittedFileName();
+                m.put("filePath", filePath);
+                fileName = fileName.replace("00.H", "O1.H");
+                m.put("fileName", fileName);
                 fileList.add(m);
             });
 
@@ -1256,19 +1258,36 @@ public class TaskWorkNode {
     }
 
     // 预上传,发送上料请求
-    public void asyncPredictUploadFile(TTask task,TaskNode taskNode){
+    public boolean asyncPredictUploadFile(TTask task,TaskNode taskNode){
         // 根据设备节点需求的设备id获取资源设备信息
         Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
+        TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()).last("limit 1"));
+        BBom bom = bBomMapper.selectById(workpiece.getBomId());
+        if(workpiece.getStorgeId()==null) {
+            return false;
+        }
+        StockInfo stockInfo = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, workpiece.getStorgeId()).eq(StockInfo::getGoodsType, "1").last("limit 1"));
+        Tray tray = trayService.getById(stockInfo.getGoodsId());
+        StringBuilder sbuilder = new StringBuilder();
+        if(tray.getProductionType().getKey().equals("JXT")){
+            String suffix = tray.getNo().replace("JXT_A", "");
+            sbuilder.append("01" + bom.getProcedureType().trim()).append(suffix.trim()+".H");
+        }else{
+            sbuilder.append("01" + bom.getProcedureType().trim() +".H");
+        }
 
         List<BomProcedureProgram>procedureProgramList = bomProcedureProgramMapper.selectList(Wraps.<BomProcedureProgram>lbQ().eq(BomProcedureProgram::getProcedureId,task.getProcedureId()));
+        if(procedureProgramList==null || procedureProgramList.size() == 0){
+            return false;
+        }
+
         List<Map<String, String>> fileList = new ArrayList<Map<String, String>>();
-        if (procedureProgramList != null && procedureProgramList.size() > 0) {
             //文件上传只允许单个文件
             procedureProgramList.forEach(i -> {
                 Map<String, String> m = new HashMap<>();
                 String filePath = i.getFilePath().replace(uriPath, storagePath);
                 //m.put("fileName", filePath.replace("/", "\\"));
-                filePath = filePath.replace("00.H", "O1.H");
+                filePath = filePath.replace("00.H", sbuilder.toString());
                 m.put("fileName", filePath);
                 fileList.add(m);
             });
@@ -1276,8 +1295,7 @@ public class TaskWorkNode {
             JSONObject data = new JSONObject();
             data.put("fileName", fileList.get(0).get("fileName"));
             //Module module = moduleService.getOne(new LbqWrapper<Module>().eq(Module::getId, productionresource.getModuleId()));
-            TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()).last("limit 1"));
-            BBom bom = bBomMapper.selectById(workpiece.getBomId());
+
             data.put("remotePath", bom.getDrawingNo());
 
             JSONObject uploadInfo = new JSONObject();
@@ -1285,14 +1303,7 @@ public class TaskWorkNode {
             uploadInfo.put("port", productionresource.getPort());
             uploadInfo.put("data", data);
 
-            Object runStatus = msgUtil.redis_get("ApplyFeeding_"+ taskNode.getId());
-            if(ObjectUtil.isEmpty(runStatus)) {
-                boolean bool = this.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
-                if(bool){
-                    //msgUtil.redis_del("ApplyFeeding_"+ taskNode.getId());
-                }
-            }
-        }
+        return this.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
     }
 
 

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

@@ -1544,10 +1544,49 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             return R.success("");
         }
 
+        //接口不让传多余参数,只能从缓存传
+        String jsonParam = msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId) == null ? ""
+                : msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId).toString();
+        //把三坐标检测结果追加进去
+        if (StringUtil.isNotEmpty(jsonParam)) {
+            JSONObject callBackJsonParam = JSONObject.parseObject(jsonParam);
+            if (StringUtil.isNotEmpty(bean.getStationId())) {
+                callBackJsonParam.put("stationId", bean.getStationId());
+            }
+            jsonParam = callBackJsonParam.toJSONString();
+        }else{
+            return R.fail("节点{}确认信息已丢失, 需要重发确认请求", taskNodeId);
+        }
+
+        JSONObject callbackJson = JSONObject.parseObject(jsonParam);
+        boolean mulCache = false;
+        boolean mulXbk = callbackJson.containsKey(YunjianConstant.YUNJIAN_XBKFLAG) && callbackJson.getString(YunjianConstant.YUNJIAN_XBKFLAG).equals("1")?true:false;
+        String mulCount = callbackJson.containsKey(taskNodeId+"count")? callbackJson.getString(taskNodeId+"count"): null;
         //验证是否重复回调
         String repeatKey = taskNodeId + taskId;
 
         String cacheUid = msgUtil.redis_get(repeatKey) == null ? "" : msgUtil.redis_get(repeatKey).toString();
+
+        if (StringUtil.isNotEmpty(cacheUid)) {//排除掉重复回调
+            //回调重复去除
+            if(!mulCache && !mulXbk) {
+                log.warn("回调重复了======================" + cacheUid);
+                //msgUtil.redis_del(cacheUid);
+                return R.fail(-5,"节点"+bean.getTaskNodeId()+"已有回调");
+            }else if(mulCount!=null){
+                //线边库
+                String checkVal = !mulXbk ? taskNodeId +"_" + mulCount : taskNodeId + "_2_" + mulCount;
+                if(!cacheUid.equals(checkVal)){
+                    //计数节点次序并发不一致直接过滤
+                    return R.fail(-5,"计数节点"+bean.getTaskNodeId()+"数据不一致");
+                }
+            }
+        }else{
+            //把当前id存放入缓存
+            String repeatVal = mulCache? taskNodeId +"_0" : taskNodeId;
+            msgUtil.redis_set(String.valueOf(repeatKey), String.valueOf(repeatVal), 2, TimeUnit.DAYS);
+        }
+
         if (StringUtil.isNotEmpty(cacheUid)) {//排除掉重复回调
             log.warn("回调重复了======================" + cacheUid);
             //回调重复去除
@@ -1605,18 +1644,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         String code = bean.getCode();
         String msg = bean.getMsg() != null ? bean.getMsg() : "指令操作失败";
 
-        //接口不让传多余参数,只能从缓存传
-        String jsonParam = msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId) == null ? ""
-                : msgUtil.redis_get(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId).toString();
-        //把三坐标检测结果追加进去
-        if (StringUtil.isNotEmpty(jsonParam)) {
-            JSONObject callBackJsonParam = JSONObject.parseObject(jsonParam);
-            if (StringUtil.isNotEmpty(bean.getStationId())) {
-                callBackJsonParam.put("stationId", bean.getStationId());
-            }
-            jsonParam = callBackJsonParam.toJSONString();
-        }
-
         if (null != taskInfoObject) {
             String taskInfos = taskInfoObject.toString();
 
@@ -1663,7 +1690,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             lg.setStatus("0").setExeResult("0").setManual("1").setFeedback(msg);
             autoNodeLogMapper.updateAllById(lg);
         }
-        msgUtil.redis_del(repeatKey);
         return R.success();
     }
 

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/dao/MMeterialReceiveLogMapper.java

@@ -26,4 +26,6 @@ public interface MMeterialReceiveLogMapper extends SuperMapper<MMeterialReceiveL
     IPage<MMeterialReceiveLog> pageList(IPage page, @Param(Constants.WRAPPER) Wrapper<MMeterialReceiveLog> queryWrapper);
 
     List<Map<String, String>> selectValidMeterialList();
+
+    List<Map> dataMap();
 }

+ 4 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/MMeterialReceiveLogService.java

@@ -10,6 +10,9 @@ import com.github.zuihou.business.productionReadyCenter.entity.MMeterialReceiveL
 import com.github.zuihou.business.productionReadyCenter.entity.Plate;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 业务接口
@@ -24,5 +27,6 @@ public interface MMeterialReceiveLogService extends SuperService<MMeterialReceiv
     IPage<MMeterialReceiveLog> pageList(IPage page, LbqWrapper<MMeterialReceiveLog> wrapper);
     MMeterialReceiveLog save(MMeterialReceiveLogSaveDTO data);
     Boolean delete(MMeterialReceiveLog model);
+    List<Map> dataMap();
 
 }

+ 8 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/MMeterialReceiveLogServiceImpl.java

@@ -16,6 +16,9 @@ import com.github.zuihou.utils.BeanPlusUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Map;
+
 import static com.github.zuihou.utils.BizAssert.isFalse;
 
 /**
@@ -51,4 +54,9 @@ public class MMeterialReceiveLogServiceImpl extends SuperServiceImpl<MMeterialRe
 
         return null;
     }
+
+    @Override
+    public List<Map> dataMap() {
+        return baseMapper.dataMap();
+    }
 }

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

@@ -34,6 +34,7 @@ import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.constant.ParameterKey;
+import com.github.zuihou.common.util.SmbShareFileUtil;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
@@ -52,6 +53,7 @@ import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static java.util.stream.Collectors.groupingBy;
 
@@ -139,6 +141,15 @@ public class MachineNodeServiceImpl implements NodeOperationService {
     @Value("${zuihou.file.uriPrefix}")
     private String uriPath;
 
+    @Value("${zuihou.smb.userName}")
+    private String userName;
+    @Value("${zuihou.smb.password}")
+    private String password;
+    @Value("${zuihou.smb.fileIp}")
+    private String fileIp;
+    @Value("${zuihou.smb.filePath}")
+    private String filePath;
+
     @Override
     public void initResource(TaskNode taskNode, TTask task, Map dataMap) {
         //获取当前设备模型
@@ -418,7 +429,17 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                         // begin modify by yejian on 20220507 for 更新tasknode表中nodetype,方便三坐标测量完成后回调后快速查找测量结果
                         taskNode.setNodeType("3");
                         taskNodeService.updateById(taskNode);
-                        // end modify by yejian on 20220507 for 更新tasknode表中nodetype,方便三坐标测量完成后回调后快速查找测量结果
+                        //更新三坐标检测程序文件名(文件读写)
+                        String programPath = filePath + "/ProgramName/name.txt";
+                        List<String> content = SmbShareFileUtil.readShareFileContent(programPath, userName, password, fileIp);
+                        //List<String> content = Stream.of("0").collect(Collectors.toList());
+                        if(content.size()>0 && content.get(0).equals("0")){
+                            String programName = procedure.getThreeDimensionalPrograme();
+                            SmbShareFileUtil.writeShareFileContent(programPath, Stream.of(programName).collect(Collectors.toList()), userName, password, fileIp );
+                        }else{
+                            map.put("result", false);
+                            return map;
+                        }
                     }
                     if("1".equals(procedure.getThreeDimensionalDeviationConf())){
                         data.put("workId", task.getCompleteBatchNo() + "-" + task.getProcedureNo());

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

@@ -2,16 +2,9 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
 
 
 import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.github.zuihou.authority.entity.auth.RoleOrg;
-import com.github.zuihou.authority.entity.common.DictionaryItem;
-import com.github.zuihou.authority.entity.core.Org;
 import com.github.zuihou.authority.service.common.ParameterService;
-import com.github.zuihou.base.R;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.DemoLine.YunjianConstant;
@@ -22,11 +15,12 @@ import com.github.zuihou.business.edgeLibrary.entity.Storge;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.externalApi.service.ExternalApiService;
-import com.github.zuihou.business.mq.TaskWorkNode;
 import com.github.zuihou.business.operationManagementCenter.dao.PlanMapper;
-import com.github.zuihou.business.operationManagementCenter.dao.PlanProductMapper;
 import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
-import com.github.zuihou.business.operationManagementCenter.entity.*;
+import com.github.zuihou.business.operationManagementCenter.entity.Plan;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.*;
@@ -48,29 +42,20 @@ import com.github.zuihou.common.constant.DictionaryKey;
 import com.github.zuihou.common.constant.ParameterKey;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
-import com.github.zuihou.common.util.UniqueKeyGenerator;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
-import com.github.zuihou.tenant.entity.Module;
 import com.github.zuihou.tenant.service.ModuleService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
 import org.springframework.http.MediaType;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
-import org.springframework.web.reactive.function.BodyInserters;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 
@@ -991,9 +976,23 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             if(null != targetStorge){
 
                 log.info("节点{}检查目标库位是否满足返回{}",taskNode.getId(),targetStorge.getPointId());
-
                 //锁定机械手
                 String targetxbk = returnMap.get("targetxbk")==null?null:(String)returnMap.get("targetxbk");
+                Object applyFeeding = msgUtil.redis_get("ApplyFeeding_"+ taskNode.getId());
+                //判断是否为机床上料
+                if(returnMap.containsKey("preUpLoadFlag") && targetxbk.equals("0") && ObjectUtil.isEmpty(applyFeeding)){
+                    // 发送请求上料cnc程序。并启动
+                    boolean bool = this.asyncPredictUploadFile(task, taskNode);
+                    if(!bool){
+                        dataMap.put("resultmsg","申请上料条件不满足");
+                        msgUtil.redis_del("ApplyFeeding_"+ taskNode.getId());
+                    }else{
+                        dataMap.put("resultmsg","申请上料程序等待");
+                    }
+                    dataMap.put("result", false);
+                    return;
+                }
+
                 jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
                 jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
                 storgeService.lockStorge(jqrStorge, taskNode.getId());
@@ -1036,13 +1035,6 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 //出入库类型
                 dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 
-                //判断是否为机床上料
-                if(returnMap.containsKey("preUpLoadFlag")){
-                    // 发送请求上料cnc程序。并启动
-                    this.asyncPredictUploadFile(task, taskNode);
-                    //程序异步文件上传,因为异步问题,会导致上面程序还没执行,就会给覆盖,不进行程序的上传
-//                    this.asyncUploadFile(task, taskNode);
-                }
             }else{
                 dataMap.put("result", false);
                 dataMap.put("resultmsg", "目标库位为空,任务id:" + taskNode.getId());
@@ -1095,19 +1087,39 @@ public class RobotNodeServiceImpl implements NodeOperationService {
     }
 
     // 预上传,发送上料请求
-    public void asyncPredictUploadFile(TTask task,TaskNode taskNode){
+    public boolean asyncPredictUploadFile(TTask task,TaskNode taskNode){
         // 根据设备节点需求的设备id获取资源设备信息
         Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
+        TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()).last("limit 1"));
+        BBom bom = bBomMapper.selectById(workpiece.getBomId());
+
+        if(workpiece.getStorgeId()==null) {
+            msgUtil.createWarnLog("上料申请节点库位地址为空", "DataException");
+            return false;
+        }
+        StockInfo stockInfo = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, workpiece.getStorgeId()).eq(StockInfo::getGoodsType, "1").last("limit 1"));
+        Tray tray = trayService.getById(stockInfo.getGoodsId());
+        StringBuilder sbuilder = new StringBuilder();
+        if(tray.getProductionType().getKey().equals("JXT")){
+            String suffix = tray.getNo().replace("JXT_A", "");
+            sbuilder.append("01" + bom.getProcedureType().trim()).append(suffix.trim()+".H");
+        }else{
+            sbuilder.append("01" + bom.getProcedureType().trim() + ".H");
+        }
 
         List<BomProcedureProgram>procedureProgramList = bomProcedureProgramMapper.selectList(Wraps.<BomProcedureProgram>lbQ().eq(BomProcedureProgram::getProcedureId,task.getProcedureId()));
+        if(procedureProgramList==null || procedureProgramList.size() == 0){
+            msgUtil.createWarnLog("上料申请配置上传文件为空", "DataException");
+            return false;
+        }
+
         List<Map<String, String>> fileList = new ArrayList<Map<String, String>>();
-        if (procedureProgramList != null && procedureProgramList.size() > 0) {
             //文件上传只允许单个文件
             procedureProgramList.forEach(i -> {
                 Map<String, String> m = new HashMap<>();
                 String filePath = i.getFilePath().replace(uriPath, storagePath);
                 //替换默认执行申请上料文件
-                filePath = filePath.replace("00.H", "O1.H");
+                filePath = filePath.replace("00.H", sbuilder.toString());
                 m.put("fileName", filePath);
                 fileList.add(m);
             });
@@ -1115,8 +1127,6 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             JSONObject data = new JSONObject();
             data.put("fileName", fileList.get(0).get("fileName"));
             //Module module = moduleService.getOne(new LbqWrapper<Module>().eq(Module::getId, productionresource.getModuleId()));
-            TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()).last("limit 1"));
-            BBom bom = bBomMapper.selectById(workpiece.getBomId());
             data.put("remotePath", bom.getDrawingNo());
 
             JSONObject uploadInfo = new JSONObject();
@@ -1124,15 +1134,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             uploadInfo.put("port", productionresource.getPort());
             uploadInfo.put("data", data);
 
-            Object runStatus = msgUtil.redis_get("ApplyFeeding_"+ taskNode.getId());
-            if(ObjectUtil.isEmpty(runStatus)) {
-              boolean bool = this.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
-              if(bool){
-                  //msgUtil.redis_del("ApplyFeeding_"+ taskNode.getId());
-              }
-            }
-        }
-
+           return this.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
     }
     /**
      *
@@ -1141,23 +1143,21 @@ public class RobotNodeServiceImpl implements NodeOperationService {
      * @return
      */
     public boolean asyncPredictUploadFilePost(JSONObject jsonObject, long taskNodeId){
-        logger.warn("====发送异步请求,允许上料请求====》"+ jsonObject);
-        System.out.println("====发送异步请求,允许上料请求====》"+jsonObject);
+        logger.warn("====发送异步请求,允许上料请求====》"+ jsonObject +"==="+ DateUtil.formatTime(new Date()));
 
+        msgUtil.redis_set("ApplyFeeding_"+ taskNodeId, DateUtil.formatTime(new Date()), 1, TimeUnit.HOURS);
         String hostSystemUrl = parameterService.getValue(ParameterKey.HOSTSYSTEMURL, null);
         WebClient webClient = WebClient.create(hostSystemUrl);
         jsonObject.put("taskId", "1");
         jsonObject.put("taskNodeId", "1");
         Mono mono = webClient.post().uri("/api/PredictUploadFile").contentType(MediaType.APPLICATION_JSON)
                 .syncBody(jsonObject).retrieve().bodyToMono(String.class);
-        msgUtil.redis_set("ApplyFeeding_"+ taskNodeId, "1", 1, TimeUnit.HOURS);
         // 当上传不成功进行抛错处理
         if(!JSONObject.parseObject(mono.block().toString()).getBoolean("result")){
-//            throw new RuntimeException("上传nc,接受异步请求结果,上传失败:" + mono.block());
+            logger.warn("======发送异步请求,请求失败======:"+mono.block() + "===" + DateUtil.formatTime(new Date()));
             return false;
         }
-        logger.info("======发送异步请求,允许上料请求返回结果======:"+mono.block());
-        System.out.println("======发送异步请求,允许上料请求返回结果======:"+mono.block());
+        logger.warn("======发送异步请求,允许上料请求返回结果======:"+mono.block() + "===" + DateUtil.formatTime(new Date()));
         return true;
     }
     /**

+ 113 - 4
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -40,6 +40,7 @@ import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.SmbShareFileUtil;
 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.exception.BizException;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.google.common.collect.Lists;
@@ -88,6 +89,8 @@ public class MsgUtil implements ApplicationContextAware {
     private String filePath;
     @Value("${zuihou.file.storage-path}")
     private String uploadFolder;
+    @Value("${imcs-to-ccs.enabled:true}")
+    private Boolean imcsTOccsEnable;
 
     @Resource
     private RedisTemplate<String,Object> redisTemplate;
@@ -314,14 +317,15 @@ public class MsgUtil implements ApplicationContextAware {
                     // TODO 后续改成动态拼接
                     //组装接口参数
                     JSONObject jsonParam = new JSONObject();
-                    jsonParam.put("tagname","DB200.20");
+                    jsonParam.put("tagname","DB300.156.4");
                     String instructionUrl = "/api/GetTagValue";
                     String returnData = this.getCcsData(instructionUrl, jsonParam, taskNode);
                     //获取检测结果
-                    int measuringResult = returnData.trim().equals("1") ? 0 : 1;
+                    int measuringResult = returnData.trim().equals("True") ? 0 : 1;
                     //String measuringResultFile = filePath + bomProcedure.getThreeDimensionalPrograme() + "_" + taskNode.getProcedureNo() + "_" + task.getCompleteBatchNo() + "_" + taskNode.getId() +".pdf";
-                    String date = DateUtil.dateToString0(new Date(), "yyyy-M-dd");
-                    String measuringResultFile = SmbShareFileUtil.findNewMeasuringFiles(fileIp,userName,password,filePath + date + "/");
+                    String measuringReportPath = filePath + bomProcedure.getThreeDimensionalPrograme() +"/REPORT/";
+                    //String date = DateUtil.dateToString0(new Date(), "yyyy-M-dd");
+                    String measuringResultFile = SmbShareFileUtil.findNewMeasuringFiles(fileIp,userName,password, measuringReportPath);
                     //List<String> fileContents = new ArrayList<>();
                     logger.warn("获取检测结果文件路径{}", measuringResultFile);
                     OrderQuality orderQuality = new OrderQuality();
@@ -483,6 +487,7 @@ public class MsgUtil implements ApplicationContextAware {
                 System.err.println("手动模式下或者订单暂停时执行到工序最后一个工步***************************");
                 return;
             }
+            String repeatKey = taskNode.getId().toString() + taskNode.getTaskId().toString();
 
             if(callBackJson.containsKey(YunjianConstant.YUNJIAN_XBKFLAG) && "1".equals(callBackJson.get(YunjianConstant.YUNJIAN_XBKFLAG).toString())){//临时存放到了线边库,向虚拟线边库发一个MQ。
 
@@ -500,7 +505,32 @@ public class MsgUtil implements ApplicationContextAware {
 
             }else{
                 jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
+                TaskNode nextNode = taskNodeService.getNextNTaskNode(taskNode, 1);
                 jsonObject.put("taskNodeId",nextTaskNode.getId().toString());
+                //boolean robotCache = callBackJson.containsKey(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG);
+                boolean robotCache = false;
+                //设备完成回调处理
+                boolean positionCache = !callBackJson.containsKey("srcPosition") || StringUtil.isEmpty(callBackJson.getString("srcPosition"));
+                boolean agvCache = callBackJson.containsKey("DEMOLINE_STOCK_TYPE") && callBackJson.get("DEMOLINE_STOCK_TYPE").equals(DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK_WITH_PLATE);
+                if(robotCache){
+                    int count =  callBackJson.getString(taskNode.getId().toString()+"count")==null?0:Integer.parseInt(callBackJson.getString(taskNode.getId().toString()+"count"));
+                    int limit =2;
+                    if(count<limit){//
+                        count = ++count;
+                        jsonObject.put(taskNode.getId().toString()+"count",count);
+                        //把当前节点推送到mq
+                        jsonObject.put("taskNodeId",taskNode.getId().toString());
+                        msgUtil.redis_set(repeatKey, taskNode.getId().toString()+"_"+count);
+                        dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
+                        return;
+                    }
+                }else if(positionCache || agvCache) {
+                    boolean ret = this.priorityHandle(taskNode, nextNode, jsonObject);
+                    if(ret) {
+                        this.cleanCacheId(repeatKey, taskNode.getId().toString(), bomzZone);
+                        return;
+                    }
+                }
                 if(1 == plan.getSingleRunFlag() && "03".equals(nextTaskNode.getInterfaceType())){
                     // 更新agv搬运节点已经完成,工序已经完成
                     nextTaskNode.setEndTime(Calendar.getInstance().getTime());
@@ -562,6 +592,47 @@ public class MsgUtil implements ApplicationContextAware {
         msgUtil.redis_set("PRIORITY_LIST",JSONObject.toJSONString(taskNodePriorityDtoList));
     }
 
+    /**
+     * 优先级处理
+     * @param taskNode
+     * @param nextNode
+     */
+    public boolean priorityHandle(TaskNode taskNode, TaskNode nextNode, JSONObject jsonObject) {
+        jsonObject.put("taskNodeId",nextNode.getId().toString());
+        dynamicRabbitMq.sendMsg(nextNode.getResourceId().toString(),jsonObject.toString());
+        return true;
+    }
+
+    /**
+     * 机器人节点清空
+     *
+     * @param repeatKey
+     */
+    public void cleanCacheId(String repeatKey, String taskNodeId, ZZone zZone){
+        String cacheUid = msgUtil.redis_get(repeatKey) == null ? "" : msgUtil.redis_get(repeatKey).toString();
+        if (StringUtil.isNotEmpty(cacheUid)){
+            msgUtil.redis_del(repeatKey);
+        }
+        //优先级消息队列处理
+        /*
+        if(StringUtil.isNotEmpty(taskNodeId) && null!=zZone){
+            String symbol="";
+            switch(zZone.getNo()){
+                case "capsule": symbol = "CT"; break;
+                case "framework": symbol = "KT"; break;
+                case "cabin": symbol = "ZC"; break;
+                case "wing": symbol = "YP"; break;
+                default: symbol = "bz";
+            }
+            Productionresource productionresource = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getCode, symbol+"_jqr").last("limit 1"));
+            if(productionresource!=null) {
+                String consumerQueue = "device.queue." + productionresource.getId();
+                String key = "PRIORITY_" + consumerQueue.toUpperCase().replace(".", "_");
+                msgUtil.redis_fuzzy_del(key, taskNodeId);
+            }
+        } */
+    }
+
     /**
      * 判断文件格式
      *
@@ -604,6 +675,11 @@ public class MsgUtil implements ApplicationContextAware {
      */
     public String getCcsData(String instructionUrl, JSONObject jsonParam, TaskNode taskNode){
 
+        if(!imcsTOccsEnable){
+            String ret = "{\"taskID\":null,\"taskNodeID\":null,\"result\":\"true\",\"resultMsg\":\"设备已离线:192.168.0.10\",\"concurrency\":\"false\",\"data\":null}";
+            return ret;
+        }
+
         ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
         long zoneId = zoneProductionresource.getZoneId();
         ZZone zZone = zoneService.getById(zoneId);
@@ -692,6 +768,39 @@ public class MsgUtil implements ApplicationContextAware {
         return redisTemplate.opsForHash().entries(key);
     }
 
+    public void redis_set_list(String key, String value) {redisTemplate.opsForList().leftPush(key, value);}
+
+    public List redis_get_list(String key) {return redisTemplate.opsForList().range(key, 0, -1);}
+
+    public void redis_remove_list(String key, String element) {redisTemplate.opsForList().remove(key, 0, element);}
+
+    public List<String> fuzzy_list(String key, int priority) {
+        List<String> dataList = this.redis_get_list(key);
+        if(dataList.size()>0){
+            return dataList.stream().filter(item->{
+                String[] dataVal = item.split("_");
+                if(dataVal.length>0){
+                    int cachePriority = Integer.parseInt(dataVal[1]);
+                    return cachePriority > priority;
+                }
+                return false;
+            }).collect(Collectors.toList());
+        }
+        return new ArrayList<String>();
+    }
+
+    public void redis_fuzzy_del(String key, String element){
+        List<String> dataList = this.redis_get_list(key);
+        if(dataList.size()>0){
+            List<String> elementList = dataList.stream().filter(item->item.contains(element)).collect(Collectors.toList());
+            if(elementList.size()>0){
+                elementList.stream().forEach(item->{
+                    this.redis_remove_list(key, item);
+                });
+            }
+        }
+    }
+
     /**
      * http post请求
      * @return

+ 16 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/MMeterialReceiveLogMapper.xml

@@ -49,4 +49,20 @@
         AND imm.id = immrl.meterial_id
         AND immrl.batch_stand - immrl.used_num > 0
     </select>
+
+    <select id="dataMap" resultType="java.util.Map">
+        SELECT
+            count(*) AS cnt,
+            sum(l.batch_stand) as totalNum,
+            sum(l.used_num) as usedNum,
+            l.meterial_id,
+            m.trade_mark,
+            m.equipment_name
+        FROM
+            imcs_m_meterial_receive_log l
+            LEFT JOIN imcs_m_meterial m ON l.meterial_id = m.id
+        GROUP BY
+            l.meterial_id
+            LIMIT 3;
+    </select>
 </mapper>

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

@@ -134,6 +134,7 @@ public class ToolbarController {
         BaseContextHandler.setTenant("0000");
         String start = data.containsKey("start")? data.get("start").toString() : null;
         String goal = data.containsKey("goal")? data.get("goal").toString() : null;
+        log.warn("库位{}手动操作更新{}进入", start, goal);
 
         if(StringUtils.isEmpty(start) || StringUtils.isEmpty(goal)) return R.fail("数据传参为空");
         if(!StringUtils.isNumeric(start) || !StringUtils.isNumeric(goal)) return R.fail("数据格式传输有误");
@@ -416,7 +417,7 @@ public class ToolbarController {
         return R.success();
     }
 
-    @ApiOperation(value = "添加节点消息", notes = "添加节点消息")
+    @ApiOperation(value = "刷新线边库优先级", notes = "刷新线边库优先级")
     @PostMapping("/refreshPriority")
     public R refreshPriority(@RequestBody Map<String, String> data) {
 
@@ -432,7 +433,7 @@ public class ToolbarController {
         String ip = data.containsKey("ip")? data.get("ip").toString() : null;
         String taskId = data.containsKey("taskId")? data.get("taskId").toString() : null;
         String taskNodeId = data.containsKey("taskNodeId")? data.get("taskNodeId").toString() : null;
-        if(StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId) || StringUtils.isEmpty(ip)) return R.fail("数据传参为空");
+        if(StringUtils.isEmpty(taskNodeId) || StringUtils.isEmpty(taskId) || StringUtils.isEmpty(ip) ) return R.fail("数据传参为空");
         JSONObject params = new JSONObject(data);
         TaskNode taskNode = taskNodeService.getById(taskNodeId);
         Productionresource productionresource = productionresourceBizMapper.selectOne(new LambdaQueryWrapper<Productionresource>().eq(Productionresource::getIp, ip).last("limit 1"));
@@ -765,5 +766,31 @@ public class ToolbarController {
         return R.success();
     }
 
+
+    @ApiOperation(value = "启动申请上料程序", notes = "启动申请上料程序")
+    @PostMapping("/applyFeeding")
+    public R runApplyFeeding(@RequestBody Map data) {
+        String instructionUrl = "/api/PredictUploadFile";
+        String ip = data.containsKey("ip")? data.get("ip").toString() : null;
+        String port = data.containsKey("port")? data.get("port").toString() : null;
+        String fileName = data.containsKey("fileName")? data.get("fileName").toString() : null;
+        String remotePath = data.containsKey("remotePath")? data.get("remotePath").toString() : null;
+        if(StringUtils.isEmpty(fileName) || StringUtils.isEmpty(remotePath) || StringUtils.isEmpty(ip) || StringUtils.isEmpty(port)) return R.fail("数据传参为空");
+        Productionresource productionresource = productionresourceBizMapper.selectOne(new LambdaQueryWrapper<Productionresource>().eq(Productionresource::getIp, ip).last("limit 1"));
+        if(null == productionresource) return R.fail("设备或节点数据不存在");
+        JSONObject dataMap = new JSONObject();
+        dataMap.put("fileName", fileName);
+        dataMap.put("remotePath", remotePath);
+        JSONObject params = new JSONObject();
+        params.put("url", ip);
+        params.put("taskId", "1");
+        params.put("taskNodeId", "1");
+        params.put("port", port);
+        params.put("data", dataMap);
+        String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get("capsule_plc").toString());
+
+        msgUtil.httpForPost(plcUrl+instructionUrl, params.toJSONString());
+        return R.success();
+    }
 }
 

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

@@ -168,8 +168,14 @@ public class BBomPageDTO implements Serializable {
     private String bomType;
 
     @ApiModelProperty(value = "零件图号")
-    @TableField(exist = false)
+    @Length(max = 64, message = "零件图号长度不能超过128")
     private String drawingNo;
 
+    @ApiModelProperty(value = "工序类型")
+    @Length(max = 4, message = "工序类型不能超过4")
+    private String procedureType;
 
+    @ApiModelProperty(value = "工序版次")
+    @Length(max = 64, message = "工序版次不能超过64")
+    private String procedureVersion;
 }

+ 7 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/BBomSaveDTO.java

@@ -123,4 +123,11 @@ public class BBomSaveDTO implements Serializable {
     @ApiModelProperty(value = "材料牌号")
     private Long materialId;
 
+    /**
+     * 工序版次
+     */
+    @ApiModelProperty(value = "工序版次")
+    @Length(max = 64, message = "工序版次不能超过64")
+    private String procedureVersion;
+
 }

+ 7 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/BBomUpdateDTO.java

@@ -127,4 +127,11 @@ public class BBomUpdateDTO implements Serializable {
      */
     @ApiModelProperty(value = "材料牌号")
     private Long materialId;
+
+    /**
+     * 工序版次
+     */
+    @ApiModelProperty(value = "工序版次")
+    @Length(max = 64, message = "工序版次不能超过64")
+    private String procedureVersion;
 }

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

@@ -280,9 +280,19 @@ public class BBom extends Entity<Long> {
     @Excel(name = "零件图号")
     private String drawingNo;
 
+    @ApiModelProperty(value = "工序类型")
+    @TableField("procedure_type")
+    @Excel(name = "工序类型")
+    private String procedureType;
+
+    @ApiModelProperty(value = "工序版次")
+    @TableField("procedure_version")
+    @Excel(name = "工序版次")
+    private String procedureVersion;
+
     @Builder
     public BBom(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, 
-                    String auditStatus, Long parentId, String name, String no, String status, 
+                    String auditStatus, Long parentId, String name, String no, String status, String drawingNo, String procedureType, String procedureVersion,
                     String model, String brand, String specification, Long moduleId, int synFlag,String groupNo,String furnaceBatchNo,String batchStand) {
         this.id = id;
         this.createTime = createTime;
@@ -301,6 +311,9 @@ public class BBom extends Entity<Long> {
         this.groupNo = groupNo;
         this.batchStand = batchStand;
         this.furnaceBatchNo = furnaceBatchNo;
+        this.drawingNo = drawingNo;
+        this.procedureType = procedureType;
+        this.procedureVersion = procedureVersion;
     }
 
 }

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

@@ -48,9 +48,9 @@ public interface BizConstant {
     /**
      * 基础库
      */
-    String BASE_DATABASE = "zuihou_base_yj";
+    String BASE_DATABASE = "imcs_base_300";
 
-    String DETAULTS_DATABASE = "zuihou_defaults_yj";
+    String DETAULTS_DATABASE = "imcs_defaults_300";
 
 
     /**

+ 4 - 3
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/DictionaryKey.java

@@ -167,9 +167,10 @@ public interface DictionaryKey {
     Map<String, String> ZEISS_LOCATION = new HashMap<String, String>(){
         {
             // 滑台点位对应关系
-            put("L", "372");
-            put("M", "373");
-            put("R", "374");
+            //put("L", "372");
+            //put("M", "373");
+            //put("R", "374");
+            put("M", "107");
         }
     };
 

+ 17 - 6
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/util/SmbShareFileUtil.java

@@ -6,6 +6,8 @@ import jcifs.smb.*;
 
 import java.io.*;
 import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 提供共享文件夹的操作的通用程序
@@ -22,7 +24,8 @@ public class SmbShareFileUtil {
         OutputStream out = null ;
         BufferedWriter bufferedWriter = null;
         try{
-            out = new BufferedOutputStream(new SmbFileOutputStream(new SmbFile(shareFile,auth )));
+            SmbFile smbFile = new SmbFile(shareFile, auth);
+            out = new BufferedOutputStream(new SmbFileOutputStream(smbFile));
             bufferedWriter = new BufferedWriter(new OutputStreamWriter(out));
             // 按行写入文件
             for(int i = 0; i < fileContents.size(); i++){
@@ -334,7 +337,7 @@ public class SmbShareFileUtil {
                 if(CollectionUtil.isNotEmpty(files)){
 
                     //筛选pdf文件,根据文件创建时间降序
-                    SmbFile smbFile = files.stream().filter(s->s.getName().contains(".pdf")).sorted(((o1, o2) -> {
+                    SmbFile smbFile = files.stream().filter(s->s.getName().contains(".res")).sorted(((o1, o2) -> {
                         try {
                             if(o1.createTime() < o2.createTime()){
                                 return 1;
@@ -364,11 +367,13 @@ public class SmbShareFileUtil {
 
 
     public static void main(String[] args) {
-        String ip="192.168.11.245";
-        String url="smb://192.168.11.245/measuring/";
+        String ip="smb://20.20.47.191";
+        String url="smb://20.20.47.191/ProgramName/";
 		//String url="smb://192.168.170.23/measuring/abcd-1234.csv";
         String name="measuring";
-        String password="Imcs@123456";
+        String password="123456";
+        String shareFile = url + "name.txt";
+        String filePath = "smb://20.20.47.191/Program/";
 //        NtlmPasswordAuthentication auth =new NtlmPasswordAuthentication(ip, name, password);
 //        SmbFile file = null;
 //        try {
@@ -393,6 +398,12 @@ public class SmbShareFileUtil {
 //        content.add("OK");
 //        writeShareFileContent(url,content,name,password,ip);
 
-        findMeasuringFilesAndDownload(ip,name,password,url,"111.xls","C:/data/projects/uploadfile/file/");
+        //findMeasuringFilesAndDownload(ip,name,password,url,"111.xls","C:/data/projects/uploadfile/file/");
+        //writeShareFileContent( shareFile, Stream.of("OYQ").collect(Collectors.toList()), name, password, ip);
+
+        String measuringReportPath = filePath + "/HJX2065/REPORT/";
+        //String date = DateUtil.dateToString0(new Date(), "yyyy-M-dd");
+        String measuringResultFile = SmbShareFileUtil.findNewMeasuringFiles(ip,name,password, measuringReportPath);
+
     }
 }