Расширение Внешних атрибутов
Добавлено: 03 июн 2011, 08:16
Вобщем проблема такая: Есть возможность сделать внешний атрибут в виде ссылки таблицу, но список этих таблиц ограничен, можно его расширить?
Обсуждение различных вопросов, связанных с сопровождением, администрированием и программированием
https://ns1.tyumbit.ru/
Код: Выделить всё
#ifdef ComponentVersion
#component "C_EXTCLASS"
#endif
VipInterface CreateAttrRef_GalMy implements ObjCreateAttrRefPlugin licensed (FREE);
//------------------------------------------------------------------------------
Handler with replace Gal_CreateAttrRefTableMy on extensionPoint epCreateAttrRefTable (AttrRef : ObjGetAttrTable) [10] // было 11
Action
{
Result := true;
var ifc : CreateAttrRef_GalMy;
ifc.AddAttrRefTable (AttrRef);
}
//------------------------------------------------------------------------------
Handler with replace Gal_PickTableRefMy on extensionPoint epPickTableRef (_coTable: word; _cAttrVal: comp) [10]
Action
{
case _coTable of
coSpecMTR :
{ var ifc : CreateAttrRef_GalMy;
Result := not ifc.PickValueRef (_coTable, _cAttrVal);
Result := False ;
}
else Result:=true ;
end ;
}
// ObjCreateAttrRefPlugin - вызвается интерфейсом GetAttrTable для создания ссылок на таблицы не являющиеся аналитикой.
// CreateAttrRef_Gal реализация объектного интерфейса ObjCreateAttrRefPlugin, чтобы дополнить список ссылок.
#doc
Создание атрибутов типа ссылка (не аналитика)
#end
Interface CreateAttrRef_GalMy;
var vcu:Cu_myfunc ;
var
cPlansSch : tNRec;
wkod_err :word ;
Create view
From
AttrVal
,SpecMTR
;
// AttrRef ссылка на интерфейс GetAttrTable
Public Procedure AddAttrRefTable (AttrRef : ObjGetAttrTable);
{
AttrRef.AddTable (coSpecMTR);
}
// Реализация интерфейса вызова для таблицы
Public Function PickValueRef (_coTable: word; _cAttrVal: comp): boolean;
{
PickValueRef:=false;
if (getFirst AttrVal where ((_cAttrVal == AttrVal.nRec)) <> tsOk)
Exit;
case _coTable of
coSpecMTR:
{ wkod_err:=vcu.Make_CU( AttrVal.wtable, Attrval.crec, 10 )
if true //wkod_err<>cmCanCel
{ AttrVal.vComp:=Attrval.crec
AttrVal.vString :=vcu.GetCuName(AttrVal.wtable,Attrval.crec)+'/'+vCu.GetCuKauNameAll(AttrVal.wtable,Attrval.crec) ;
PickValueRef:=true;
}
}
else // Если нет интерфейса выбора
{
}
end; // case
if ( PickValueRef )
{
var err : word;
err := Update current AttrVal
if err <> 0
{
Message ('Ошибка N ' + string(err) + ' обновления записи в таблице AttrVal.');
exit;
}
}
}
end. // интерфейс
Код: Выделить всё
#include GetAttrTable.vih
const
coMarShin : Word = 12024;
end;
#ifdef ComponentVersion
#component "C_EXTCLASS"
#endif
VipInterface CreateAttrRef_GalMy implements ObjCreateAttrRefPlugin licensed (FREE);
//------------------------------------------------------------------------------
Handler with replace Gal_CreateAttrRefTableMy on extensionPoint epCreateAttrRefTable (AttrRef : ObjGetAttrTable) [10] // í佫 11
Action
{
Result := true;
var ifc : CreateAttrRef_GalMy;
ifc.AddAttrRefTable (AttrRef);
}
//------------------------------------------------------------------------------
Handler with replace Gal_PickTableRefMy on extensionPoint epPickTableRef (_coTable: word; _cAttrVal: comp) [10]
Action
{
case _coTable of
coMarShin :
{ var ifc : CreateAttrRef_GalMy;
Result := not ifc.PickValueRef (_coTable, _cAttrVal);
Result := False ;
}
else Result:=true ;
end ;
}
#doc
櫺ñá¡¿Ñ áΓα¿íπΓ«ó Γ¿»á ßß佬á (¡Ñ á¡á½¿Γ¿¬á)
#end
Interface CreateAttrRef_GalMy;
Create view
From
AttrVal
,MarShin
;
Public Procedure AddAttrRefTable (AttrRef : ObjGetAttrTable);
{
AttrRef.AddTable(coMarShin);
}
Public Function PickValueRef (_coTable: word; _cAttrVal: comp): boolean;
var
cMarShinPick: Comp;
Var
lMarShinMrkCnt ,
lMarShinMrk : Longint;
var
err : word;
begin
PickValueRef := false;
if (getFirst AttrVal where ((_cAttrVal == AttrVal.nRec)) <> tsOk)
Exit;
case _coTable of
coMarShin: {
cMarShinPick := AttrVal.vComp;
if ( RunInterface('M_TRANSP::GET_MSH', cMarShinPick, 1) <> cmCancel ) {
lMarShinMrk := InitMarker('Get_MarShin', 8, 10, 10);
lMarShinMrkCnt := GetMarkerCount(lMarShinMrk);
GetMarker(lMarShinMrk, 0, cMarShinPick);
ClearMarker(lMarShinMrk);
DoneMarker(lMarShinMrk, 'Get_MarShin');
if (getFirst MarShin where ((cMarShinPick == MarShin.nRec)) = tsOk) {
AttrVal.vComp := MarShin.nRec ;
AttrVal.vString := MarShin.NMSHIN ;
PickValueRef :=true;
}
}
}
end; // case
if ( PickValueRef ) {
err := Update current AttrVal;
if err <> 0 {
Message ('ÄΦ¿í¬á N ' + string(err) + ' «í¡«ó½Ñ¡¿∩ ºá»¿ß¿ ó Γáí½¿µÑ AttrVal.');
exit;
}
}
end;
end.