public UpdateInventoryPost() { graphPostInfoEntry = PXGraph.CreateInstance <PostInfoEntry>(); graphUpdatePostBatchMaint = PXGraph.CreateInstance <InventoryPostBatchMaint>(); UpdateInventoryFilter filter = Filter.Current; Appointments.SetProcessDelegate( delegate(List <FSAppointmentDet> fsAppointmentInventoryItem) { CreateDocuments(fsAppointmentInventoryItem, filter); }); }
/// <summary> /// Update the references in <c>FSPostInfo</c> and <c>FSPostDet</c> when the posting process of every AppointmentInventoryItem is complete in IN. /// </summary> public virtual void UpdateIssuePostInfo(INIssueEntry graphINIssueEntry, InventoryPostBatchMaint graphInventoryPostBatchMaint, PostInfoEntry graphPostInfoEntry, FSAppointmentDet fsAppointmentInventoryItemRow, SharedClasses.AppointmentInventoryItemInfo appointmentInventoryItemInfoRow, FSPostBatch fsPostBatchRow) { //Create | Update Post info FSPostInfo fsPostInfoRow; FSPostDet fsPostDet; fsPostBatchRow = graphInventoryPostBatchMaint.BatchRecords.Current = graphInventoryPostBatchMaint.BatchRecords.Search <FSPostBatch.batchID>(fsPostBatchRow.BatchID); fsPostInfoRow = PXSelect <FSPostInfo, Where < FSPostInfo.postID, Equal <Required <FSPostInfo.postID> > > > .Select(this, appointmentInventoryItemInfoRow.FSAppointmentInventoryItem.PostID); if (fsPostInfoRow == null || fsPostInfoRow.PostID == null) { fsPostInfoRow = new FSPostInfo(); fsPostInfoRow = graphPostInfoEntry.PostInfoRecords.Current = graphPostInfoEntry.PostInfoRecords.Insert(fsPostInfoRow); } else { fsPostInfoRow = graphPostInfoEntry.PostInfoRecords.Current = graphPostInfoEntry.PostInfoRecords.Search <FSPostInfo.postID>(fsPostInfoRow.PostID); } fsPostInfoRow.INPosted = true; fsPostInfoRow.INDocType = graphINIssueEntry.issue.Current.DocType; fsPostInfoRow.INRefNbr = graphINIssueEntry.issue.Current.RefNbr; foreach (INTran inTranRowLocal in graphINIssueEntry.transactions.Select()) { FSxINTran fsxINTranRow = graphINIssueEntry.transactions.Cache.GetExtension <FSxINTran>(inTranRowLocal); if (fsxINTranRow != null && appointmentInventoryItemInfoRow.FSAppointmentInventoryItem.AppDetID == fsxINTranRow.AppDetID) { fsPostInfoRow.INLineNbr = inTranRowLocal.LineNbr; break; } } fsPostInfoRow.AppointmentID = appointmentInventoryItemInfoRow.FSAppointmentRow.AppointmentID; fsPostInfoRow.SOID = appointmentInventoryItemInfoRow.FSAppointmentRow.SOID; fsPostInfoRow = graphPostInfoEntry.PostInfoRecords.Update(fsPostInfoRow); graphPostInfoEntry.Save.Press(); fsPostInfoRow = graphPostInfoEntry.PostInfoRecords.Current; fsPostDet = new FSPostDet(); fsPostDet.PostID = fsPostInfoRow.PostID; fsPostDet.INPosted = fsPostInfoRow.INPosted; fsPostDet.INDocType = fsPostInfoRow.INDocType; fsPostDet.INRefNbr = fsPostInfoRow.INRefNbr; fsPostDet.INLineNbr = fsPostInfoRow.INLineNbr; graphInventoryPostBatchMaint.BatchDetails.Insert(fsPostDet); graphInventoryPostBatchMaint.Save.Press(); fsAppointmentInventoryItemRow.Mem_BatchNbr = fsPostBatchRow.BatchNbr; fsPostInfoRow = graphPostInfoEntry.PostInfoRecords.Current; PXUpdate < Set <FSAppointmentDet.postID, Required <FSAppointmentDet.postID> >, FSAppointmentDet, Where < FSAppointmentDet.appDetID, Equal <Required <FSAppointmentDet.appDetID> > > > .Update(this, fsPostInfoRow.PostID, appointmentInventoryItemInfoRow.FSAppointmentInventoryItem.AppDetID); }