X++:
public server WMSOrderTrans split(InventQty splitQty)
{
WMSOrderTrans WMSOrderTrans;
;
if ((splitQty <= 0) || (splitQty >= this.qty))
throw(error("@SYS25644"));
ttsbegin;
WMSOrderTrans.data(this);
WMSOrderTrans.qty = splitQty;
WMSOrderTrans.expectedExpeditionTime = this.expectedExpeditionTime * splitQty / this.qty;
WMSOrderTrans.volume = this.volume * splitQty / this.qty;
this.qty -= splitQty;
this.expectedExpeditionTime -= WMSOrderTrans.expectedExpeditionTime;
this.volume -= WMSOrderTrans.volume;
this.doUpdate();
WMSOrderTrans.doInsert();
ttscommit;
return WMSOrderTrans;
}