cl
2024-07-07 e0c9c69431934041c303ef4c08295de64cd80a49
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -145,10 +145,9 @@
                            }
                        } else if(Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){
                            //1、进站PLC给产品类型,MES读取产品类型
                            ReadWriteEntity productTypeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType");//产品类型
                            if (ObjectUtil.isNotNull(productTypeRead.getValue())){
                                String productType = productTypeRead.getValue().toString();
                            Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型
                            if (ObjectUtil.isNotNull(productTypeObjcet)){
                                String productType = productTypeObjcet.toString();//产品类型
                                CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
                                    //调用工厂MES,保存到数据库,并且将工单传给PLC (目前临时用该方法)
                                    receivingWorkOrders(thoroughfare, device);
@@ -156,7 +155,6 @@
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build());
                                log.info("写入到工位{}的RecordDataDone数据:{}",device,11);
                            }else{
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
                            }
@@ -185,11 +183,11 @@
                            }
                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                            log.info("写入到工位{}的RecordDataDone数据:{}",device,result);
                        } else if (Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){
                        } else if (Constants.OP100_OP150.contains(device)){//人工工位
                            WebSocketUsers.sendMessageToUserByText(map.get(device), "END");
                        } else {
                            Integer result = 21;
                            Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型
                            Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue();
                            if (ObjectUtil.isNull(modulCodeObjcet) && modulCodeObjcet.toString().trim().isEmpty()){
                                result = 23;
@@ -234,8 +232,8 @@
                String productNum = orderList.get(0).getProductNum();//模组码
                String orderNum = orderList.get(0).getWorkOrderNo();
                //下发产品模组码
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".MES_ModuleCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".MES_WorkOrderNumber").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(productNum).build());
                //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());
                //更新工单状态为执行中
@@ -477,6 +475,9 @@
                    String paramValue = "";
                    if (ObjectUtil.isNotNull(readWriteEntityList.get(i).getValue())){
                        paramValue = readWriteEntityList.get(i).getValue().toString();//参数值
                        if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){
                            paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString();
                        }
                    }
                    daParamCollection.setParamValue(paramValue);//参数值
                    daParamCollection.setLocationCode(device);//工位
@@ -490,7 +491,7 @@
                    childVO.setItemValue(paramValue);//参数值
                    childVO.setItemText(list.get(i).getCollectParameterName());
                    childVO.setCheckResult("1");
                    childVO.setCheckTime(new Date().toString());
                    childVO.setCheckTime(format.format(new Date()));
                    mesList.add(childVO);
                }
@@ -591,7 +592,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl1.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList1.add(childVO);
                    }
@@ -619,7 +620,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl2.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList2.add(childVO);
                    }
                }
@@ -645,7 +646,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl3.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList3.add(childVO);
                    }
                }
@@ -671,7 +672,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl4.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList4.add(childVO);
                    }
                }
@@ -688,9 +689,9 @@
                                String paramValue = "";
                                if (ObjectUtil.isNotNull(paramCollectionList0.get(j).getValue())) {
                                    paramValue = paramCollectionList0.get(j).getValue().toString();//参数值
                                }
                                if(confColl0.get(j).getCollectParameterName().contains("时间") && !"".equals(paramValue)){
                                    paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString();
                                    if("DATE".equals(confColl0.get(j).getCollectParameterType()) && !paramValue.isEmpty()){
                                        paramValue = TimeUtil.test(TimeUtil.stringProcessing(paramValue));
                                    }
                                }
                                daParamCollection.setParamValue(paramValue);//参数值
                                daParamCollection.setLocationCode(device);//工位
@@ -704,7 +705,7 @@
                                childVO.setItemValue(paramValue);//参数值
                                childVO.setItemText(confColl0.get(j).getParameterSetName());
                                childVO.setCheckResult("1");
                                childVO.setCheckTime(new Date().toString());
                                childVO.setCheckTime(format.format(new Date()));
                                mesChildList0.add(childVO);
                            }
                        }