Eduardo
2010-08-05 22:50:03 UTC
Hi,
I have managed to be able to create a Transfer Order header and line with
the header status to "Created" thanks to the help of many of you.
However, I'm facing a situation that I cannot solve. Basicaly, I need to
transfer the items from Waehouse DOCK to Warehouse 001.
The header takes this information well, but when I'm creating the line,
unless I comment a method called CheckInventLocationId
(InventMov_TransferFrom class) I always get an error message saying that the
Warehouse From should be DOCK.
Now, the application is correct as when I create the line without going into
the method stated above, under the Dimenssions tab (line) the warehouse is
950 and the site DI, where these should be FR and DOCK.
The weird thing is that when I create the item directly into the form and
triggers the initFromInventTable method, everything is correct.
What am I missing? The following is the code. Thanks a lot!
static void TestTOCreation(Args _args)
{
InventLocationIdFrom fromLoc = 'DOCK';
InventLocationIdTo toLoc = '001';
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
NumberSequenceReference numberSequenceReference;
NumberSeq numberSeq;
Qty qtyTransfer;
ItemId itemId;
;
inventTransferTable.clear();
inventTransferTable.initValue();
numberSequenceReference = InventParameters::numRefTransferId();
numberSeq =
numberSeq::newGetNumFromCode(numberSequenceReference.NumberSequence);
ttsbegin;
inventTransferTable.TransferId = numberSeq.num();
ttscommit;
inventTransferTable.InventLocationIdFrom = fromLoc;
inventTransferTable.modifiedField(fieldNum(inventTransferTable,
InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = toLoc;
inventTransferTable.modifiedField(fieldNum(inventTransferTable,
InventLocationIdTo));
inventTransferTable.ShipDate = today();
inventTransferTable.ReceiveDate = today() + 21;
inventTransferTable.TransferStatus = InventTransferStatus::Created;
inventTransferTable.insert();
itemId = '01-3016-150';
qtyTransfer = 1020;
inventTransferLine.clear();
inventTransferLine.LineNum = 1;
inventTransferLine.initFromInventTransferTable(inventTransferTable,
NoYes::Yes);
inventTransferLine.ItemId = itemId;
inventTransferLine.initFromInventTable(InventTable::find(itemId));
inventTransferLine.QtyTransfer = qtyTransfer;
inventTransferLine.QtyRemainShip = qtyTransfer;
inventTransferLine.QtyRemainReceive = qtyTransfer;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
//this following line is where the update gets cancelled because of the
CheckinventLocation.
inventTransferLine.insert();
}
I have managed to be able to create a Transfer Order header and line with
the header status to "Created" thanks to the help of many of you.
However, I'm facing a situation that I cannot solve. Basicaly, I need to
transfer the items from Waehouse DOCK to Warehouse 001.
The header takes this information well, but when I'm creating the line,
unless I comment a method called CheckInventLocationId
(InventMov_TransferFrom class) I always get an error message saying that the
Warehouse From should be DOCK.
Now, the application is correct as when I create the line without going into
the method stated above, under the Dimenssions tab (line) the warehouse is
950 and the site DI, where these should be FR and DOCK.
The weird thing is that when I create the item directly into the form and
triggers the initFromInventTable method, everything is correct.
What am I missing? The following is the code. Thanks a lot!
static void TestTOCreation(Args _args)
{
InventLocationIdFrom fromLoc = 'DOCK';
InventLocationIdTo toLoc = '001';
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
NumberSequenceReference numberSequenceReference;
NumberSeq numberSeq;
Qty qtyTransfer;
ItemId itemId;
;
inventTransferTable.clear();
inventTransferTable.initValue();
numberSequenceReference = InventParameters::numRefTransferId();
numberSeq =
numberSeq::newGetNumFromCode(numberSequenceReference.NumberSequence);
ttsbegin;
inventTransferTable.TransferId = numberSeq.num();
ttscommit;
inventTransferTable.InventLocationIdFrom = fromLoc;
inventTransferTable.modifiedField(fieldNum(inventTransferTable,
InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = toLoc;
inventTransferTable.modifiedField(fieldNum(inventTransferTable,
InventLocationIdTo));
inventTransferTable.ShipDate = today();
inventTransferTable.ReceiveDate = today() + 21;
inventTransferTable.TransferStatus = InventTransferStatus::Created;
inventTransferTable.insert();
itemId = '01-3016-150';
qtyTransfer = 1020;
inventTransferLine.clear();
inventTransferLine.LineNum = 1;
inventTransferLine.initFromInventTransferTable(inventTransferTable,
NoYes::Yes);
inventTransferLine.ItemId = itemId;
inventTransferLine.initFromInventTable(InventTable::find(itemId));
inventTransferLine.QtyTransfer = qtyTransfer;
inventTransferLine.QtyRemainShip = qtyTransfer;
inventTransferLine.QtyRemainReceive = qtyTransfer;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
//this following line is where the update gets cancelled because of the
CheckinventLocation.
inventTransferLine.insert();
}