Has anyone managed to sucessfully add a new barcode step to a WMS form. My code appeared to working fine, but replacing the transitions breaks the confirm package and confirm shipment buttons for some reason.
Basically in pick pack ship in pack mode, I need it to tell the user to scan a custom field value for the package. And it seems to works if I do this in a scanextension script:
[PXOverride]
public virtual ScanMode<PickPackShip> DecorateScanMode(ScanMode<PickPackShip> original, Func<ScanMode<PickPackShip>, ScanMode<PickPackShip>> base_DecorateScanMode)
{
// Call the base code to get the original mode
var mode = base_DecorateScanMode(original);//return mode;
if (mode is PickPackShip.PackMode packMode)
{packMode.Intercept.CreateStates.ByAppend(basis =>
new ScanState<PickPackShip>[] { new BoxPackageTransferLabel() }
);packMode
// Replaces the previous implementation with a new one.
.Intercept.CreateTransitions.ByReplace(basis =>
{
// Creates a list of sequential transitions.
return basis.StateFlow(flow => flow
.From<PickPackShip.PackMode.ShipmentState>()
.NextTo<PickPackShip.PackMode.BoxState>()
.NextTo<BoxPackageTransferLabel>() //inserted new state for scanning transfer label
.NextTo<WMSBase.InventoryItemState>()
.NextTo<WMSBase.LotSerialState>()
.NextTo<PickPackShip.PackMode.ConfirmState>()
.NextTo<CommandOrShipmentOnlyState>()
);
});}
return mode;
}
Thar BoxTransferLabel step correctly reads a barcode, verifies it to an actual record and assigns it to the package record without issue. However when I go to press the confirm package or confirm shipment, it gets lost and gives a generic error. If I remove the createtransitions part entirely, standard works. If I just remove my new custom state and keep the rest of the replace, it still breaks. Acumatica documentation on this is so poor, there are no examples explaining it. I thought perhaps I could maybe do an append instead of replace, but there are zero examples of that either.
Has anyone managed to add a barcode scanning step without breaking the rest of the functionality?
Thanks.
Andrew
