public inventDimId findorCreateInventdimId(InventBatchId _batchNo, InventSerialId _reelNo,ItemId _ItemId,InventdimId _InventdimId)
{
InventSerial InventSerial;
InventBatch InventBatch;
InventDim InventDimselect,InventDimLoc;
;
InventDimselect = InventDim::find(_InventdimId);
ttsBegin;
select /*itemId,InventBatchId from*/ forupdate InventBatch where InventBatch.itemId == _ItemId
&& InventBatch.inventBatchId == _batchNo;
if(!InventBatch)
{
InventBatch.itemId = _ItemId;
InventBatch.inventBatchId = _batchNo;
InventBatch.insert();
}
ttsCommit;
ttsBegin;
select /*InventSerialId,ItemId from*/ forupdate InventSerial where InventSerial.InventSerialId == _reelNo
&& InventSerial.ItemId == _ItemId;
if(!InventSerial)
{
InventSerial.InventSerialId = _reelNo;
InventSerial.ItemId = _ItemId;
InventSerial.insert();
}
ttsCommit;
select InventDimLoc where InventDimLoc.inventBatchId == _batchNo
&& InventDimLoc.inventSerialId == _reelNo
&& InventDimLoc.InventSiteId == InventDimselect.InventSiteId
&& InventDimLoc.InventLocationId == InventDimselect.InventLocationId
&& InventDimLoc.ConfigId == InventDimselect.ConfigId
&& InventDimLoc.InventSizeId == InventDimselect.InventSizeId
&& InventDimLoc.InventColorId == InventDimselect.InventColorId
&& InventDimLoc.InventStyleId == InventDimselect.InventStyleId
&& InventDimLoc.wmsLocationId == InventDimselect.wmsLocationId
&& InventDimLoc.wmsPalletId == InventDimselect.wmsPalletId
// Added License Plate & Inventory Status
&& InventDimLoc.LicensePlateId == InventDimselect.LicensePlateId
&& InventDimLoc.InventStatusId == InventDimselect.InventStatusId
// <GEERU>
&& InventDimLoc.InventGtdId_RU == InventDimselect.InventGtdId_RU
&& InventDimLoc.InventProfileId_RU == InventDimselect.InventProfileId_RU
&& InventDimLoc.InventOwnerId_RU == InventDimselect.InventOwnerId_RU;
if(InventDimLoc)
return InventDimLoc.inventDimId;
else
{
ttsBegin;
select forUpdate InventDimLoc;
InventDimLoc.inventDimId = InventDim::newDimId();
#inventDimDevelop
InventDimLoc.ConfigId = InventDimselect.ConfigId;
InventDimLoc.InventSizeId = InventDimselect.InventSizeId;
InventDimLoc.InventColorId = InventDimselect.InventColorId;
InventDimLoc.InventStyleId = InventDimselect.InventStyleId;
InventDimLoc.InventSiteId = InventDimselect.InventSiteId;
InventDimLoc.InventLocationId = InventDimselect.InventLocationId;
InventDimLoc.InventBatchId = _batchNo;//InventDimselect.InventBatchId;
InventDimLoc.wmsLocationId = InventDimselect.wmsLocationId;
InventDimLoc.wmsPalletId = InventDimselect.wmsPalletId;
InventDimLoc.InventSerialId = _reelNo;//InventDimselect.InventSerialId;
// Added License Plate & Inventory Status
InventDimLoc.LicensePlateId= InventDimselect.LicensePlateId;
InventDimLoc.InventStatusId= InventDimselect.InventStatusId;
// <GEERU>
InventDimLoc.InventGtdId_RU = InventDimselect.InventGtdId_RU;
InventDimLoc.InventProfileId_RU = InventDimselect.InventProfileId_RU;
InventDimLoc.InventOwnerId_RU = InventDimselect.InventOwnerId_RU;
// </GEERU>
InventDimLoc.insert(true);
ttsCommit;
return InventDimLoc.inventDimId;
}
// </GEERU>
//inventDim.insert(true);
}
/////////////////////////////inserting new dim id in inventdim table///////////////////
ttsBegin;
select forUpdate InventDimLoc;
InventDimLoc.inventDimId = InventDim::newDimId();
#inventDimDevelop
InventDimLoc.ConfigId = InventDimselect.ConfigId;
InventDimLoc.InventSizeId = InventDimselect.InventSizeId;
InventDimLoc.InventColorId = InventDimselect.InventColorId;
InventDimLoc.InventStyleId = InventDimselect.InventStyleId;
InventDimLoc.InventSiteId = InventDimselect.InventSiteId;
InventDimLoc.InventLocationId = InventDimselect.InventLocationId;
InventDimLoc.InventBatchId = _batchNo;//InventDimselect.InventBatchId;
InventDimLoc.wmsLocationId = InventDimselect.wmsLocationId;
InventDimLoc.wmsPalletId = InventDimselect.wmsPalletId;
InventDimLoc.InventSerialId = _reelNo;//InventDimselect.InventSerialId;
// Added License Plate & Inventory Status
InventDimLoc.LicensePlateId= InventDimselect.LicensePlateId;
InventDimLoc.InventStatusId= InventDimselect.InventStatusId;
// <GEERU>
InventDimLoc.InventGtdId_RU = InventDimselect.InventGtdId_RU;
InventDimLoc.InventProfileId_RU = InventDimselect.InventProfileId_RU;
InventDimLoc.InventOwnerId_RU = InventDimselect.InventOwnerId_RU;
// </GEERU>
InventDimLoc.insert(true);
ttsCommit;