| | |
| | | } |
| | | } catch (Exception e) { |
| | | logger.info("订阅方法报错:{}"+e.getMessage()); |
| | | e.printStackTrace(); |
| | | logger.error("订阅方法报错",e); |
| | | } |
| | | } |
| | | |
| | |
| | | read = read + "ModuleCode"; |
| | | if(device.equals("OP365")){ |
| | | try { |
| | | saveStationInfo365(thoroughfare,device); |
| | | result = saveStationInfo365(thoroughfare,device); |
| | | return result; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else { |
| | | read = read + "PACKCode"; |
| | | snCode = miloService.readFromOpcUa(read).getValue().toString(); |
| | | |
| | | if(null == snCode || "".equals(snCode)){ |
| | | result = "22"; |
| | | }else{ |
| | | |
| | | String workOrderNo = ""; |
| | | String productCode = ""; |
| | | //2、保存过站采集数据 |
| | | Object orderNumberObject = miloService.readFromOpcUa(thoroughfare + "." + device + "." + "WorkOrderNumber").getValue(); |
| | | if(orderNumberObject!=null){ |
| | | workOrderNo = orderNumberObject.toString(); |
| | | } |
| | | |
| | | Object productCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + "." + "ProductType").getValue(); |
| | | if(productCodeObject!=null){ |
| | | productCode = productCodeObject.toString(); |
| | | } |
| | | |
| | | saveStationInfo(snCode,thoroughfare,device,workOrderNo,productCode); |
| | | //3、保存参数采集数据 |
| | | SaveParamData(snCode,thoroughfare,device,workOrderNo,productCode); |
| | | |
| | | //如果是末尾工站要报工 |
| | | if(device.equals("OP500")){ |
| | | RestfulService.getWorkReportResultFeedback(snCode,device,format.format(new Date())); |
| | | //1、更新工单信息 |
| | | updateOrderInfo(snCode); |
| | | } |
| | | try{ |
| | | daParamCollectionService.pushGeelycvMesFeedback(snCode,device); |
| | | }catch (Exception e){ |
| | | } |
| | | result = "21"; |
| | | |
| | | } |
| | | } |
| | | } |
| | | snCode = miloService.readFromOpcUa(read).getValue().toString(); |
| | | |
| | | if(null == snCode || "".equals(snCode)){ |
| | | result = "22"; |
| | | }else{ |
| | | |
| | | String workOrderNo = ""; |
| | | String productCode = ""; |
| | | //2、保存过站采集数据 |
| | | Object orderNumberObject = miloService.readFromOpcUa(thoroughfare + "." + device + "." + "WorkOrderNumber").getValue(); |
| | | if(orderNumberObject!=null){ |
| | | workOrderNo = orderNumberObject.toString(); |
| | | } |
| | | |
| | | Object productCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + "." + "ProductType").getValue(); |
| | | if(productCodeObject!=null){ |
| | | productCode = productCodeObject.toString(); |
| | | } |
| | | |
| | | saveStationInfo(snCode,thoroughfare,device,workOrderNo,productCode); |
| | | //3、保存参数采集数据 |
| | | SaveParamData(snCode,thoroughfare,device,workOrderNo,productCode); |
| | | |
| | | //如果是末尾工站要报工 |
| | | if(device.equals("OP500")){ |
| | | RestfulService.getWorkReportResultFeedback(snCode,device,format.format(new Date())); |
| | | //1、更新工单信息 |
| | | updateOrderInfo(snCode); |
| | | } |
| | | try{ |
| | | daParamCollectionService.pushGeelycvMesFeedback(snCode,device); |
| | | }catch (Exception e){ |
| | | } |
| | | result = "21"; |
| | | |
| | | } |
| | | |
| | | }catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | |
| | | /** |
| | | * 保存过站采集 |
| | | */ |
| | | public void saveStationInfo365(String thoroughfare,String device) throws Exception { |
| | | public String saveStationInfo365(String thoroughfare,String device) throws Exception { |
| | | String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; |
| | | String prefix = thoroughfare+"."+device+"."; |
| | | List<DaPassingStationCollection> passingStationCollections = new ArrayList<>(); |
| | |
| | | passingStationCollections.add(daPassingStationCollection); |
| | | } |
| | | daPassingStationCollectionService.saveBeachDaPassingStationCollection(passingStationCollections); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(21).build()); |
| | | return; |
| | | //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(21).build()); |
| | | return "21"; |
| | | }else { |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(22).build()); |
| | | return; |
| | | //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(22).build()); |
| | | return "22"; |
| | | } |
| | | } |
| | | |