public virtual void CreateEquipments(SMEquipmentMaint graphSMEquipmentMaint, ARRegister arRegisterRow, Dictionary <int?, int?> newEquiments) { var inventoryItemSet = PXSelectJoin <InventoryItem, InnerJoin <ARTran, On <ARTran.inventoryID, Equal <InventoryItem.inventoryID>, And <ARTran.tranType, Equal <ARDocType.invoice> > >, LeftJoin <SOLine, On <SOLine.orderType, Equal <ARTran.sOOrderType>, And <SOLine.orderNbr, Equal <ARTran.sOOrderNbr>, And <SOLine.lineNbr, Equal <ARTran.sOOrderLineNbr> > > > > >, Where < ARTran.tranType, Equal <Required <ARInvoice.docType> >, And <ARTran.refNbr, Equal <Required <ARInvoice.refNbr> >, And <FSxEquipmentModel.eQEnabled, Equal <True>, And <FSxARTran.equipmentAction, Equal <ListField_EquipmentAction.SellingTargetEquipment>, And <FSxARTran.sMEquipmentID, IsNull, And <FSxARTran.newTargetEquipmentLineNbr, IsNull, And <FSxARTran.componentID, IsNull> > > > > > >, OrderBy < Asc <ARTran.tranType, Asc <ARTran.refNbr, Asc <ARTran.lineNbr> > > > > .Select(Base, arRegisterRow.DocType, arRegisterRow.RefNbr); Create_Replace_Equipments(graphSMEquipmentMaint, inventoryItemSet, arRegisterRow, newEquiments, ID.Equipment_Action.SELLING_TARGET_EQUIPMENT); }
public void Persist(PersistDelegate baseMethod) { if (SharedFunctions.isFSSetupSet(Base) == false || PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false) { baseMethod(); return; } //// Invoice ARRegister arRegisterRow = (ARRegister)Base.Caches[typeof(ARRegister)].Current; Dictionary <int?, int?> newEquiments = new Dictionary <int?, int?>(); SMEquipmentMaint graphSMEquipmentMaint = PXGraph.CreateInstance <SMEquipmentMaint>(); if (processEquipmentAndComponents) { CreateEquipments(graphSMEquipmentMaint, arRegisterRow, newEquiments); ReplaceEquipments(graphSMEquipmentMaint, arRegisterRow); UpgradeEquipmentComponents(graphSMEquipmentMaint, arRegisterRow, newEquiments); CreateEquipmentComponents(graphSMEquipmentMaint, arRegisterRow, newEquiments); ReplaceComponents(graphSMEquipmentMaint, arRegisterRow); } baseMethod(); }
public virtual void ViewInSMEquipment() { FSEquipment fsEquipmentRow = GetRelatedFSEquipmentRow(Base); if (fsEquipmentRow == null) { return; } switch (fsEquipmentRow.SourceType) { case ID.SourceType_Equipment.VEHICLE: VehicleMaint graphVehicleMaint = PXGraph.CreateInstance <VehicleMaint>(); graphVehicleMaint.EPEquipmentRecords.Current = graphVehicleMaint.EPEquipmentRecords.Search <EPEquipment.equipmentCD>(fsEquipmentRow.SourceRefNbr); throw new PXRedirectRequiredException(graphVehicleMaint, null) { Mode = PXBaseRedirectException.WindowMode.NewWindow }; default: SMEquipmentMaint graphSMEquipmentMaint = PXGraph.CreateInstance <SMEquipmentMaint>(); graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Search <FSEquipment.refNbr>(fsEquipmentRow.RefNbr); throw new PXRedirectRequiredException(graphSMEquipmentMaint, null) { Mode = PXBaseRedirectException.WindowMode.NewWindow }; } }
public virtual void ExtendToSMEquipment() { SMEquipmentMaint graphSMEquipmentMaint = PXGraph.CreateInstance <SMEquipmentMaint>(); FSEquipment fsEquipmentRow = new FSEquipment(); fsEquipmentRow.SourceID = Base.Equipment.Current.EquipmentID; fsEquipmentRow.SourceRefNbr = Base.Equipment.Current.EquipmentCD; fsEquipmentRow.SourceType = ID.SourceType_Equipment.EP_EQUIPMENT; fsEquipmentRow.RequireMaintenance = false; fsEquipmentRow.ResourceEquipment = true; graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Insert(fsEquipmentRow); EquipmentHelper.UpdateFSEquipmentWithEPEquipment(graphSMEquipmentMaint.EquipmentRecords.Cache, graphSMEquipmentMaint.EquipmentRecords.Current, Base.Equipment.Cache, Base.Equipment.Current); EquipmentHelper.SetDefaultValuesFromFixedAsset(graphSMEquipmentMaint.EquipmentRecords.Cache, graphSMEquipmentMaint.EquipmentRecords.Current, Base.Equipment.Current.FixedAssetID); throw new PXRedirectRequiredException(graphSMEquipmentMaint, null) { Mode = PXBaseRedirectException.WindowMode.NewWindow }; }
private void ReplaceEquipments( SMEquipmentMaint graphSMEquipmentMaint, ARRegister arRegisterRow) { var inventoryItemSet = PXSelectJoin <InventoryItem, InnerJoin <ARTran, On <ARTran.inventoryID, Equal <InventoryItem.inventoryID>, And <ARTran.tranType, Equal <ARDocType.invoice> > >, InnerJoin <SOLineSplit, On <SOLineSplit.orderType, Equal <ARTran.sOOrderType>, And <SOLineSplit.orderNbr, Equal <ARTran.sOOrderNbr>, And <SOLineSplit.lineNbr, Equal <ARTran.sOOrderLineNbr>, And <SOLineSplit.qty, Greater <Zero> > > > >, InnerJoin <SOLine, On <SOLine.orderType, Equal <SOLineSplit.orderType>, And <SOLine.orderNbr, Equal <SOLineSplit.orderNbr>, And <SOLine.lineNbr, Equal <SOLineSplit.lineNbr> > > >, LeftJoin <SOShipLineSplit, On <SOShipLineSplit.origOrderType, Equal <SOLineSplit.orderType>, And <SOShipLineSplit.origOrderNbr, Equal <SOLineSplit.orderNbr>, And <SOShipLineSplit.origLineNbr, Equal <SOLineSplit.lineNbr>, And <SOShipLineSplit.origSplitLineNbr, Equal <SOLineSplit.splitLineNbr> > > > > > > > >, Where < ARTran.tranType, Equal <Required <ARInvoice.docType> >, And <ARTran.refNbr, Equal <Required <ARInvoice.refNbr> >, And <FSxEquipmentModel.eQEnabled, Equal <True>, And <FSxSOLine.equipmentAction, Equal <ListField_EquipmentAction.ReplacingTargetEquipment>, And <FSxSOLine.sMEquipmentID, IsNotNull, And <FSxSOLine.newTargetEquipmentLineNbr, IsNull, And <FSxSOLine.componentID, IsNull, And <SOLineSplit.pOCreate, Equal <False> > > > > > > > >, OrderBy < Asc <ARTran.tranType, Asc <ARTran.refNbr, Asc <ARTran.lineNbr> > > > > .Select(Base, arRegisterRow.DocType, arRegisterRow.RefNbr); Create_Replace_Equipments(graphSMEquipmentMaint, inventoryItemSet, arRegisterRow, null, ID.Equipment_Action.REPLACING_TARGET_EQUIPMENT); }
public virtual void UpgradeEquipmentComponents(SMEquipmentMaint graphSMEquipmentMaint, ARRegister arRegisterRow, Dictionary <int?, int?> newEquiments) { var inventoryItemSet = PXSelectJoin <InventoryItem, InnerJoin <ARTran, On <ARTran.inventoryID, Equal <InventoryItem.inventoryID>, And <ARTran.tranType, Equal <ARDocType.invoice> > >, LeftJoin <SOLine, On <SOLine.orderType, Equal <ARTran.sOOrderType>, And <SOLine.orderNbr, Equal <ARTran.sOOrderNbr>, And <SOLine.lineNbr, Equal <ARTran.sOOrderLineNbr> > > > > >, Where < ARTran.tranType, Equal <Required <ARInvoice.docType> >, And <ARTran.refNbr, Equal <Required <ARInvoice.refNbr> >, And <FSxARTran.equipmentAction, Equal <ListField_EquipmentAction.UpgradingComponent>, And <FSxARTran.sMEquipmentID, IsNull, And <FSxARTran.newTargetEquipmentLineNbr, IsNotNull, And <FSxARTran.componentID, IsNotNull, And <FSxARTran.equipmentLineRef, IsNull> > > > > > >, OrderBy < Asc <ARTran.tranType, Asc <ARTran.refNbr, Asc <ARTran.lineNbr> > > > > .Select(Base, arRegisterRow.DocType, arRegisterRow.RefNbr); foreach (PXResult <InventoryItem, ARTran, SOLine> bqlResult in inventoryItemSet) { ARTran arTranRow = (ARTran)bqlResult; SOLine soLineRow = (SOLine)bqlResult; InventoryItem inventoryItemRow = (InventoryItem)bqlResult; FSxARTran fsxARTranRow = PXCache <ARTran> .GetExtension <FSxARTran>(arTranRow); int?smEquipmentID = -1; if (newEquiments.TryGetValue(fsxARTranRow.NewTargetEquipmentLineNbr, out smEquipmentID)) { graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Search <FSEquipment.SMequipmentID>(smEquipmentID); FSEquipmentComponent fsEquipmentComponentRow = graphSMEquipmentMaint.EquipmentWarranties.Select().Where(x => ((FSEquipmentComponent)x).ComponentID == fsxARTranRow.ComponentID).FirstOrDefault(); if (fsEquipmentComponentRow != null) { fsEquipmentComponentRow.SalesOrderNbr = arTranRow.SOOrderNbr; fsEquipmentComponentRow.SalesOrderType = arTranRow.SOOrderType; fsEquipmentComponentRow.LongDescr = arTranRow.TranDesc; fsEquipmentComponentRow.InvoiceRefNbr = arTranRow.RefNbr; fsEquipmentComponentRow.InstallationDate = arTranRow.TranDate != null ? arTranRow.TranDate : arRegisterRow.DocDate; if (fsxARTranRow != null) { if (fsxARTranRow.AppointmentID != null) { fsEquipmentComponentRow.InstAppointmentID = fsxARTranRow.AppointmentID; fsEquipmentComponentRow.InstallationDate = fsxARTranRow.AppointmentDate; } else if (fsxARTranRow.SOID != null) { fsEquipmentComponentRow.InstServiceOrderID = fsxARTranRow.SOID; fsEquipmentComponentRow.InstallationDate = fsxARTranRow.ServiceOrderDate; } fsEquipmentComponentRow.Comment = fsxARTranRow.Comment; } fsEquipmentComponentRow.SerialNumber = arTranRow.LotSerialNbr; fsEquipmentComponentRow = graphSMEquipmentMaint.EquipmentWarranties.Update(fsEquipmentComponentRow); graphSMEquipmentMaint.EquipmentWarranties.SetValueExt <FSEquipmentComponent.inventoryID>(fsEquipmentComponentRow, arTranRow.InventoryID); graphSMEquipmentMaint.EquipmentWarranties.SetValueExt <FSEquipmentComponent.salesDate>(fsEquipmentComponentRow, soLineRow != null && soLineRow.OrderDate != null ? soLineRow.OrderDate : arTranRow.TranDate); graphSMEquipmentMaint.Save.Press(); } } } }
public virtual void Create_Replace_Equipments(SMEquipmentMaint graphSMEquipmentMaint, PXResultset <InventoryItem> inventoryItemSet, ARRegister arRegisterRow, Dictionary <int?, int?> newEquiments, string action) { foreach (PXResult <InventoryItem, ARTran, SOLine> bqlResult in inventoryItemSet) { ARTran arTranRow = (ARTran)bqlResult; //Fetching the cached data record for ARTran that will be updated later arTranRow = PXSelect <ARTran, Where < ARTran.tranType, Equal <Required <ARTran.tranType> >, And <ARTran.refNbr, Equal <Required <ARTran.refNbr> >, And <ARTran.lineNbr, Equal <Required <ARTran.lineNbr> > > > > > .Select(Base, arTranRow.TranType, arTranRow.RefNbr, arTranRow.LineNbr); InventoryItem inventoryItemRow = (InventoryItem)bqlResult; SOLine soLineRow = (SOLine)bqlResult; FSEquipment fsEquipmentRow = null; FSxARTran fsxARTranRow = PXCache <ARTran> .GetExtension <FSxARTran>(arTranRow); FSxEquipmentModel fsxEquipmentModelRow = PXCache <InventoryItem> .GetExtension <FSxEquipmentModel>(inventoryItemRow); for (int i = 0; i < arTranRow.Qty; i++) { SoldInventoryItem soldInventoryItemRow = new SoldInventoryItem(); soldInventoryItemRow.CustomerID = arRegisterRow.CustomerID; soldInventoryItemRow.CustomerLocationID = arRegisterRow.CustomerLocationID; soldInventoryItemRow.InventoryID = inventoryItemRow.InventoryID; soldInventoryItemRow.InventoryCD = inventoryItemRow.InventoryCD; soldInventoryItemRow.InvoiceRefNbr = arTranRow.RefNbr; soldInventoryItemRow.InvoiceLineNbr = arTranRow.LineNbr; soldInventoryItemRow.DocType = arRegisterRow.DocType; soldInventoryItemRow.DocDate = arTranRow.TranDate != null ? arTranRow.TranDate : arRegisterRow.DocDate; if (fsxARTranRow != null) { if (fsxARTranRow.AppointmentID != null) { soldInventoryItemRow.DocDate = fsxARTranRow.AppointmentDate; } else if (fsxARTranRow.SOID != null) { soldInventoryItemRow.DocDate = fsxARTranRow.ServiceOrderDate; } } soldInventoryItemRow.Descr = inventoryItemRow.Descr; soldInventoryItemRow.SiteID = arTranRow.SiteID; soldInventoryItemRow.ItemClassID = inventoryItemRow.ItemClassID; soldInventoryItemRow.SOOrderType = arTranRow.SOOrderType; soldInventoryItemRow.SOOrderNbr = arTranRow.SOOrderNbr; soldInventoryItemRow.SOOrderDate = soLineRow.OrderDate; soldInventoryItemRow.EquipmentTypeID = fsxEquipmentModelRow.EquipmentTypeID; soldInventoryItemRow.LotSerialNumber = arTranRow.LotSerialNbr; fsEquipmentRow = SharedFunctions.CreateSoldEquipment(graphSMEquipmentMaint, soldInventoryItemRow, arTranRow, fsxARTranRow, soLineRow, action, inventoryItemRow); } if (fsEquipmentRow != null) { if (fsxARTranRow.SuspendedSMEquipmentID == null && action == ID.Equipment_Action.REPLACING_TARGET_EQUIPMENT) { fsxARTranRow.SuspendedSMEquipmentID = fsxARTranRow.SMEquipmentID; } fsxARTranRow.SMEquipmentID = fsEquipmentRow.SMEquipmentID; Base.ARTran_TranType_RefNbr.Update(arTranRow); if (action == ID.Equipment_Action.SELLING_TARGET_EQUIPMENT) { int?smEquipmentID = -1; if (newEquiments.TryGetValue(arTranRow.LineNbr, out smEquipmentID) == false) { newEquiments.Add( arTranRow.LineNbr, fsEquipmentRow.SMEquipmentID); } } else if (action == ID.Equipment_Action.REPLACING_TARGET_EQUIPMENT) { if (fsxARTranRow != null) { graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Search <FSEquipment.SMequipmentID>(fsxARTranRow.SuspendedSMEquipmentID); graphSMEquipmentMaint.EquipmentRecords.Current.ReplaceEquipmentID = fsEquipmentRow.SMEquipmentID; graphSMEquipmentMaint.EquipmentRecords.Current.Status = ID.Equipment_Status.DISPOSED; graphSMEquipmentMaint.EquipmentRecords.Current.DisposalDate = soLineRow.OrderDate != null ? soLineRow.OrderDate : arTranRow.TranDate; graphSMEquipmentMaint.EquipmentRecords.Current.DispServiceOrderID = fsxARTranRow.SOID; graphSMEquipmentMaint.EquipmentRecords.Current.DispAppointmentID = fsxARTranRow.AppointmentID; graphSMEquipmentMaint.EquipmentRecords.Cache.SetStatus(graphSMEquipmentMaint.EquipmentRecords.Current, PXEntryStatus.Updated); graphSMEquipmentMaint.Save.Press(); } } } } }
private void Create_Replace_Equipments( SMEquipmentMaint graphSMEquipmentMaint, PXResultset <InventoryItem> inventoryItemSet, ARRegister arRegisterRow, Dictionary <int?, int?> newEquiments, string action) { foreach (PXResult <InventoryItem, ARTran, SOLineSplit, SOLine, SOShipLineSplit> bqlResult in inventoryItemSet) { ARTran arTranRow = (ARTran)bqlResult; InventoryItem inventoryItemRow = (InventoryItem)bqlResult; SOLine soLineRow = (SOLine)bqlResult; SOLineSplit soLineSplitRow = (SOLineSplit)bqlResult; SOShipLineSplit soShipLineSplitRow = (SOShipLineSplit)bqlResult; FSEquipment fsEquipmentRow = null; FSxSOLine fsxSOLineRow = PXCache <SOLine> .GetExtension <FSxSOLine>(soLineRow); FSxARTran fsxARTranRow = PXCache <ARTran> .GetExtension <FSxARTran>(arTranRow); FSxEquipmentModel fsxEquipmentModelRow = PXCache <InventoryItem> .GetExtension <FSxEquipmentModel>(inventoryItemRow); int?iteratorMax = (int?)(soShipLineSplitRow == null || soShipLineSplitRow.Qty == null ? soLineSplitRow.Qty : soShipLineSplitRow.Qty); for (int i = 0; i < iteratorMax; i++) { SoldInventoryItem soldInventoryItemRow = new SoldInventoryItem(); soldInventoryItemRow.CustomerID = arRegisterRow.CustomerID; soldInventoryItemRow.CustomerLocationID = arRegisterRow.CustomerLocationID; soldInventoryItemRow.InventoryID = inventoryItemRow.InventoryID; soldInventoryItemRow.InventoryCD = inventoryItemRow.InventoryCD; soldInventoryItemRow.InvoiceRefNbr = arTranRow.RefNbr; soldInventoryItemRow.InvoiceLineNbr = arTranRow.LineNbr; soldInventoryItemRow.DocType = arRegisterRow.DocType; soldInventoryItemRow.DocDate = arTranRow.TranDate != null ? arTranRow.TranDate : arRegisterRow.DocDate; if (fsxSOLineRow != null) { if (fsxSOLineRow.AppointmentID != null) { soldInventoryItemRow.DocDate = fsxSOLineRow.AppointmentDate; } else if (fsxSOLineRow.SOID != null) { soldInventoryItemRow.DocDate = fsxSOLineRow.ServiceOrderDate; } } soldInventoryItemRow.Descr = inventoryItemRow.Descr; soldInventoryItemRow.SiteID = arTranRow.SiteID; soldInventoryItemRow.ItemClassID = inventoryItemRow.ItemClassID; soldInventoryItemRow.SOOrderType = soLineRow.OrderType; soldInventoryItemRow.SOOrderNbr = soLineRow.OrderNbr; soldInventoryItemRow.SOOrderDate = soLineRow.OrderDate; soldInventoryItemRow.EquipmentTypeID = fsxEquipmentModelRow.EquipmentTypeID; if (soLineSplitRow != null) { soldInventoryItemRow.LotSerialNumber = soLineSplitRow.LotSerialNbr; } if (soldInventoryItemRow.LotSerialNumber == null && soShipLineSplitRow != null) { soldInventoryItemRow.LotSerialNumber = soShipLineSplitRow.LotSerialNbr; } fsEquipmentRow = SharedFunctions.CreateSoldEquipment(graphSMEquipmentMaint, soldInventoryItemRow, soLineRow, fsxSOLineRow, action, inventoryItemRow); } if (fsEquipmentRow != null) { fsxARTranRow.SMEquipmentID = fsEquipmentRow.SMEquipmentID; Base.ARTran_TranType_RefNbr.Update(arTranRow); if (action == ID.Equipment_Action.SELLING_TARGET_EQUIPMENT) { int?smEquipmentID = -1; if (newEquiments.TryGetValue(soLineRow.LineNbr, out smEquipmentID) == false) { newEquiments.Add( soLineRow.LineNbr, fsEquipmentRow.SMEquipmentID); } } else if (action == ID.Equipment_Action.REPLACING_TARGET_EQUIPMENT) { if (fsxSOLineRow != null) { graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Search <FSEquipment.SMequipmentID>(fsxSOLineRow.SMEquipmentID); graphSMEquipmentMaint.EquipmentRecords.Current.ReplaceEquipmentID = fsEquipmentRow.SMEquipmentID; graphSMEquipmentMaint.EquipmentRecords.Current.Status = ID.Equipment_Status.DISPOSED; graphSMEquipmentMaint.EquipmentRecords.Current.DisposalDate = soLineRow.OrderDate; graphSMEquipmentMaint.EquipmentRecords.Current.DispServiceOrderID = fsxSOLineRow.SOID; graphSMEquipmentMaint.EquipmentRecords.Current.DispAppointmentID = fsxSOLineRow.AppointmentID; graphSMEquipmentMaint.EquipmentRecords.Cache.SetStatus(graphSMEquipmentMaint.EquipmentRecords.Current, PXEntryStatus.Updated); graphSMEquipmentMaint.Save.Press(); } } } } }
private void ReplaceComponents( SMEquipmentMaint graphSMEquipmentMaint, ARRegister arRegisterRow) { var inventoryItemSet = PXSelectJoin <InventoryItem, InnerJoin <ARTran, On <ARTran.inventoryID, Equal <InventoryItem.inventoryID>, And <ARTran.tranType, Equal <ARDocType.invoice> > >, InnerJoin <SOLineSplit, On <SOLineSplit.orderType, Equal <ARTran.sOOrderType>, And <SOLineSplit.orderNbr, Equal <ARTran.sOOrderNbr>, And <SOLineSplit.lineNbr, Equal <ARTran.sOOrderLineNbr>, And <SOLineSplit.qty, Greater <Zero> > > > >, InnerJoin <SOLine, On <SOLine.orderType, Equal <SOLineSplit.orderType>, And <SOLine.orderNbr, Equal <SOLineSplit.orderNbr>, And <SOLine.lineNbr, Equal <SOLineSplit.lineNbr> > > >, LeftJoin <SOShipLineSplit, On <SOShipLineSplit.origOrderType, Equal <SOLineSplit.orderType>, And <SOShipLineSplit.origOrderNbr, Equal <SOLineSplit.orderNbr>, And <SOShipLineSplit.origLineNbr, Equal <SOLineSplit.lineNbr>, And <SOShipLineSplit.origSplitLineNbr, Equal <SOLineSplit.splitLineNbr> > > > > > > > >, Where < ARTran.tranType, Equal <Required <ARInvoice.docType> >, And <ARTran.refNbr, Equal <Required <ARInvoice.refNbr> >, And <FSxEquipmentModel.eQEnabled, Equal <True>, And <FSxSOLine.equipmentAction, Equal <ListField_EquipmentAction.ReplacingComponent>, And <FSxSOLine.sMEquipmentID, IsNotNull, And <FSxSOLine.newTargetEquipmentLineNbr, IsNull, And <FSxSOLine.equipmentLineRef, IsNotNull, And <SOLineSplit.pOCreate, Equal <False> > > > > > > > >, OrderBy < Asc <ARTran.tranType, Asc <ARTran.refNbr, Asc <ARTran.lineNbr> > > > > .Select(Base, arRegisterRow.DocType, arRegisterRow.RefNbr); foreach (PXResult <InventoryItem, ARTran, SOLineSplit, SOLine, SOShipLineSplit> bqlResult in inventoryItemSet) { ARTran arTranRow = (ARTran)bqlResult; InventoryItem inventoryItemRow = (InventoryItem)bqlResult; SOLine soLineRow = (SOLine)bqlResult; SOLineSplit soLineSplitRow = (SOLineSplit)bqlResult; SOShipLineSplit soShipLineSplitRow = (SOShipLineSplit)bqlResult; FSxSOLine fsxSOLineRow = PXCache <SOLine> .GetExtension <FSxSOLine>(soLineRow); FSxARTran fsxARTranRow = PXCache <ARTran> .GetExtension <FSxARTran>(arTranRow); graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Search <FSEquipment.SMequipmentID>(fsxSOLineRow.SMEquipmentID); FSEquipmentComponent fsEquipmentComponentRow = graphSMEquipmentMaint.EquipmentWarranties.Select().Where(x => ((FSEquipmentComponent)x).LineNbr == fsxSOLineRow.EquipmentLineRef).FirstOrDefault(); FSEquipmentComponent fsNewEquipmentComponentRow = new FSEquipmentComponent(); fsNewEquipmentComponentRow.ComponentID = fsxSOLineRow.ComponentID; fsNewEquipmentComponentRow = graphSMEquipmentMaint.ApplyComponentReplacement(fsEquipmentComponentRow, fsNewEquipmentComponentRow); fsNewEquipmentComponentRow.SalesOrderNbr = soLineRow.OrderNbr; fsNewEquipmentComponentRow.SalesOrderType = soLineRow.OrderType; fsNewEquipmentComponentRow.InvoiceRefNbr = arTranRow.RefNbr; fsNewEquipmentComponentRow.InstallationDate = arTranRow.TranDate != null ? arTranRow.TranDate : arRegisterRow.DocDate; if (fsxSOLineRow != null) { if (fsxSOLineRow.AppointmentID != null) { fsNewEquipmentComponentRow.InstAppointmentID = fsxSOLineRow.AppointmentID; fsNewEquipmentComponentRow.InstallationDate = fsxSOLineRow.AppointmentDate; } else if (fsxSOLineRow.SOID != null) { fsNewEquipmentComponentRow.InstServiceOrderID = fsxSOLineRow.SOID; fsNewEquipmentComponentRow.InstallationDate = fsxSOLineRow.ServiceOrderDate; } fsNewEquipmentComponentRow.Comment = fsxSOLineRow.Comment; } fsNewEquipmentComponentRow.LongDescr = soLineRow.TranDesc; if (soLineSplitRow != null) { fsNewEquipmentComponentRow.SerialNumber = soLineSplitRow.LotSerialNbr; } if (fsNewEquipmentComponentRow.SerialNumber == null && soShipLineSplitRow != null) { fsNewEquipmentComponentRow.SerialNumber = soShipLineSplitRow.LotSerialNbr; } fsNewEquipmentComponentRow = graphSMEquipmentMaint.EquipmentWarranties.Update(fsNewEquipmentComponentRow); graphSMEquipmentMaint.EquipmentWarranties.SetValueExt <FSEquipmentComponent.inventoryID>(fsNewEquipmentComponentRow, soLineRow.InventoryID); graphSMEquipmentMaint.EquipmentWarranties.SetValueExt <FSEquipmentComponent.salesDate>(fsNewEquipmentComponentRow, soLineRow.OrderDate); graphSMEquipmentMaint.Save.Press(); } }