Beispiel #1
0
 private void CopyNotesAndAttachments(PXCache cache, POLine poLineRow, POEnabledFSSODet poEnabledFSSODetRow)
 {
     if (poSetup.Current != null &&
         (poSetup.Current.CopyLineNotesFromServiceOrder == true ||
          poSetup.Current.CopyLineAttachmentsFromServiceOrder == true))
     {
         SharedFunctions.CopyNotesAndFiles(
             new PXCache <FSSODet>(cache.Graph),
             cache,
             poEnabledFSSODetRow,
             poLineRow,
             poSetup.Current.CopyLineNotesFromServiceOrder,
             poSetup.Current.CopyLineAttachmentsFromServiceOrder);
     }
 }
Beispiel #2
0
        private void CreatePOOrderDocument(
            POOrderEntry graphPOOrderEntry,
            List <POEnabledFSSODet> itemGroup,
            POOrder poOrderRow,
            POLine poLineRow,
            POEnabledFSSODet firstPOEnabledFSSODetRow)
        {
            firstPOEnabledFSSODetRow = itemGroup[0];

            this.InitializePOOrderDocument(graphPOOrderEntry, poOrderRow, firstPOEnabledFSSODetRow);

            foreach (POEnabledFSSODet poEnabledFSSODetRow in itemGroup)
            {
                this.InsertPOLine(graphPOOrderEntry, poLineRow, poEnabledFSSODetRow);
            }

            graphPOOrderEntry.Save.Press();
        }
Beispiel #3
0
        public virtual IEnumerable ViewDocument(PXAdapter adapter)
        {
            LinesToPO.Cache.IsDirty = false;

            POEnabledFSSODet poEnabledFSSODetRow = LinesToPO.Current;

            if (poEnabledFSSODetRow == null ||
                poEnabledFSSODetRow.SrvOrdType == null ||
                poEnabledFSSODetRow.RefNbr == null)
            {
                return(adapter.Get());
            }

            ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            graphServiceOrderEntry.ServiceOrderRecords.Current =
                graphServiceOrderEntry.ServiceOrderRecords
                .Search <FSServiceOrder.refNbr>(poEnabledFSSODetRow.RefNbr, poEnabledFSSODetRow.SrvOrdType);

            PXRedirectHelper.TryRedirect(graphServiceOrderEntry, PXRedirectHelper.WindowMode.Popup);

            return(adapter.Get());
        }
Beispiel #4
0
        private void InsertPOLine(POOrderEntry graphPOOrderEntry, POLine poLineRow, POEnabledFSSODet poEnabledFSSODetRow)
        {
            poLineRow = new POLine()
            {
                BranchID = poEnabledFSSODetRow.BranchID
            };

            poLineRow = graphPOOrderEntry.Transactions.Current = graphPOOrderEntry.Transactions.Insert(poLineRow);

            poLineRow.InventoryID  = poEnabledFSSODetRow.InventoryID;
            poLineRow.SiteID       = poEnabledFSSODetRow.SiteID;
            poLineRow.OrderQty     = poEnabledFSSODetRow.EstimatedQty;
            poLineRow.ProjectID    = poEnabledFSSODetRow.ProjectID;
            poLineRow.TaskID       = poEnabledFSSODetRow.ProjectTaskID;
            poLineRow.CuryUnitCost = poEnabledFSSODetRow.UnitCost;
            poLineRow = graphPOOrderEntry.Transactions.Update(poLineRow);

            poEnabledFSSODetRow.POType      = poLineRow.OrderType;
            poEnabledFSSODetRow.POLineNbr   = poLineRow.LineNbr;
            poEnabledFSSODetRow.POCompleted = poLineRow.Completed;

            this.CopyNotesAndAttachments(graphPOOrderEntry.Transactions.Cache, poLineRow, poEnabledFSSODetRow);
        }
Beispiel #5
0
 private void InitializePOOrderDocument(POOrderEntry graphPOOrderEntry, POOrder poOrderRow, POEnabledFSSODet firstPOEnabledFSSODetRow)
 {
     poOrderRow                  = new POOrder();
     poOrderRow                  = graphPOOrderEntry.Document.Current = graphPOOrderEntry.Document.Insert(poOrderRow);
     poOrderRow.OrderType        = POOrderType.RegularOrder;
     poOrderRow.VendorID         = firstPOEnabledFSSODetRow.POVendorID;
     poOrderRow.VendorLocationID = firstPOEnabledFSSODetRow.POVendorLocationID;
     graphPOOrderEntry.Document.Update(poOrderRow);
 }
Beispiel #6
0
        private void processLines(
            List <POEnabledFSSODet> originalItemList,
            PXGraph <CreatePurchaseOrderProcess> graphCreatePurchaseOrderByServiceOrder,
            List <List <POEnabledFSSODet> > groupedFSSODetRows)
        {
            if (groupedFSSODetRows.Count == 0)
            {
                return;
            }

            POOrder          poOrderRow = null;
            POLine           poLineRow  = null;
            POEnabledFSSODet firstPOEnabledFSSODetRow = null;

            PXGraph      processGraph      = new PXGraph();
            POOrderEntry graphPOOrderEntry = CreateInstance <POOrderEntry>();

            foreach (List <POEnabledFSSODet> itemGroup in groupedFSSODetRows)
            {
                if (!this.IsThisItemGroupValid(itemGroup, originalItemList))
                {
                    continue;
                }

                using (PXTransactionScope ts = new PXTransactionScope())
                {
                    try
                    {
                        processGraph.Clear(PXClearOption.ClearAll);
                        graphPOOrderEntry.Clear(PXClearOption.ClearAll);

                        this.CreatePOOrderDocument(graphPOOrderEntry, itemGroup, poOrderRow, poLineRow, firstPOEnabledFSSODetRow);

                        foreach (POEnabledFSSODet poEnabledFSSODetRow in itemGroup)
                        {
                            PXUpdate <
                                Set <FSSODet.poType, Required <FSSODet.poType>,
                                     Set <FSSODet.poNbr, Required <FSSODet.poNbr>,
                                          Set <FSSODet.poLineNbr, Required <FSSODet.poLineNbr>,
                                               Set <FSSODet.poStatus, Required <FSSODet.poStatus>,
                                                    Set <FSSODet.poCompleted, Required <FSSODet.poCompleted>,
                                                         Set <FSSODet.poVendorID, Required <FSSODet.poVendorID>,
                                                              Set <FSSODet.poVendorLocationID, Required <FSSODet.poVendorLocationID> > > > > > > >,
                                FSSODet,
                                Where <
                                    FSSODet.sODetID, Equal <Required <FSSODet.sODetID> >,
                                    And <FSSODet.poNbr, IsNull> > >
                            .Update(
                                processGraph,
                                poEnabledFSSODetRow.POType,
                                graphPOOrderEntry.Document.Current.OrderNbr,
                                poEnabledFSSODetRow.POLineNbr,
                                graphPOOrderEntry.Document.Current.Status,
                                poEnabledFSSODetRow.POCompleted,
                                poEnabledFSSODetRow.POVendorID,
                                poEnabledFSSODetRow.POVendorLocationID,
                                poEnabledFSSODetRow.SODetID);

                            PXProcessing <POEnabledFSSODet> .SetInfo(originalItemList.IndexOf(poEnabledFSSODetRow), TX.Messages.RECORD_PROCESSED_SUCCESSFULLY);

                            poEnabledFSSODetRow.PONbrCreated = graphPOOrderEntry.Document.Current.OrderNbr;
                        }

                        ts.Complete();
                    }
                    catch (Exception e)
                    {
                        ts.Dispose();

                        foreach (POEnabledFSSODet poEnabledFSSODetRow in itemGroup)
                        {
                            PXProcessing <POEnabledFSSODet> .SetError(originalItemList.IndexOf(poEnabledFSSODetRow), e);
                        }
                    }
                }
            }
        }