| | |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
| | | }else{ |
| | | String productNum = snCodeObjcet.toString(); |
| | | //将产品SN发送到前台 |
| | | productNum = "productNum,"+ productNum; |
| | | WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
| | | if(productNum.length()<10){ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
| | | }else{ |
| | | //将产品SN发送到前台 |
| | | productNum = "productNum,"+ productNum; |
| | | WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
| | | } |
| | | |
| | | } |
| | | }else {//自动工位 |
| | | //所有进站将进站时间写给PLC |
| | |
| | | if (ObjectUtil.isNull(snCodeObjcet)){ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(25).build()); |
| | | }else { |
| | | //所有出站将出站时间写给PLC |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String currentDate = dateFormat.format(new Date()); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StopTime").value(currentDate).build()); |
| | | |
| | | Integer result = 21; |
| | | String snCode = snCodeObjcet.toString();//产品SN |
| | | String orderNumber = orderObjcet.toString();//工单号 |
| | | Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址 |
| | | if (ObjectUtil.isNotNull(stationStatusObjcet)) { |
| | | String stationStatus = stationStatusObjcet.toString(); |
| | | if (Constants.OP010.equals(device)) { |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | updateOrderStatus(snCode, "3");//OP010工位更新工单状态为执行中 |
| | | reportFactoryMes(snCode, device, format.format(new Date()));//工厂MES报工 |
| | | }); |
| | | if(snCode.length()<10){ |
| | | result = 22; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | }else { |
| | | //所有出站将出站时间写给PLC |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String currentDate = dateFormat.format(new Date()); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StopTime").value(currentDate).build()); |
| | | |
| | | Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址 |
| | | if (ObjectUtil.isNotNull(stationStatusObjcet)) { |
| | | String stationStatus = stationStatusObjcet.toString(); |
| | | if (Constants.OP010.equals(device)) { |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | updateOrderStatus(snCode, "3");//OP010工位更新工单状态为执行中 |
| | | reportFactoryMes(snCode, device, format.format(new Date()));//工厂MES报工 |
| | | }); |
| | | } |
| | | result = savePassingStation(thoroughfare, device, snCode, orderNumber, stationStatus);//保存过站 |
| | | if (result == 21) { |
| | | result = saveParamCollection(device, snCode, orderNumber, stationStatus);//保存参数,发送工厂MES |
| | | } |
| | | } else { |
| | | result = 23; |
| | | log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}", device, "IS NULL!", result); |
| | | } |
| | | result = savePassingStation(thoroughfare, device, snCode, orderNumber, stationStatus);//保存过站 |
| | | if (result == 21) { |
| | | result = saveParamCollection(device, snCode, orderNumber, stationStatus);//保存参数,发送工厂MES |
| | | } |
| | | } else { |
| | | result = 23; |
| | | log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}", device, "IS NULL!", result); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | } |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | |
| | | } |
| | | } |
| | | } |