|
|
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
+using System.Windows.Data;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
@@ -42,8 +43,6 @@ namespace PRSDesktop
|
|
|
public event Action<StagingManufacturingPacketListItem>? AfterDelete;
|
|
|
public event Action<bool>? OnCollapsed;
|
|
|
|
|
|
- public static FuncConverter<int, string> BarcodeQuantityConverter = new(x => x.ToString(), x => int.TryParse(x, out var i) ? i : 0);
|
|
|
-
|
|
|
//private StagingManufacturingPacketStageGrid StagesGrid;
|
|
|
|
|
|
public event EventHandler? Changed;
|
|
|
@@ -91,16 +90,26 @@ namespace PRSDesktop
|
|
|
get => (bool)GetValue(IsEditableProperty);
|
|
|
set => SetValue(IsEditableProperty, value);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ private double oldQuantity;
|
|
|
+
|
|
|
public StagingManufacturingPacketListItem(ManufacturingPacket packet, QueryMultipleResults? results, bool collapsed)
|
|
|
{
|
|
|
Packet = packet;
|
|
|
+ oldQuantity = packet.Quantity;
|
|
|
Packet.PropertyEdited += (sender, args) =>
|
|
|
{
|
|
|
SaveTemplate();
|
|
|
- if (String.Equals(args.PropertyName, nameof(ManufacturingPacket.Quantity)))
|
|
|
+ if (args.PropertyName == nameof(ManufacturingPacket.Quantity))
|
|
|
+ {
|
|
|
+ if(packet.BarcodeQty == oldQuantity)
|
|
|
+ {
|
|
|
+ packet.BarcodeQty = packet.Quantity;
|
|
|
+ }
|
|
|
+ oldQuantity = packet.Quantity;
|
|
|
BarcodeQtyPlaceHolder.Text = packet.Quantity.ToString();
|
|
|
- if(args.PropertyName == nameof(ManufacturingPacket.Approved))
|
|
|
+ }
|
|
|
+ else if (args.PropertyName == nameof(ManufacturingPacket.Approved))
|
|
|
{
|
|
|
ApproveButton.Content = new Image
|
|
|
{
|
|
|
@@ -112,6 +121,10 @@ namespace PRSDesktop
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
+ BarcodeQtyBox.Bind(TextBox.TextProperty, Packet, x => x.BarcodeQty,
|
|
|
+ mode: BindingMode.TwoWay,
|
|
|
+ converter: new FuncConverter<int, string>(x => x == packet.Quantity ? "" : x.ToString(), x => int.TryParse(x, out var i) ? i : packet.Quantity));
|
|
|
+
|
|
|
UpdateTemplateButton();
|
|
|
|
|
|
StagesGrid.Packet = packet;
|