| | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class EOP090Callback implements SubscriptionCallback { |
| | | public class EOP090Callback { |
| | | |
| | | public MiloService miloService; |
| | | |
| | |
| | | this.productionOrderRecordsService = productionOrderRecordsService; |
| | | this.productionOrderBatchInfoService = productionOrderBatchInfoService; |
| | | } |
| | | @Override |
| | | public void onSubscribe(String identifier, Object value) { |
| | | String ecpStr = "";//异常记录标记 |
| | | try { |
| | | //心跳 |
| | | if(null != value && identifier.equals(OPCElement.EOP090_F_HEART_BEAT)){ |
| | | if( "false".equals(value.toString())) |
| | | { |
| | | ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP090_F_HEART_BEAT,true); |
| | | miloService.writeToOpcUa(entity); |
| | | } |
| | | } |
| | | //PLC进站 |
| | | else if(null != value && identifier.equals(OPCElement.EOP090_J_PLC_START)){ |
| | | if("true".equals(value.toString())){ |
| | | handleOrder(); |
| | | } |
| | | } |
| | | //PLC出站 |
| | | else if(null != value && identifier.equals(OPCElement.EOP090_J_PLC_FINISH)){ |
| | | if("true".equals(value.toString())){ |
| | | handleFinsh(); |
| | | handleInfo(); |
| | | handleMaterial(); |
| | | } |
| | | }else{ |
| | | System.out.println("值没有变"); |
| | | } |
| | | } catch (Exception e) { |
| | | ecpStr ="出现异常:" + logUtil.getTrace(e); |
| | | }finally { |
| | | if(!"".equals(ecpStr)){ |
| | | logger.info(ecpStr+"\r\n"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //PC读工单 |
| | | public void handleOrder() throws Exception { |