Промаявшись с импортом проводок по клиентам, решил в классе SysDataImport заменить пару временных таблиц на Map
X++:
class SysDataImport extends SysDataExpImp implements sysDeleteTables
{
...
// шустрый импорт -->
// TmpTransactionIdMap old2NewCreatedTransactionId;
// TmpTransactionIdMap old2NewModifiedTransactionId;
Map old2NewCreatedTransactionId;
Map old2NewModifiedTransactionId;
// шустрый импорт <--
...
}
X++:
void new()
{
...
// шустрый импорт -->
old2NewCreatedTransactionId = new Map(Types::Integer, Types::Integer);
old2NewModifiedTransactionId = new Map(Types::Integer, Types::Integer);
// шустрый импорт <--
}
X++:
private void updateTransactionId(TableId _tableId, CreatedTransactionId _oldCreatedTransId, ModifiedTransactionId _oldModifiedTransId)
{
CreatedTransactionId newTransId = 0;
;
if (!hasTransIdSupport)
{
return;
}
if (hasCreatedTransId[tableIds[_tableId]])
{
// шустрый импорт -->
// select old2NewCreatedTransactionId where old2NewCreatedTransactionId.Id == _oldCreatedTransId;
// if (old2NewCreatedTransactionId)
// {
// newTransId = old2NewCreatedTransactionId.RefId;
// }
if(old2NewCreatedTransactionId.exists(_oldCreatedTransId))
{
newTransId = old2NewCreatedTransactionId.lookup(_oldCreatedTransId);
}
// шустрый импорт <--
if (newTransId)
{
curCommon.(new DictTable(curCommon.TableId).fieldName2Id(extendedtypestr(CreatedTransactionId))) = newTransId;
}
else
{
curCommon.(new DictTable(curCommon.TableId).fieldName2Id(extendedtypestr(CreatedTransactionId))) = nextTransId;
// шустрый импорт -->
// old2NewCreatedTransactionId.Id = _oldCreatedTransId;
// old2NewCreatedTransactionId.RefId = nextTransId;
// old2NewCreatedTransactionId.insert();
old2NewCreatedTransactionId.insert(_oldCreatedTransId, nextTransId);
// шустрый импорт <--
nextTransId++;
}
}
newTransId = 0;
if (hasModifiedTransId[tableIds[_tableId]])
{
// шустрый импорт -->
// select old2NewModifiedTransactionId where old2NewModifiedTransactionId.Id == _oldModifiedTransId;
// if (old2NewModifiedTransactionId)
// {
// newTransId = old2NewModifiedTransactionId.RefId;
// }
if(old2NewModifiedTransactionId.exists(_oldModifiedTransId))
{
newTransId = old2NewModifiedTransactionId.lookup(_oldModifiedTransId);
}
// шустрый импорт <--
if (newTransId)
{
CurCommon.(new DictTable(curCommon.TableId).fieldName2Id(extendedtypestr(ModifiedTransactionId))) = newTransId;
}
else
{
curCommon.(new DictTable(curCommon.TableId).fieldName2Id(extendedtypestr(ModifiedTransactionId))) = nextTransId;
// шустрый импорт -->
// old2NewModifiedTransactionId.Id = _oldModifiedTransId;
// old2NewModifiedTransactionId.RefId = nextTransId;
// old2NewModifiedTransactionId.insert();
old2NewModifiedTransactionId.insert(_oldModifiedTransId, nextTransId);
// шустрый импорт <--
nextTransId++;
}
}
}
X++:
private void updateTransactionIdReference()
{
Counter fieldCount;
Counter fieldCounter;
FieldId fieldId;
container fields;
;
if (!hasTransIdSupport)
{
return;
}
fields = createdTransField[curCommon.TableId];
if (fields)
{
fieldCount = conlen(fields);
for (fieldCounter=1;fieldCount<=fieldCounter;fieldCount++)
{
fieldId = conpeek(fields,fieldCount);
if (isSysId(fieldId)) // If is a system field, it's already been handled through updateTransactionId
{
continue;
}
// шустрый импорт -->
// select old2NewCreatedTransactionid where old2NewCreatedTransactionId.Id == curCommon.(fieldId);
// if (old2NewCreatedTransactionId)
// {
// curCommon.(fieldId) = old2NewCreatedTransactionId.RefId;
// }
if (old2NewCreatedTransactionId.exists(curCommon.(fieldId)))
{
curCommon.(fieldId) = old2NewCreatedTransactionId.lookup(curCommon.(fieldId));
}
// шустрый импорт <--
else
{
curCommon.(fieldId) = nextTransId;
// шустрый импорт -->
// old2NewCreatedTransactionId.Id = curCommon.(fieldId);
// old2NewCreatedTransactionId.RefId = nextTransId;
// old2NewCreatedTransactionId.insert();
old2NewCreatedTransactionId.insert(curCommon.(fieldId), nextTransId);
// шустрый импорт <--
nextTransId++;
}
}
}
fields = modifiedTransField[curCommon.TableId];
if (fields)
{
fieldCount = conlen(fields);
for (fieldCounter=1;fieldCount<=fieldCounter;fieldCount++)
{
fieldId = conpeek(fields,fieldCount);
if (isSysId(fieldId)) // If is a system field, it's already been handled through updateTransactionId
{
continue;
}
// шустрый импорт -->
// select old2NewModifiedTransactionid where old2NewModifiedTransactionid.Id == curCommon.(fieldId);
// if (old2NewModifiedTransactionid)
// {
// curCommon.(fieldId) = old2NewModifiedTransactionid.RefId;
// }
if (old2NewModifiedTransactionid.exists(curCommon.(fieldId)))
{
curCommon.(fieldId) = old2NewModifiedTransactionid.lookup(curCommon.(fieldId));
}
// шустрый импорт <--
else
{
curCommon.(fieldId) = nextTransId;
// шустрый импорт -->
// old2NewModifiedTransactionid.Id = curCommon.(fieldId);
// old2NewModifiedTransactionid.RefId = nextTransId;
// old2NewModifiedTransactionid.insert();
old2NewModifiedTransactionid.insert(curCommon.(fieldId), nextTransId);
// шустрый импорт <--
nextTransId++;
}
}
}
}
Результат:
Импорт занял 2889 секунд для 1801345 записей.
Таблицы: CustTrans, VendTrans, LedgerTrans, CustTransOpen, CustSettlement и т.д.