static void SHP_ItemSiteWarehouseUpdate(Args _args)
{
InventDim inventdimTo;//To create the buffer for new inventDim for updated warehouse.
InventDim inventdim, inventdimCount;
InventDim inventdimTo2;//To find or create new inventDimId for update in reqItemTable.
InventDim inventdimLoc;//To get the buffer of inventDIim inside while loop.
ReqItemTable reqitemtable, reqitemtableUpd, reqitemtableCount;
Counter counter;
/*select count(recId) from reqitemtableCount group by CovInventDimId
exists join inventdimCount
where inventdimCount.InventSiteId == 'PL' &&
inventdimCount.InventLocationId == 'WARE' &&
reqitemtableCount.CovInventDimId == inventdimCount.inventDimId;
info(strFmt("%1",reqitemtableCount.RecId));*/
while select reqitemtable group by CovInventDimId
join inventdim
where inventdim.InventSiteId == 'PL' &&
inventdim.InventLocationId == 'WARE' &&
reqitemtable.CovInventDimId == inventdim.inventDimId
{
counter += 1;
inventdimLoc = InventDim::find(reqitemtable.CovInventDimId);
info(inventdimLoc.inventDimId + inventdimLoc.InventLocationId + inventdimLoc.InventSiteId);
inventdimTo.InventSiteId = 'PL';
inventdimTo.InventLocationId = 'POLUDNIOWA';
inventdimTo.configId = inventdimLoc.configId;
inventdimTo.InventStyleId = inventdimLoc.InventStyleId;
inventdimTo.wMSLocationId = inventdimLoc.wMSLocationId;
inventdimTo.inventBatchId = inventdimLoc.inventBatchId;
inventdimTo.InventColorId = inventdimLoc.InventColorId;
inventdimTo.inventSerialId = inventdimLoc.inventSerialId;
inventdimTo.InventStatusId = inventdimLoc.InventStatusId;
inventdimTo.LicensePlateId = inventdimLoc.LicensePlateId;
inventdimTo.wmsPalletId = inventdimLoc.wmsPalletId;
inventdimTo2 = inventdim::findOrCreate(inventdimTo);
update_recordSet reqitemtableUpd
setting CovInventDimId = inventdimTo2.inventDimId where
reqitemtableUpd.CovInventDimId == inventdimLoc.inventDimId;
}
info('done, records updated in item coverage');
}
{
InventDim inventdimTo;//To create the buffer for new inventDim for updated warehouse.
InventDim inventdim, inventdimCount;
InventDim inventdimTo2;//To find or create new inventDimId for update in reqItemTable.
InventDim inventdimLoc;//To get the buffer of inventDIim inside while loop.
ReqItemTable reqitemtable, reqitemtableUpd, reqitemtableCount;
Counter counter;
/*select count(recId) from reqitemtableCount group by CovInventDimId
exists join inventdimCount
where inventdimCount.InventSiteId == 'PL' &&
inventdimCount.InventLocationId == 'WARE' &&
reqitemtableCount.CovInventDimId == inventdimCount.inventDimId;
info(strFmt("%1",reqitemtableCount.RecId));*/
while select reqitemtable group by CovInventDimId
join inventdim
where inventdim.InventSiteId == 'PL' &&
inventdim.InventLocationId == 'WARE' &&
reqitemtable.CovInventDimId == inventdim.inventDimId
{
counter += 1;
inventdimLoc = InventDim::find(reqitemtable.CovInventDimId);
info(inventdimLoc.inventDimId + inventdimLoc.InventLocationId + inventdimLoc.InventSiteId);
inventdimTo.InventSiteId = 'PL';
inventdimTo.InventLocationId = 'POLUDNIOWA';
inventdimTo.configId = inventdimLoc.configId;
inventdimTo.InventStyleId = inventdimLoc.InventStyleId;
inventdimTo.wMSLocationId = inventdimLoc.wMSLocationId;
inventdimTo.inventBatchId = inventdimLoc.inventBatchId;
inventdimTo.InventColorId = inventdimLoc.InventColorId;
inventdimTo.inventSerialId = inventdimLoc.inventSerialId;
inventdimTo.InventStatusId = inventdimLoc.InventStatusId;
inventdimTo.LicensePlateId = inventdimLoc.LicensePlateId;
inventdimTo.wmsPalletId = inventdimLoc.wmsPalletId;
inventdimTo2 = inventdim::findOrCreate(inventdimTo);
update_recordSet reqitemtableUpd
setting CovInventDimId = inventdimTo2.inventDimId where
reqitemtableUpd.CovInventDimId == inventdimLoc.inventDimId;
}
info('done, records updated in item coverage');
}