在Acumatica中使用MoveEntry API来移动库存。但是,在使用该API时注意到一个问题,即在移动库存时未生成批号。下面是解决该问题的示例代码:
示例代码:
InventoryItem res = new InventoryItem();
LotSerialNbrAttribute lotSerialAttr = new LotSerialNbrAttribute();
...
// Get the lot/serial number from the source location
string lotSerialNbr = lotSerialAttr.ValFromReturnLotSerialNbr(sourceLocation);
// Create a new lot/serial number on the destination
if (lotSerialAttr.IsTrackSerial(lotSerialNbr) || lotSerialAttr.IsTrack(lotSerialNbr))
{
lotSerialNbr = lotSerialAttr.CreateNumber(res, DateTime.UtcNow);
}
// Move the item at the source location to the destination location
inventoryGraph.moveEntry.MoveQty(new PX.Objects.IN.InventoryTransfer()
{
InventoryID = source.InventoryID,
SiteID = source.LocationID,
ToSiteID = dest.LocationID,
SubItemID = source.SubItemID,
LotSerialNbr = lotSerialNbr,
Qty = qty,
});
通过在目标地点创建新的批号 /序列号,此代码段显示如何在Acumatica中创建丢失的批号。 然后将该批次指定为移动项的一部分。