Вот модифицированный код и полученная ошибка. Используя отладку, я подтвердил, что это происходит на:
var ret = cmd.Select();
Вот полный код.
[PXFilterable]
public PXFilteredProcessing<EDASNShipProj, EDCreateASNFilter> Shipment;
protected virtual IEnumerable shipment()
{
int ii = 0;
foreach (var row in Shipment.Cache.Cached)
{
ii++;
yield return row;
}
if (ii == 0)
{
var cmd = new PXSelectJoin<SOShipment,
LeftJoin<SOOrderShipment, On<SOShipment.shipmentNbr, Equal<SOOrderShipment.shipmentNbr>>,
LeftJoin<SOOrder, On<SOOrder.orderNbr, Equal<SOOrderShipment.orderNbr>>>>,
Where2<Where2<Where2<Where2<Where2<Where2<Where2<
Where<Current<EDCreateASNFilter.customerID>, IsNull,
Or<SOOrderExt.usrEDICustomerId, Equal<Current<EDCreateASNFilter.customerID>>>>,
And<Where<Current<EDCreateASNFilter.startDate>, IsNull,
Or<SOShipment.shipDate, GreaterEqual<Current<EDCreateASNFilter.startDate>>>>>>,
And<Where<SOShipment.shipDate, LessEqual<Current<EDCreateASNFilter.endDate>>>>>,
And<Where<Current<EDCreateASNFilter.shipVia>, IsNull,
Or<SOShipment.shipVia, Equal<Current<EDCreateASNFilter.shipVia>>>>>>,
And<Where<Current<EDCreateASNFilter.truckNbr>, IsNull,
Or<SOShipmentExt.usrTruckNbr, Equal<Current<EDCreateASNFilter.truckNbr>>>>>>,
And<Where<SOShipment.status, Equal<SOShipmentStatus.open>>>>,
And<Where<SOShipmentExt.usrEDIStatus, Equal<SOShipmentEDIStatus.truckAssigned>,
Or<SOShipmentExt.usrEDIStatus, Equal<SOShipmentEDIStatus.newStat>>>>>,
And<Where<SOOrder.customerRefNbr, IsNotNull>>>,
OrderBy<Asc<SOShipment.customerID,
Asc<SOOrderExt.usrEDICustomerId,
Asc<SOOrderExt.usrEDICustomerVendorId,
Asc<SOShipment.shipVia,
Asc<SOShipmentExt.usrTruckNbr,
Asc<SOShipment.customerLocationID>>>>>>>>(this);
cmd.View.Clear();
var ret = cmd.Select();
if (ret != null)
{
EDASNShipProj shipProj = new EDASNShipProj();
foreach (PXResult<SOShipment, SOOrderShipment, SOOrder> record in ret)
{
shipProj = new EDASNShipProj();
SOShipment shipment = (SOShipment)record;
SOShipmentExt soShipmentExt = shipment.GetExtension<SOShipmentExt>();
SOOrder soOrder = (SOOrder)record;
SOOrderExt soOrderExt = soOrder.GetExtension<SOOrderExt>();
shipProj.OrderNbr = soOrder.OrderNbr;
shipProj.CustomerRefNbr = soOrder.CustomerRefNbr;
shipProj.CustomerOrderNbr = soOrder.CustomerOrderNbr;
shipProj.UsrTruckNbr = soShipmentExt.UsrTruckNbr;
shipProj.UsrEDICustomerId = soOrderExt.UsrEDICustomerId;
shipProj.UsrEDICustomerVendorId = soOrderExt.UsrEDICustomerVendorId;
shipProj.UsrEDIStatus = soShipmentExt.UsrEDIStatus;
shipProj.CustomerID = shipment.CustomerID;
shipProj.CustomerLocationID = shipment.CustomerLocationID;
shipProj.ShipVia = shipment.ShipVia;
shipProj.ShipmentNbr = shipment.ShipmentNbr;
shipProj.ShipDate = shipment.ShipDate;
shipProj = Shipment.Insert(shipProj);
Shipment.Cache.SetStatus(shipProj, PXEntryStatus.Held);
yield return shipProj;
}
}
Shipment.Cache.IsDirty = false;