【发布时间】:2018-08-24 07:02:27
【问题描述】:
我有一个例行程序来发布发票并过帐到 v6.1 中的库存。我认为它也在 2017R2 中工作,但我不确定。它似乎在 2018R1 中根本不起作用。发票下达,但库存问题未下达。自动化都设置为自动发布问题,并且它们在手动处理时起作用。只有我的代码不会发布问题。我不知道为什么。有什么想法吗?
================================================ ==============
我已根据您的建议将代码更新到最新版本,但库存问题仍未发布。
foreach (EDASNShipment asnShipment in PXSelect<EDASNShipment,
Where<EDASNShipment.aSNNbr, Equal<Required<EDASN.aSNNbr>>>>.Select(this, asn.ASNNbr))
{
soShipmentGraph.Clear();
SOShipment soShipment = soShipmentGraph.Document.Search<SOShipment.shipmentNbr>(asnShipment.ShipmentNbr);
var soShipmentExt = PXCache<SOShipment>.GetExtension<SOShipmentExt>(soShipment);
SOOrderShipment soOrderShipment = PXSelect<SOOrderShipment,
Where<SOOrderShipment.shipmentNbr, Equal<Required<SOOrderShipment.shipmentNbr>>>>.Select(this, asnShipment.ShipmentNbr);
ARInvoice arInvoice = PXSelect<ARInvoice, Where<ARInvoice.refNbr, Equal<Required<ARInvoice.refNbr>>,
And<ARInvoice.docType, Equal<Required<ARInvoice.docType>>>>>.Select(this, soOrderShipment.InvoiceNbr, "INV");
if (soShipment.Status != "C")
{
if (autoReleaseInvoices)
{
if (arInvoice != null)
{
/*
soInvoiceGraph.Clear();
soInvoiceGraph.Document.Current = arInvoice;
soInvoiceGraph.release.Press();
var a = new PXAdapter(soShipmentGraph.Document)
{
Searches = new object[] { soShipment.ShipmentNbr }
};
//Note: Post Invoice to IN is Action 3
a.Arguments.Add("actionID", 3);
a.MassProcess = false; //Don't pop up invoice screen
a.MaximumRows = 1;
PXLongOperation.StartOperation(this, () =>
{
foreach (SOShipment shipment in soShipmentGraph.action.Press(a))
{
shipment.ShipmentNbr = shipment.ShipmentNbr;
}
});
*/
//Release Invoice
PXLongOperation.StartOperation(this, delegate ()
{
soInvoiceGraph.Clear();
soInvoiceGraph.Document.Current = arInvoice;
soInvoiceGraph.release.Press();
//Update IN on Shipment
soShipmentGraph.Clear();
soShipmentGraph.Document.Current =
soShipmentGraph.Document.Search<SOShipment.shipmentNbr>(asnShipment.ShipmentNbr);
soShipmentGraph.UpdateIN.Press();
});
}
else
{
statusText += String.Format("Acumatica Invoice could not be located: {0} ", soOrderShipment.InvoiceNbr);
errorOccurred = true;
bolAtLeastOneError = true;
}
}
}
soShipmentGraph.Clear();
soShipment = soShipmentGraph.Document.Search<SOShipment.shipmentNbr>(asnShipment.ShipmentNbr);
soShipmentExt = PXCache<SOShipment>.GetExtension<SOShipmentExt>(soShipment);
soShipmentExt.UsrEDIStatus = "S"; //Sent
soShipmentGraph.Document.Update(soShipment);
soShipmentGraph.Persist();
}
【问题讨论】: