Question

Unbound Processing Screen

  • 25 March 2024
  • 0 replies
  • 24 views

Team,
I have created a new Unbound processing screen and added some basic information to the process. This screen works as expected when run manually. However, when using schedulers, the processing count is not updating.
Here is complete code.

  public class NewProcessingScreen : PXGraph<NewProcessingScreen>
    {
        #region View

        public PXProcessing<SHWKImportDAC> SHWKSOOrderView;

        #endregion

        #region View Delegate
        protected virtual IEnumerable sHWKSOOrderView()
        {
            foreach (SOOrder item in PXSelect<SOOrder, Where<SOOrder.orderType, Equal<SOBehavior.sO>, And<SOOrder.status, Equal<SOOrderStatus.open>>>>.Select(this))
            {
                SHWKImportDAC dac = new SHWKImportDAC();
                dac.OrderType = item.OrderType;
                dac.OrderNbr = item.OrderNbr;

                SHWKSOOrderView.Cache.Insert(dac);

                yield return dac;
            }
        }

        #endregion

        #region Process Delegate

        public NewProcessingScreen()
        {
            SHWKSOOrderView.SetSelected<SHWKImportDAC.selected>();
            SHWKSOOrderView.SetProcessDelegate(
                delegate (List<SHWKImportDAC> list)
                {
                    PrepareImport(list);
                });
        }

        #endregion

        

        #region Helper Method
        public static void PrepareImport(List<SHWKImportDAC> list)
        {
            NewProcessingScreen graph = PXGraph.CreateInstance<NewProcessingScreen>();
            graph.ImportShipments(graph, list);
        }

        public virtual void ImportShipments(NewProcessingScreen graph, List<SHWKImportDAC> list)
        {
            foreach (SHWKImportDAC item in list)
            {
                try
                {
                    int kk = list.IndexOf(item);

                    if (item.OrderNbr == "SK22R2430007" || item.OrderNbr == "SK22R2430072" || item.OrderNbr == "SO006019")
                    {
                        PXProcessing<SHWKImportDAC>.SetInfo(list.IndexOf(item), SHWKMessages.ShipmentDtlsImpSuccess);
                    }
                    else
                    {
                        throw new PXException("Error");
                    }
                }
                catch (PXException ex)
                {
                    PXProcessing<SHWKImportDAC>.SetError(list.IndexOf(item), ex.Message);
                }
            }
        }

        #endregion
    }


    #region Unbound DAC
    
    [PXHidden]
    public partial class SHWKImportDAC : IBqlTable
    {
        #region  Selected
        [PXBool()]
        [PXUIField(DisplayName = "Selected")]
        public virtual bool? Selected { get; set; }
        public abstract class selected : BqlBool.Field<selected> { }
        #endregion

        #region  OrderType
        [PXString(10, IsUnicode = true)]
        [PXUIField(DisplayName = "Order Type")]
        public virtual string OrderType { get; set; }
        public abstract class orderType : BqlString.Field<orderType> { }
        #endregion

        #region OrderNbr
        [PXString(15, IsKey = true, IsUnicode = true)]
        [PXUIField(DisplayName = "Order Nbr.")]
        public virtual string OrderNbr { get; set; }
        public abstract class orderNbr : BqlString.Field<orderNbr> { }
        #endregion
    }

    #endregion

 

Manually
Through Automation Schduler

 


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved