瀏覽代碼

新增抽检模块

oyq28 3 年之前
父節點
當前提交
f48fef3184

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

@@ -19,10 +19,17 @@ zuihou:
     driverClassName: com.mysql.cj.jdbc.Driver
     database: zuihou_defaults_yj
     username: root
-    password: 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:
     isNotWrite: false
+  smb:
+    userName: measuring
+    password: Imcs@123456
+    fileIp: 192.168.170.23
+    filePath: smb://192.168.170.23/measuring/
+  file:
+    remoteInputDataPath: smb://SOFLEX-PCS:SOFLEX-PCS@192.168.0.2/SOFLEX_PCS_iGen_CASC1_INPUT/ERP_DATA/
   swagger:
     # 正式环境用nginx代理,为了保持和cloud版本一致的URL,特意调整
     docket:

+ 9 - 7
imcs-admin-boot/imcs-authority-server/src/main/resources/application-test.yml

@@ -1,18 +1,18 @@
 zuihou:
   nginx:
-    ip: 106.14.142.95     # 正式环境需要将该ip设置成nginx对应的 公网ip
+    ip: 127.0.0.1     # 正式环境需要将该ip设置成nginx对应的 公网ip
     port: 10000
   redis:
     ip: 127.0.0.1
     port: 6379
-    password:
+    password: 123456
     database: 0
   rabbitmq:
     enabled: true
-    ip: 127.0.0.1
+    ip: 106.15.38.8
     port: 5672
-    username: guest
-    password: guest
+    username: admin
+    password: adminoyq
   mysql:
     ip: 106.15.38.8
     port: 3306
@@ -23,13 +23,15 @@ zuihou:
     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
-  file:
-    remoteInputDataPath: smb://SOFLEX-PCS:SOFLEX-PCS@192.168.0.2/SOFLEX_PCS_iGen_CASC1_INPUT/ERP_DATA/
   smb:
     userName: measuring
     password: Imcs@123456
     fileIp: 192.168.170.23
     filePath: smb://192.168.170.23/measuring/
+  file:
+    remoteInputDataPath: smb://SOFLEX-PCS:SOFLEX-PCS@192.168.0.2/SOFLEX_PCS_iGen_CASC1_INPUT/ERP_DATA/
+  machineCuttingTools:
+    synUrl: https://www.baidu.com
   swagger:
     # 正式环境用nginx代理,为了保持和cloud版本一致的URL,特意调整
     docket:

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

@@ -1,17 +1,17 @@
 zuihou:
   nginx:
-    ip: 106.15.38.8     # 正式环境需要将该ip设置成nginx对应的 公网ip
+    ip: 127.0.0.1     # 正式环境需要将该ip设置成nginx对应的 公网ip
     port: 10000
     #ip: 127.0.0.1
     #port: 8764
   redis:
-    ip: 106.15.38.8
+    ip: 127.0.0.1
     port: 6379
-    password:
+    password: 123456
     database: 0
   rabbitmq:
-    enabled: false
-    ip: 106.15.38.8
+    enabled: true
+    ip: 127.0.0.1
     port: 5672
     username: guest
     password: guest
@@ -31,6 +31,7 @@ zuihou:
     worker-id: 0
     data-center-id: 0
     isSeata: false
+
   injection:
     # 是否启用 远程数据 手动注入
     enabled: true
@@ -54,7 +55,7 @@ zuihou:
     order: -20
   file:
     type: LOCAL # FAST_DFS LOCAL
-    storage-path: C:/data/projects/uploadfile/file/     # 文件存储路径  ( 某些版本的 window 需要改成  D:\\data\\projects\\uploadfile\\file\\  )
+    storage-path: D:/data/projects/uploadfile/file/     # 文件存储路径  ( 某些版本的 window 需要改成  D:\\data\\projects\\uploadfile\\file\\  )
     uriPrefix: http://${zuihou.nginx.ip}:${zuihou.nginx.port}/file/   # 文件访问 需要通过这个uri前缀进行访问
     inner-uri-prefix: null  #  内网的url前缀
     down-by-id: http://${zuihou.nginx.ip}:${zuihou.nginx.port}/api/file/attachment/download?ids[]=%s
@@ -282,6 +283,8 @@ mybatis-plus:
     #配置JdbcTypeForNull, oracle数据库必须配置
     jdbc-type-for-null: 'null'
     call-setters-on-nulls: true
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
 
 j2cache:
   #  config-location: /j2cache.properties

+ 6 - 6
imcs-admin-boot/imcs-authority-server/src/test/java/generator/AuthorityGenerator.java

@@ -4,12 +4,12 @@
 //import java.util.HashSet;
 //import java.util.Set;
 //
-//import com.github.zuihoou.generator.CodeGenerator;
-//import com.github.zuihoou.generator.config.CodeGeneratorConfig;
-//import com.github.zuihoou.generator.config.FileCreateConfig;
-//import com.github.zuihoou.generator.type.EntityFiledType;
-//import com.github.zuihoou.generator.type.EntityType;
-//import com.github.zuihoou.generator.type.GenerateType;
+//import com.github.zuihou.generator.CodeGenerator;
+//import com.github.zuihou.generator.config.CodeGeneratorConfig;
+//import com.github.zuihou.generator.config.FileCreateConfig;
+//import com.github.zuihou.generator.type.EntityFiledType;
+//import com.github.zuihou.generator.type.EntityType;
+//import com.github.zuihou.generator.type.GenerateType;
 //
 ///**
 // * 权限代码生成器

+ 48 - 5
imcs-admin-boot/imcs-business-biz/pom.xml

@@ -61,15 +61,46 @@
         </dependency>
         <dependency>
             <groupId>com.github.zuihou</groupId>
-            <artifactId>imcs-jobs-core</artifactId>
+            <artifactId>imcs-file-biz</artifactId>
             <version>b.2.5-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>com.github.zuihou</groupId>
-            <artifactId>imcs-file-biz</artifactId>
-            <version>b.2.5-SNAPSHOT</version>
-            <scope>compile</scope>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+        </dependency>
+        <!--
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.12</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+        </dependency> -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.3.9</version>
         </dependency>
 
         <!--<dependency>-->
@@ -94,6 +125,18 @@
             <artifactId>jenetics</artifactId>
             <version>5.2.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.github.zuihou</groupId>
+            <artifactId>imcs-msgs-biz</artifactId>
+            <version>b.2.5-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.github.zuihou</groupId>
+            <artifactId>imcs-msgs-biz</artifactId>
+            <version>b.2.5-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 

+ 328 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/AutoTaskOperatorUtil.java

@@ -0,0 +1,328 @@
+package com.github.zuihou.business.util;
+
+import com.alibaba.fastjson.JSONObject;
+import com.github.zuihou.business.externalApi.dto.ManualInfo;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 自动模式下参数组装
+ */
+public class AutoTaskOperatorUtil {
+    /**
+     * 上位机系统地址
+     */
+//    private static String hostSyetemUrl = "http://192.168.170.240:8090";
+    private static String hostSyetemUrl = "http://192.168.10.155:63570/";
+
+    /**
+     * agv运输
+     */
+    private static String agvURL = "http://localhost:9099/api/authority/mock/mockWms";
+    //质量中心
+    private static String ZK_ip_zlzx = "192.168.170.61";
+    //柔性
+    private static String ZK_ip_rxx = "192.168.170.71";
+    //智能单元
+    private static String ZK_ip_zndy = "192.168.170.81";
+
+    // 质量中心PLC端口
+    private static String ZK_ip_zlzx_port = "102";
+    // 柔性线端口
+    private  static String ZK_ip_rxx_port = "102";
+    // 智能单元端口
+    private static String ZK_ip_zndy_port = "102";
+
+    /**
+     * 组装参数
+     * @param map
+     * @return
+     */
+    public static String getRequestParam(Map<String, Object> map){
+        JSONObject jsonParam = new JSONObject();
+        jsonParam.put("url", map.get("deviceUrl").toString());
+        jsonParam.put("port",map.get("devicePort").toString());
+        jsonParam.put("taskId", map.get("taskId").toString());
+        jsonParam.put("taskNodeId", map.get("taskNodeId").toString());
+        JSONObject data = new JSONObject();
+        String jobType = map.get("bizType").toString();
+
+        if("execProgram".equals(jobType)) {
+            // 执行程序
+            data.put("remotePath", map.get("execProgram"));
+        }else if("clean".equals(jobType)) {
+            // 清洗
+            data.put("workId", map.get("workId").toString());
+            data.put("workType",  map.get("workType").toString());
+        }else if("print".equals(jobType)) {
+            // 打标
+            data.put("workId", map.get("workId").toString());
+            data.put("labelContent", map.get("labelContent").toString());
+        }else if("measuring".equals(jobType)) {
+            // 测量
+            data.put("workId", map.get("workId").toString());
+            data.put("workType", map.get("workType").toString());
+        }else{
+            // 机器人相关
+            data.put("location", map.get("location").toString());
+        }
+        jsonParam.put("data", data);
+
+        return jsonParam.toJSONString();
+
+    }
+
+    /**
+     * 处理自动模式首次任务结点信息
+     * @param robotTaskNodes
+     * @param robotNoMoveTaskNodes
+     * @param manualInfo
+     * @return
+     */
+    public static Map<String,Object> judgeFirstProcessInfo(Map<String, Object> map , ArrayList<String> robotTaskNodes, ArrayList<String> robotNoMoveTaskNodes , ManualInfo manualInfo){
+        Map<String,Object> processInfo = new HashMap<String,Object>();
+        String unit = map.get("unit").toString();
+        String jobType = map.get("jobType").toString();
+        String deviceUrl = "";
+        String devicePort = "";
+        // Plc地址
+        if("capsule".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }else if("framework".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }else if("safeguard".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }
+        if("general".equals(jobType)){
+            if("capsule".equals(unit)){
+                // 舱体(智能单元) 代码先写死,6个动作,后续根据resource_code表中获取
+                // 执行第一个任务
+                int currentIndex = 0;
+                String taskType = robotNoMoveTaskNodes.get(currentIndex);
+                int nextTaskNodeIndex = currentIndex +1;
+                if("move".equals(taskType)){
+                    String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
+                    //String location = manualInfo.getStartpointId();
+                    String location = map.get("startPointId").toString();
+                    setProcessInfo(robotNoMoveTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                }
+                if(nextTaskNodeIndex < robotNoMoveTaskNodes.size() -1){
+                    manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex + 1);
+                }
+            }else if("framework".equals(unit)){
+                int currentIndex = 0;
+                String taskType = robotNoMoveTaskNodes.get(currentIndex);
+                int nextTaskNodeIndex = currentIndex +1;
+                if("move".equals(taskType)){
+                    String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
+                    String location = manualInfo.getStartpointId();
+                    setProcessInfo(robotNoMoveTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                }
+                if(nextTaskNodeIndex < robotNoMoveTaskNodes.size() -1){
+                    manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex + 1);
+                }
+            }else if("safeguard".equals(unit)){
+                // 保障平台(质量中心) 代码先写死,6个动作,后续根据resource_code表中获取
+                // 执行第一个任务
+                int currentIndex = 0;
+                String taskType = robotNoMoveTaskNodes.get(currentIndex);
+                int nextTaskNodeIndex = currentIndex +1;
+                if("get".equals(taskType)){
+                    String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                    String location = manualInfo.getStartpointId();
+                    setProcessInfo(robotNoMoveTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                }
+                manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
+            }
+        }else{
+            // 设备相关
+            processMachineAutoType(map, processInfo, manualInfo);
+            manualInfo.setNextTaskNodeIndex(-1);
+        }
+        return processInfo;
+    }
+
+    /**
+     * 设备执行程序通用
+     * @param manualInfo
+     * @param processInfo
+     * @param
+     */
+    private static void processMachineAutoType(Map<String, Object> map, Map<String, Object> processInfo,ManualInfo manualInfo) {
+        String jobType = map.get("bizType").toString();
+        String taskNode = map.get("taskNode").toString();
+        String deviceUrl = map.get("deviceUrl").toString();
+        String devicePort = map.get("devicePort").toString();
+        String location = map.get("location").toString();
+
+        if("execProgram".equals(jobType)) {
+            String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartNCProgram";
+            //String location = manualInfo.getStartpointId();
+
+            // 查找设备ip及端口
+            setProcessInfo( new ArrayList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+        }else if("clean".equals(jobType)) {
+            String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartCleanMachine";
+            setProcessInfo( new ArrayList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+        }else if("print".equals(jobType)) {
+            String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartLabelMachine";
+            setProcessInfo( new ArrayList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+        }else if("measuring".equals(jobType)) {
+            String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartCoordinateMeasuringMachine";
+            setProcessInfo( new ArrayList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+        }
+    }
+
+    /**
+     * 处理自动模式回调任务结点信息
+     * @param taskNodes
+     * @param manualInfo
+     * @return
+     */
+    public static Map<String,Object> judgeProcessInfo(ArrayList<String> taskNodes, ManualInfo manualInfo){
+        String unit = manualInfo.getDeviceUnit();
+        String manualType = manualInfo.getManualIdType();
+        Map<String,Object> processInfo = new HashMap<String,Object>();
+
+        String deviceUrl = "";
+        String devicePort = "";
+        // Plc地址
+        if("capsule".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }else if("framework".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }else if("safeguard".equals(unit)){
+            deviceUrl = ZK_ip_zndy;
+            devicePort = ZK_ip_zndy_port;
+        }
+
+        if("general".equals(manualType)){
+            if("capsule".equals(unit)){
+                int currentIndex = manualInfo.getNextTaskNodeIndex();
+                int nextTaskNodeIndex = currentIndex +1;
+                String taskType = taskNodes.get(currentIndex);
+
+                if(taskNodes.size() == 6){
+                    // 舱体(柔性线) 代码先写死,6个动作,后续根据resource_code表中获取
+                    // 执行第一个任务
+                    if("get".equals(taskType) && currentIndex == 1){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 2){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("move".equals(taskType) && currentIndex == 3){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
+
+                        // 查找设备机器人
+
+
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }if("get".equals(taskType) && currentIndex == 4){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 5){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }
+                    manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
+                }else if(taskNodes.size() == 3 && currentIndex == 1){
+                    if("get".equals(taskType) ){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 2){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getEndpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }
+                }
+            }else if("framework".equals(unit)){
+                int currentIndex = manualInfo.getNextTaskNodeIndex();
+                int nextTaskNodeIndex = currentIndex +1;
+                String taskType = taskNodes.get(currentIndex);
+
+                if(taskNodes.size() == 6){
+                    // 舱体(柔性线) 代码先写死,6个动作,后续根据resource_code表中获取
+                    // 执行第一个任务
+                    if("get".equals(taskType) && currentIndex == 1){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 2){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("move".equals(taskType) && currentIndex == 3){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }if("get".equals(taskType) && currentIndex == 4){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 5){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }
+                    manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
+                }else if(taskNodes.size() == 3){
+                    if("get".equals(taskType) && currentIndex == 1){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
+                        String location = manualInfo.getStartpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }else if("put".equals(taskType) && currentIndex == 2){
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                        String location = manualInfo.getEndpointId();
+                        setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                    }
+                }
+            }else if("safeguard".equals(unit)){
+                int currentIndex = manualInfo.getNextTaskNodeIndex();
+                int nextTaskNodeIndex = currentIndex +1;
+                String taskType = taskNodes.get(currentIndex);
+                // 保障平台(质量中心)
+                // 执行第一个任务
+                if("put".equals(taskType)){
+                    String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
+                    String location = manualInfo.getEndpointId();
+                    setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
+                }
+                manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
+            }
+        }
+        return processInfo;
+    }
+
+    /**
+     *
+     * @param taskNodes
+     * @param processInfo
+     * @param hostSyetemTaskUrl
+     * @param location
+     * @param deviceUrl
+     * @param devicePort
+     */
+    private static void setProcessInfo(ArrayList<String> taskNodes, Map<String, Object> processInfo, String hostSyetemTaskUrl, String location, String deviceUrl, String devicePort) {
+        processInfo.put("hostSyetemTaskUrl", hostSyetemTaskUrl);
+        processInfo.put("deviceUrl", deviceUrl);
+        processInfo.put("devicePort", devicePort);
+        processInfo.put("location", location);
+        processInfo.put("remindTaskNodes", taskNodes);
+    }
+}

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

@@ -0,0 +1,113 @@
+package com.github.zuihou.business.controller.operationManagementCenter;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.R;
+import com.github.zuihou.base.controller.SuperController;
+import com.github.zuihou.base.request.PageParams;
+import com.github.zuihou.business.edgeLibrary.dto.StorgeTypeSaveDTO;
+import com.github.zuihou.business.operationManagementCenter.dto.InspectionPageDTO;
+import com.github.zuihou.business.operationManagementCenter.dto.InspectionSaveDTO;
+import com.github.zuihou.business.operationManagementCenter.dto.InspectionUpdateDTO;
+import com.github.zuihou.business.operationManagementCenter.entity.Inspection;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
+import com.github.zuihou.business.operationManagementCenter.service.InspectionService;
+import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
+import com.github.zuihou.business.productionReadyCenter.service.BBomService;
+import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
+import com.github.zuihou.common.util.StringUtil;
+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;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/inspection")
+@Api(value = "inspection", tags = "计划表")
+@SysLog(enabled = true)
+public class InspectionController extends SuperController<InspectionService, Long, Inspection, InspectionPageDTO, InspectionSaveDTO, InspectionUpdateDTO> {
+
+    @Autowired
+    private BomProcedureService bomProcedureService;
+
+    @Autowired
+    private WorkpieceService workpieceService;
+
+    @Autowired
+    private BBomService bBomService;
+
+    @Autowired
+    private ZZoneService zZoneService;
+
+    @Override
+    public void query(PageParams<InspectionPageDTO> params, IPage<Inspection> page, Long defSize) {
+        InspectionPageDTO data = params.getModel();
+        QueryWrap<Inspection> wrap = handlerWrapper(null, params);
+        LbqWrapper<Inspection> wrapper = wrap.lambda();
+        Inspection inspection = BeanUtil.toBean(data, Inspection.class);
+
+        wrapper.eq(Inspection::getPlanId, inspection.getPlanId()).orderByDesc(Inspection::getCreateTime);
+        baseService.pageList(page, wrapper);
+    }
+
+    @ApiOperation(value = "检测抽检是否可以新增", notes = "检测抽检是否可以新增")
+    @PostMapping("/check/")
+    public R<Boolean> check(@RequestBody InspectionSaveDTO model) {
+        return success(baseService.check(model));
+    }
+
+    @ApiOperation(value = "获取可抽检工序", notes = "获取可抽检工序")
+    @PostMapping("/procedure")
+    public R<List<BomProcedure>> procedure(@RequestBody Map map) {
+        LbqWrapper<BomProcedure> wrapper = new LbqWrapper<BomProcedure>();
+        //满足当前零件、属于设备序、工艺允许配置抽检、按照优先级降序排列
+        wrapper.eq(BomProcedure::getBomId, map.get("bomId")).eq(BomProcedure::getType, "设备序").eq(BomProcedure::getRandomCheckConf, "1").orderByDesc(BomProcedure::getSort);
+        if(map.containsKey("workpieceId")){
+            TWorkpiece workPiece = workpieceService.getById(map.get("workpieceId").toString());
+            String status = workPiece.getProduceStatus();
+            //零件工序已完成或状态不正常
+            if(StringUtil.isEmpty(status) || "3".equals(status)){
+                return fail("零件工序已完成或状态不正常");
+            }
+            if("2".equals(status)){
+                //零件加工进行中
+                Long procedureId = workPiece.getProcedureId();
+                int sort = bomProcedureService.getById(procedureId).getSort();
+                //在当前零件加工工序之后
+                wrapper.le(BomProcedure::getSort, sort);
+            }
+            Long existProcedureId = baseService.getOne(new LbqWrapper<Inspection>().eq(Inspection::getWorkpieceId,workPiece.getId())).getProcedureId();
+            if(null!= existProcedureId){
+                wrapper.ne(BomProcedure::getId, existProcedureId);
+            }
+        }
+
+        List<BomProcedure> dataList = bomProcedureService.list(wrapper).stream().filter(data->{
+            //排除保障中心设备序
+            Long zone_id = bBomService.getById(data.getBomId()).getZoneId();
+            return zZoneService.getById(zone_id).getNo() != "safeguard";
+        }).collect(Collectors.toList());
+        return success(dataList);
+    }
+
+    @ApiOperation(value = "检测抽检是否可以新增", notes = "检测抽检是否可以新增")
+    @PostMapping("/save")
+    public R<Inspection> save(@RequestBody InspectionSaveDTO model) {
+        Inspection inspection = BeanUtil.toBean(model, Inspection.class);
+        return baseService.save(inspection)? success(inspection) : success(null);
+    }
+}

+ 117 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/InspectionPageDTO.java

@@ -0,0 +1,117 @@
+package com.github.zuihou.business.operationManagementCenter.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ * <p>
+ * 实体类
+ * 计划表
+ * </p>
+ *
+ * @author imcs
+ * @since 2020-12-29
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "InspectionPageDTO", description = "抽检表")
+public class InspectionPageDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 订单id
+     */
+    @ApiModelProperty(value = "订单id")
+    @NotNull(message = "订单id不能为空")
+    private Long orderId;
+
+    /**
+     * 计划id
+     */
+    @ApiModelProperty(value = "计划id")
+    @NotNull(message = "计划id不能为空")
+    private Long planId;
+
+    /**
+     * 产线id
+     */
+    @ApiModelProperty(value = "产线id")
+    @NotNull(message = "产线id不能为空")
+    private Long zoneId;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "工件id不能为空")
+    private Long workpieceId;
+
+    /**
+     * 工序id
+     */
+    @ApiModelProperty(value = "工序id")
+    @NotNull(message = "工序id不能为空")
+    private Long procedureId;
+
+    /**
+     * 抽检状态
+     */
+    @ApiModelProperty(value = "抽检状态(0-待定 1-合格 2-不合格)")
+    private Integer result;
+
+    /**
+     * 抽检报告
+     */
+    @ApiModelProperty(value = "抽检报告")
+    @NotEmpty(message = "抽检报告不能为空")
+    @Length(max = 128, message = "抽检报告长度不能超过128")
+    private String report;
+
+    @ApiModelProperty(value = "零件名称")
+    @TableField(exist = false)
+    private String  bomName;
+
+    @ApiModelProperty(value = "零件编号")
+    @TableField(exist = false)
+    private String  partsNo;
+
+    @ApiModelProperty(value = "开始时间")
+    @TableField(exist = false)
+    private LocalDateTime startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    @TableField(exist = false)
+    private LocalDateTime endTime;
+
+    @ApiModelProperty(value = "工序号")
+    @TableField(exist = false)
+    private String procedureNo;
+
+    @ApiModelProperty(value = "工序名称")
+    @TableField(exist = false)
+    private String procedureName;
+
+    @ApiModelProperty(value = "产线编号")
+    @TableField(exist = false)
+    private String zoneNo;
+
+}

+ 95 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/InspectionSaveDTO.java

@@ -0,0 +1,95 @@
+package com.github.zuihou.business.operationManagementCenter.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ * <p>
+ * 实体类
+ * 计划表
+ * </p>
+ *
+ * @author imcs
+ * @since 2020-12-29
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "InspectionSaveDTO", description = "抽检表")
+public class InspectionSaveDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "bom_id不能为空")
+    private Long bomId;
+
+    /**
+     * 订单id
+     */
+    @ApiModelProperty(value = "订单id")
+    @NotNull(message = "订单id不能为空")
+    private Long orderId;
+
+    /**
+     * 计划id
+     */
+    @ApiModelProperty(value = "计划id")
+    @NotNull(message = "计划id不能为空")
+    private Long planId;
+
+    /**
+     * 产线id
+     */
+    @ApiModelProperty(value = "产线id")
+    @NotNull(message = "产线id不能为空")
+    private Long zoneId;
+
+    /**
+     * 工序id
+     */
+    @ApiModelProperty(value = "工序id")
+    @NotNull(message = "工序id不能为空")
+    private Long procedureId;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "工件id不能为空")
+    private Long workpieceId;
+
+
+    /**
+     * 抽检状态
+     */
+    @ApiModelProperty(value = "抽检状态")
+    private Integer result;
+
+    /**
+     * 抽检报告
+     */
+    @ApiModelProperty(value = "抽检报告")
+    @Length(max = 128, message = "抽检报告长度不能超过128")
+    private String report;
+
+}

+ 91 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/dto/InspectionUpdateDTO.java

@@ -0,0 +1,91 @@
+package com.github.zuihou.business.operationManagementCenter.dto;
+
+import com.github.zuihou.base.entity.SuperEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 实体类
+ * 计划表
+ * </p>
+ *
+ * @author imcs
+ * @since 2020-12-29
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "InspectionUpdateDTO", description = "抽检表")
+public class InspectionUpdateDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "bom_id不能为空")
+    private Long bomId;
+
+    /**
+     * 订单id
+     */
+    @ApiModelProperty(value = "订单id")
+    @NotNull(message = "订单id不能为空")
+    private Long orderId;
+
+    /**
+     * 计划id
+     */
+    @ApiModelProperty(value = "计划id")
+    @NotNull(message = "计划id不能为空")
+    private Long planId;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "工件id不能为空")
+    private Long workpieceId;
+
+    /**
+     * 产线id
+     */
+    @ApiModelProperty(value = "产线id")
+    @NotNull(message = "产线id不能为空")
+    private Long zoneId;
+
+    /**
+     * 工序id
+     */
+    @ApiModelProperty(value = "工序id")
+    @NotNull(message = "工序id不能为空")
+    private Long procedureId;
+
+    /**
+     * 抽检状态
+     */
+    @ApiModelProperty(value = "抽检状态")
+    private Integer result;
+
+    /**
+     * 抽检报告
+     */
+    @ApiModelProperty(value = "抽检报告")
+    @NotEmpty(message = "抽检报告不能为空")
+    @Length(max = 128, message = "抽检报告长度不能超过128")
+    private String report;
+}

+ 152 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/Inspection.java

@@ -0,0 +1,152 @@
+package com.github.zuihou.business.operationManagementCenter.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+import java.time.LocalDateTime;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ * <p>
+ * 实体类
+ * 抽检表
+ * </p>
+ *
+ * @author imcs
+ * @since 2022-04-10
+ */
+@Data
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("imcs_o_order_inspection")
+@ApiModel(value = "Inspection", description = "抽检表")
+@AllArgsConstructor
+public class Inspection extends Entity<Long> {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "bom_id不能为空")
+    @TableField("bom_id")
+    @Excel(name = "工件id")
+    private Long bomId;
+
+    /**
+     * 订单id
+     */
+    @ApiModelProperty(value = "订单id")
+    @NotNull(message = "订单id不能为空")
+    @TableField("order_id")
+    @Excel(name = "订单id")
+    private Long orderId;
+
+    /**
+     * 计划id
+     */
+    @ApiModelProperty(value = "计划id")
+    @NotNull(message = "计划id不能为空")
+    @TableField("plan_id")
+    @Excel(name = "计划id")
+    private Long planId;
+
+    /**
+     * 产线id
+     */
+    @ApiModelProperty(value = "产线id")
+    @NotNull(message = "产线id不能为空")
+    @TableField("zone_id")
+    @Excel(name = "产线id")
+    private Long zoneId;
+
+    /**
+     * 工件id
+     */
+    @ApiModelProperty(value = "工件id")
+    @NotNull(message = "工件id不能为空")
+    @TableField("workpiece_id")
+    @Excel(name = "工件id")
+    private Long workpieceId;
+
+
+    /**
+     * 工序id
+     */
+    @ApiModelProperty(value = "工序id")
+    @NotNull(message = "工序id不能为空")
+    @TableField("procedure_id")
+    @Excel(name = "工序id")
+    private Long procedureId;
+
+    /**
+     * 抽检状态
+     */
+    @ApiModelProperty(value = "抽检状态")
+    @TableField("result")
+    @Excel(name = "抽检状态 (0-待定 1-合格 2-不合格)")
+    private Integer result;
+
+    /**
+     * 抽检报告
+     */
+    @ApiModelProperty(value = "抽检报告")
+    @NotEmpty(message = "抽检报告不能为空")
+    @Length(max = 128, message = "抽检报告长度不能超过128")
+    @TableField(value = "report", condition = LIKE)
+    @Excel(name = "抽检报告")
+    private String report;
+
+    @ApiModelProperty(value = "零件名称")
+    @TableField(exist = false)
+    private String  bomName;
+
+    @ApiModelProperty(value = "零件编号")
+    @TableField(exist = false)
+    private String  partsNo;
+
+    @ApiModelProperty(value = "开始时间")
+    @TableField(exist = false)
+    private LocalDateTime startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    @TableField(exist = false)
+    private LocalDateTime endTime;
+
+    @ApiModelProperty(value = "工序号")
+    @TableField(exist = false)
+    private String procedureNo;
+
+    @ApiModelProperty(value = "工序名称")
+    @TableField(exist = false)
+    private String procedureName;
+
+    @ApiModelProperty(value = "产线编号")
+    @TableField(exist = false)
+    private String zoneNo;
+
+
+    @Builder
+    public Inspection(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, Long bomId, Long orderId, Long zoneId, Long procedureId, Integer result, String report) {
+        super(id, createTime, createUser, updateTime, updateUser);
+        this.bomId = bomId;
+        this.orderId = orderId;
+        this.zoneId = zoneId;
+        this.procedureId = procedureId;
+        this.result = result;
+        this.report = report;
+    }
+}