Skip to main content

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
        bPXBool()]
         PXUIField(DisplayName = "Selected")]
        public virtual bool? Selected { get; set; }
        public abstract class selected : BqlBool.Field<selected> { }
        #endregion

        #region  OrderType
        >PXString(10, IsUnicode = true)]
        ePXUIField(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)]
        sPXUIField(DisplayName = "Order Nbr.")]
        public virtual string OrderNbr { get; set; }
        public abstract class orderNbr : BqlString.Field<orderNbr> { }
        #endregion
    }

    #endregion

 

Manually
Through Automation Schduler

 

Be the first to reply!

Reply