public class ssUploadInventClassification_VS extends RunBase
{
CommaIO
csvFile;
Filename
filename;
container readCon;
counter
inserted;
args args;
DialogField
dialogFilename;
InventTable
inventTable;
ItemId
itemId;
#define.CurrentVersion(2)
#localmacro.CurrentList
filename,
inserted,
#endmacro
#localmacro.ListVersion1
filename,
inserted
#endmacro
#File
}
public Object dialog()
{
DialogRunbase dialog = super();
;
dialog.caption("Update inventory ABC
Classification");
dialogFilename = dialog.addField(extendedTypeStr(FilenameOpen));
dialogFilename.value(filename);
dialog.filenameLookupFilter(["All
files", #AllFiles]);
return dialog;
}
public boolean getFromDialog()
{
filename = dialogFilename.value();
return true;
}
void run()
{
boolean first = true;
;
csvFile = new
CommaIO(filename, 'r');
try
{
if
(csvFile)
{
ttsbegin;
while
(csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
if
(readCon)
{
//inventTable.clear();
itemId = conPeek(readCon,1);
while
select forUpdate
inventTable
where inventTable.ItemId == itemId
{
inventTable.ssClassificationCode
= conPeek(readCon,2);
inventTable.ssClassificationName
= conPeek(readCon,3);
inventTable.update();
}
/*if(!ReqItemTable::find(reqItemTableGlobal.ItemId,
reqItemTableGlobal.CovInventDimId) && reqItemTableGlobal.itemId)
{
reqItemTableGlobal.insert();
inserted++;
info(strFmt("%1
inserted",inserted));
}*/
}
}
ttsCommit;
}
}
catch(Exception::Error)
{
info(strFmt("%1 %2",Exception::Error,inserted));
}
}
static void main(Args args)
{
ssUploadInventClassification_VS
uploadInventClassification;
;
uploadInventClassification = new ssUploadInventClassification_VS();
if
(uploadInventClassification.prompt())
{
uploadInventClassification.run();
}
}
No comments:
Post a Comment