/// <summary> /// Handle DataChange notifications from Server /// </summary> private void OnMonitoredEquals(MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e) { try { // Log MonitoredItem Notification event MonitoredItemNotification notification = e.NotificationValue as MonitoredItemNotification; // Console.WriteLine("Notification Received for Variable \"{0}\" and Value = {1}.", monitoredItem.DisplayName, notification.Value); if ((bool)notification.Value.Value) { string scan_code = ReadNode("ns=3;s=\"上位通讯\".\"写入\".\"15#\".\"物流篮条码\""); scanDataBaseServer.Create(new ScanEntity() { scanTime = DateTime.Now, scanData = scan_code }); } } catch (Exception ex) { Console.WriteLine("OnMonitoredItemNotification error: {0}", ex.Message); } }
public ActionResult <ScanEntity> Post([Body] ScanEntity scanEntity) { scanEntity.scanTime = DateTime.Now; return(_scanDataBaseServer.Create(scanEntity)); }