If a transfer order haven't got completed and that left QTY's related with an output order and reserved, Functions->Deliver remainder->Cancel quantity button will not work. It'll get an error about "there's not enough QTY with ordered" and quit. It's about that QTY reserved with output order and can't unreserve (At least I couldn't a way) direct with one line code. If you even unreserve from menu, relation will still stay and you'll get that error again. In first tie with output order should be break. I couldn't a way break relation with standart code and found this way, it seem works:
InventTransferTable header;
InventTransferLine line;
WMSOrderTrans orderTrans;
InventTrans inventTrans;
;
while select header
where header.TransferId == myTransferId
join forupdate line
where line.TransferId == header.TransferId &&
(line.QtyRemainReceive > 0 || line.QtyRemainShip>0)
{
ttsbegin;
while select orderTrans
where orderTrans.inventTransId == line.InventTransId &&
orderTrans.expeditionStatus != WMSExpeditionStatus::Complete &&
orderTrans.expeditionStatus != WMSExpeditionStatus::Cancelled &&
orderTrans.expeditionStatus != WMSExpeditionStatus::CancelledSW
{
WmsPickingLineCancel::newWMSPickingLineCancel(orderTrans).run();
}
while select forupdate inventTrans
where (inventTrans.StatusIssue == StatusIssue::ReservPhysical ||
(inventTrans.TransChildRefId != "" &&
inventTrans.TransChildType == InventTransChildType::WMSOrder) ) &&
inventTrans.InventTransId == line.InventTransId
{
inventTrans.TransChildRefId = "";
inventTrans.TransChildType = InventTransChildType::None;
inventTrans.update();
InventUpd_Reservation::newInventDim(InventMovement::construct(inventTrans,InventMovSubType::None),
inventtrans.inventDim(),2,false).updateNow();
}
line.QtyRemainReceive = 0;
line.QtyRemainShip = 0;
line.AutoReservation = NoYes::No;
line.update();
ttscommit;
}
Hiç yorum yok:
Yorum Gönder