Sometimes we need ti create new location to use it through the system those code lines help in this Situation :
void CreateLocation(WMSAisleId aisleNo)
{
WMSAisle WMSaisle;
wmslocation _wmslocation;
;
try
{
select forupdate WMSaisle where WMSaisle.aisleId == aisleNo && WMSaisle.inventLocationId == inventLocationId ;
if(WMSaisle.RecId==0)
{
WMSaisle.clear();
WMSaisle.initValue();
WMSaisle.inventLocationId= inventLocationId;
WMSaisle.aisleId= aisleNo;
WMSaisle.name= strfmt("%1,aisle%2",inventLocationId,aisleNo);
WMSaisle.insert();
}
}
catch
{
Error(strfmt("Isle already exist %1,%2", inventLocationId,aisleNo));
}
select firstonly _wmslocation where _wmslocation.inventLocationId ==inventLocationId && _wmslocation.wMSLocationId == wmsLocationId;
if(_wmslocation.RecId== 0)
{
_wmslocation.clear();
_wmslocation.initValue();
_wmslocation.aisleId=aisleNo;
_wmslocation.wMSLocationId= wmsLocationId;
_wmslocation.inventLocationId = inventLocationId;
_wmslocation.insert();
}
}
void CreateLocation(WMSAisleId aisleNo)
{
WMSAisle WMSaisle;
wmslocation _wmslocation;
;
try
{
select forupdate WMSaisle where WMSaisle.aisleId == aisleNo && WMSaisle.inventLocationId == inventLocationId ;
if(WMSaisle.RecId==0)
{
WMSaisle.clear();
WMSaisle.initValue();
WMSaisle.inventLocationId= inventLocationId;
WMSaisle.aisleId= aisleNo;
WMSaisle.name= strfmt("%1,aisle%2",inventLocationId,aisleNo);
WMSaisle.insert();
}
}
catch
{
Error(strfmt("Isle already exist %1,%2", inventLocationId,aisleNo));
}
select firstonly _wmslocation where _wmslocation.inventLocationId ==inventLocationId && _wmslocation.wMSLocationId == wmsLocationId;
if(_wmslocation.RecId== 0)
{
_wmslocation.clear();
_wmslocation.initValue();
_wmslocation.aisleId=aisleNo;
_wmslocation.wMSLocationId= wmsLocationId;
_wmslocation.inventLocationId = inventLocationId;
_wmslocation.insert();
}
}
*This post is locked for comments