我想以编程方式取消AX 2009中所有状态为BackOrder且小于特定日期的销售订单。
我设法通过运行以下Job来完成此操作
static void SalesOrderUpdate(Args _args)
{
SalesTable salesTable;
SalesLine salesLine;
int i;
;
changecompany ('10')
{
ttsBegin;
while select forUpdate salesTable
where salesTable.SalesStatus == SalesStatus::Backorder
&& salesTable.ReceiptDateRequested <= 31\12\2016
&& salesTable.ShippingDateRequested <= 31\12\2016
join forUpdate salesLine
where salesLine.SalesId == salesTable.SalesId
{
i++;
salesLine.RemainSalesPhysical = 0;
salesLine.RemainInventPhysical = 0;
salesLine.update();
}
ttsCommit;
}
info(int2Str(i));
}