Skip to main content
Solved

Pick Pack and Ship Screen


param2022
Jr Varsity II
Forum|alt.badge.img

If I want to add new DB fields on this screen, which table they will be added I know its ScanHeader DACExtension but I am not able to find the respective table. I need to add details like on which day this shipment was scanned it was scanned by whom and data like that. 

Best answer by Naveen Boga

Hi @param2022  Yes, I just modified the code and verified and it is working fine.

 

Please do modify your code accordingly and verify. 

 

    protected void ScanHeader_Barcode_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            PXCache<SOShipment> shipmentTemp = new PXCache<SOShipment>(Base);
            IEnumerable<SOShipmentEntry> temp = cache.Cached.Cast<SOShipmentEntry>();
            ScanHeader row = (ScanHeader)e.Row;
            HeaderExt headerExt = row.GetExtension<HeaderExt>();
            PickPackShip.Host graph = PXGraph.CreateInstance<PickPackShip.Host>();
            switch (row.ScanState)
            {
                case "ITEM":
                    headerExt.ScanningStatus = "Partial";
                    break;
                case "NONE":
                    headerExt.ScanningStatus = "Completed";
                    break;
                default:
                    break;
            }

            SOShipment shipment = (from p in graph.Select<SOShipment>()
                                   where
                                   p.ShipmentNbr == row.Barcode
                                   select p).FirstOrDefault();
            if (shipment != null)
            {
                SOShipmentEntry shipGraph = PXGraph.CreateInstance<SOShipmentEntry>();
                SOShipmentExt shipmentExt = shipment.GetExtension<SOShipmentExt>();
                //cache.SetValueExt<SOShipmentExt.usrScanner>(shipment, headerExt.Scanner);
                //cache.SetValueExt<SOShipmentExt.usrScannerName>(shipment, headerExt.ScannerName);
                shipGraph.Document.Cache.SetValueExt<SOShipmentExt.usrPicker>(shipment, headerExt.UsrPicker);
                cache.SetValueExt<SOShipmentExt.usrPickerName>(shipment, headerExt.UsrPickerName);
                shipGraph.Document.Update(shipment);
                shipGraph.Save.Press();
            }
        }

 

View original
Did this topic help you find an answer to your question?

23 replies

Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • June 13, 2022

The main view is a virtual DAC so there is no database table. If you are looking to persist information like that you would probably want to do so on the Shipment record. 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 14, 2022

@markusray17 by Shipment table are you suggesting SOShipment table ??

If that's the case how can I add those field in that table via ScanHeader DACExtension. Or there is some other way to do this.


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 14, 2022

 

param2022 wrote:

@markusray17 by Shipment table are you suggesting SOShipment table ??

If that's the case how can I add those field in that table via ScanHeader DACExtension. Or there is some other way to do this.

Anyone knows how to do this then please reply.

 


Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • June 14, 2022

You would add them to SOShipment DAC via a cache extension(and the SOShipment table). I’m not sure what the ScanHeader DAC has to do with this but I may just be on a different version(21R2) than you. On mine the graph is PickPackShipHost for that page and the primary view uses the WMSHeader DAC.


Forum|alt.badge.img+5
  • Captain II
  • 485 replies
  • June 14, 2022

What’s the screen ID that you’re wanting to modify?


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 15, 2022

@ddunn @markusray17 I am trying to add those fields in screen-id SO302020.

I am using version (22R1).

Gaph for me is PX.Objects.SO.WMS.PickPackShip.Host

 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 15, 2022

Hi, @param2022  Pick Pack and Ship screen, is where we can enter a few details to scan the shipments one by one.

But why do you want to add the DATABASE fields? Can you please explain the business scenario for this? which will help us to provide a proper solution.


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 15, 2022

@Naveen Boga  I need to add details like on which day I want to add this fields in relation to shipment. Like who was the picker need to add name and Id for that person. Then I need to add that info to shipping screen.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 15, 2022

@param2022  I have very limited knowledge on the Pick Pack and Ship screen but for this requirement, you can do like below and hope it would help.

  1. In the Pick Pack, and Header, you can create 2 Unbound fields (Picker and Date)
  2. As soon as we scan the shipment, make sure these 2 fields should be populated automatically.
  3. And create the same fields in SOShipment DAC with database fields
  4. In the Pick Pack and Ship screen, while performing any action you can override and pass these fields to SOShipment DAC and SAVE the field.

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 15, 2022

@Naveen Boga that seems doable but I am getting shipment object null in the graph extension.

My code 

 

SOShipment shipment = Base.WMS.Shipment;
SOShipmentExt shipmentExt = shipment.GetExtension<SOShipmentExt>();

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 18, 2022

@Naveen Boga @ddunn @markusray17 

I am facing issue in accessing SOShipment record in the Host graph for PickPackShip screen.
Every time a value is entered in the Scan field the field updated event is called. And it might not be shipment number every time. It might be a item code also or a command. So i need ShipmentNumber in every event call. How can we access that anyone have any idea ? 


Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • June 18, 2022

You can store the shipment record in the cache when it is scanned. I would expect the graph already does that though so you may want to look at the views/caches and see if it is storing the shipment record somewhere after being scanned. I believe the Host graph inherits from SOShipmentEntry so you could also use the views/cache from that graph if necessary. 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 20, 2022

@Naveen Boga @ddunn @markusray17 

I have tried getting the SOShipment in various ways through base but all the time value is null.

PXCache<SOShipment> shipmentTemp = new PXCache<SOShipment>(Base);

var shipment = Base.WMS.Shipment;

Can’t get the value by any of this. 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 20, 2022

Hi @param2022  Can you please share your complete Graph file source code here. I will check from my end.


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 20, 2022

@Naveen Boga here is my graph file code. I am trying to do this in ScanHeader_Barcode_FieldUpdated method. I need to take values from HeaderExt, find SOShipment record in DB fetch it and update that record.

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using PX.SM;
using PX.Common;
using PX.BarcodeProcessing;
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.Objects.Common;
using PX.Objects.Common.Extensions;
using PX.Objects.Extensions;
using PX.Objects.AR;
using PX.Objects.CS;
using PX.Objects.IN;
using PX.Objects.IN.WMS;
using WMSBase = PX.Objects.IN.WMS.WarehouseManagementSystem<PX.Objects.SO.WMS.PickPackShip, PX.Objects.SO.WMS.PickPackShip.Host>;
using PX.Objects;
using PX.Objects.SO.WMS;
using Demo_Code.DAC_Extentions;
using PX.Objects.EP;
using Demo_Code.Helpers;

namespace PX.Objects.SO.WMS
{
    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    public class PickPackShip_Extension : PXGraphExtension<PX.Objects.SO.WMS.PickPackShip.Host>
    {
        #region Event Handlers

        protected void ScanHeader_Picker_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            try
            {
                ScanHeader row = (ScanHeader)e.Row;
                HeaderExt headerExt = row.GetExtension<HeaderExt>();
                PickPackShip.Host graph = PXGraph.CreateInstance<PickPackShip.Host>();
                var employees = from p in graph.Select<EPEmployee>()
                            where
                            p.BAccountID.Value == headerExt.Picker
                            select new
                            {
                                p.AcctName
                            };
                headerExt.PickerName = employees.FirstOrDefault()?.AcctName;
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        protected void ScanHeader_Barcode_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
        {
            ScanHeader row = (ScanHeader)e.Row;
            HeaderExt headerExt = row.GetExtension<HeaderExt>();
            if (headerExt.Picker == null || headerExt.PickerName == null)
            {
                throw new PXSetPropertyException(CustomMessages.PickerNotSelectedMsg);
            }
        }

        protected void ScanHeader_Barcode_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            PXCache<SOShipment> shipmentTemp = new PXCache<SOShipment>(Base);
            IEnumerable<SOShipmentEntry> temp = cache.Cached.Cast<SOShipmentEntry>();
            ScanHeader row = (ScanHeader)e.Row;
            HeaderExt headerExt = row.GetExtension<HeaderExt>();
            PickPackShip.Host graph = PXGraph.CreateInstance<PickPackShip.Host>();
            switch (row.ScanState)
            {
                case "ITEM":
                    headerExt.ScanningStatus = "Partial";
                    break;
                case "NONE":
                    headerExt.ScanningStatus = "Completed";
                    break;
                default:
                    break;
            }

            SOShipment shipment = (from p in graph.Select<SOShipment>()
                            where
                            p.ShipmentNbr == row.Barcode
                            select p).FirstOrDefault();
            if (shipment != null)
            {
                SOShipmentExt shipmentExt = shipment.GetExtension<SOShipmentExt>();
                cache.SetValueExt<SOShipmentExt.usrScanner>(shipment, headerExt.Scanner);
                cache.SetValueExt<SOShipmentExt.usrScannerName>(shipment, headerExt.ScannerName);
                cache.SetValueExt<SOShipmentExt.usrPicker>(shipment, headerExt.Picker);
                cache.SetValueExt<SOShipmentExt.usrPickerName>(shipment, headerExt.PickerName);
                Base.Document.Update(shipment);
            }
        }

        #endregion
    }
}

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 21, 2022

@Naveen Boga did you get any breakthrough ?


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • Answer
  • June 21, 2022

Hi @param2022  Yes, I just modified the code and verified and it is working fine.

 

Please do modify your code accordingly and verify. 

 

    protected void ScanHeader_Barcode_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            PXCache<SOShipment> shipmentTemp = new PXCache<SOShipment>(Base);
            IEnumerable<SOShipmentEntry> temp = cache.Cached.Cast<SOShipmentEntry>();
            ScanHeader row = (ScanHeader)e.Row;
            HeaderExt headerExt = row.GetExtension<HeaderExt>();
            PickPackShip.Host graph = PXGraph.CreateInstance<PickPackShip.Host>();
            switch (row.ScanState)
            {
                case "ITEM":
                    headerExt.ScanningStatus = "Partial";
                    break;
                case "NONE":
                    headerExt.ScanningStatus = "Completed";
                    break;
                default:
                    break;
            }

            SOShipment shipment = (from p in graph.Select<SOShipment>()
                                   where
                                   p.ShipmentNbr == row.Barcode
                                   select p).FirstOrDefault();
            if (shipment != null)
            {
                SOShipmentEntry shipGraph = PXGraph.CreateInstance<SOShipmentEntry>();
                SOShipmentExt shipmentExt = shipment.GetExtension<SOShipmentExt>();
                //cache.SetValueExt<SOShipmentExt.usrScanner>(shipment, headerExt.Scanner);
                //cache.SetValueExt<SOShipmentExt.usrScannerName>(shipment, headerExt.ScannerName);
                shipGraph.Document.Cache.SetValueExt<SOShipmentExt.usrPicker>(shipment, headerExt.UsrPicker);
                cache.SetValueExt<SOShipmentExt.usrPickerName>(shipment, headerExt.UsrPickerName);
                shipGraph.Document.Update(shipment);
                shipGraph.Save.Press();
            }
        }

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 21, 2022

@Naveen Boga is there any other change that I need to do ? Because I replaced the whole method with method that you provided and still all fields are null in my database.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 21, 2022

@param2022  That is the only change I have done and it was working for me.

Can you please verify that are you getting the values in the below extension fields in  ScanHeader_Barcode_FieldUpdated?

  1. headerExt.UsrPickerName
  2. headerExt.UsrPicker

param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 21, 2022

@Naveen Boga yes I am getting both of those field’s correct values in the method. I have debugged and check that.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 21, 2022

@param2022  Hoping that you have written the bound DAC fields in the SOShipment extension DAC but NOT the unbound fields. Please confirm


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 94 replies
  • June 21, 2022

@Naveen Boga  yes that was issue. Thank you very much.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3377 replies
  • June 21, 2022

@param2022  Expected :) Thanks for sharing the update.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings