Create Purchase Orders Without Merging Demand Into Single PO Lines - Additions Only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region CreatePOOrders - Replace base version (clone and inject code) | |
public static PXRedirectRequiredException CreatePOOrders(List<POFixedDemand> list, DateTime? PurchDate, bool extSort) | |
{ | |
... | |
POLine line = null; | |
//Sales Orders to Blanket should not be grouped together | |
//Drop Ships to Blankets are not grouped either | |
if (!orderedByPlantype.TryGetValue(demand.PlanType, out ordered)) | |
{ | |
ordered = orderedByPlantype[demand.PlanType] = new DocumentList<POLine>(docgraph); | |
} | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
// Get MyField from Plan - stored in INItemPlanExt | |
INItemPlan plan = demand as INItemPlan; | |
INItemPlanExt planExt = plan.GetExtension<INItemPlanExt>(); | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
if (OrderType == POOrderType.RegularOrder && demand.PlanType != INPlanConstants.Plan6B) | |
{ | |
var lineSearchValues = new List<FieldLookup>() | |
{ | |
new FieldLookup<POLine.vendorID>(demand.VendorID), | |
new FieldLookup<POLine.vendorLocationID>(demand.VendorLocationID), | |
new FieldLookup<POLine.siteID>(demand.POSiteID), | |
new FieldLookup<POLine.inventoryID>(demand.InventoryID), | |
new FieldLookup<POLine.subItemID>(demand.SubItemID), | |
new FieldLookup<POLine.requestedDate>(soline?.ShipDate), | |
new FieldLookup<POLine.projectID>(soline?.ProjectID), | |
new FieldLookup<POLine.taskID>(soline?.TaskID), | |
new FieldLookup<POLine.costCodeID>(soline?.CostCodeID), | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//Add MyField to Search | |
new FieldLookup<POLineExt.usrXXMyField>(planExt?.UsrXXMyField), | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
}; | |
if (setup.CopyLineDescrSO == true && soline != null) | |
{ | |
lineSearchValues.Add(new FieldLookup<POLine.tranDesc>(soline.TranDesc)); | |
line = ordered.Find(lineSearchValues.ToArray()); | |
if (line != null && setup.CopyLineNoteSO == true && | |
(PXNoteAttribute.GetNote(docgraph.Caches[typeof(POLine)], line) != null || PXNoteAttribute.GetNote(docgraph.Caches[typeof(SOLineSplit3)], soline) != null)) | |
{ | |
line = null; | |
} | |
} | |
else | |
line = ordered.Find(lineSearchValues.ToArray()); | |
} | |
line = line ?? new POLine(); | |
... | |
line = docgraph.Transactions.Update(line); | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
// Save MyField to PO Line | |
POLineExt lineExt = line.GetExtension<POLineExt>(); | |
lineExt.UsrXXMyField = planExt.UsrXXMyField; | |
docgraph.Caches[typeof(POLine)].Update(lineExt); | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
//////////////////////////////////////// | |
... | |
} | |
#endregion | |
#region CreateSplitDemand - Copy Private Static Method From Base For Accessibility | |
private static void CreateSplitDemand(PXCache cache, POFixedDemand demand) | |
{ | |
... | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment