转移单的装运和收货
正如前文所说的,AX的很多功能与窗体绑定了,需要剥离出来,有一些类提供了供其他代码直接调用的方法,比如PurchFormLetter及SalesFormLetter的Update方法,它们就帮忙处理了Parm*等一系列的表,并自动过账,于是客户段代码可以很方便地调用它们。但也有一些类没有提供类似的方法,就需要我们自己去处理Parm*表,比如转移单的装运和收货,本文仿照PurchFormLetter的方式给转移单对应的类添加方法,以期实现类似的效果,供客户端类调用。
1.给类InventTransferUpdate添加构造方法:
1.给类InventTransferUpdate添加构造方法:
static InventTransferUpd construct(InventTransferUpdateType _InventTransferUpdateType)
{
;
switch(_InventTransferUpdateType)
{
case InventTransferUpdateType::PickingList:
{
if (InventParameters::logisticsRegistrationEnabled())
return InventTransferUpdPick_Journal::construct();
return InventTransferUpdPick_Pick::construct();
break;
}
case InventTransferUpdateType::Shipment:
return InventTransferUpdShip::construct();
break;
case InventTransferUpdateType::Receive:
return InventTransferUpdReceive::construct();
break;
default:
break;
}
}
{
;
switch(_InventTransferUpdateType)
{
case InventTransferUpdateType::PickingList:
{
if (InventParameters::logisticsRegistrationEnabled())
return InventTransferUpdPick_Journal::construct();
return InventTransferUpdPick_Pick::construct();
break;
}
case InventTransferUpdateType::Shipment:
return InventTransferUpdShip::construct();
break;
case InventTransferUpdateType::Receive:
return InventTransferUpdReceive::construct();
break;
default:
break;
}
}
2.给类InventTransferUpdate添加updateShip和updateReceive方法:
发货:
void updateShip(InventTransferId _inventTransferId, //InventTransfer Order Number
InventTransferShipUpdateQty _inventTransferShipUpdateQty, //Ship Qty the value is Enum:InventTransferShipUpdateQty
InventTransferEditLines _editLines = NoYes::No,
InventTransferAutoReceiveQty _autoReceiveQty = NoYes::No,
NoYes _printTransferPickingList = NoYes::No,//print pick list
NoYes _printTransferReceipt = NoYes::No,//print transfer receipt
NoYes _printTransferShip = NoYes::No,//print transfer ship
TransDate _transDate = SystemDateGet())
{
InventTransferParmTable localInventTransferParmTable;
;
localInventTransferParmTable.skipTTSCheck(true);
localInventTransferParmTable.TransferId = _inventTransferId;
localInventTransferParmTable.AutoReceiveQty = _autoReceiveQty;
localInventTransferParmTable.ShipUpdateQty = _inventTransferShipUpdateQty;
localInventTransferParmTable.EditLines = _editLines;
localInventTransferParmTable.TransDate = _transDate;
localInventTransferParmTable.PrintTransferPickingList = _printTransferPickingList;
localInventTransferParmTable.PrintTransferReceipt = _printTransferReceipt;
localInventTransferParmTable.PrintTransferShipment = _printTransferShip;
localInventTransferParmTable.ParmBuffer::initParmId();
localInventTransferParmTable.write();
this.parmParmBuffer(localInventTransferParmTable);
this.run();
}
InventTransferShipUpdateQty _inventTransferShipUpdateQty, //Ship Qty the value is Enum:InventTransferShipUpdateQty
InventTransferEditLines _editLines = NoYes::No,
InventTransferAutoReceiveQty _autoReceiveQty = NoYes::No,
NoYes _printTransferPickingList = NoYes::No,//print pick list
NoYes _printTransferReceipt = NoYes::No,//print transfer receipt
NoYes _printTransferShip = NoYes::No,//print transfer ship
TransDate _transDate = SystemDateGet())
{
InventTransferParmTable localInventTransferParmTable;
;
localInventTransferParmTable.skipTTSCheck(true);
localInventTransferParmTable.TransferId = _inventTransferId;
localInventTransferParmTable.AutoReceiveQty = _autoReceiveQty;
localInventTransferParmTable.ShipUpdateQty = _inventTransferShipUpdateQty;
localInventTransferParmTable.EditLines = _editLines;
localInventTransferParmTable.TransDate = _transDate;
localInventTransferParmTable.PrintTransferPickingList = _printTransferPickingList;
localInventTransferParmTable.PrintTransferReceipt = _printTransferReceipt;
localInventTransferParmTable.PrintTransferShipment = _printTransferShip;
localInventTransferParmTable.ParmBuffer::initParmId();
localInventTransferParmTable.write();
this.parmParmBuffer(localInventTransferParmTable);
this.run();
}
收货:
Code
3.调用示例:
发货:
InventTransferUpd inventTransferUpd = InventTransferUpd::construct(InventTransferUpdateType::Shipment);
inventTransferUpd.update('00031_080',InventTransferShipUpdateQty::PickedQty);
收货:inventTransferUpd.update('00031_080',InventTransferShipUpdateQty::PickedQty);
Code