static void insertColor(Args _args)
{
EcoResProductMaster ecoResProductMaster;
EcoResProductIdentifier ecoResProductIdentifier;
EcoResProductDimensionGroupProduct ecoResProductDimensionGroupProduct;
EcoResProductMasterModelingPolicy ecoResProductMasterModelingPolicy;
EcoResConfiguration ecoResConfiguration;
EcoResProductMasterConfiguration ecoResProductMasterConfiguration;
EcoResSize ecoResSize;
EcoResProductMasterSize ecoResProductMasterSize;
EcoResColor ecoResColor;
EcoResProductMasterColor EcoResProductMasterColor;
EcoResDistinctProductVariant ecoResDistinctProductVariant;
EcoResProductVariantConfiguration ecoResProductVariantConfiguration;
InventTable inventTable;
InventTableModule inventTableModule;
InventItemSetupSupplyType inventItemSetupSupplyType;
InventDim inventDim,inventdim1;
InventDimCombination inventDimCombination;
int x,y;
str s1,s2,s3;
//ecoresproductMas
ItemMasterRMVAR Table;
;
try
{
while select ecoResProductMaster where ecoResProductMaster.DisplayProductNumber like "Pj*" // == "CFAR33A13293" //like "DC*"
// join ecoresprodcutdimension
//like "CFIN*" //= ecoResProductMaster::find(5637159868);
//&& ecoResProductMaster.ite
{
//Product translation
EcoResProductTranslation::createOrUpdateTranslation(ecoResProductMaster.RecId, ecoResProductMaster.SearchName,ecoResProductMaster.SearchName);
//"ART-Blue-33x33x09", "ART-Blue-33x33x09");
//Strscan(ecoResProductMaster.SearchName,"-",4,6);
x =Strscan(ecoResProductMaster.SearchName,"-",0,strLen(ecoResProductMaster.SearchName));
s1 =substr(ecoResProductMaster.SearchName,x+1,strLen(ecoResProductMaster.SearchName));
y =Strscan(s1,"-",0,strLen(s1));
s2 =substr(s1,0,y-1);
s3 =substr(s1,y+1,strLen(s1));
info(strFmt("%1 %2 %3 %4 %5 %6",s2,s3));
//Configuration
// ecoResSize = EcoResSize::findByName(s2);
ecoResConfiguration = EcoResConfiguration::findByName(s2);
if (!ecoResConfiguration)
{
ecoResConfiguration.clear();
ecoResConfiguration.initValue();
ecoResConfiguration.Name = s2;
ecoResConfiguration.insert();
}
//Configuration assigned to product master
if(!ecoResProductMasterConfiguration::find(ecoResProductMaster.RecId,ecoResConfiguration.RecId))
{
ecoResProductMasterConfiguration.clear();
ecoResProductMasterConfiguration.initValue();
ecoResProductMasterConfiguration.Configuration = ecoResConfiguration.RecId;
ecoResProductMasterConfiguration.Description = s2;
ecoResProductMasterConfiguration.ConfigProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, ConfigId));
ecoResProductMasterConfiguration.ConfigProductMaster = ecoResProductMaster.RecId;
ecoResProductMasterConfiguration.insert();
}
inventDim.clear();
inventDim.configId = s2;/*ConfigId*/
inventDim = InventDim::findOrCreate(inventDim);
/*inventDim1.clear();
inventDim1.InventSizeId = s3;/*ConfigId*/
inventDim1 = InventDim::findOrCreate(inventDim1);*/
/*//Released product variant
inventDimCombination.clear();
inventDimCombination.initValue();
inventDimCombination.DistinctProductVariant = ecoResDistinctProductVariant.RecId;
inventDimCombination.ItemId = inventTable.ItemId;
inventDimCombination.InventDimId = inventDim.InventDimId;
inventDimCombination.insert();*/
}
// }
}
catch
{
error("Error!");
return;
}
info("Done!");
}
{
EcoResProductMaster ecoResProductMaster;
EcoResProductIdentifier ecoResProductIdentifier;
EcoResProductDimensionGroupProduct ecoResProductDimensionGroupProduct;
EcoResProductMasterModelingPolicy ecoResProductMasterModelingPolicy;
EcoResConfiguration ecoResConfiguration;
EcoResProductMasterConfiguration ecoResProductMasterConfiguration;
EcoResSize ecoResSize;
EcoResProductMasterSize ecoResProductMasterSize;
EcoResColor ecoResColor;
EcoResProductMasterColor EcoResProductMasterColor;
EcoResDistinctProductVariant ecoResDistinctProductVariant;
EcoResProductVariantConfiguration ecoResProductVariantConfiguration;
InventTable inventTable;
InventTableModule inventTableModule;
InventItemSetupSupplyType inventItemSetupSupplyType;
InventDim inventDim,inventdim1;
InventDimCombination inventDimCombination;
int x,y;
str s1,s2,s3;
//ecoresproductMas
ItemMasterRMVAR Table;
;
try
{
while select ecoResProductMaster where ecoResProductMaster.DisplayProductNumber like "Pj*" // == "CFAR33A13293" //like "DC*"
// join ecoresprodcutdimension
//like "CFIN*" //= ecoResProductMaster::find(5637159868);
//&& ecoResProductMaster.ite
{
//Product translation
EcoResProductTranslation::createOrUpdateTranslation(ecoResProductMaster.RecId, ecoResProductMaster.SearchName,ecoResProductMaster.SearchName);
//"ART-Blue-33x33x09", "ART-Blue-33x33x09");
//Strscan(ecoResProductMaster.SearchName,"-",4,6);
x =Strscan(ecoResProductMaster.SearchName,"-",0,strLen(ecoResProductMaster.SearchName));
s1 =substr(ecoResProductMaster.SearchName,x+1,strLen(ecoResProductMaster.SearchName));
y =Strscan(s1,"-",0,strLen(s1));
s2 =substr(s1,0,y-1);
s3 =substr(s1,y+1,strLen(s1));
info(strFmt("%1 %2 %3 %4 %5 %6",s2,s3));
//Configuration
// ecoResSize = EcoResSize::findByName(s2);
ecoResConfiguration = EcoResConfiguration::findByName(s2);
if (!ecoResConfiguration)
{
ecoResConfiguration.clear();
ecoResConfiguration.initValue();
ecoResConfiguration.Name = s2;
ecoResConfiguration.insert();
}
//Configuration assigned to product master
if(!ecoResProductMasterConfiguration::find(ecoResProductMaster.RecId,ecoResConfiguration.RecId))
{
ecoResProductMasterConfiguration.clear();
ecoResProductMasterConfiguration.initValue();
ecoResProductMasterConfiguration.Configuration = ecoResConfiguration.RecId;
ecoResProductMasterConfiguration.Description = s2;
ecoResProductMasterConfiguration.ConfigProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, ConfigId));
ecoResProductMasterConfiguration.ConfigProductMaster = ecoResProductMaster.RecId;
ecoResProductMasterConfiguration.insert();
}
inventDim.clear();
inventDim.configId = s2;/*ConfigId*/
inventDim = InventDim::findOrCreate(inventDim);
/*inventDim1.clear();
inventDim1.InventSizeId = s3;/*ConfigId*/
inventDim1 = InventDim::findOrCreate(inventDim1);*/
/*//Released product variant
inventDimCombination.clear();
inventDimCombination.initValue();
inventDimCombination.DistinctProductVariant = ecoResDistinctProductVariant.RecId;
inventDimCombination.ItemId = inventTable.ItemId;
inventDimCombination.InventDimId = inventDim.InventDimId;
inventDimCombination.insert();*/
}
// }
}
catch
{
error("Error!");
return;
}
info("Done!");
}
No comments:
Post a Comment