Пример #1
0
        public virtual void FillPOLineFromDemand(POLine dest, POFixedDemand demand, string OrderType, SOLineSplit3 solinesplit, FillPOLineFromDemandDelegate del)
        {
            if (demand.PlanType == INPlanConstants.PlanF6)
            {
                PXResult <FSSODetSplit, FSSODet> fsSODetSplitDetRow =
                    (PXResult <FSSODetSplit, FSSODet>)
                    PXSelectJoin <FSSODetSplit,
                                  InnerJoin <FSSODet,
                                             On <
                                                 FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr>,
                                                 And <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>,
                                                      And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr> > > > >,
                                  Where <
                                      FSSODetSplit.planID, Equal <Required <FSSODetSplit.planID> > > >
                    .Select(Base, demand.PlanID);

                if (fsSODetSplitDetRow != null)
                {
                    FSSODetSplit fsSODetSplitRow = (FSSODetSplit)fsSODetSplitDetRow;
                    FSSODet      fsSODetRow      = (FSSODet)fsSODetSplitDetRow;

                    dest.LineType = (fsSODetSplitRow.LineType == SO.SOLineType.Inventory
                                            ? POLineType.GoodsForServiceOrder
                                            : POLineType.NonStockForServiceOrder);

                    if (fsSODetRow.ManualCost == true)
                    {
                        dest.CuryUnitCost = fsSODetRow.CuryUnitCost;
                    }
                }
            }

            del(dest, demand, OrderType, solinesplit);
        }
        public void CopyPOLineFields(POFixedDemand demand, POLine line)
        {
            PXResult <FSSODetSplit, FSSODet> fsSODetSplitDetRow =
                (PXResult <FSSODetSplit, FSSODet>) PXSelectJoin <FSSODetSplit,
                                                                 InnerJoin <FSSODet,
                                                                            On <FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr>,
                                                                                And <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>,
                                                                                     And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr> > > > >,
                                                                 Where <FSSODetSplit.planID, Equal <Required <FSSODetSplit.planID> > > >
                .Select(Base, demand.PlanID);

            if (fsSODetSplitDetRow != null)
            {
                FSSODet fsSODetRow = (FSSODet)fsSODetSplitDetRow;

                if (POSetupRecord.Current != null)
                {
                    if (POSetupRecord.Current.CopyLineNotesFromServiceOrder == true ||
                        POSetupRecord.Current.CopyLineAttachmentsFromServiceOrder == true)
                    {
                        var fsSODetCache = new PXCache <FSSODet>(Base);
                        fsSODetCache.Update(fsSODetRow);

                        PXNoteAttribute.CopyNoteAndFiles(fsSODetCache,
                                                         fsSODetRow,
                                                         Base.Transactions.Cache,
                                                         line,
                                                         POSetupRecord.Current.CopyLineNotesFromServiceOrder == true,
                                                         POSetupRecord.Current.CopyLineAttachmentsFromServiceOrder == true);
                    }
                }

                line.TranDesc = fsSODetRow.TranDesc;
            }
        }
Пример #3
0
        public virtual string GetPOFixDemandSorter(POFixedDemand line, GetPOFixDemandSorterDelegate del)
        {
            if (line.PlanType == INPlanConstants.PlanF6)
            {
                FSSODet row = PXSelectJoin <FSSODet,
                                            InnerJoin <FSSODetSplit,
                                                       On <FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr>,
                                                           And <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>,
                                                                And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr> > > > >,
                                            Where <FSSODetSplit.planID, Equal <Required <FSSODetSplit.planID> > > > .Select(Base, line.PlanID);

                return(row == null ? String.Empty : string.Format("{0}.{1}.{2:D7}", row.SrvOrdType, row.RefNbr, row.SortOrder.GetValueOrDefault()));
            }
            else
            {
                return(del(line));
            }
        }
Пример #4
0
        public virtual IEnumerable ViewServiceOrderDocument(PXAdapter adapter)
        {
            POFixedDemand line = Base.FixedDemand.Current;

            if (line == null || line.RefNoteID == null)
            {
                return(adapter.Get());
            }

            FSServiceOrder doc = PXSelect <FSServiceOrder, Where <FSServiceOrder.noteID, Equal <Required <POFixedDemand.refNoteID> > > > .Select(Base, line.RefNoteID);

            if (doc != null)
            {
                ServiceOrderEntry graph = PXGraph.CreateInstance <ServiceOrderEntry>();
                graph.ServiceOrderRecords.Current = graph.ServiceOrderRecords.Search <FSServiceOrder.refNbr>
                                                        (doc.RefNbr, doc.SrvOrdType);
                PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
            }
            return(adapter.Get());
        }
Пример #5
0
        protected IEnumerable fixedDemand()
        {
            PXResultset <POFixedDemand> fixedDemands =
                PXSelectJoin <POFixedDemand,
                              InnerJoin <InventoryItem,
                                         On <InventoryItem.inventoryID, Equal <POFixedDemand.inventoryID> >,
                                         LeftJoin <Vendor,
                                                   On <Vendor.bAccountID, Equal <POFixedDemand.vendorID> >,
                                                   LeftJoin <POVendorInventory,
                                                             On <POVendorInventory.recordID, Equal <POFixedDemand.recordID> >,
                                                             LeftJoin <CRLocation,
                                                                       On <CRLocation.bAccountID, Equal <POFixedDemand.vendorID>,
                                                                           And <CRLocation.locationID, Equal <POFixedDemand.vendorLocationID> > >,
                                                                       LeftJoin <SOOrder,
                                                                                 On <SOOrder.noteID, Equal <POFixedDemand.refNoteID> >,
                                                                                 LeftJoin <SOLineSplit,
                                                                                           On <SOLineSplit.planID, Equal <POFixedDemand.planID> >,
                                                                                           LeftJoin <SOLine,
                                                                                                     On <SOLine.orderType, Equal <SOLineSplit.orderType>,
                                                                                                         And <SOLine.orderNbr, Equal <SOLineSplit.orderNbr>,
                                                                                                              And <SOLine.lineNbr, Equal <SOLineSplit.lineNbr> > > >,
                                                                                                     LeftJoin <FSServiceOrder,
                                                                                                               On <FSServiceOrder.noteID, Equal <POFixedDemand.refNoteID> >,
                                                                                                               LeftJoin <FSSODetSplit,
                                                                                                                         On <FSSODetSplit.planID, Equal <POFixedDemand.planID> >,
                                                                                                                         LeftJoin <FSSODet,
                                                                                                                                   On <FSSODet.srvOrdType, Equal <FSSODetSplit.srvOrdType>,
                                                                                                                                       And <FSSODet.refNbr, Equal <FSSODetSplit.refNbr>,
                                                                                                                                            And <FSSODet.lineNbr, Equal <FSSODetSplit.lineNbr> > > >,
                                                                                                                                   LeftJoin <INItemClass,
                                                                                                                                             On <INItemClass.itemClassID, Equal <InventoryItem.itemClassID> > > > > > > > > > > > >,
                              Where2 <
                                  Where <POFixedDemand.vendorID, Equal <Current <POCreateFilter.vendorID> >,
                                         Or <Current <POCreateFilter.vendorID>, IsNull> >,
                                  And2 <
                                      Where <POFixedDemand.inventoryID, Equal <Current <POCreateFilter.inventoryID> >,
                                             Or <Current <POCreateFilter.inventoryID>, IsNull> >,
                                      And2 <
                                          Where <POFixedDemand.siteID, Equal <Current <POCreateFilter.siteID> >,
                                                 Or <Current <POCreateFilter.siteID>, IsNull> >,
                                          And2 <
                                              Where2 <
                                                  Where <SOOrder.customerID, Equal <Current <POCreateFilter.customerID> >,
                                                         Or <Current <POCreateFilter.customerID>, IsNull> >,
                                                  Or <FSServiceOrder.customerID, Equal <Current <POCreateFilter.customerID> >,
                                                      Or <Current <POCreateFilter.customerID>, IsNull> > >,
                                              And2 <
                                                  Where <SOOrder.orderType, Equal <Current <POCreateFilter.orderType> >,
                                                         Or <Current <POCreateFilter.orderType>, IsNull> >,
                                                  And2 <
                                                      Where <SOOrder.orderNbr, Equal <Current <POCreateFilter.orderNbr> >,
                                                             Or <Current <POCreateFilter.orderNbr>, IsNull> >,
                                                      And2 <
                                                          Where <FSServiceOrder.srvOrdType, Equal <Current <POCreateFilter.srvOrdType> >,
                                                                 Or <Current <POCreateFilter.srvOrdType>, IsNull> >,
                                                          And2 <
                                                              Where <FSServiceOrder.refNbr, Equal <Current <POCreateFilter.serviceOrderRefNbr> >,
                                                                     Or <Current <POCreateFilter.serviceOrderRefNbr>, IsNull> >,
                                                              And2 <
                                                                  Where <POFixedDemand.planDate, LessEqual <Current <POCreateFilter.requestedOnDate> >,
                                                                         Or <Current <POCreateFilter.requestedOnDate>, IsNull> >,
                                                                  And <Where <INItemClass.itemClassCD, Like <Current <POCreateFilter.itemClassCDWildcard> >,
                                                                              Or <Current <POCreateFilter.itemClassCDWildcard>, IsNull> > > > > > > > > > > > >
                .Select(Base);

            foreach (PXResult <POFixedDemand, InventoryItem, Vendor, POVendorInventory, CRLocation, SOOrder, SOLineSplit, SOLine, FSServiceOrder, FSSODetSplit, FSSODet, INItemClass> resultRow in fixedDemands)
            {
                POFixedDemand  poFixedDemandRow  = (POFixedDemand)resultRow;
                FSServiceOrder fsServiceOrderRow = (FSServiceOrder)resultRow;
                SOOrder        soOrderRow        = (SOOrder)resultRow;

                if (fsServiceOrderRow.CustomerID != null)
                {
                    soOrderRow.CustomerID = fsServiceOrderRow.CustomerID;
                }

                poFixedDemandRow.SrvOrdType = fsServiceOrderRow.SrvOrdType;
                poFixedDemandRow.FSRefNbr   = fsServiceOrderRow.RefNbr;
            }

            return(Base.EnumerateAndPrepareFixedDemands(fixedDemands));
        }