Axapta 在Dynamics AX 2012中创建库存变动日记帐

Axapta 在Dynamics AX 2012中创建库存变动日记帐,axapta,dynamics-ax-2012,x++,Axapta,Dynamics Ax 2012,X++,这个问题快把我逼疯了。。。我不知道怎么修理它。我正在尝试使用ProfitLossJournalService创建库存移动日记账条目 下面的代码运行,但它在“库存调整”日记账中显示了该交易记录。我想在《库存运动》杂志上看到 public void UpdateInventoryForConsumableItem(InventoryUpdate update) { var svc = new ProfitLossJournalServiceClient(); var cc = new CallCon

这个问题快把我逼疯了。。。我不知道怎么修理它。我正在尝试使用ProfitLossJournalService创建库存移动日记账条目

下面的代码运行,但它在“库存调整”日记账中显示了该交易记录。我想在《库存运动》杂志上看到

public void UpdateInventoryForConsumableItem(InventoryUpdate update)
{
var svc = new ProfitLossJournalServiceClient();
var cc = new CallContext {Company = "SS"};
var journal = new AxdProfitLossJournal();


var table = new AxdEntity_InventJournalTable
{
InventDimFixedSpecified = false,
InventSiteId = "MC",
InventLocationId = "MAIN WH",
JournalType = AxdEnum_InventJournalType.Movement,
JournalNameId = "InvMovJour",
Description = Constants.InventoryMovementJournalDescription,

NumOfLines = 1,
NumOfLinesSpecified = true,
JournalTypeSpecified = true,
JournalId = "InvMovJour",
JournalIdOrignal = "InvMovJour",
action = AxdEnum_AxdEntityAction.update
};


var inventoryDims = new AxdEntity_InventDim
{
InventLocationId = "MAIN WH",
InventDimId = update.InventoryDimId,
InventColorId = update.Color,
InventSiteId = "MC",
InventSizeId = update.Size,
InventStyleId = update.Style,
action = AxdEnum_AxdEntityAction.create
};


var entry = new AxdEntity_InventJournalTrans
{
InventDimId = update.InventoryDimId,
TransDate = DateTime.Now,
ItemId = update.ItemId,
CostMarkupSpecified = false,
InventRefTypeSpecified = false,
LineNumSpecified = false,
JournalType = AxdEnum_InventJournalType.Movement,
JournalTypeSpecified = true,
Qty = update.Quantity,
QtySpecified = true,
InventDim = new AxdEntity_InventDim[1] {inventoryDims}
};



table.InventJournalTrans = new[] {entry};

journal.InventJournalTable = new[] {table};


try
{
var result = svc.create(cc, journal);

Logger.LogTrace(string.Format("sending InventoryTransferJournal {0}", result.GetValue(0)));
Logger.LogEvent(Logger.SentConsumableInventoryUpdateToDynamics);
}
catch (Exception e)
{
Logger.LogException(e);

throw;
}
}

当您使用基本上就是您创建的
ProfitLossJournalService
时,库存调整

如果您想创建库存移动日志,很遗憾,没有标准的AIF服务可以做到这一点。您需要自己实现它并将其暴露于AIF