|
@@ -40,7 +40,7 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
|
|
|
public Guid[] GroupIDs { get; set; } = [];
|
|
|
public Guid[] JobIDs { get; set; } = [];
|
|
|
- public Guid[] SupplierIDs { get; set; } = [];
|
|
|
+ public HashSet<Guid> SupplierIDs { get; set; } = [];
|
|
|
|
|
|
private readonly Button? OrderButton;
|
|
|
|
|
@@ -132,10 +132,12 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
private int? _instanceProductIDCol;
|
|
|
private int? _instanceStyleIDCol;
|
|
|
private int? _instanceUnitSizeCol;
|
|
|
+ private int? _instanceSupplierCol;
|
|
|
|
|
|
private int? _supplierProductIDCol;
|
|
|
private int? _supplierStyleIDCol;
|
|
|
private int? _supplierUnitSizeCol;
|
|
|
+ private int? _supplierSupplierCol;
|
|
|
|
|
|
public bool CheckSuppliers(CoreRow row)
|
|
|
{
|
|
@@ -148,16 +150,18 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
new Columns<SupplierProduct>(Grid._supplierProducts.Columns).IndexOf(x => x.Style.ID);
|
|
|
_supplierUnitSizeCol ??=
|
|
|
new Columns<SupplierProduct>(Grid._supplierProducts.Columns).IndexOf(x => x.Dimensions.UnitSize);
|
|
|
+ _supplierSupplierCol ??=
|
|
|
+ new Columns<SupplierProduct>(Grid._supplierProducts.Columns).IndexOf(x => x.SupplierLink.ID);
|
|
|
|
|
|
_instanceProductIDCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Product.ID);
|
|
|
_instanceStyleIDCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Style.ID);
|
|
|
_instanceUnitSizeCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Dimensions.UnitSize);
|
|
|
|
|
|
- return (Grid._supplierProducts.Rows.Any(r =>
|
|
|
+ return Grid._supplierProducts.Rows.Any(r =>
|
|
|
Equals(r.Values[_supplierProductIDCol.Value], row.Values[_instanceProductIDCol.Value])
|
|
|
&& Equals(r.Values[_supplierStyleIDCol.Value], row.Values[_instanceStyleIDCol.Value])
|
|
|
- && Equals(r.Values[_supplierUnitSizeCol.Value], row.Values[_instanceUnitSizeCol.Value]))
|
|
|
- );
|
|
|
+ && Equals(r.Values[_supplierUnitSizeCol.Value], row.Values[_instanceUnitSizeCol.Value])
|
|
|
+ && Grid.SupplierIDs.Contains((Guid?)r.Values[_supplierSupplierCol.Value] ?? Guid.Empty));
|
|
|
}
|
|
|
|
|
|
protected override Brush? GetCellBackground(CoreRow row, DynamicColumnBase column)
|
|
@@ -166,7 +170,7 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
_instanceStyleIDCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Style.ID);
|
|
|
_instanceUnitSizeCol ??= new Columns<ProductInstance>(row.Table.Columns).IndexOf(x => x.Dimensions.UnitSize);
|
|
|
|
|
|
- if (Grid.AllStock && !CheckSuppliers(row))
|
|
|
+ if (Grid.AllStock && !CheckSuppliers(row))
|
|
|
return new SolidColorBrush(Colors.Silver) { Opacity = 0.5F };
|
|
|
|
|
|
if (column is DynamicTextColumn col && Grid._summaryinfo.TryGetValue(row.Get<ProductInstance,Guid>(x=>x.ID), out StockSummaryInfo? info))
|
|
@@ -456,7 +460,7 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
var query = new MultiQuery();
|
|
|
|
|
|
query.Add<ProductInstance>(
|
|
|
- !GroupIDs.Any()
|
|
|
+ GroupIDs.Length == 0
|
|
|
? new Filter<ProductInstance>().None()
|
|
|
: new Filter<ProductInstance>(pi=>pi.Product.Group.ID).InList(GroupIDs),
|
|
|
columns,
|
|
@@ -464,8 +468,10 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
);
|
|
|
|
|
|
query.Add<StockHolding>(
|
|
|
- !GroupIDs.Any() ? new Filter<StockHolding>().None() : new Filter<StockHolding>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
- .And(new Filter<StockHolding>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
+ GroupIDs.Length == 0
|
|
|
+ ? new Filter<StockHolding>().None()
|
|
|
+ : new Filter<StockHolding>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
+ .And(new Filter<StockHolding>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
new Columns<StockHolding>(x=>x.Product.ID)
|
|
|
.Add(x=>x.Job.ID)
|
|
|
.Add(x=>x.Style.ID)
|
|
@@ -476,9 +482,11 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
);
|
|
|
|
|
|
query.Add<PurchaseOrderItem>(
|
|
|
- !GroupIDs.Any() ? new Filter<PurchaseOrderItem>().None() : new Filter<PurchaseOrderItem>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
- .And(x=>x.ReceivedDate).IsEqualTo(DateTime.MinValue)
|
|
|
- .And(new Filter<PurchaseOrderItem>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
+ GroupIDs.Length == 0
|
|
|
+ ? new Filter<PurchaseOrderItem>().None()
|
|
|
+ : new Filter<PurchaseOrderItem>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
+ .And(x=>x.ReceivedDate).IsEqualTo(DateTime.MinValue)
|
|
|
+ .And(new Filter<PurchaseOrderItem>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
new Columns<PurchaseOrderItem>(x=>x.Product.ID)
|
|
|
.Add(x=>x.Job.ID)
|
|
|
.Add(x=>x.Style.ID)
|
|
@@ -489,8 +497,10 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
);
|
|
|
|
|
|
query.Add<JobBillOfMaterialsItem>(
|
|
|
- !GroupIDs.Any() ? new Filter<JobBillOfMaterialsItem>().None() : new Filter<JobBillOfMaterialsItem>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
- .And(new Filter<JobBillOfMaterialsItem>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
+ GroupIDs.Length == 0
|
|
|
+ ? new Filter<JobBillOfMaterialsItem>().None()
|
|
|
+ : new Filter<JobBillOfMaterialsItem>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
+ .And(new Filter<JobBillOfMaterialsItem>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
new Columns<JobBillOfMaterialsItem>(x=>x.Product.ID)
|
|
|
.Add(x=>x.Job.ID)
|
|
|
.Add(x=>x.Style.ID)
|
|
@@ -501,9 +511,11 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
);
|
|
|
|
|
|
query.Add<StockMovement>(
|
|
|
- !GroupIDs.Any() ? new Filter<StockMovement>().None() : new Filter<StockMovement>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
- .And(x=>x.Type).IsEqualTo(StockMovementType.Issue)
|
|
|
- .And(new Filter<StockMovement>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
+ GroupIDs.Length == 0
|
|
|
+ ? new Filter<StockMovement>().None()
|
|
|
+ : new Filter<StockMovement>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
+ .And(x=>x.Type).IsEqualTo(StockMovementType.Issue)
|
|
|
+ .And(new Filter<StockMovement>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
new Columns<StockMovement>(x=>x.Product.ID)
|
|
|
.Add(x=>x.Job.ID)
|
|
|
.Add(x=>x.Style.ID)
|
|
@@ -514,8 +526,10 @@ public class StockSummaryGrid : DynamicDataGrid<ProductInstance>, IDataModelSour
|
|
|
);
|
|
|
|
|
|
query.Add<SupplierProduct>(
|
|
|
- !GroupIDs.Any() ? new Filter<SupplierProduct>().None() : new Filter<SupplierProduct>(x=>x.Product.Group.ID).InList(GroupIDs)
|
|
|
- .And(new Filter<SupplierProduct>(x=>x.Job.ID).InList(JobIDs).Or(x=>x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
+ GroupIDs.Length == 0
|
|
|
+ ? new Filter<SupplierProduct>().None()
|
|
|
+ : new Filter<SupplierProduct>(x => x.Product.Group.ID).InList(GroupIDs)
|
|
|
+ .And(new Filter<SupplierProduct>(x => x.Job.ID).InList(JobIDs).Or(x => x.Job.ID).IsEqualTo(Guid.Empty)),
|
|
|
new Columns<SupplierProduct>(x=>x.Product.ID)
|
|
|
.Add(x=>x.Job.ID)
|
|
|
.Add(x=>x.Style.ID)
|