简体   繁体   English

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

[英]Create a inventory movement journal in Dynamics AX 2012

This problem is driving me nuts... I don't know how to fix it. 这个问题使我发疯……我不知道该如何解决。 I'm trying to create an inventory movement journal entry using the ProfitLossJournalService. 我正在尝试使用ProfitLossJournalService创建库存移动日记帐分录。

The code below runs, but it shows the transaction in the "inventory adjustment" journal. 下面的代码运行,但是在“库存调整”日志中显示了交易。 I want it in the inventory movement jounal. 我希望在库存运动过程中获得成功。

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;
}
}

When you use the ProfitLossJournalService that is essentially what you are creating, an Inventory adjustment. 当您使用实质上是您要创建的ProfitLossJournalService ,将进行库存调整。

If you want to create an inventory movement journal, unfortunately there is no standard AIF service that does that. 如果要创建库存移动日记帐,很遗憾,没有标准的AIF服务可以这样做。 You would need to implement that yourself and expose it to AIF. 您将需要自己实现并将其公开给AIF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM