private void RefreshProgress() { try { _putAwayRack = RackSelection.Text; _putAwayShelf = ShelfSelection.Text; if (string.IsNullOrEmpty(_putAwayShelf)) { ShelfSelection.Focus(); return; } _putAwayPosition = PositionSelection.Text; if (string.IsNullOrEmpty(_putAwayPosition)) { PositionSelection.Focus(); return; } using (var ppTA = new PhysicalProgressTableAdapter()) { uxGridProgress.DataSource = ppTA.GetCycleCountProgressByAddress(Plant, _putAwayRack, _putAwayShelf, _putAwayPosition); } using (var ppsTA = new PhysicalProgressSummaryTableAdapter()) { var ppsDT = ppsTA.GetCycleCountProgressSummary(Plant, _putAwayRack, _putAwayShelf, _putAwayPosition); switch (ppsDT.Rows.Count) { case 1: uxLabelProgress.Text = ppsDT[0].FoundCount + " Found, " + ppsDT[0].MissingCount + " Missing, " + ppsDT[0].TotalCount + " Total"; break; default: throw new Exception("Unable to retrieve summary."); } } } catch (SqlException ex) { foreach (SqlError sqlErr in ex.Errors) { MessageBox.Show(sqlErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private int TryProcessSerial(Int32 boxSerial) { try { // Verify that shelf and subshelf are selected. _putAwayRack = RackSelection.Text; _putAwayShelf = ShelfSelection.Text; if (string.IsNullOrEmpty(_putAwayShelf)) { ShelfSelection.Focus(); throw new Exception("Shelf not selected."); } _putAwayPosition = PositionSelection.Text; if (string.IsNullOrEmpty(_putAwayPosition)) { PositionSelection.Focus(); throw new Exception("Subshelf not selected."); } // Scan object to location. using (var ppTA = new PhysicalProgressTableAdapter()) { DateTime?tranDT = null; Int32? result = null; ppTA.ScanSerial(OperatorCode, boxSerial, Plant, _putAwayRack, _putAwayShelf, _putAwayPosition, ref tranDT, ref result); } // Refresh screen and find row. using (var wiTA = new WarehouseInventoryTableAdapter()) { var wiDT = wiTA.GetInventoryBySerial(boxSerial); switch (wiDT.Rows.Count) { case 1: uxLabelMessage.Text = "Serial " + boxSerial + " Part " + wiDT[0].Part; break; default: throw new Exception("Part not found!"); } } RefreshProgress(); return(1); } catch (SqlException ex) { foreach (SqlError sqlErr in ex.Errors) { MessageBox.Show(sqlErr.Message); } return(-1); } catch (Exception ex) { uxLabelMessage.Text = ex.Message; const int DURATION = 1500; //millisec const int FREQUENCY = 2670; //hz try { _myAudioController.PlayAudio(DURATION, FREQUENCY); //play Default beep } catch { MessageBox.Show("PlayAudio failed. Speaker may not be present", "PlayAudio"); } return(-1); } }