private void handleWeightAcquired(WeightAcquiredMessage msg) { try { if (!_initialized || _canceled || _loadCreated) { return; } Logging.Logger.Log("INFO", "Entering handleWeightAcquired " + msg.Weight.ToString()); //lock (_dataLocker) //{ if (_canceled) { return; } if (!_weight1Acquired) { Weight1 = msg.Weight; _weight1Acquired = true; //if not semi signal weight acquired if (!IsSplitWeight) { WelcomeMessage = "WEIGHT RECORDED"; Logging.Logger.Log("INFO", "WEIGHT RECORDED " + msg.Weight.ToString()); waitingForExit = true; TagDataProvider.SetGPOState(2, true); TagDataProvider.SetGPOState(3, false); } else { WelcomeMessage = "WEIGHT 1 OF 2 RECORDED"; Logging.Logger.Log("INFO", "WEIGHT 1 OF 2 RECORDED " + msg.Weight.ToString()); TagDataProvider.SetGPOState(2, true); TagDataProvider.SetGPOState(3, false); _waitingForMotion = true; } } else if (_isSplitWeigh && _weight1Acquired && !_waitingForMotion && !_weight2Acquired) { Weight2 = msg.Weight; _weight2Acquired = true; waitingForExit = true; //signal pull forward WelcomeMessage = "WEIGHT 2 OF 2 RECORDED "; Logging.Logger.Log("INFO", "WEIGHT 2 OF 2 RECORDED " + msg.Weight.ToString()); TagDataProvider.SetGPOState(3, false); TagDataProvider.SetGPOState(2, true); } //} } catch (Exception exc) { Logging.Logger.Log(exc); Logging.Logger.WriteBuffer(); } }
private void handleWeightAcquired(WeightAcquiredMessage msg) { try { TagDataProvider.SetGPOState(3, false); } catch (Exception exc) { Logging.Logger.Log(exc); Logging.Logger.WriteBuffer(); } }
private void handleWeightAcquired(WeightAcquiredMessage msg) { if (waitingForWeight) { try { using (var dp = SimpleIoc.Default.GetInstance <IUnitOfWorkFactory>().CreateUnitOfWork()) { var scanNumber = dp.BaleScanRepository.LastScanNumber(); var scan = dp.BaleScanRepository.FindSingle(s => s.ScanNumber == scanNumber); if (scan != null && scan.Created >= DateTime.Now.AddMinutes(-5)) { scan.ScaleWeight = msg.Weight; scan.SyncedToCloud = false; scan.Source = InputSource.TRUCK; dp.BaleScanRepository.Save(scan); dp.SaveChanges(); var displayedScan = PBIScans.FirstOrDefault(s => s.Barcode == scan.PbiNumber); //update weight on displayed scan if (displayedScan != null) { displayedScan.Weight = scan.NetLintBaleWeight; } Task.Run(() => { if (PBISyncHelper.IsRunning) { PBISyncHelper.WaitForCompletion(); } PBISyncHelper.RunSync(); }); } } } catch (Exception exc) { Logging.Logger.Log(exc); } waitingForWeight = false; } }
private void handleWeightAcquired(WeightAcquiredMessage msg) { }