
Hi there,
I have a requirement that when i'm creating a transfer order and when i click on add in transfer line and selected a item, location,qunaitity will be 1 by defalut and i'm not changing it and when i clicked on save it has to validate that 1 quantity is available in the repective warehouse location if it is there it has to do normal standard functionality if it is not available it has to prompt a dialog box with YES Cancel button if i click on cancel it has to delete that line from that transfer order. I have written a code but it is not deleting the line. Kindly, please help me on achieving this requirement and i have written coc on form data source validatewrite() method of inventtransferline formdatasorce.
public boolean validateWrite()
{
boolean ret = true;
next validateWrite();
InventTransferLine inventTransferLine = this.cursor();
InventTable inventTable;
InventTransferTable inventTransferTable;
InventDim inventDim;
InventDimParm invDimParm;
Qty availPhys;
DialogButton diagbut;
select firstonly inventTable
where inventTable.ItemId == inventTransferLine.ItemId
join inventDim
where inventDim.inventDimId == inventTransferLine.InventDimId
join inventTransferTable
where inventTransferTable.TransferId == inventTransferLine.TransferId;
invDimParm.initFromInventDim(InventDim::find(inventDim.inventDimId));
availPhys = InventSum::findSum(inventTransferLine.ItemId,inventDim,invDimParm).availPhysicalCalculated();
if(inventTransferLine.QtyTransfer == 1 && availPhys == 0)
{
if(inventTable.customfield1 == NoYes::Yes)
{
diagbut = Box::okCancel(strFmt("@PG001004",inventTable.customfieldItemNumber),DialogButton::Cancel,"@SYS117647");
if (diagbut == DialogButton::Ok)
{
inventTransferLine.ItemId = inventTable.customfieldItemNumber;
ret = true;
}
else if (diagbut == DialogButton::Cancel)
{
ttsbegin;
inventTransferLine.doDelete();
ttscommit;
//this.research(true);
this.refresh();
ret = false;
}
}
}
return ret;
} Hi, Does it even create a transfer line. I think you are trying to delete transfer order lines which is not yet created. How about preventing creation of line and throwing error that no enough quantity available.