|
@@ -23,7 +23,7 @@ namespace PRSDesktop
|
|
|
/// </summary>
|
|
|
public partial class RequisitionPanel : UserControl, IPanel<Requisition>
|
|
|
{
|
|
|
- private Requisition _requisition;
|
|
|
+ private Requisition? _requisition;
|
|
|
|
|
|
public List<IMotorolaBarcodeScanner> Scanners = new();
|
|
|
|
|
@@ -63,9 +63,6 @@ namespace PRSDesktop
|
|
|
|
|
|
SetupScanner();
|
|
|
|
|
|
- Items.OnBeforeSave += Items_OnBeforeSave;
|
|
|
- UnPickedItems.OnBeforeSave += UnPickedItems_OnBeforeSave;
|
|
|
-
|
|
|
Items.Reconfigure(options =>
|
|
|
{
|
|
|
options.BeginUpdate();
|
|
@@ -92,18 +89,6 @@ namespace PRSDesktop
|
|
|
UpdateLayout();
|
|
|
}
|
|
|
|
|
|
- private void UnPickedItems_OnBeforeSave(IDynamicEditorForm editor, BaseObject[] items)
|
|
|
- {
|
|
|
- foreach (var item in items)
|
|
|
- (item as RequisitionItem).Picked = DateTime.MinValue;
|
|
|
- }
|
|
|
-
|
|
|
- private void Items_OnBeforeSave(IDynamicEditorForm editor, BaseObject[] items)
|
|
|
- {
|
|
|
- foreach (var item in items)
|
|
|
- (item as RequisitionItem).Picked = DateTime.Now;
|
|
|
- }
|
|
|
-
|
|
|
public void Shutdown(CancelEventArgs? cancel)
|
|
|
{
|
|
|
ShutdownScanner();
|
|
@@ -166,7 +151,7 @@ namespace PRSDesktop
|
|
|
BarcodeScannerManager.Instance.DataReceived += Instance_DataReceived;
|
|
|
}
|
|
|
|
|
|
- private void Instance_DataReceived(object sender, BarcodeScanEventArgs e)
|
|
|
+ private void Instance_DataReceived(object? sender, BarcodeScanEventArgs e)
|
|
|
{
|
|
|
Dispatcher.Invoke(() => { ProcessCode(Scanners[(int)e.ScannerId], e.Data); });
|
|
|
}
|
|
@@ -191,15 +176,15 @@ namespace PRSDesktop
|
|
|
|
|
|
var sCode = code;
|
|
|
var iQty = 1;
|
|
|
- if (sCode.Contains("*"))
|
|
|
+ if (sCode.Contains('*'))
|
|
|
{
|
|
|
var comps = sCode.Split('*');
|
|
|
sCode = comps[0];
|
|
|
iQty = int.Parse(comps[1].Trim());
|
|
|
}
|
|
|
|
|
|
- RequisitionItem item = null;
|
|
|
- CoreRow itemrow = null;
|
|
|
+ RequisitionItem? item = null;
|
|
|
+ CoreRow? itemrow = null;
|
|
|
try
|
|
|
{
|
|
|
itemrow = Items.Data.Rows.FirstOrDefault(r => /* r.Get<RequisitionItem, int>(x => x.BoxNumber).Equals(boxes) && */
|
|
@@ -218,8 +203,7 @@ namespace PRSDesktop
|
|
|
{
|
|
|
item.Quantity += iQty;
|
|
|
new Client<RequisitionItem>().Save(item, "Quantity Updated by Barcode Scanner");
|
|
|
- if (scanner != null)
|
|
|
- scanner.Actions.SoundBeeper(BeepPattern.LowHigh);
|
|
|
+ scanner?.Actions.SoundBeeper(BeepPattern.LowHigh);
|
|
|
Refresh();
|
|
|
}
|
|
|
else
|
|
@@ -238,26 +222,23 @@ namespace PRSDesktop
|
|
|
};
|
|
|
new Client<RequisitionItem>().Save(item, "Scanned by Barcode Reader");
|
|
|
|
|
|
- if (scanner != null)
|
|
|
- scanner.Actions.SoundBeeper(BeepPattern.LowHigh);
|
|
|
+ scanner?.Actions.SoundBeeper(BeepPattern.LowHigh);
|
|
|
|
|
|
Refresh();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (scanner != null)
|
|
|
- scanner.Actions.SoundBeeper(BeepPattern.FourLowLong);
|
|
|
+ scanner?.Actions.SoundBeeper(BeepPattern.FourLowLong);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception e)
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- if (scanner != null)
|
|
|
- scanner.Actions.SoundBeeper(BeepPattern.FourLowShort);
|
|
|
+ scanner?.Actions.SoundBeeper(BeepPattern.FourLowShort);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ArchiveRequisition(PanelAction obj)
|
|
|
+ /*private void ArchiveRequisition(PanelAction obj)
|
|
|
{
|
|
|
var bClosed = false;
|
|
|
var iRow = Requisitions.SelectedRows.First().Index;
|
|
@@ -288,14 +269,15 @@ namespace PRSDesktop
|
|
|
|
|
|
if (bClosed)
|
|
|
Refresh();
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
public Dictionary<Type, CoreTable> DataEnvironment()
|
|
|
{
|
|
|
- var env = new Dictionary<Type, CoreTable>();
|
|
|
- env[typeof(Requisition)] = Requisitions.Data;
|
|
|
- env[typeof(RequisitionItem)] = Items.Data;
|
|
|
- return env;
|
|
|
+ return new Dictionary<Type, CoreTable>
|
|
|
+ {
|
|
|
+ [typeof(Requisition)] = Requisitions.Data,
|
|
|
+ [typeof(RequisitionItem)] = Items.Data
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
//private void Timer_Tick(object sender, EventArgs e)
|
|
@@ -323,7 +305,7 @@ namespace PRSDesktop
|
|
|
|
|
|
DueDate.Content = _requisition != null ? string.Format("{0:dddd, dd MMM yyyy}", _requisition.Due) : "";
|
|
|
|
|
|
- var notes = _requisition != null ? _requisition.Notes : new string[] { };
|
|
|
+ var notes = _requisition != null ? _requisition.Notes : Array.Empty<string>();
|
|
|
var request = _requisition != null ? CoreUtils.StripHTML(_requisition.Request) : "";
|
|
|
Request.Text = string.Join("\n===============================\n", Utility.ProcessNotes(notes, request));
|
|
|
|
|
@@ -428,7 +410,7 @@ namespace PRSDesktop
|
|
|
filltime = DateTime.Now;
|
|
|
if (confirm == MessageBoxResult.Yes)
|
|
|
{
|
|
|
- List<RequisitionItem> updates = new List<RequisitionItem>();
|
|
|
+ var updates = new List<RequisitionItem>();
|
|
|
foreach (var row in unpickeditems)
|
|
|
{
|
|
|
var item = row.ToObject<RequisitionItem>();
|
|
@@ -523,7 +505,7 @@ namespace PRSDesktop
|
|
|
|
|
|
private void ProcessItems(DateTime picked, CoreRow[] rows)
|
|
|
{
|
|
|
- List<RequisitionItem> list = new List<RequisitionItem>();
|
|
|
+ var list = new List<RequisitionItem>();
|
|
|
foreach (CoreRow row in rows)
|
|
|
{
|
|
|
var item = row.ToObject<RequisitionItem>();
|