Показать сообщение отдельно
Старый 27.01.2014, 18:40   #5  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Благодарю! Удалось выбросить пару строчек:
X++:
public static void setStopped(
    InventItemOrderSetupMap     _inventItemOrderSetupMap,
    ItemStopped                 _stopped,
    date                        _effectiveDate = systemDateGet())
{
    InventItemSetupStopped  record;

    ttsBegin;

    record = InventItemSetupStopped::find(_inventItemOrderSetupMap.TableId, _inventItemOrderSetupMap.RecId, _effectiveDate);

    record.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);

    if (record && record.Stopped != _stopped)
    {
        while select forUpdate validTimeState(_effectiveDate) record
            where record.InventItemSetupRecId   == _inventItemOrderSetupMap.RecId
               && record.InventItemSetupTableId == _inventItemOrderSetupMap.TableId
        {
            record.ValidTo = max(_effectiveDate-1, record.ValidFrom);
            if (record.validateWrite())
                record.update();
        }
    }

    select forUpdate validTimeState(_effectiveDate) record
        where record.InventItemSetupRecId   == _inventItemOrderSetupMap.RecId
           && record.InventItemSetupTableId == _inventItemOrderSetupMap.TableId;

    record.initFromInventItemOrderSetupMap(_inventItemOrderSetupMap);
    record.ValidFrom = _effectiveDate;
    record.ValidTo = dateMax();
    record.Stopped = _stopped;

    if (record.validateWrite())
        record.write();

    ttsCommit;
}
Таблица ...Stopped - моя.
Без строки record.ValidTo = max(_effectiveDate-1, record.ValidFrom); работает, но ожидаемо перестает формироваться строчка с историей, а хочется.