|
@@ -436,9 +436,6 @@ public class ReservationManagementItemGrid : DynamicDataGrid<JobRequisitionItem>
|
|
|
LookupFactory.DoLookups<PurchaseOrderItem, ProductStyle, ProductStyleLink>(
|
|
|
orderItems.Values.Select(x => new Tuple<PurchaseOrderItem, Guid>(x, x.Style.ID)),
|
|
|
x => x.Style);
|
|
|
- //LookupFactory.DoLookups<PurchaseOrderItem, Job, JobLink>(
|
|
|
- // orderItems.Values.Select(x => new Tuple<PurchaseOrderItem, Guid>(x, x.Job.ID)),
|
|
|
- // x => x.Job);
|
|
|
LookupFactory.DoLookups<PurchaseOrderItem, TaxCode, TaxCodeLink>(
|
|
|
orderItems.Values.Select(x => new Tuple<PurchaseOrderItem, Guid>(x, x.TaxCode.ID)),
|
|
|
x => x.TaxCode);
|
|
@@ -464,97 +461,29 @@ public class ReservationManagementItemGrid : DynamicDataGrid<JobRequisitionItem>
|
|
|
}
|
|
|
Client.Save(orders.SelectMany(x => x.Item2.Values), "Created from Reservation Management screen");
|
|
|
|
|
|
- List<PurchaseOrderItemAllocation> allocations = new();
|
|
|
+ var allocations = new List<PurchaseOrderItemAllocation>();
|
|
|
progress.Report($"Processing Breakups");
|
|
|
foreach(var (order, orderItems) in orders)
|
|
|
{
|
|
|
- foreach(var pair in orderItems)
|
|
|
+ foreach(var (result, poi) in orderItems)
|
|
|
{
|
|
|
- foreach (var breakup in pair.Key.Breakups)
|
|
|
+ foreach (var breakup in result.Breakups)
|
|
|
{
|
|
|
var alloc = new PurchaseOrderItemAllocation();
|
|
|
- alloc.Item.ID = pair.Value.ID;
|
|
|
- alloc.Job.ID = breakup.Item1;
|
|
|
- alloc.JobRequisitionItem.ID = breakup.Item2;
|
|
|
- alloc.Quantity = breakup.Item4;
|
|
|
+ alloc.Item.ID = poi.ID;
|
|
|
+ alloc.Job.ID = breakup.JobID;
|
|
|
+ alloc.JobRequisitionItem.ID = breakup.JobRequiItemID;
|
|
|
+ alloc.Quantity = breakup.Quantity;
|
|
|
allocations.Add(alloc);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (allocations.Any())
|
|
|
- Client.Save(allocations,"Created from Reservation Management Screen");
|
|
|
+ if (allocations.Count != 0)
|
|
|
+ Client.Save(allocations, "Created from Reservation Management Screen");
|
|
|
});
|
|
|
MessageWindow.ShowMessage($"The following orders were created:\n- {string.Join("\n- ",orders.Select(x=>x.Item1.PONumber))}", $"Created {orders.Count} orders");
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
- // private bool DoCreatePurchaseOrder(Button button, CoreRow[]? rows)
|
|
|
- // {
|
|
|
- // if (rows?.Any() != true)
|
|
|
- // return false;
|
|
|
- //
|
|
|
- // MultiSelectDialog<Supplier> dlg = new MultiSelectDialog<Supplier>(
|
|
|
- // LookupFactory.DefineFilter<Supplier>(),
|
|
|
- // Columns.None<Supplier>()
|
|
|
- // .Add(x => x.ID)
|
|
|
- // .Add(x => x.Code)
|
|
|
- // .Add(x => x.Name),
|
|
|
- // false
|
|
|
- // );
|
|
|
- //
|
|
|
- // var _po = new PurchaseOrder();
|
|
|
- // if (dlg.ShowDialog())
|
|
|
- // {
|
|
|
- // Progress.ShowModal("Creating Purchase Order", progress =>
|
|
|
- // {
|
|
|
- //
|
|
|
- // _po.Description = "Created from Job Requisition Screen" + System.Environment.NewLine;
|
|
|
- // _po.RaisedBy.ID = App.EmployeeID;
|
|
|
- // _po.SupplierLink.ID = dlg.IDs().First();
|
|
|
- // Client.Save(_po, "Created From Requisition Screen");
|
|
|
- //
|
|
|
- // progress.Report("Creating Order Items");
|
|
|
- // Dictionary<Guid,PurchaseOrderItem> _pois = new Dictionary<Guid,PurchaseOrderItem>();
|
|
|
- // foreach (CoreRow row in SelectedRows)
|
|
|
- // {
|
|
|
- // JobRequisitionItem _jri = row.ToObject<JobRequisitionItem>();
|
|
|
- // PurchaseOrderItem _poi = new PurchaseOrderItem();
|
|
|
- // _poi.PurchaseOrderLink.ID = _po.ID;
|
|
|
- // _poi.Product.ID = _jri.Product.ID;
|
|
|
- // _poi.Product.Code = _jri.Product.Code;
|
|
|
- // _poi.Product.Name = _jri.Product.Name;
|
|
|
- // _poi.Qty = _jri.Qty;
|
|
|
- // _poi.Dimensions.CopyFrom(_jri.Dimensions);
|
|
|
- // _poi.Dimensions.Value = _jri.Dimensions.Value;
|
|
|
- // _poi.Style.ID = _jri.Style.ID;
|
|
|
- // _poi.Style.Code = _jri.Style.Code;
|
|
|
- // _poi.Style.Description = _jri.Style.Description;
|
|
|
- // _poi.Job.ID = _jri.Job.ID;
|
|
|
- // _poi.Dimensions.UnitSize = _jri.Dimensions.UnitSize;
|
|
|
- // _poi.Description = _jri.Product.Name + " (" + _jri.Dimensions.ToString() + ")";
|
|
|
- // _poi.Cost = _jri.UnitCost;
|
|
|
- // _pois[_jri.ID] = _poi;
|
|
|
- // }
|
|
|
- // Client.Save(_pois.Values, "Created From Requisition Screen");
|
|
|
- //
|
|
|
- // List<JobRequisitionItemPurchaseOrderItem> _jripois = new();
|
|
|
- // foreach (var _poi in _pois)
|
|
|
- // {
|
|
|
- // var _jripoi = new JobRequisitionItemPurchaseOrderItem();
|
|
|
- // _jripoi.JobRequisitionItem.ID = _poi.Key;
|
|
|
- // _jripoi.PurchaseOrderItem.ID = _poi.Value.ID;
|
|
|
- // _jripois.Add(_jripoi);
|
|
|
- // }
|
|
|
- // Client.Save(_jripois, "Created From Requisition Screen");
|
|
|
- //
|
|
|
- // });
|
|
|
- //
|
|
|
- // }
|
|
|
- // new SupplierPurchaseOrders().EditItems(new[] { _po });
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- //
|
|
|
- #endregion
|
|
|
|
|
|
#region CreatePickingList
|
|
|
|