|
|
@@ -27,7 +27,7 @@ namespace PRSDesktop
|
|
|
bool bLoaded = false;
|
|
|
public void LoadFromRequiLine()
|
|
|
{
|
|
|
- if (bLoaded)
|
|
|
+ if (bLoaded || JobRequiItems.Count == 0)
|
|
|
return;
|
|
|
|
|
|
var poid = JobRequiItems[0].PurchaseOrderItem.PurchaseOrderLink.ID;
|
|
|
@@ -218,7 +218,7 @@ namespace PRSDesktop
|
|
|
|
|
|
public void DropItems(CoreRow[] rows)
|
|
|
{
|
|
|
- var page = Editor.Pages.Find(x => x.GetType() == typeof(SupplierPurchaseOrderItemOneToMany)) as SupplierPurchaseOrderItemOneToMany;
|
|
|
+ var page = Editor.Pages.OfType<SupplierPurchaseOrderItemOneToMany>().First();
|
|
|
if (page.Items.Count == 0)
|
|
|
page.LoadItems(CreatePOItemsFromRequiItems(rows).ToArray());
|
|
|
else
|
|
|
@@ -233,7 +233,7 @@ namespace PRSDesktop
|
|
|
return items.ToArray();
|
|
|
}
|
|
|
|
|
|
- private List<PurchaseOrderItem> CreatePOItemsFromRequiItems(CoreRow[] selected, List<PurchaseOrderItem> comparison = null)
|
|
|
+ private List<PurchaseOrderItem> CreatePOItemsFromRequiItems(CoreRow[] selected, List<PurchaseOrderItem>? comparison = null)
|
|
|
{
|
|
|
List<PurchaseOrderItem> items = new List<PurchaseOrderItem>();
|
|
|
foreach (CoreRow row in selected)
|
|
|
@@ -245,8 +245,7 @@ namespace PRSDesktop
|
|
|
|
|
|
PurchaseOrderItem POItem = new PurchaseOrderItem();
|
|
|
POItem.Product.ID = JobReqItem.Product.ID;
|
|
|
- POItem.Product.Code = JobReqItem.Product.Code;
|
|
|
- POItem.Product.Name = JobReqItem.Product.Name;
|
|
|
+ POItem.Product.Synchronise(JobReqItem.Product);
|
|
|
POItem.Description = JobReqItem.Product.Name;
|
|
|
POItem.Qty = JobReqItem.Qty;
|
|
|
POItem.Dimensions.CopyFrom(JobReqItem.Dimensions);
|