Ver código fonte

云箭业务功能和接口更新

oyq28 3 anos atrás
pai
commit
0ecaba501c
17 arquivos alterados com 193 adições e 94 exclusões
  1. 6 6
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  2. 1 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/TaskNodeService.java
  3. 17 4
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java
  4. 33 34
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java
  5. 3 3
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/MachineCuttingToolServiceImpl.java
  6. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/ProgramService.java
  7. 9 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  8. 36 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProgramServiceImpl.java
  9. 6 6
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  10. 16 16
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/ManualTaskOperatorUtil.java
  11. 42 19
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/ZplPrinter.java
  12. 1 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskMapper.xml
  13. 7 0
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/TaskNodeController.java
  14. 2 2
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/WorkpieceController.java
  15. 8 0
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ProgramController.java
  16. 1 1
      imcs-admin-boot/imcs-file-biz/src/main/java/com/github/zuihou/file/service/impl/AttachmentServiceImpl.java
  17. 3 0
      imcs-admin-boot/imcs-tenant-biz/src/main/java/com/github/zuihou/tenant/service/impl/ProductionresourceServiceImpl.java

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

@@ -447,8 +447,8 @@ public class TaskWorkNode {
                                         //动态调用接口和新增指令执行时间
                                         log.setZoneId(zZone.getId()).setMethod(method).setExecuteTime(new Date());
                                         String instructionUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
-                                        logger.info("instructionUrl=" + instructionUrl);
-                                        logger.info("jsonParam=" + jsonParam);
+                                        logger.info("instructionUrl={}" ,instructionUrl);
+                                        logger.info("jsonParam={}" ,jsonParam);
                                         returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
                                     }
                                 }
@@ -964,7 +964,7 @@ public class TaskWorkNode {
 
             } else if (count == 1) {
                 jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
-                dataMap.put("method", "GetFlexibleWire");
+                dataMap.put("method", "GetQualityCenter");
                 Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                 dataMap.put("fromStorge", currentStore);
 
@@ -978,7 +978,7 @@ public class TaskWorkNode {
                 dataMap.put("result", true);
             } else if (count == 2) {
                 Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
-                dataMap.put("method", "SendFlexibleWire");
+                dataMap.put("method", "SendQualityCenter");
                 dataMap.put("fromStorge", currentStore);
                 //出入库类型
                 dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
@@ -1079,7 +1079,7 @@ public class TaskWorkNode {
                 }
 
             } else if (count == 4) {//从缓存位拿出来
-                dataMap.put("method", "GetFlexibleWire");
+                dataMap.put("method", "GetQualityCenter");
                 Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
 
                 Map locationMap = new HashMap();
@@ -1094,7 +1094,7 @@ public class TaskWorkNode {
                 dataMap.put("result", true);
             } else if (count == 5) {
                 targetStorge = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId())==null?null:(Storge)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());;
-                dataMap.put("method", "SendFlexibleWire");
+                dataMap.put("method", "SendQualityCenter");
                 //出入库类型
                 dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/TaskNodeService.java

@@ -165,4 +165,5 @@ public interface TaskNodeService extends SuperService<TaskNode> {
 
     R callRobot(Map<String, Object> map);
 
+    R printCode(Map<String, Object> map);
 }

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

@@ -41,6 +41,7 @@ import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.DynamicRabbitMq;
 import com.github.zuihou.business.util.ManualTaskOperatorUtil;
 import com.github.zuihou.business.util.MsgUtil;
+import com.github.zuihou.business.util.ZplPrinter;
 import com.github.zuihou.common.constant.BizConstant;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.constant.CodeRuleModule;
@@ -55,12 +56,14 @@ import com.github.zuihou.tenant.entity.ProductionlineUser;
 import com.github.zuihou.tenant.service.CodeRuleService;
 import com.github.zuihou.tenant.service.ProductionlineService;
 import com.github.zuihou.tenant.service.ProductionlineUserService;
+import com.github.zuihou.utils.SpringUtils;
 import lombok.extern.slf4j.Slf4j;
 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.MediaType;
@@ -217,8 +220,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private PlateMapper plateMapper;
 
-
-
     private static Logger logger = LoggerFactory.getLogger(TaskNodeServiceImpl.class);
 
     //获取子二级节点
@@ -462,6 +463,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
      */
     private Long getResourceIdByAutoCode(String resourceType){
         String robotName = DictionaryKey.YJ_ROBOT_NODES.get(resourceType);
+        //String robotName = DictionaryKey.LINE_ROBOT_NODES.get(resourceType);
         Productionresource productionresource =  productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getName, robotName));
         return productionresource.getId();
     }
@@ -1386,8 +1388,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
         List<AAutoNodeLog> autoNodeLogList = autoNodeLogMapper.selectList(Wraps.<AAutoNodeLog>lbQ().eq(AAutoNodeLog::getTaskNodeId, taskNode.getId()));
         AAutoNodeLog lg = autoNodeLogList.get(0);
-        if ("1".equals(code)) {
-            //处理
+        if (StringUtils.isNotEmpty(code) && "1".equals(code)) {
             taskNodeCallbackBiz(taskNode, task, taskNodeList, lg, bizCallBackData);
             msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE_CONDITION + "_" + taskNode.getId());
             msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId());
@@ -1828,6 +1829,8 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             }
         } else if (DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK.equals(stockType)) {//托盘夹具、原料一起出库
             List<BomProcedureMeterial> meterialList = bomProcedureMeterialService.list(Wraps.<BomProcedureMeterial>lbQ().eq(BomProcedureMeterial::getId, task.getProcedureMeterialId()));
+            //临时代码 材料为空
+            if(meterialList.size()==0) return R.success("");
             R<String> ckresult = stockInfoService.meterialStockOut(meterialList.get(0), Long.parseLong(srcStorgeId), task.getCompleteBatchNo());
             R<String> rkresult = null;
             if (ckresult.getIsSuccess()) {
@@ -1854,6 +1857,8 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
             return R.success("");
         } else if (DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK_WITH_PLATE.equals(stockType)) {//托板出入库
             List<BomProcedureMeterial> meterialList = bomProcedureMeterialService.list(Wraps.<BomProcedureMeterial>lbQ().eq(BomProcedureMeterial::getId, task.getProcedureMeterialId()));
+            //临时代码 材料为空
+            if(meterialList.size()==0) return R.success("");
             R<String> ckresult = stockInfoService.meterialStockOut(meterialList.get(0), Long.parseLong(srcStorgeId), task.getCompleteBatchNo());
             R<String> rkresult = null;
             if (ckresult.getIsSuccess()) {
@@ -2423,6 +2428,14 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         return R.success("");
     }
 
+    @Override
+    public R printCode(Map<String, Object> map) {
+        ZplPrinter.init();
+        ZplPrinter.resetZpl();
+        String content = ZplPrinter.getZpl();
+        return ZplPrinter.print(content)? R.success("打印成功"):R.fail("打印失败");
+    }
+
 
     private  Boolean containAll(List<Long> A, List<Long> B) {
         List<Long> collect = A.stream().filter(item -> B.contains(item)).collect(Collectors.toList());

+ 33 - 34
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -36,10 +36,7 @@ import com.github.zuihou.business.productionResourceCenter.entity.*;
 import com.github.zuihou.business.productionResourceCenter.service.RepairService;
 import com.github.zuihou.business.util.CommonUtil;
 import com.github.zuihou.business.util.MsgUtil;
-import com.github.zuihou.common.constant.BizConstant;
-import com.github.zuihou.common.constant.CacheKey;
-import com.github.zuihou.common.constant.CodeRuleModule;
-import com.github.zuihou.common.constant.ParameterKey;
+import com.github.zuihou.common.constant.*;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.auth.DataScope;
@@ -1114,41 +1111,43 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     @Override
     public R updateTaskStatus(Map<String, Object> map){
         TTask tTask = baseMapper.selectById(Long.valueOf(map.get("id").toString()));
-        String type = map.get("updateType").toString();
-
-
-        HttpHeaders headers = new HttpHeaders();
-        JSONObject jObject = new JSONObject();
-        //jsonObject.put("businessType", taskNode.getAutoNodeCode());
-        String taskNodeId = map.get("taskNodeId").toString();
-        jObject.put("taskId", map.get("id").toString());
-        jObject.put("taskNodeId", taskNodeId);
-        jObject.put("url", "192.168.170.130");
-        jObject.put("port", "102");
-        JSONObject subjsonObject = new JSONObject();
-        subjsonObject.put("content",map.get("uniqueCode").toString());
-        //TODO 具体怎么对应。
-        subjsonObject.put("positionIndex","1");
-        jObject.put("data",subjsonObject.toJSONString());
-
-
-        headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
-        HttpEntity<String> formEntity = new HttpEntity<String>(jObject.toJSONString(),headers);
-        //TODO
-        //String instructionUrl = conMap.get("instructionUrl") + "/api/WriteRFID" ;
-        String  returnData = restTemplate.postForObject("", formEntity, String.class);
-
-        if(StringUtil.isNotEmpty(returnData)){
-            return  R.fail("写入rfid失败");
+        String type = map.containsKey("updateType")? map.get("updateType").toString() : null;
+
+        if(StringUtils.isEmpty(type)){
+            HttpHeaders headers = new HttpHeaders();
+            JSONObject jObject = new JSONObject();
+            //jsonObject.put("businessType", taskNode.getAutoNodeCode());
+            Map safeguard = DictionaryKey.PLC_CATEGORY.get("safeguard");
+            String taskNodeId = map.get("taskNodeId").toString();
+            jObject.put("taskId", map.get("id").toString());
+            jObject.put("taskNodeId", taskNodeId);
+            jObject.put("url", safeguard.get("url").toString());
+            jObject.put("port", safeguard.get("port").toString());
+            JSONObject subjsonObject = new JSONObject();
+            if(map.containsKey("uniqueCode")) {
+                subjsonObject.put("content", map.get("uniqueCode").toString());
+            }
+            //TODO 具体怎么对应。
+            subjsonObject.put("positionIndex", map.get("positionIndex").toString());
+            jObject.put("data",subjsonObject.toJSONString());
+
+            headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
+            HttpEntity<String> formEntity = new HttpEntity<String>(jObject.toJSONString(),headers);
+            //TODO
+            String instructionUrl = safeguard.get("url").toString() + "/api/WriteRFID" ;
+            String  returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
+
+            if(StringUtil.isNotEmpty(returnData)){
+                return  R.fail("写入rfid失败");
+            }
         }
-
-
-        if("begin".equals(type)) {
+        else if("begin".equals(type)) {
             if(null == tTask.getStartTime()) {
                 tTask.setStartTime(Calendar.getInstance().getTime());
                 baseMapper.updateById(tTask);
             }
-        }else if("end".equals(type)) {
+        }
+        else if("end".equals(type)) {
             TaskNode taskNode = taskNodeService.getOne(Wraps.<TaskNode>lbQ().eq(TaskNode::getTaskId, tTask.getId()).eq(TaskNode::getExeStatus,"2"));
             String id = taskNode.getId().toString();
             //验证是否重复回调

+ 3 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/MachineCuttingToolServiceImpl.java

@@ -104,7 +104,7 @@ public class MachineCuttingToolServiceImpl extends SuperCacheServiceImpl<Machine
             String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
 
             // TODO 后续删除代码,目前条用模拟接口
-            plcUrl = plcUrl.replace("8081","8083");
+            //plcUrl = plcUrl.replace("8081","8083");
 
             Productionresource productionresource =  productionresourceviewMapper.selectById(resourceId);
             // 访问ccs接口查询设备刀具
@@ -115,8 +115,8 @@ public class MachineCuttingToolServiceImpl extends SuperCacheServiceImpl<Machine
             HttpEntity<String> request = new HttpEntity<>(jsonObject.toJSONString(), headers);
 
             String synMachineCuttingTolls = "";
-            String instructionUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get("capsule_plc").toString()) + "/api/GetTool";
-
+            //String instructionUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(plcUrl).toString()) + "/api/GetTool";
+            String instructionUrl = plcUrl +"/api/GetTools";
 //             instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/GetTools";
             System.out.println("instructionUrl=" + instructionUrl);
             System.out.println("jsonParam=" + jsonObject.toJSONString());

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/ProgramService.java

@@ -62,6 +62,8 @@ public interface ProgramService extends SuperService<Program> {
      */
     Map getProgramContent(Program data);
 
+    Map getProgramContent(String bizId);
+
     /**
      * 同步到设备
      */

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

@@ -44,6 +44,7 @@ import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -131,6 +132,12 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 
     private String instructionUrl;
 
+    @Value("${zuihou.file.storage-path}")
+    private String storagePath;
+
+    @Value("${zuihou.file.uriPrefix}")
+    private String uriPath;
+
     @Override
     public void initResource(TaskNode taskNode, TTask task, Map dataMap) {
         //获取当前设备模型
@@ -269,7 +276,8 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                         //文件上传只允许单个文件
                         procedureProgramList.forEach(i -> {
                             Map<String, String> m = new HashMap<>();
-                            m.put("fileName", i.getSubmittedFileName());
+                            String filePath = i.getFilePath().replace(uriPath, storagePath);
+                            m.put("fileName", filePath.replace("/", "\\"));
                             fileList.add(m);
                         });
                         //map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "uploadProgram");

+ 36 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProgramServiceImpl.java

@@ -213,15 +213,49 @@ public class ProgramServiceImpl extends SuperServiceImpl<ProgramMapper, Program>
     /**
      * 查看程序
      */
-    @Override
     public Map getProgramContent(Program data){
+        Program program = baseMapper.selectById(data.getId());
         StringBuilder sb = new StringBuilder();
         Map map = new HashMap<>();
-        Program program = baseMapper.selectById(data.getId());
         BufferedReader br = null;
         try {
             URL url = new URL(program.getFilePath());
             URLConnection con = url.openConnection();
+            br = new BufferedReader(new InputStreamReader(con.getInputStream()));
+            String inputLine = null;
+            while((inputLine = br.readLine()) != null){
+                if (inputLine != null && inputLine.trim().length() > 0) {
+                    sb.append(inputLine);
+                    sb.append("\n\r");
+                }
+            }
+            map.put("content",sb.toString());
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            if(null != br){
+                try{
+                    br.close();
+                }catch (Exception e){
+
+                }
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 查看程序
+     */
+    @Override
+    public Map getProgramContent(String bizId){
+        StringBuilder sb = new StringBuilder();
+        Map map = new HashMap<>();
+        Attachment attachment = attachmentService.getOne(new LbqWrapper<Attachment>().eq(Attachment::getBizId, bizId));
+        BufferedReader br = null;
+        try {
+            URL url = new URL(attachment.getUrl());
+            URLConnection con = url.openConnection();
 
             br = new BufferedReader(new InputStreamReader(con.getInputStream()));
             String inputLine = null;

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

@@ -327,11 +327,11 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 break;
             case "智能生产保障系统":
                 dataMap = this.commandHandle(dataMap, agvStartStationStorge,functionName);
-                dataMap.put("deviceUrl", ZK_ip_rxx);
+                dataMap.put("deviceUrl", plcInfo.get("url"));
                 break;
             case "框体类加工单元":
                 dataMap = this.commandHandle(dataMap,agvStartStationStorge, functionName);
-                dataMap.put("deviceUrl", ZK_ip_rxx);
+                dataMap.put("deviceUrl", plcInfo.get("url"));
                 break;
             default:
                 dataMap = this.commandHandle(dataMap,agvStartStationStorge, functionName);
@@ -490,7 +490,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
                 } else if (count == 1) {
                     jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
-                    dataMap.put("method", "GetFlexibleWire");
+                    dataMap.put("method", "GetQualityCenter");
                     Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                     dataMap.put("fromStorge", currentStore);
 
@@ -504,7 +504,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     dataMap.put("result", true);
                 } else if (count == 2) {
                     Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
-                    dataMap.put("method", "SendFlexibleWire");
+                    dataMap.put("method", "SendQualityCenter");
                     dataMap.put("fromStorge", currentStore);
                     //出入库类型
                     dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
@@ -691,7 +691,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         //end add by yejian on 20220921 for 机器人缓存位上面有料时先判断当前机器人移动所在位子是否和机器人缓存台上面的暂存物料的目标地址一致,
                         // 如果一致,先将缓存台物料放到目标地址
                     }else if(count == 1){//从缓存位拿出来
-                        dataMap.put("method", "GetFlexibleWire");
+                        dataMap.put("method", "GetQualityCenter");
                         Storge hcwStorge = (Storge)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
 
                         Map locationMap = new HashMap();
@@ -705,7 +705,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
                         dataMap.put("result", true);
                     }else if(count == 2){
-                        dataMap.put("method", "SendFlexibleWire");
+                        dataMap.put("method", "SendQualityCenter");
                         //出入库类型
                         dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 

+ 16 - 16
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/ManualTaskOperatorUtil.java

@@ -22,17 +22,17 @@ public class ManualTaskOperatorUtil {
     /**
      * 黄哥模拟接口地址,模式调试时改成38
       */
-    private static String hostSyetemUrl = "http://192.168.170.248:8081/";
+    private static String hostSyetemUrl = "http://127.0.0.1:8089/";
     /**
      * agv运输
      */
     private static String agvURL = "http://localhost:9099/api/authority/mock/mockWms";
     // 保障平台
-    private static String ZK_ip_zlzx = "192.168.170.130";
+    private static String ZK_ip_zlzx = "192.168.11.130";
     //框体
-    private static String ZK_ip_rxx = "192.168.170.170";
+    private static String ZK_ip_rxx = "192.168.11.170";
     //舱体
-    private static String ZK_ip_zndy = "192.168.170.150";
+    private static String ZK_ip_zndy = "192.168.11.150";
 
     // 障平台PLC端口
     private static String ZK_ip_zlzx_port = "102";
@@ -253,11 +253,11 @@ public class ManualTaskOperatorUtil {
                     // 舱体(柔性线) 代码先写死,6个动作,后续根据resource_code表中获取
                     // 执行第一个任务
                     if("get".equals(taskType) && currentIndex == 1){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         String location = manualInfo.getStartpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 2){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         productionresourcePositions = productionresourcePositions.stream().filter(p->null == p.getGoodsId() && "1".equals(p.getLockStatus())).collect(toList());
 
                         String location = productionresourcePositions.get(0).getPointId().toString();
@@ -267,24 +267,24 @@ public class ManualTaskOperatorUtil {
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }if("get".equals(taskType) && currentIndex == 4){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         productionresourcePositions = productionresourcePositions.stream().filter(p->null == p.getGoodsId()  && "1".equals(p.getLockStatus())).collect(toList());
 
                         String location = productionresourcePositions.get(0).getPointId().toString();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 5){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }
                     manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
                 }else if(robotNodes.size() == 3 && currentIndex == 1){
                     if("get".equals(taskType) ){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         String location = manualInfo.getStartpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 2){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }
@@ -298,11 +298,11 @@ public class ManualTaskOperatorUtil {
                     // 舱体(柔性线) 代码先写死,6个动作,后续根据resource_code表中获取
                     // 执行第一个任务
                     if("get".equals(taskType) && currentIndex == 1){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         String location = manualInfo.getStartpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 2){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         productionresourcePositions = productionresourcePositions.stream().filter(p->null == p.getGoodsId() && "1".equals(p.getLockStatus())).collect(toList());
 
                         String location = productionresourcePositions.get(0).getPointId().toString();
@@ -312,24 +312,24 @@ public class ManualTaskOperatorUtil {
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }if("get".equals(taskType) && currentIndex == 4){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         productionresourcePositions = productionresourcePositions.stream().filter(p->null == p.getGoodsId()  && "1".equals(p.getLockStatus())).collect(toList());
 
                         String location = productionresourcePositions.get(0).getPointId().toString();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 5){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }
                     manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
                 }else if(robotNodes.size() == 3){
                     if("get".equals(taskType) && currentIndex == 1){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetQualityCenter";
                         String location = manualInfo.getStartpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }else if("put".equals(taskType) && currentIndex == 2){
-                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendFlexibleWire";
+                        String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendQualityCenter";
                         String location = manualInfo.getEndpointId();
                         setProcessInfo(robotNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
                     }

+ 42 - 19
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/ZplPrinter.java

@@ -1,4 +1,12 @@
 package com.github.zuihou.business.util;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+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.stereotype.Component;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -14,15 +22,20 @@ import javax.print.SimpleDoc;
 import javax.print.attribute.standard.PrinterName;
 
 public class ZplPrinter {
-    private String printerURI = null;//打印机完整路径
-    private PrintService printService = null;//打印机服务
-    private byte[] dotFont;
-    private String begin = "^XA";   //标签格式以^XA开始
-    private String end = "^XZ";     //标签格式以^XZ结束
-    private String content = "";
+    private static Logger logger = LoggerFactory.getLogger(ZplPrinter.class);
+
+    //@Value("${zuihou.print.printCodePath}")
+    private static String printerURI;//打印机完整路径
+    private static PrintService printService;//打印机服务
+    private static byte[] dotFont;
+    private static String begin = "^XA";   //标签格式以^XA开始
+    private static String end = "^XZ";     //标签格式以^XZ结束
+    private static String content = "";
 
     public static void main(String[] args) {
-        ZplPrinter p = new ZplPrinter("\\\\192.168.0.12\\ZDesigner 105SLPlus-300dpi ZPL");
+        //ZplPrinter p = new ZplPrinter("\\\\192.168.11.247\\ZDesigner ZT210-200dpi ZPL");
+        ZplPrinter p = new ZplPrinter();
+        printerURI = "\\\\192.168.11.247\\ZDesigner ZT210-200dpi ZPL";
         //1.打印单个条码
         String bar0 = "1234567890";//条码内容
         String bar0Zpl = "^FO110,110^BY6,3.0,280^BCN,,Y,N,N^FD${data}^FS";//条码样式模板
@@ -54,11 +67,9 @@ public class ZplPrinter {
     }
 
     /**
-     * 构造方法
-     * @param printerURI 打印机路径
+     * 构造方法     *
      */
-    public ZplPrinter(String printerURI){
-        this.printerURI = printerURI;
+    public static void init(){
         //加载字体
         String relativelyPath=System.getProperty("user.dir");
         File file = new File(relativelyPath + "//ts24.lib");
@@ -75,6 +86,17 @@ public class ZplPrinter {
         }else{
             System.out.println("ts24.lib文件不存在");
         }
+
+        printerURI = "\\\\192.168.11.247\\ZDesigner ZT210-200dpi ZPL";
+        //1.打印单个条码
+        String bar0 = "1234567890";//条码内容
+        String bar0Zpl = "^FO110,110^BY6,3.0,280^BCN,,Y,N,N^FD${data}^FS";//条码样式模板
+        ZplPrinter.setBarcode(bar0, bar0Zpl);
+        ZplPrinter.setText("云箭集团", 380, 260, 60, 60, 30, 2, 2, 24);
+
+        ZplPrinter.setText("品类:前格框", 380, 485, 56, 56, 30, 2, 2, 24);
+        ZplPrinter.setChar("78787878788", 500, 560, 40, 40);
+
         //初始化打印机
         PrintService[] services = PrintServiceLookup.lookupPrintServices(null,null);
         if (services != null && services.length > 0) {
@@ -98,13 +120,14 @@ public class ZplPrinter {
             System.out.println("找到打印机:["+printerURI+"]");
             System.out.println("打印机名称:["+printService.getAttribute(PrinterName.class).getValue()+"]");
         }
+
     }
     /**
      * 设置条形码
      * @param barcode 条码字符
      * @param zpl 条码样式模板
      */
-    public void setBarcode(String barcode,String zpl) {
+    public static void setBarcode(String barcode,String zpl) {
         content += zpl.replace("${data}", barcode);
     }
 
@@ -120,7 +143,7 @@ public class ZplPrinter {
      * @param my 中文y轴字体图形放大倍率。范围1-10,默认1
      * @param ms 中文字体间距。24是个比较合适的值。
      */
-    public void setText(String str, int x, int y, int eh, int ew, int es, int mx, int my, int ms) {
+    public static void setText(String str, int x, int y, int eh, int ew, int es, int mx, int my, int ms) {
         byte[] ch = str2bytes(str);
         for (int off = 0; off < ch.length;) {
             if (((int) ch[off] & 0x00ff) >= 0xA0) {
@@ -154,7 +177,7 @@ public class ZplPrinter {
      * @param h 高度
      * @param w 宽度
      */
-    public void setChar(String str, int x, int y, int h, int w) {
+    public static void setChar(String str, int x, int y, int h, int w) {
         content += "^FO" + x + "," + y + "^A0," + h + "," + w + "^FD" + str + "^FS";
     }
     /**
@@ -165,20 +188,20 @@ public class ZplPrinter {
      * @param h 高度
      * @param w 宽度
      */
-    public void setCharR(String str, int x, int y, int h, int w) {
+    public static void setCharR(String str, int x, int y, int h, int w) {
         content += "^FO" + x + "," + y + "^A0R," + h + "," + w + "^FD" + str + "^FS";
     }
     /**
      * 获取完整的ZPL
      * @return
      */
-    public String getZpl() {
+    public static String getZpl() {
         return begin + content + end;
     }
     /**
      * 重置ZPL指令,当需要打印多张纸的时候需要调用。
      */
-    public void resetZpl() {
+    public static void resetZpl() {
         begin = "^XA";
         end = "^XZ";
         content = "";
@@ -187,7 +210,7 @@ public class ZplPrinter {
      * 打印
      * @param zpl 完整的ZPL
      */
-    public boolean print(String zpl){
+    public static boolean print(String zpl){
         if(printService==null){
             System.out.println("打印出错:没有找到打印机:["+printerURI+"]");
             return false;
@@ -210,7 +233,7 @@ public class ZplPrinter {
      * @param s
      * @return
      */
-    private byte[] str2bytes(String s) {
+    private static byte[] str2bytes(String s) {
         if (null == s || "".equals(s)) {
             return null;
         }

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskMapper.xml

@@ -355,6 +355,7 @@
           itp.name AS deviceName,
           ioo.order_name AS orderName,
           ioo.order_no AS orderNumber,
+          irdr.resource_id AS resourceId,
           tmp1.productName,
           tmp1.productNumber
         FROM imcs_resource_3d_relation irdr

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

@@ -165,4 +165,11 @@ public class TaskNodeController extends SuperController<TaskNodeService, Long, T
         log.info("翻面呼叫机器人,请求参数{}",map);
         return baseService.callRobot(map);
     }
+
+    @ApiOperation(value = "打印物料编码", notes = "打印物料编码")
+    @PostMapping("/printCode")
+    public R printCode(@RequestBody Map<String,Object> map) {
+        log.info("打印物料编码,请求参数{}",map);
+        return baseService.printCode(map);
+    }
 }

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

@@ -247,8 +247,8 @@ public class WorkpieceController extends SuperController<WorkpieceService, Long,
             String manualIdType = manualInfo.getManualIdType()==null?"":manualInfo.getManualIdType().toString();
             String deviceUnit = manualInfo.getDeviceUnit()==null?"":manualInfo.getDeviceUnit().toString();
 
-            if(StringUtils.isBlank(startpointId) || StringUtils.isBlank(endpointId) || StringUtils.isBlank(startResourceId)
-                || StringUtils.isBlank(endResourceId) || StringUtils.isBlank(robotResourceId) || StringUtils.isBlank(manualIdType)
+            if(StringUtils.isBlank(startpointId) || StringUtils.isBlank(endpointId)
+                //    || StringUtils.isBlank(startResourceId) || StringUtils.isBlank(endResourceId) || StringUtils.isBlank(robotResourceId) || StringUtils.isBlank(manualIdType)
                 || StringUtils.isBlank(deviceUnit)){
                 return R.fail("请求参数不完整");
             }

+ 8 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ProgramController.java

@@ -18,6 +18,7 @@ import com.github.zuihou.base.controller.SuperController;
 import com.github.zuihou.base.R;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
+import com.github.zuihou.file.entity.Attachment;
 import com.github.zuihou.log.annotation.SysLog;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -105,6 +106,13 @@ public class ProgramController extends SuperController<ProgramService, Long, Pro
         return success(baseService.getProgramContent(model));
     }
 
+    @ApiOperation(value = "查看程序", notes = "查看程序")
+    @PostMapping("/getProgramContent")
+    public R<Map> getProgramContent(@RequestBody Attachment attachment) {
+        String bizId = attachment.getBizId();
+        return success(baseService.getProgramContent(bizId));
+    }
+
 
     @ApiOperation(value = "同步到设备", notes = "同步到设备")
     @PostMapping("/synchronousProgram")

+ 1 - 1
imcs-admin-boot/imcs-file-biz/src/main/java/com/github/zuihou/file/service/impl/AttachmentServiceImpl.java

@@ -74,7 +74,7 @@ public class AttachmentServiceImpl extends SuperServiceImpl<AttachmentMapper, At
         LbqWrapper<Attachment> wrapper = Wraps.<Attachment>lbQ()
                 .like(Attachment::getSubmittedFileName, attachment.getSubmittedFileName())
                 .like(Attachment::getBizType, attachment.getBizType())
-                .like(Attachment::getBizId, attachment.getBizId())
+                .eq(Attachment::getBizId, attachment.getBizId())
                 .eq(Attachment::getDataType, attachment.getDataType())
                 .orderByDesc(Attachment::getId);
         return baseMapper.page(page, wrapper, new DataScope());

+ 3 - 0
imcs-admin-boot/imcs-tenant-biz/src/main/java/com/github/zuihou/tenant/service/impl/ProductionresourceServiceImpl.java

@@ -869,9 +869,12 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
                 String showStatus = item.get("showStatus")==null?"0":item.get("showStatus").toString();
                 if("1".equals(showStatus)){
                     DictionaryItem dictionaryItem = productionMap.get(item.get("onlineStatus"));
+                    DictionaryItem dictionaryItem2 = controlMap.get(item.get("onlineStatus").toString()!="0"?"1":"0");
                     item.put("productionStatus",buildMap(dictionaryItem));
                     //直接存汉字
                     item.put("productionStatusCN",null!=dictionaryItem?dictionaryItem.getName():"");
+                    item.put("controlStatus",buildMap(dictionaryItem2));
+                    item.put("controlStatusCN",null!=dictionaryItem2?dictionaryItem2.getName():"");
                 }
 
                 return item;