Для Axapta 3.0
PHP код:
static void Fill_InventItemLocation(Args _args)
{
SysOperationProgress progressDlg;
InventItemLocation InventItemLocation;
InventLocation InventLocation;
InventDimSetup InventDimSetup;
InventTable InventTable;
InventBatch InventBatch;
ConfigTable ConfigTable;
InventColor InventColor;
InventSize InventSize;
InventDim InventDim;
boolean _Config, _Color, _Size, LoopConfig, LoopColor, LoopSize;
;
#aviFiles
if (box::yesNo("Заполнить InventItemLocation?",DialogButton::No,"Сделайте выбор","") == DialogButton::Yes)
{
progressDlg = new SysOperationProgress();
progressDlg.setAnimation(#AviFormLetter);
progressDlg.setCaption("Подождите...");
progressDlg.setText("Заполняется InventItemLocation");
progressDlg.setCount(1);
while select InventTable where InventTable.ItemType != ItemType::Service
{
while select InventLocation
{
_Config = InventDimSetup::find(InventTable.DimGroupId,fieldname2id(tablename2id("InventDim"),"ConfigId")).Active;
_Color = InventDimSetup::find(InventTable.DimGroupId,fieldname2id(tablename2id("InventDim"),"InventColorId")).Active;
_Size = InventDimSetup::find(InventTable.DimGroupId,fieldname2id(tablename2id("InventDim"),"InventSizeId")).Active;
LoopConfig = true;
LoopColor = true;
LoopSize = true;
select ConfigTable where ConfigTable.ItemId == InventTable.ItemId;
while (LoopConfig)
{
select InventColor where InventColor.ItemId == InventTable.ItemId;
while (LoopColor)
{
select InventSize where InventSize.ItemId == InventTable.ItemId;
while (LoopSize)
{
InventDim.clear();
if (_Config) InventDim.configId = ConfigTable.ConfigId;
if (_Color) InventDim.InventColorId = InventColor.InventColorId;
if (_Size) InventDim.InventSizeId = InventSize.InventSizeId;
InventDim.InventLocationId = InventLocation.InventLocationId;
InventDim = InventDim::findOrCreate(InventDim);
select InventItemLocation where InventItemLocation.ItemId == InventTable.ItemId &&
InventItemLocation.inventDimId == InventDim.inventDimId;
if (InventItemLocation.RecId == 0)
{
InventItemLocation.clear();
InventItemLocation.ItemId = InventTable.ItemId;
InventItemLocation.InventDimId = InventDim.InventDimId;
InventItemLocation.insert();
}
progressDlg.incCount();
LoopSize = (InventSize.RecId != 0);
if (LoopSize) next InventSize;
}
LoopColor = (InventColor.RecId != 0);
if (LoopColor) next InventColor;
}
LoopConfig = (ConfigTable.RecId != 0);
if (LoopConfig) next ConfigTable;
}
}
}
}
}