代码过帐采购装箱单

static void WL_YZF_PurchPackingSlipPost(Args _args)
{
PurchFormLetter_PackingSlip purchFormLetter;
sysQueryRun chooseLinesQuery;

PurchParmUpdate purchParmUpdate;
PurchLine line,updateLine;
PurchTable table;
PurchParmTable parmTable;
InventDim dim;
PurchId purchId = "PO18/027037";
boolean success = true;
;
table = PurchTable::find(PurchId);

ttsbegin;
while select forupdate line where line.PurchId == purchId
{
line.PurchReceivedNow = line.RemainPurchPhysical;
line.setInventReceivedNow();
line.update();
}

chooseLinesQuery = new sysQueryRun(queryStr(PurchUpdate));
chooseLinesQuery.query().dataSourceTable(TableNum(PurchTable)).addRange(fieldNum(PurchTable,purchId)).value(QueryValue(PurchId));
chooseLinesQuery.query().interactive(false);
chooseLinesQuery.saveUserSetup(false);

purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);

purchFormLetter.chooseLinesQuery (chooseLinesQuery);
purchFormLetter.purchTable (table);
purchFormLetter.transDate (systemdateget());
purchFormLetter.specQty (PurchUpdate::ReceiveNow);
purchFormLetter.printFormLetter (NoYes::No);
purchFormLetter.splitDeliveryInformation(NoYes::No);
purchFormLetter.sumBy (AccountOrder::Auto);
purchFormLetter.creditRemaining (true);

purchFormLetter.createParmUpdate(false);
purchFormLetter.chooseLines();
purchFormLetter.setForUpdatePurchParmTable();
purchFormLetter.reArrangeNow(true);

parmTable = purchFormLetter.currentPurchParmTable();
parmTable.Num = strfmt("20181010A");

if (!parmTable)
throw checkFailed("没有订单行可过账.");

parmTable.selectForUpdate(true);

parmTable.TransDate = systemDateGet();

parmTable.write();

purchFormLetter.run();

ttscommit;
}

posted @ 2019-06-08 11:06  学习是进步的阶梯  阅读(218)  评论(0)    收藏  举报