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.
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.
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.
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.
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.
What’s the screen ID that you’re wanting to modify?
I am using version (22R1).
Gaph for me is PX.Objects.SO.WMS.PickPackShip.Host
Hi,
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.
- In the Pick Pack, and Header, you can create 2 Unbound fields (Picker and Date)
- As soon as we scan the shipment, make sure these 2 fields should be populated automatically.
- And create the same fields in SOShipment DAC with database fields
- 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.
My code
SOShipment shipment = Base.WMS.Shipment;
SOShipmentExt shipmentExt = shipment.GetExtension<SOShipmentExt>();
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 ?
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.
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.
Hi
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
}
}
Hi
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();
}
}
Can you please verify that are you getting the values in the below extension fields in ScanHeader_Barcode_FieldUpdated?
- headerExt.UsrPickerName
- headerExt.UsrPicker
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.