public virtual void FillEquipmentFields(PXCache cache, ARTran arTranRow) { if (arTranRow.SOOrderType != null && arTranRow.SOOrderNbr != null && arTranRow.SOOrderLineNbr != null) { PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment> bqlResult = (PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment>) PXSelectJoin <SOLine, InnerJoin <SOOrder, On <SOOrder.orderNbr, Equal <SOLine.orderNbr>, And <SOOrder.orderType, Equal <SOLine.orderType> > >, LeftJoin <FSServiceOrder, On < Where2 < Where < FSServiceOrder.refNbr, Equal <FSxSOOrder.soRefNbr>, And <FSServiceOrder.srvOrdType, Equal <FSxSOOrder.srvOrdType> > >, Or <FSServiceOrder.sOID, Equal <FSxSOLine.sOID> > > >, LeftJoin <FSAppointment, On <FSAppointment.appointmentID, Equal <FSxSOLine.appointmentID> > > > >, Where < SOLine.orderType, Equal <Required <SOLine.orderType> >, And < SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >, And < SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > > .Select(cache.Graph, arTranRow.SOOrderType, arTranRow.SOOrderNbr, arTranRow.SOOrderLineNbr); SOLine soLineRow = (SOLine)bqlResult; SOOrder soOrderRow = (SOOrder)bqlResult; FSServiceOrder fsServiceOrderRow = (FSServiceOrder)bqlResult; FSAppointment fsAppointmentRow = (FSAppointment)bqlResult; if (soLineRow != null) { FSxSOOrder fsxSOOrderRow = PXCache <SOOrder> .GetExtension <FSxSOOrder>(soOrderRow); FSxSOLine fsxSOLineRow = PXCache <SOLine> .GetExtension <FSxSOLine>(soLineRow); FSxARTran fsxARTranRow = cache.GetExtension <FSxARTran>(arTranRow); if (fsxSOLineRow.EquipmentAction == ID.Equipment_Action.CREATING_COMPONENT || fsxSOLineRow.EquipmentAction == ID.Equipment_Action.REPLACING_COMPONENT) { fsxARTranRow.SMEquipmentID = fsxSOLineRow.SMEquipmentID; } else { fsxARTranRow.SuspendedSMEquipmentID = fsxSOLineRow.SMEquipmentID; } fsxARTranRow.NewTargetEquipmentLineNbr = fsxSOLineRow.NewTargetEquipmentLineNbr; fsxARTranRow.ComponentID = fsxSOLineRow.ComponentID; if (fsxSOOrderRow.SDEnabled == true || fsServiceOrderRow.SOID != null) { fsxARTranRow.SOID = fsServiceOrderRow.SOID; fsxARTranRow.BillCustomerID = fsServiceOrderRow.BillCustomerID; fsxARTranRow.CustomerLocationID = fsServiceOrderRow.BillLocationID; } if (fsAppointmentRow?.AppointmentID != null) { fsxARTranRow.AppointmentID = fsAppointmentRow.AppointmentID; fsxARTranRow.AppointmentDate = fsAppointmentRow.ScheduledDateTimeBegin; } } } }
public virtual void FillEquipmentFields(PXCache cache, ARTran arTranRow) { if (arTranRow.SOOrderType != null && arTranRow.SOOrderNbr != null && arTranRow.SOOrderLineNbr != null) { PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment> bqlResult = (PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment>) PXSelectJoin <SOLine, InnerJoin <SOOrder, On < SOOrder.orderNbr, Equal <SOLine.orderNbr>, And <SOOrder.orderType, Equal <SOLine.orderType> > >, LeftJoin <FSServiceOrder, On < Where2 < Where < FSServiceOrder.refNbr, Equal <FSxSOOrder.soRefNbr>, And <FSServiceOrder.srvOrdType, Equal <FSxSOOrder.srvOrdType> > >, Or <FSServiceOrder.sOID, Equal <FSxSOLine.sOID> > > >, LeftJoin <FSAppointment, On < FSAppointment.appointmentID, Equal <FSxSOLine.appointmentID> > > > >, Where < SOLine.orderType, Equal <Required <SOLine.orderType> >, And < SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >, And < SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > > .Select(cache.Graph, arTranRow.SOOrderType, arTranRow.SOOrderNbr, arTranRow.SOOrderLineNbr); SOLine soLineRow = (SOLine)bqlResult; SOOrder soOrderRow = (SOOrder)bqlResult; FSServiceOrder fsServiceOrderRow = (FSServiceOrder)bqlResult; FSAppointment fsAppointmentRow = (FSAppointment)bqlResult; if (soLineRow != null) { FSxSOOrder fsxSOOrderRow = PXCache <SOOrder> .GetExtension <FSxSOOrder>(soOrderRow); FSxSOLine fsxSOLineRow = PXCache <SOLine> .GetExtension <FSxSOLine>(soLineRow); FSxARTran fsxARTranRow = cache.GetExtension <FSxARTran>(arTranRow); fsxARTranRow.SMEquipmentID = fsxSOLineRow.SMEquipmentID; fsxARTranRow.ComponentID = fsxSOLineRow.ComponentID; fsxARTranRow.EquipmentLineRef = fsxSOLineRow.EquipmentLineRef; fsxARTranRow.EquipmentAction = fsxSOLineRow.EquipmentAction; fsxARTranRow.Comment = fsxSOLineRow.Comment; SOLine soLineRow2 = PXSelect <SOLine, Where < SOLine.orderType, Equal <Required <SOLine.orderType> >, And <SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >, And <SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > > .Select(cache.Graph, arTranRow.SOOrderType, arTranRow.SOOrderNbr, fsxSOLineRow.NewTargetEquipmentLineNbr); if (soLineRow2 != null) { ARTran arTranRow2 = Base.Transactions.Select().Where(x => ((ARTran)x).SOOrderType == arTranRow.SOOrderType && ((ARTran)x).SOOrderNbr == arTranRow.SOOrderNbr && ((ARTran)x).SOOrderLineNbr == soLineRow2.LineNbr).RowCast <ARTran>().FirstOrDefault(); fsxARTranRow.NewTargetEquipmentLineNbr = arTranRow2?.LineNbr; } if (fsxSOOrderRow.SDEnabled == true || fsServiceOrderRow.SOID != null) { fsxARTranRow.SOID = fsServiceOrderRow.SOID; fsxARTranRow.BillCustomerID = fsServiceOrderRow.CustomerID; fsxARTranRow.CustomerLocationID = fsServiceOrderRow.LocationID; } if (fsAppointmentRow?.AppointmentID != null) { fsxARTranRow.AppointmentID = fsAppointmentRow.AppointmentID; fsxARTranRow.AppointmentDate = fsAppointmentRow.ScheduledDateTimeBegin; } } } }