时点现有量JOB

qty availQty(ItemId _PitemId,InventLocationId _InventLocationId,TransDate pointDate)
{
  Query _Query;
  QueryRun _QueryRun;
  InventSum inventsum;
  InventDim InventDim;

  inventDim inventDimCriteria;
  inventdimparm inventDimparmCriteria;
  inventDimParm inventDimparmGroupby;
  InventSumDatePhysicalDim inventSumDateDim;
  Qty availQty ;
  ;

  inventDimCriteria.clear();
  inventDimCriteria.InventLocationId = _InventLocationId;

  inventDimparmCriteria.clear();
  inventDimparmCriteria.ItemIdFlag = Noyes::Yes;
  inventDimparmCriteria.InventLocationIdFlag = Noyes::Yes;

  inventDimparmGroupby.clear();
  inventDimparmGroupby.ItemIdFlag =Noyes::Yes;
  inventDimparmGroupby.InventLocationIdFlag =Noyes::Yes;

  _Query = new Query();
  Inventsum::newQuery(_Query,_PitemId,inventDimCriteria,inventDimparmCriteria,inventDimparmGroupby);

  _queryRun = new QueryRun(_query);
  while(_queryrun.next())
  {
    inventsum = _Queryrun.get(tablenum(InventSum));
    inventDim = _QueryRun.get(tablenum(InventDim));

    inventSumDateDim=InventSumDatePhysicalDim::newParameters(pointDate,

                                  InventSum.ItemId,

                                  inventdim,

                                  inventDimparmCriteria);
    availQty = inventSumDateDim.postedQty()+ inventSumDateDim.receivedQty() -

         InventSumDateDim.deductedQty() + InventSumDateDim.registeredQty() -InventSumDateDim.pickedQty();

  }

  return availQty;

}

posted @ 2019-06-17 10:32  学习是进步的阶梯  阅读(166)  评论(0编辑  收藏  举报