static void jay_getInventSum(Args _args)
{
InventDim inventDim;
inventDimParm inventDimParm;
InventOnhand inventOnhand;
InventLocationId inventLocationId = "J-001";
InventBatchId inventBatchId = "J-000003";
ItemId itemId = "J-iphone4";
Qty qty = 0;
;
inventDim.InventLocationId = inventLocationId;
inventDim.InventBatchId = inventBatchId;
inventDimParm.initFromInventDim(inventDim);
inventOnhand = InventOnhand::newParameters(itemId, inventDim, inventDimParm);
qty = inventOnHand.inventSum().availPhysical();
info(num2str(qty, 2, 2, 1, 2));
}
//计算某一天的现有量
static void findingOnHandByDate(Args _args)
{
ItemId itemId;
InventDim inventDimCriteria;
InventDimParm inventDimParm;
InventSumDateDim inventSumDateDim;
;
// Specify the item to get onhand info on
itemId = "1001";
inventDimCriteria.InventColorId = "02";
inventDimParm.initFromInventDim(inventDimCriteria);
inventSumDateDim =
InventSumDateDim::newParameters(mkdate(01,01,2009),
itemId,
inventDimCriteria,
inventDimParm);
info(strfmt("PostedQty: %1",inventSumDateDim.postedQty()));
info(strfmt("DeductedQty: %1",inventSumDateDim.deductedQty()));
info(strfmt("ReceivedQty: %1",inventSumDateDim.receivedQty()));
}
//现有量查询
static void jay_testInventSumQuery(Args _args)
{
query q;
queryRun qr;
InventSum inventSum;
InventDim inventDim;
InventDim inventDimValue;
InventDimParm inventDimParmCriteria;
inventDimParm inventDimParmGroupBy;
inventSumDateValueReportDim inventSumDateValueReportDim;
;
//维度(Dimension)条件
inventDimValue.InventLocationId = "NNLLC";
//inventDimValue.configId = "NZ-R";
//inventDimValue.inventBatchId = "00000000-000000";
//维度显示(有效)参数 过滤条件
inventDimParmCriteria.ItemIdFlag = NoYes::Yes;
//inventDimParmCriteria.InventLocationIdFlag = NoYes::Yes;
//inventDimParmCriteria.ConfigIdFlag = NoYes::Yes;
//inventDimParmCriteria.InventBatchIdFlag = NoYes::Yes;
//维度汇总参数
inventDimParmGroupBy.ItemIdFlag = NoYes::Yes;
//inventDimParmGroupBy.ConfigIdFlag = NoYes::Yes;
inventDimParmGroupBy.InventSiteIdFlag = NoYes::Yes;
//inventDimParmGroupBy.InventLocationIdFlag = NoYes::Yes;
//inventDimParmGroupBy.InventBatchIdFlag = NoYes::Yes;
q = new Query();
InventSum::newQuery(q,"Pro-000330",inventDimValue,inventDimParmCriteria,inventDimParmGroupBy);
//info(q.dataSourceNo(1).toString());
qr = new QueryRun(q);
while (qr.next())
{
inventDim = qr.get(tableNum(InventDim));
inventSum = qr.get(tableNum(InventSum));
info(num2str(inventSum.AvailPhysical, 2, 2, 2, 2) + " " + num2str(inventSum.PhysicalInvent, 2, 2, 2, 2));
}
}