mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 22:45:39 +02:00
1817 lines
62 KiB
ObjectPascal
1817 lines
62 KiB
ObjectPascal
unit U_AddInterface;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, cxMaskEdit,
|
||
cxSpinEdit, cxControls, cxContainer, cxEdit, cxTextEdit, cxDropDownEdit,
|
||
cxButtonEdit, U_BaseCommon, cxRadioGroup, cxCheckBox, cxCurrencyEdit,
|
||
Mask, RzEdit, cxGroupBox, ExtCtrls, RzPanel, DB, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxDBData, cxGridLevel,
|
||
cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxGrid, RzButton, kbmMemTable, cxColorComboBox,
|
||
ActnList, ActnMan, Menus, XPMenu, cxDBLookupComboBox, cxImage, cxMemo,
|
||
ComCtrls, ToolWin, RzRadChk, RzTabs, RzRadGrp,
|
||
|
||
U_BaseConstants, U_SCSLists, cxCalc, siComp, siLngLnk, Buttons,
|
||
cxLookAndFeels, cxNavigator, PlatformDefaultStyleActnCtrls;
|
||
|
||
|
||
type
|
||
TF_AddInterface = class(TForm)
|
||
Panel_Main: TRzPanel;
|
||
Panel_OkCancel: TRzPanel;
|
||
Label1: TLabel;
|
||
Label_KolvoAdd: TLabel;
|
||
Label_Mul2: TLabel;
|
||
Label_ValueI: TLabel;
|
||
Label4: TLabel;
|
||
SpinEdit_Kolvo: TcxSpinEdit;
|
||
ComboBox_Name: TcxComboBox;
|
||
Button_NameInterfce: TcxButton;
|
||
CurrencyEdit_ValueI: TcxCurrencyEdit;
|
||
ColorEdit: TRzColorEdit;
|
||
Button_Help: TcxButton;
|
||
SpinEdit_Npp: TcxSpinEdit;
|
||
Label_Npp: TLabel;
|
||
Label_Notice: TLabel;
|
||
Edit_Notice_: TcxTextEdit;
|
||
gbPortInterfaes: TRzGroupBox;
|
||
DSrcPortInterfRels: TDataSource;
|
||
mtPortInterfRels: TkbmMemTable;
|
||
ActionManager1: TActionManager;
|
||
Act_AddPortInterface: TAction;
|
||
Act_EditPortInterface: TAction;
|
||
Act_DelPortInterface: TAction;
|
||
pmPortInterfaces: TPopupMenu;
|
||
pmnuAdd: TMenuItem;
|
||
pmnuEdit: TMenuItem;
|
||
pmnuDel: TMenuItem;
|
||
tbInternalConnection: TToolBar;
|
||
tbAdd: TToolButton;
|
||
tbEdit: TToolButton;
|
||
tbDelete: TToolButton;
|
||
cbApplyForAllNoRelPorts: TRzCheckBox;
|
||
ToolButton4: TToolButton;
|
||
pcIsLine: TRzPageControl;
|
||
tsIsLine: TRzTabSheet;
|
||
tsIsPoint: TRzTabSheet;
|
||
GroupBox_NppPort: TRzGroupBox;
|
||
Label_NppPort: TLabel;
|
||
SpinEdit_NppPort: TcxSpinEdit;
|
||
pcIsPair: TRzPageControl;
|
||
tsIsPairTrue: TRzTabSheet;
|
||
tsIsPairFalse: TRzTabSheet;
|
||
Label_lbPairKolvo: TLabel;
|
||
Label_PairKolvo: TLabel;
|
||
Label_NppSide: TLabel;
|
||
SpinEdit_NppSide: TcxSpinEdit;
|
||
gbTypeI: TRzGroupBox;
|
||
rbTypeFunctional: TcxRadioButton;
|
||
rbTypeConstructive: TcxRadioButton;
|
||
gbKind: TRzGroupBox;
|
||
rbKindNoSplit: TcxRadioButton;
|
||
rbKindSplit: TcxRadioButton;
|
||
gbGender: TRzGroupBox;
|
||
rbGenderMale: TcxRadioButton;
|
||
rbGenderFemale: TcxRadioButton;
|
||
gbSignType: TRzGroupBox;
|
||
rbSignTypeProject: TcxRadioButton;
|
||
rbSignTypeActive: TcxRadioButton;
|
||
pcInternalRelation: TRzPageControl;
|
||
tsPortInterfRel: TRzTabSheet;
|
||
tsInternalInterfConn: TRzTabSheet;
|
||
grid_PortInterfRels: TcxGrid;
|
||
GT_PortInterfRels: TcxGridDBTableView;
|
||
GT_PortInterfRelsName: TcxGridDBColumn;
|
||
GT_PortInterfRelsUnitInterfKolvo: TcxGridDBColumn;
|
||
GL_PortInterfRels: TcxGridLevel;
|
||
GT_InterfInternalConn: TcxGridDBTableView;
|
||
GL_InterfInternalConn: TcxGridLevel;
|
||
grid_InterfInternalConn: TcxGrid;
|
||
mtInterfInternalConnection: TkbmMemTable;
|
||
dsrcInterfInternalConnection: TDataSource;
|
||
GT_InterfInternalConnName: TcxGridDBColumn;
|
||
GT_InterfInternalConnGender: TcxGridDBColumn;
|
||
GT_InterfInternalConnKolvo: TcxGridDBColumn;
|
||
Act_AddInterfInternalConn: TAction;
|
||
Act_EditInterfInternalConn: TAction;
|
||
Act_DelInterfInternalConn: TAction;
|
||
lng_Forms: TsiLangLinked;
|
||
Edit_Notice: TcxMemo;
|
||
pnSectionSideValue: TRzPanel;
|
||
btSectionSide: TSpeedButton;
|
||
cbSectionSide: TcxComboBox;
|
||
Label2: TLabel;
|
||
CheckBox_Multiple: TRzCheckBox;
|
||
CheckBox_IsPair: TRzCheckBox;
|
||
CheckBox_IsPort: TRzCheckBox;
|
||
CheckBox_IsUserPort: TRzCheckBox;
|
||
Button_OK: TRzBitBtn;
|
||
Button_Cancel: TRzBitBtn;
|
||
cbConnectToAnyGender: TRzCheckBox;
|
||
XP_Menu1: TXPMenu;
|
||
procedure ComboBox_Type_I_KeyPress(Sender: TObject; var Key: Char);
|
||
procedure FormHide(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure Button_OKClick(Sender: TObject);
|
||
procedure SpinEdit_KolvoPropertiesChange(Sender: TObject);
|
||
procedure Button_NameInterfceClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure ComboBox_NameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ComboBox_Type_IPropertiesChange(Sender: TObject);
|
||
procedure Label_Mul2Click(Sender: TObject);
|
||
procedure Button_HelpClick(Sender: TObject);
|
||
procedure CheckBox_IsPortPropertiesChange(Sender: TObject);
|
||
procedure SpinEdit_NppPortPropertiesChange(Sender: TObject);
|
||
procedure CheckBox_IsUserPortPropertiesChange(Sender: TObject);
|
||
procedure RadioGroup_TypeIPropertiesChange(Sender: TObject);
|
||
procedure SpinEdit_NppThreadPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
procedure SpinEdit_NppPortPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
procedure Button_CancelClick(Sender: TObject);
|
||
procedure CheckBox_IsPairPropertiesChange(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure Act_AddPortInterfaceExecute(Sender: TObject);
|
||
procedure Act_EditPortInterfaceExecute(Sender: TObject);
|
||
procedure Act_DelPortInterfaceExecute(Sender: TObject);
|
||
procedure CheckBox_MultiplePropertiesChange(Sender: TObject);
|
||
procedure SpinEdit_KolvoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
procedure rbTypeFunctionalClick(Sender: TObject);
|
||
procedure GT_InterfInternalConnGenderGetDisplayText(
|
||
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
||
var AText: String);
|
||
procedure pcInternalRelationChange(Sender: TObject);
|
||
procedure Act_AddInterfInternalConnExecute(Sender: TObject);
|
||
procedure Act_EditInterfInternalConnExecute(Sender: TObject);
|
||
procedure Act_DelInterfInternalConnExecute(Sender: TObject);
|
||
procedure ComboBox_NamePropertiesChange(Sender: TObject);
|
||
procedure btSectionSideClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
GForm: TForm;
|
||
FDataSource: TDataSource;
|
||
FCurrNpp: Integer;
|
||
FmeInterfaceRel: TmeInterfaceRel;
|
||
FCurrInterfID: Integer;
|
||
FCurrInterfGUID: string;
|
||
|
||
FReadOnly: Boolean;
|
||
|
||
FInterfRelIDsForKolvo: TIntList;
|
||
FInterfRelKolvosForKolvo: TIntList;
|
||
FUOMMin: Integer;
|
||
|
||
procedure ApplyCurrPortInterfsForOthetWithOutPortInterfs;
|
||
//procedure DefineInterfaceKolvoByPortKolvo(AIDInterfRel, ANewPortKolvo, AUnitInterfKolvo: Integer);
|
||
//procedure DefineInterfacesKolvoByDeletedPortInterfRels;
|
||
//procedure DefineInterfacesKolvoByPortKolvo(ANewPortKolvo: Integer; AOnlyForNewPortInterfRels: Boolean);
|
||
|
||
//procedure DefineInterfRelIDsForKolvo(AClearPrevios: Boolean);
|
||
//procedure DefineInterfacesKolvoByPortKolvo(ANewPortKolvo: Integer);
|
||
procedure DefineInternalRelControls;
|
||
procedure DefineNotice;
|
||
procedure EnableControlsInterfInternalConn;
|
||
procedure EnableControlsPortInterfRel;
|
||
procedure MakeEditInterfInternalConnWizard(AMakeEdit: TMakeEdit);
|
||
procedure MakeEditPortInterfaceRelWizard(AMakeEdit: TMakeEdit);
|
||
procedure MakeEditPortInterfaceRel(AMakeEdit: TMakeEdit; AMemTable: TkbmMemTable; AIDPort,
|
||
AIDInterfRel, AUnitInterfKolvo: Integer; AInterfName: String);
|
||
procedure OnChangeInterfName;
|
||
procedure ShowPairKolvo;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure ThrowDownIDAdverse(AIDInterfRel, AIDAdverse, ANewTypeI: Integer; AMemTable: TkbmMemTable);
|
||
public
|
||
{ Public declarations }
|
||
GFormMode : TFormMode;
|
||
GID_Interface: Integer;
|
||
GGUIDInterface: string;
|
||
GTypeInterface: Integer;
|
||
GNppPort: Integer;
|
||
GIsLineCompon: Integer;
|
||
GKolvo: Integer;
|
||
GName: String;
|
||
GDeletedPortInterfRelIDs: TIntList;
|
||
|
||
property ReadOnly: Boolean read FReadOnly write FReadOnly;
|
||
|
||
procedure SetControls;
|
||
function GetInterfRel(var AmeInterfaceRel: TmeInterfaceRel; AFormMode: TFormMode; AReadOnly: Boolean = false): Boolean;
|
||
Constructor Create(AOwner: TComponent; AForm: TForm);
|
||
Destructor Destroy; override;
|
||
end;
|
||
{
|
||
var
|
||
F_AddInterface: TF_AddInterface; }
|
||
|
||
implementation
|
||
Uses Unit_DM_SCS, U_CaseForm, U_MAIN, U_AnswerToQuast,
|
||
U_MakeEditPortInterfRel, U_SCSComponent;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TF_AddInterface.FormCreate(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
FReadOnly := false;
|
||
GDeletedPortInterfRelIDs := TIntList.Create;
|
||
|
||
FInterfRelIDsForKolvo := TIntList.Create;
|
||
FInterfRelKolvosForKolvo := TIntList.Create;
|
||
|
||
|
||
gbPortInterfaes.Constraints.MinHeight := gbPortInterfaes.Height;
|
||
|
||
SetStyleToRZColorEdit(ColorEdit);
|
||
//FillComboBox(ComboBox_Name, F_NormBase.DM.DataSet_INTERFACE, 'ID', 'Name');
|
||
|
||
CurrencyEdit_ValueI.Properties.DisplayFormat := GetDisplayFormatForFloat;
|
||
CurrencyEdit_ValueI.Properties.DecimalPlaces := FloatPrecision;
|
||
|
||
with TF_Main(GForm).DM do
|
||
begin
|
||
for i := 0 to MemTable_PortInterfRel.FieldDefs.Count - 1 do
|
||
mtPortInterfRels.FieldDefs.Add(MemTable_PortInterfRel.FieldDefs[i].Name,
|
||
MemTable_PortInterfRel.FieldDefs[i].DataType,
|
||
MemTable_PortInterfRel.FieldDefs[i].Size);
|
||
|
||
for i := 0 to mtInterfInternalConn.FieldDefs.Count - 1 do
|
||
begin
|
||
mtInterfInternalConnection.FieldDefs.Add(mtInterfInternalConn.FieldDefs[i].Name,
|
||
mtInterfInternalConn.FieldDefs[i].DataType,
|
||
mtInterfInternalConn.FieldDefs[i].Size);
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TF_AddInterface.FormShow(Sender: TObject);
|
||
begin
|
||
Case GFormMode of
|
||
fmMake:
|
||
begin
|
||
//CurrencyEdit_ValueI.Value := 1;
|
||
ComboBox_Name.SetFocus;
|
||
end;
|
||
fmEdit:
|
||
with TF_Main(GForm).FNormBase.DM do
|
||
begin
|
||
//Self.SpinEdit_Kolvo.Value := GKolvo;
|
||
//RadioGroup_TypeI.ItemIndex := GTypeInterface; //ComboBox_Type_I.ItemIndex := GTypeInterface;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TF_AddInterface.Button_NameInterfceClick(Sender: TObject);
|
||
var
|
||
ID_Interf: Integer;
|
||
NewID_Interf: Integer;
|
||
GUIDInterf: String;
|
||
//ModalRes: TModalResult;
|
||
begin
|
||
ID_Interf := GetIDFromComboBox(ComboBox_Name);
|
||
GUIDInterf := GetGUIDFromComboBox(ComboBox_Name);
|
||
|
||
{F_NormBase.F_CaseForm.Tree_InterfType.Selected := F_NormBase.F_CaseForm.Tree_InterfType.TopItem;
|
||
SearchRecord(F_NormBase.DM.DataSet_INTERFACE, 'ID', ID_Interf);
|
||
|
||
F_NormBase.F_CaseForm.GFormMode := GFormMode;
|
||
F_NormBase.F_CaseForm.GViewKind := vkInterface;
|
||
ModalRes := F_NormBase.F_CaseForm.ShowModal;
|
||
NewID_Interf := F_NormBase.DM.DataSet_INTERFACE.FN('ID').AsInteger;
|
||
}
|
||
|
||
ComboBox_Name.Properties.OnChange := nil;
|
||
if TF_Main(GForm).GDBMode = bkNormBase then
|
||
begin
|
||
NewID_Interf := F_NormBase.DM.GetInterfaceIDFromGuide(ID_Interf, GFormMode);
|
||
|
||
//F_NormBase.DM.SelectInterfaceByType;
|
||
if NewID_Interf <> -1 then
|
||
FillComboBox(ComboBox_Name, F_NormBase, true, tnInterface, fnID, fnName, '', NewID_Interf)
|
||
else
|
||
FillComboBox(ComboBox_Name, F_NormBase, true, tnInterface, fnID, fnName, '', ID_Interf);
|
||
end
|
||
else
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
begin
|
||
if ShowCurrProjectProperties(vkInterface, GUIDInterf) then
|
||
if TF_Main(GForm).GSCSBase.CurrProject.Spravochnik.LastInterface <> nil then
|
||
begin
|
||
TF_Main(GForm).GSCSBase.CurrProject.Spravochnik.LoadInterfacesToStrings(ComboBox_Name.Properties.Items, true);
|
||
SelectItemByGUIDinCombo(ComboBox_Name, TF_Main(GForm).GSCSBase.CurrProject.Spravochnik.LastInterface.GUID);
|
||
end;
|
||
end;
|
||
ComboBox_Name.Properties.OnChange := ComboBox_NamePropertiesChange;
|
||
|
||
OnChangeInterfName;
|
||
end;
|
||
|
||
|
||
|
||
procedure TF_AddInterface.ComboBox_Type_I_KeyPress(Sender: TObject;
|
||
var Key: Char);
|
||
begin
|
||
Key := #0;
|
||
Beep;
|
||
end;
|
||
|
||
procedure TF_AddInterface.FormHide(Sender: TObject);
|
||
begin
|
||
// ##### <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>s<EFBFBD><73><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #####
|
||
//F_AddInterface.Position := poMainFormCenter;
|
||
end;
|
||
|
||
constructor TF_AddInterface.Create(AOwner: TComponent; AForm: TForm);
|
||
begin
|
||
GForm := AForm;
|
||
inherited Create(AOwner);
|
||
end;
|
||
|
||
destructor TF_AddInterface.Destroy;
|
||
begin
|
||
inherited;
|
||
end;
|
||
|
||
|
||
procedure TF_AddInterface.SetControls;
|
||
var
|
||
VisibleValue: Boolean;
|
||
MultipleName: String;
|
||
begin
|
||
{if (GFormMode = fmMake) and (GIsLineCompon = biTrue) and
|
||
(RadioGroup_TypeI.ItemIndex = itFunctional) then
|
||
begin
|
||
Label_Mul2.Visible := true;
|
||
Label_lbPairKolvo.Visible := true;
|
||
Label_PairKolvo.Visible := true;
|
||
end;
|
||
else
|
||
begin
|
||
Label_Mul2.Visible := false;
|
||
Label_lbPairKolvo.Visible := false;
|
||
Label_PairKolvo.Visible := false;
|
||
end;}
|
||
|
||
CheckBox_IsPair.Visible := false;
|
||
CheckBox_IsPort.Visible := false;
|
||
|
||
Label_Mul2.Visible := false;
|
||
Label_lbPairKolvo.Visible := false;
|
||
Label_PairKolvo.Visible := false;
|
||
|
||
Label_Npp.Visible := false;
|
||
SpinEdit_Npp.Visible := false;
|
||
|
||
Label_NppSide.Visible := false;
|
||
SpinEdit_NppSide.Visible := false;
|
||
|
||
if GFormMode = fmMake then
|
||
begin
|
||
if GIsLineCompon = biTrue then
|
||
begin
|
||
//if RadioGroup_TypeI.ItemIndex = itFunctional then
|
||
if rbTypeFunctional.Checked then
|
||
begin
|
||
CheckBox_IsPair.Visible := true;
|
||
if (CheckBox_IsPair.Checked) and (CheckBox_IsPair.Visible) then
|
||
begin
|
||
Label_Mul2.Visible := true;
|
||
Label_lbPairKolvo.Visible := true;
|
||
Label_PairKolvo.Visible := true;
|
||
ShowPairKolvo;
|
||
end;
|
||
if Not CheckBox_IsPair.Checked then
|
||
begin
|
||
Label_NppSide.Visible := true;
|
||
SpinEdit_NppSide.Visible := true;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
if GIsLineCompon = biFalse then
|
||
begin
|
||
if rbTypeFunctional.Checked then
|
||
CheckBox_IsPort.Visible := true;
|
||
end;
|
||
end
|
||
else
|
||
if GIsLineCompon = biTrue then
|
||
if rbTypeFunctional.Checked then
|
||
if (FmeInterfaceRel.ID_Adverse = 0) then
|
||
begin
|
||
pcIsPair.ActivePage := tsIsPairFalse;
|
||
Label_NppSide.Visible := true;
|
||
SpinEdit_NppSide.Visible := true;
|
||
end;
|
||
|
||
if GFormMode = fmEdit then
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
begin
|
||
Label_Npp.Enabled := true;
|
||
SpinEdit_Npp.Enabled := true;
|
||
end;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
VisibleValue := false;
|
||
if rbTypeFunctional.Checked or (rbTypeConstructive.Checked and (GFormMode = fmMake)) then
|
||
VisibleValue := true;
|
||
Label_KolvoAdd.Visible := VisibleValue;
|
||
SpinEdit_Kolvo.Visible := VisibleValue;
|
||
|
||
|
||
VisibleValue := false;
|
||
MultipleName := CMultiplePoinInterface;
|
||
if (GIsLineCompon = biTrue) and (rbTypeConstructive.Checked) then
|
||
begin
|
||
MultipleName := GetNameInterfaceMultipleForLine; //CMultipleLineInterface;
|
||
if CheckBox_Multiple.Checked then
|
||
VisibleValue := true;
|
||
end;
|
||
CheckBox_Multiple.Caption := MultipleName;
|
||
Label_ValueI.Visible := VisibleValue;
|
||
CurrencyEdit_ValueI.Visible := VisibleValue;
|
||
|
||
//pnSectionSideValue.Visible := rbTypeFunctional.Checked;
|
||
|
||
{
|
||
if (GIsLineCompon = biTrue) and (RadioGroup_TypeI.ItemIndex = itConstructive) then
|
||
begin
|
||
Label_ValueI.Visible := true;
|
||
CurrencyEdit_ValueI.Visible := true;
|
||
//CurrencyEdit_ValueI.Value := 1;
|
||
//CheckBox_Multiple.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Label_ValueI.Visible := false;
|
||
CurrencyEdit_ValueI.Visible := false;
|
||
end; }
|
||
|
||
{if (GIsLineCompon = biTrue) and (ComboBox_Type_I.ItemIndex = itFunctional) then
|
||
ColorEdit.Visible := true
|
||
else
|
||
ColorEdit.Visible := false;}
|
||
|
||
Panel_Main.Enabled := Not FReadOnly;
|
||
tbInternalConnection.Enabled := Not FReadOnly;
|
||
grid_PortInterfRels.Enabled := Not FReadOnly;
|
||
grid_InterfInternalConn.Enabled := Not FReadOnly;
|
||
end;
|
||
|
||
|
||
|
||
function TF_AddInterface.GetInterfRel(var AmeInterfaceRel: TmeInterfaceRel;
|
||
AFormMode: TFormMode; AReadOnly: Boolean = false): Boolean;
|
||
var
|
||
ModalRes: TModalResult;
|
||
OldmeInterfaceRel: TmeInterfaceRel;
|
||
StrIsVisibleFilter: string;
|
||
begin
|
||
Result := false;
|
||
FUOMMin := ConvertUOMToMin(TF_Main(GForm).FUOM);
|
||
|
||
FReadOnly := AReadOnly;
|
||
GFormMode := AFormMode;
|
||
GGUIDInterface := '';
|
||
|
||
FmeInterfaceRel := AmeInterfaceRel;
|
||
FCurrInterfID := FmeInterfaceRel.ID_INTERFACE;
|
||
FCurrInterfGUID := FmeInterfaceRel.GUIDInterface;
|
||
GDeletedPortInterfRelIDs.Clear;
|
||
|
||
AmeInterfaceRel.ServiceIsPair := false;
|
||
AmeInterfaceRel.ServiceApplyForAllNoRelPorts := false;
|
||
|
||
if AmeInterfaceRel.IsLineCompon = biTrue then
|
||
pcIsLine.ActivePage := tsIsLine
|
||
else
|
||
if AmeInterfaceRel.IsLineCompon = biFalse then
|
||
pcIsLine.ActivePage := tsIsPoint;
|
||
|
||
Label_ValueI.Caption := cNameVolumeB + ', '+GetNameUOM(FUOMMin, true, false)+'2';
|
||
Label_Mul2.Visible := false;
|
||
GIsLineCompon := AmeInterfaceRel.IsLineCompon;
|
||
FDataSource := AmeInterfaceRel.DataSource;
|
||
FCurrNpp := 0;
|
||
if AFormMode = fmEdit then
|
||
begin
|
||
GID_Interface := AmeInterfaceRel.ID_INTERFACE;
|
||
GGUIDInterface := AmeInterfaceRel.GUIDInterface;
|
||
GKolvo := AmeInterfaceRel.KOLVO;
|
||
GTypeInterface := AmeInterfaceRel.TYPEI;
|
||
FCurrNpp := AmeInterfaceRel.Npp;
|
||
CheckBox_Multiple.Checked := IntToBool(AmeInterfaceRel.Multiple);
|
||
{if AmeInterfaceRel.Multiple = biTrue then
|
||
CheckBox_Multiple.Checked := true
|
||
else
|
||
CheckBox_Multiple.Checked := false;}
|
||
end;
|
||
|
||
CheckBox_IsPort.Visible := false;
|
||
GroupBox_NppPort.Visible := false;
|
||
//Label_NppPort.Visible := false;
|
||
//SpinEdit_NppPort.Visible := false;
|
||
//CheckBox_IsUserPort.Visible := false;
|
||
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
CheckBox_IsPort.Checked := IntToBool(AmeInterfaceRel.IsPort);
|
||
{if AmeInterfaceRel.IsPort = biTrue then
|
||
CheckBox_IsPort.Checked := true
|
||
else
|
||
CheckBox_IsPort.Checked := false;}
|
||
Label_NppPort.Enabled := false;
|
||
SpinEdit_NppPort.Enabled := false;
|
||
CheckBox_IsUserPort.Enabled := false;
|
||
|
||
SetControls;
|
||
|
||
rbTypeFunctional.Checked := false;
|
||
rbTypeConstructive.Checked := false;
|
||
rbKindNoSplit.Checked := false;
|
||
rbKindSplit.Checked := false;
|
||
rbGenderMale.Checked := false;
|
||
rbGenderFemale.Checked := false;
|
||
rbSignTypeProject.Checked := false;
|
||
rbSignTypeActive.Checked := false;
|
||
|
||
mtPortInterfRels.Active := false;
|
||
mtInterfInternalConnection.Active := false;
|
||
//pcIsLine.ActivePage := nil;
|
||
//rgSignType.ItemIndex := AmeInterfaceRel.SignType - 1;
|
||
|
||
ComboBox_Name.Properties.OnChange := nil;
|
||
if TF_Main(GForm).GDBMode = bkNormBase then
|
||
begin
|
||
//*** <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
StrIsVisibleFilter := '';
|
||
if Not IsShowUnvisibleInterface then
|
||
begin
|
||
if AFormMode = fmMake then
|
||
StrIsVisibleFilter := GetSQLForIsVisible(tnInterface)
|
||
else
|
||
if AFormMode = fmEdit then
|
||
StrIsVisibleFilter := GetSQLForIsVisibleWithFieldIntValue(tnInterface, fnID, AmeInterfaceRel.ID_INTERFACE);
|
||
end;
|
||
|
||
FillComboBox(ComboBox_Name, F_NormBase, true, tnInterface, fnID, fnName, '', 0, '', StrIsVisibleFilter);
|
||
end
|
||
else
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
begin
|
||
ComboBox_Name.Properties.BeginUpdate;
|
||
try
|
||
TF_Main(GForm).GSCSBase.CurrProject.Spravochnik.LoadInterfacesToStrings(ComboBox_Name.Properties.Items, true);
|
||
finally
|
||
ComboBox_Name.Properties.EndUpdate;
|
||
end;
|
||
end;
|
||
|
||
cbSectionSide.Properties.BeginUpdate;
|
||
try
|
||
TF_Main(GForm).FNormBase.DM.LoadInputStringsToTStrings(cbSectionSide.Properties.Items, stDimensions);
|
||
finally
|
||
cbSectionSide.Properties.EndUpdate;
|
||
end;
|
||
|
||
case AFormMode of
|
||
fmMake:
|
||
begin
|
||
Caption := cAddInterface_Msg2_1;
|
||
//(GForm as TF_Main).DM.DataSet_INTERFACE.First;
|
||
|
||
SelectItemByIDinCombo(ComboBox_Name, 0); //FillComboBox(ComboBox_Name, F_NormBase, true, tnInterface, fnID, fnName, '', 0);
|
||
//GID_Interface :=F_NormBase.DM.DataSet_INTERFACE.FN('ID').AsInteger;
|
||
ComboBox_Name.ItemIndex := 0;
|
||
|
||
SpinEdit_Kolvo.Value := 1;
|
||
Label_PairKolvo.Caption := IntToStr(SpinEdit_Kolvo.Value);
|
||
CheckBox_Multiple.Checked := false;
|
||
|
||
Label_Npp.Enabled := false;
|
||
SpinEdit_Npp.Enabled := false;
|
||
|
||
//RadioGroup_Kind.ItemIndex := 0;
|
||
rbTypeFunctional.Checked := true;
|
||
rbKindNoSplit.Checked := true;
|
||
rbSignTypeProject.Checked := true;
|
||
|
||
Label_KolvoAdd.Visible := true;
|
||
//Label_KolvoInterf.Visible := true;
|
||
SpinEdit_Kolvo.Visible := true;
|
||
CurrencyEdit_ValueI.Value := 1;
|
||
ColorEdit.SelectedColor := ColorEdit.DefaultColor;
|
||
|
||
CheckBox_IsPort.Visible := Not IntToBool(AmeInterfaceRel.IsLineCompon);
|
||
CheckBox_IsPort.Enabled := true;
|
||
//GroupBox_NppPort.Visible := Not IntToBool(AmeInterfaceRel.IsLineCompon);
|
||
Edit_Notice.Text := '';
|
||
cbConnectToAnyGender.Checked := false;
|
||
cbSectionSide.Text := '';
|
||
|
||
AmeInterfaceRel.IsUserPort := biFalse;
|
||
AmeInterfaceRel.ValueI := 0;
|
||
end;
|
||
fmEdit:
|
||
begin
|
||
Self.Caption := cAddInterface_Msg2_2;
|
||
//DataSet_Interface.Locate(fnID, GID_Interface, []);
|
||
if GGUIDInterface <> '' then
|
||
SelectItemByGUIDinCombo(ComboBox_Name, GGUIDInterface)
|
||
else
|
||
SelectItemByIDinCombo(ComboBox_Name, GID_Interface); //FillComboBox(ComboBox_Name, F_NormBase, true, tnInterface, fnID, fnName, '', GID_Interface);
|
||
|
||
SpinEdit_Kolvo.Value := AmeInterfaceRel.Kolvo;
|
||
SpinEdit_Kolvo.Visible := AmeInterfaceRel.TypeI = itFunctional;
|
||
Label_KolvoAdd.Visible := SpinEdit_Kolvo.Visible;
|
||
|
||
SpinEdit_NppSide.Value := AmeInterfaceRel.Side;
|
||
|
||
//RadioGroup_Kind.ItemIndex := AmeInterfaceRel.Kind;
|
||
if GTypeInterface = itFunctional then
|
||
rbTypeFunctional.Checked := true
|
||
else
|
||
if GTypeInterface = itConstructive then
|
||
rbTypeConstructive.Checked := true;
|
||
|
||
if AmeInterfaceRel.Kind = ikNoSplit then
|
||
rbKindNoSplit.Checked := true
|
||
else
|
||
if AmeInterfaceRel.Kind = ikSplit then
|
||
rbKindSplit.Checked := true;
|
||
|
||
if AmeInterfaceRel.GENDER = gtMale then
|
||
rbGenderMale.Checked := true
|
||
else
|
||
if AmeInterfaceRel.GENDER = gtFemale then
|
||
rbGenderFemale.Checked := true;
|
||
|
||
if AmeInterfaceRel.SignType = oitProjectible then
|
||
rbSignTypeProject.Checked := true
|
||
else
|
||
if AmeInterfaceRel.SignType = oitActive then
|
||
rbSignTypeActive.Checked := true;
|
||
|
||
//Label_KolvoInterf.Visible := false;
|
||
CurrencyEdit_ValueI.Value := RoundCP(FloatInUOM(AmeInterfaceRel.ValueI, umSM, FUOMMin, 2));
|
||
ColorEdit.SelectedColor := AmeInterfaceRel.Color;
|
||
SpinEdit_Npp.Value := AmeInterfaceRel.Npp;
|
||
//GroupBox_IsPort.Visible := false; //CheckBox_IsPort.Visible := false;
|
||
Edit_Notice.Text := AmeInterfaceRel.Notice;
|
||
|
||
cbConnectToAnyGender.Checked := IntToBool(AmeInterfaceRel.ConnToAnyGender);
|
||
cbSectionSide.Text := AmeInterfaceRel.SideSection;
|
||
|
||
CheckBox_IsPort.Visible := AmeInterfaceRel.IsPort = biTrue;
|
||
CheckBox_IsPort.Enabled := false;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
if AmeInterfaceRel.IsPort = biTrue then
|
||
begin
|
||
GNppPort := AmeInterfaceRel.NppPort;
|
||
//GroupBox_IsPort.Visible := true;
|
||
//Label_NppPort.Visible := True;
|
||
//SpinEdit_NppPort.Visible := true;
|
||
//Label_NppPort.Enabled := true;
|
||
//SpinEdit_NppPort.Enabled := true;
|
||
CheckBox_IsUserPort.Enabled := true;
|
||
SpinEdit_NppPort.Value := GNppPort;
|
||
|
||
CheckBox_IsUserPort.Visible := true;
|
||
CheckBox_IsUserPort.Checked := IntToBool(AmeInterfaceRel.IsUserPort);
|
||
end;
|
||
end;
|
||
end;
|
||
case AmeInterfaceRel.IsPort of
|
||
biTrue:
|
||
tsInternalInterfConn.Caption := cAddInterface_Msg8_2;
|
||
biFalse:
|
||
tsInternalInterfConn.Caption := cAddInterface_Msg8_1;
|
||
end;
|
||
|
||
ComboBox_Name.Properties.OnChange := ComboBox_NamePropertiesChange;
|
||
CheckBox_IsPortPropertiesChange(CheckBox_IsPort);
|
||
|
||
|
||
cbApplyForAllNoRelPorts.Checked := false;
|
||
//mtPortInterfRels.Active := false;
|
||
if Assigned(AmeInterfaceRel.mtPortInterfRel) then
|
||
begin
|
||
mtPortInterfRels.Active := true;
|
||
if AFormMode = fmEdit then
|
||
mtPortInterfRels.LoadFromDataSet(AmeInterfaceRel.mtPortInterfRel, []);
|
||
EnableControlsPortInterfRel;
|
||
end;
|
||
//DefineInterfRelIDsForKolvo(true);
|
||
TF_Main(GForm).DM.DefineInterfRelIDsForKolvo(true, FInterfRelIDsForKolvo, FInterfRelKolvosForKolvo, FmeInterfaceRel.mtPortInterfRel);
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//mtInterfInternalConnection.Active := false;
|
||
if Assigned(AmeInterfaceRel.mtInterfInternalConnect) then
|
||
begin
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterSource := nil;
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterFields := '';
|
||
AmeInterfaceRel.mtInterfInternalConnect.DetailFields := '';
|
||
if AmeInterfaceRel.DataSource <> nil then
|
||
begin
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterFields := fnID;
|
||
AmeInterfaceRel.mtInterfInternalConnect.DetailFields := fnIDPort;
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterSource := AmeInterfaceRel.DataSource;
|
||
end;
|
||
mtInterfInternalConnection.Active := true;
|
||
if AFormMode = fmEdit then
|
||
mtInterfInternalConnection.LoadFromDataSet(AmeInterfaceRel.mtInterfInternalConnect, []);
|
||
EnableControlsInterfInternalConn;
|
||
end;
|
||
DefineInternalRelControls;
|
||
pcInternalRelationChange(pcInternalRelation);
|
||
|
||
ModalRes := ShowModal;
|
||
if (ModalRes = mrOk) and (Not FReadOnly) then
|
||
begin
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
ValidateActiveFormControl(Self);
|
||
|
||
//----------------------------------------
|
||
OldmeInterfaceRel := AmeInterfaceRel;
|
||
|
||
AmeInterfaceRel.NAME := ComboBox_Name.Text;
|
||
AmeInterfaceRel.ID_INTERFACE := GetIDFromComboBox(ComboBox_Name); //GID_Interface;
|
||
AmeInterfaceRel.GUIDInterface := GetGUIDFromComboBox(ComboBox_Name);
|
||
AmeInterfaceRel.KOLVO := SpinEdit_Kolvo.Value;
|
||
if rbTypeFunctional.Checked then
|
||
AmeInterfaceRel.TYPEI := itFunctional
|
||
else
|
||
if rbTypeConstructive.Checked then
|
||
AmeInterfaceRel.TYPEI := itConstructive;
|
||
|
||
if rbKindNoSplit.Checked then
|
||
AmeInterfaceRel.Kind := ikNoSplit
|
||
else
|
||
if rbKindSplit.Checked then
|
||
AmeInterfaceRel.Kind := ikSplit;
|
||
|
||
if rbGenderMale.Checked then
|
||
AmeInterfaceRel.GENDER := gtMale
|
||
else
|
||
if rbGenderFemale.Checked then
|
||
AmeInterfaceRel.GENDER := gtFemale;
|
||
|
||
if rbSignTypeProject.Checked then
|
||
AmeInterfaceRel.SignType := oitProjectible
|
||
else
|
||
if rbSignTypeActive.Checked then
|
||
AmeInterfaceRel.SignType := oitActive;
|
||
|
||
AmeInterfaceRel.Multiple := BoolToInt(CheckBox_Multiple.Checked);
|
||
{if CheckBox_Multiple.Checked then
|
||
AmeInterfaceRel.Multiple := biTrue
|
||
else
|
||
AmeInterfaceRel.Multiple := biFalse;}
|
||
if (GIsLineCompon = biTrue) and (rbTypeConstructive.Checked) then
|
||
AmeInterfaceRel.ValueI := FloatInUOM(CurrencyEdit_ValueI.Value, FUOMMin, umSM, 2);
|
||
AmeInterfaceRel.Color := ColorEdit.SelectedColor;
|
||
AmeInterfaceRel.Notice := Edit_Notice.Text;
|
||
|
||
AmeInterfaceRel.Count := 1;
|
||
if (AFormMode = fmMake) then
|
||
begin
|
||
if AmeInterfaceRel.TYPEI = itFunctional then
|
||
begin
|
||
if (AmeInterfaceRel.IsLineCompon = biTrue) and
|
||
(CheckBox_IsPair.Checked) then
|
||
AmeInterfaceRel.Count := 2; //AmeInterfaceRel.KOLVO * 2;
|
||
end
|
||
else
|
||
if AmeInterfaceRel.TYPEI = itConstructive then
|
||
begin
|
||
AmeInterfaceRel.Count := AmeInterfaceRel.KOLVO;
|
||
AmeInterfaceRel.KOLVO := 1;
|
||
end;
|
||
end;
|
||
|
||
|
||
if AmeInterfaceRel.IsLineCompon = biTrue then
|
||
if AmeInterfaceRel.TYPEI = itFunctional then
|
||
AmeInterfaceRel.Side := SpinEdit_NppSide.Value;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
case GFormMode of
|
||
fmMake:
|
||
begin
|
||
AmeInterfaceRel.ServiceIsPair := CheckBox_IsPair.Checked;
|
||
//AmeInterfaceRel.Side := SpinEdit_NppSide.Value;
|
||
AmeInterfaceRel.IsPort := BoolToInt(CheckBox_IsPort.Checked);
|
||
{if CheckBox_IsPort.Checked = True then
|
||
AmeInterfaceRel.IsPort := biTrue
|
||
else
|
||
AmeInterfaceRel.IsPort := biFalse;}
|
||
end;
|
||
fmEdit:
|
||
begin
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
if AmeInterfaceRel.IsPort = biTrue then
|
||
begin
|
||
AmeInterfaceRel.IsUserPort := BoolToInt(CheckBox_IsUserPort.Checked);
|
||
if CheckBox_IsUserPort.Checked then
|
||
AmeInterfaceRel.NppPort := SpinEdit_NppPort.Value;
|
||
end;
|
||
AmeInterfaceRel.Npp := SpinEdit_Npp.Value;
|
||
if AmeInterfaceRel.TYPEI = itConstructive then
|
||
begin
|
||
AmeInterfaceRel.Kolvo := 1;
|
||
if OldmeInterfaceRel.TypeI <> AmeInterfaceRel.TypeI then
|
||
begin
|
||
ThrowDownIDAdverse(AmeInterfaceRel.ID, AmeInterfaceRel.ID_Adverse, AmeInterfaceRel.TypeI, AmeInterfaceRel.mtInterfaces);
|
||
AmeInterfaceRel.ID_Adverse := 0;
|
||
AmeInterfaceRel.NumPair := 0;
|
||
AmeInterfaceRel.Side := 0;
|
||
end;
|
||
end;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (AmeInterfaceRel.IsLineCompon = biTrue) and
|
||
(OldmeInterfaceRel.Kolvo <> AmeInterfaceRel.Kolvo) and
|
||
Assigned(AmeInterfaceRel.mtInterfaces) then
|
||
TF_Main(GForm).DM.DefineInterfaceNumPairs(AmeInterfaceRel.mtInterfaces, @AmeInterfaceRel);
|
||
end;
|
||
end;
|
||
|
||
AmeInterfaceRel.ConnToAnyGender := BoolToInt(cbConnectToAnyGender.Checked);
|
||
AmeInterfaceRel.SideSection := '';
|
||
if cbSectionSide.Visible then
|
||
AmeInterfaceRel.SideSection := cbSectionSide.Text;
|
||
|
||
if Assigned(AmeInterfaceRel.mtPortInterfRel) then
|
||
if CheckBox_IsPort.Checked then
|
||
begin
|
||
if AFormMode = fmEdit then
|
||
TF_Main(GForm).DM.DeleteRecords(TDataSet(AmeInterfaceRel.mtPortInterfRel));
|
||
mtPortInterfRels.SaveToDataSet(AmeInterfaceRel.mtPortInterfRel);
|
||
|
||
////*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
TF_Main(GForm).DM.DefineInterfRelIDsForKolvo(false, FInterfRelIDsForKolvo, FInterfRelKolvosForKolvo, mtPortInterfRels);
|
||
TF_Main(GForm).DM.DefineInterfacesKolvoByPortKolvo(AmeInterfaceRel.Kolvo,
|
||
mtPortInterfRels, AmeInterfaceRel.mtInterfaces, FInterfRelIDsForKolvo, FInterfRelKolvosForKolvo);
|
||
|
||
if cbApplyForAllNoRelPorts.Checked then
|
||
begin
|
||
ApplyCurrPortInterfsForOthetWithOutPortInterfs;
|
||
AmeInterfaceRel.ServiceApplyForAllNoRelPorts := true;
|
||
end;
|
||
end;
|
||
|
||
if Assigned(AmeInterfaceRel.mtInterfInternalConnect) then
|
||
begin
|
||
if AFormMode = fmEdit then
|
||
TF_Main(GForm).DM.DeleteRecords(TDataSet(AmeInterfaceRel.mtInterfInternalConnect));
|
||
mtInterfInternalConnection.SaveToDataSet(AmeInterfaceRel.mtInterfInternalConnect);
|
||
end;
|
||
Result := true;
|
||
end
|
||
else
|
||
Result := false;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
if Assigned(AmeInterfaceRel.mtInterfInternalConnect) then
|
||
begin
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterSource := nil;
|
||
AmeInterfaceRel.mtInterfInternalConnect.MasterFields := '';
|
||
AmeInterfaceRel.mtInterfInternalConnect.DetailFields := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Button_OKClick(Sender: TObject);
|
||
var MessgError: String;
|
||
CanOk: Boolean;
|
||
|
||
procedure AddErrorMsg(AMessage: String);
|
||
begin
|
||
MessgError := MessgError + #13+ ' -'+AMessage;
|
||
CanOk := false;
|
||
end;
|
||
|
||
begin
|
||
ModalResult := mrOk;
|
||
CanOk := true;
|
||
|
||
MessgError := cSetNextParameters+':'+#13;
|
||
if ComboBox_Name.Text = '' then
|
||
AddErrorMsg(cNameInterface);
|
||
if Not rbTypeFunctional.Checked and Not rbTypeConstructive.Checked then
|
||
AddErrorMsg(cNameInterfaceType);
|
||
if Not rbGenderMale.Checked and Not rbGenderFemale.Checked then
|
||
AddErrorMsg(cNameInterfaceGender);
|
||
|
||
if Not CanOk then
|
||
begin
|
||
MessageModal(MessgError, Caption, MB_OK or MB_ICONINFORMATION);
|
||
ModalResult := mrNone;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.SpinEdit_KolvoPropertiesChange(Sender: TObject);
|
||
begin
|
||
try
|
||
if SpinEdit_Kolvo.Value < 0 then
|
||
SpinEdit_Kolvo.Value := 1;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
if (SpinEdit_Kolvo.Value > 1) and mtPortInterfRels.Active and (mtPortInterfRels.RecordCount > 1) then
|
||
begin
|
||
MessageModal(CControlPortInterfRelCount +' '+cbMessage10,
|
||
ApplicationName, MB_ICONINFORMATION or MB_OK);
|
||
SpinEdit_Kolvo.Value := 1;
|
||
end;
|
||
|
||
ShowPairKolvo;
|
||
|
||
//DefinePortInterfRelActions;
|
||
except
|
||
on E: Exception do AddExceptionToLog('TF_AddInterface.SpinEdit_KolvoPropertiesChange: '+E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.ComboBox_NameKeyPress(Sender: TObject;
|
||
var Key: Char);
|
||
begin
|
||
//key := #0;
|
||
//Beep;
|
||
end;
|
||
|
||
|
||
// ##### <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #####
|
||
procedure TF_AddInterface.ComboBox_Type_IPropertiesChange(Sender: TObject);
|
||
begin
|
||
SetControls;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Label_Mul2Click(Sender: TObject);
|
||
begin
|
||
with TF_Main(GForm).F_AnswerToQuast do
|
||
begin
|
||
GCaption := '';
|
||
GAnswer := cAddInterface_Msg3;
|
||
ShowModal;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Button_HelpClick(Sender: TObject);
|
||
begin
|
||
with TF_Main(GForm).F_AnswerToQuast do
|
||
begin
|
||
GCaption := cAddInterface_Msg4_1;
|
||
GAnswer := cAddInterface_Msg4_2;
|
||
|
||
|
||
{'<27> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>'+#13+
|
||
'<27> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 2.';}
|
||
ShowContextHelp(GCaption, GAnswer);
|
||
end;
|
||
end;
|
||
|
||
|
||
// ##### <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>" #####
|
||
procedure TF_AddInterface.CheckBox_IsPortPropertiesChange(Sender: TObject);
|
||
var
|
||
CanShowNppPort: Boolean;
|
||
begin
|
||
CanShowNppPort := false;
|
||
try
|
||
case CheckBox_IsPort.Checked of
|
||
true:
|
||
begin
|
||
case GFormMode of
|
||
fmMake:
|
||
Caption := cAddInterface_Msg5_1;
|
||
fmEdit:
|
||
Caption := cAddInterface_Msg5_2;
|
||
end;
|
||
|
||
rbTypeFunctional.Checked := true;
|
||
rbKindSplit.Checked := true;
|
||
//RadioGroup_Gender.ItemIndex := 1 - gtFemale;
|
||
|
||
gbTypeI.Enabled := false; //RadioGroup_TypeI.Enabled := false;
|
||
gbKind.Enabled := false; //RadioGroup_Kind.Enabled := false;
|
||
//RadioGroup_Gender.Enabled := false;
|
||
end;
|
||
false:
|
||
begin
|
||
case GFormMode of
|
||
fmMake:
|
||
Caption := cAddInterface_Msg6_1;
|
||
fmEdit:
|
||
Caption := cAddInterface_Msg6_2;
|
||
end;
|
||
|
||
gbTypeI.Enabled := true; //RadioGroup_TypeI.Enabled := true;
|
||
gbKind.Enabled := true; //RadioGroup_Kind.Enabled := true;
|
||
//RadioGroup_Gender.Enabled := true;
|
||
end;
|
||
end;
|
||
Label_NppPort.Enabled := CheckBox_IsPort.Checked;
|
||
SpinEdit_NppPort.Enabled := CheckBox_IsPort.Checked;
|
||
CheckBox_IsUserPort.Enabled := CheckBox_IsPort.Checked;
|
||
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
if CheckBox_IsPort.Checked then
|
||
if GFormMode = fmEdit then
|
||
CanShowNppPort := true;
|
||
GroupBox_NppPort.Visible := CanShowNppPort;
|
||
CheckBox_Multiple.Visible := Not CheckBox_IsPort.Checked;
|
||
|
||
DefineInternalRelControls;
|
||
except
|
||
on E: Exception do AddExceptionToLog('TF_AddInterface.CheckBox_IsPortPropertiesChange: '+E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.SpinEdit_NppPortPropertiesChange(
|
||
Sender: TObject);
|
||
begin
|
||
//CheckBox_IsUserPort.Properties.OnChange := nil;
|
||
CheckBox_IsUserPort.Checked := (Round(SpinEdit_NppPort.Value) <> GNppPort) or (FmeInterfaceRel.IsUserPort = biTrue);
|
||
//CheckBox_IsUserPort.Properties.OnChange := CheckBox_IsUserPortPropertiesChange;
|
||
end;
|
||
|
||
procedure TF_AddInterface.CheckBox_IsUserPortPropertiesChange(
|
||
Sender: TObject);
|
||
begin
|
||
if Not TRzCheckBox(Sender).Checked then
|
||
begin
|
||
SpinEdit_NppPort.Properties.OnChange := nil;
|
||
SpinEdit_NppPort.Value := GNppPort;
|
||
SpinEdit_NppPort.Properties.OnChange := SpinEdit_NppPortPropertiesChange;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.RadioGroup_TypeIPropertiesChange(
|
||
Sender: TObject);
|
||
begin
|
||
if GIsLineCompon = biTrue then
|
||
if rbTypeFunctional.Checked then
|
||
CheckBox_IsPair.Checked := true;
|
||
|
||
SetControls;
|
||
end;
|
||
|
||
|
||
// ##### <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> #####
|
||
procedure TF_AddInterface.SpinEdit_NppThreadPropertiesValidate(
|
||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
var RecNo: Integer;
|
||
//i: Integer;
|
||
begin
|
||
Error := false;
|
||
ErrorText := '';
|
||
|
||
{//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> "0"
|
||
if DisplayValue = 0 then
|
||
begin
|
||
Error := true;
|
||
ShowMessageByType(Self.Handle, smtDisplay, '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Application.Title, MB_OK or MB_ICONINFORMATION);
|
||
ModalResult := mrNone;
|
||
Exit; ///// EXIT ////
|
||
end; }
|
||
|
||
{if Integer(DisplayValue) < 0 then
|
||
begin
|
||
Error := true;
|
||
Exit; //// EXIT ////
|
||
end; }
|
||
|
||
if Assigned(FDataSource) then
|
||
with FDataSource do
|
||
begin
|
||
if DataSet.RecordCount > 0 then // Tolik 28/12/2019 --
|
||
begin
|
||
RecNo := DataSet.RecNo;
|
||
DataSet.DisableControls;
|
||
try
|
||
DataSet.First;
|
||
while Not DataSet.Eof do
|
||
begin
|
||
if DataSet.FieldByName(fnNpp).AsInteger <> FCurrNpp then
|
||
if DataSet.FieldByName(fnNpp).AsInteger = DisplayValue then
|
||
begin
|
||
Error := true;
|
||
ShowMessageByType(Self.Handle, smtDisplay, cAddInterface_Msg7, Application.Title, MB_OK or MB_ICONINFORMATION);
|
||
ModalResult := mrNone;
|
||
Exit; ///// EXIT ////
|
||
end;
|
||
DataSet.Next;
|
||
end;
|
||
finally
|
||
DataSet.RecNo := RecNo;
|
||
DataSet.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.SpinEdit_NppPortPropertiesValidate(
|
||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||
var Error: Boolean);
|
||
begin
|
||
ErrorText := '';
|
||
if DisplayValue < 0 then
|
||
Error := true;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Button_CancelClick(Sender: TObject);
|
||
begin
|
||
ModalResult := mrCancel;
|
||
Close;
|
||
end;
|
||
|
||
procedure TF_AddInterface.CheckBox_IsPairPropertiesChange(Sender: TObject);
|
||
begin
|
||
if CheckBox_IsPair.Checked then
|
||
pcIsPair.ActivePage := tsIsPairTrue
|
||
else
|
||
pcIsPair.ActivePage := tsIsPairFalse;
|
||
SetControls;
|
||
end;
|
||
|
||
procedure TF_AddInterface.FormDestroy(Sender: TObject);
|
||
begin
|
||
ClearComboBox(ComboBox_Name);
|
||
GDeletedPortInterfRelIDs.Free;
|
||
DeactiveDataSets(Self);
|
||
end;
|
||
|
||
procedure TF_AddInterface.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
try
|
||
TF_Main(GForm).F_AnswerToQuast.Close;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.ApplyCurrPortInterfsForOthetWithOutPortInterfs;
|
||
var
|
||
CurrPortInterRels: TList;
|
||
InterfRelsInPorts: TIntList;
|
||
|
||
ptrPortInterfRel: PPortInterfRel;
|
||
PortInterfRel: TPortInterfRel;
|
||
PortRecNo: Integer;
|
||
InterfRelRecNo: Integer;
|
||
i: Integer;
|
||
|
||
IDInterfRel: Integer;
|
||
KolvoInterfRel: Integer;
|
||
begin
|
||
//Tolik 28/12/2019 --
|
||
if mtPortInterfRels.RecordCount = 0 then
|
||
exit;
|
||
//
|
||
InterfRelsInPorts := TIntList.Create;
|
||
CurrPortInterRels := TList.Create;
|
||
PortRecNo := FmeInterfaceRel.mtPorts.RecNo;
|
||
InterfRelRecNo := FmeInterfaceRel.mtInterfaces.RecNo;
|
||
try
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
mtPortInterfRels.First;
|
||
while Not mtPortInterfRels.Eof do
|
||
begin
|
||
GetMem(ptrPortInterfRel, SizeOf(TPortInterfRel));
|
||
TF_Main(GForm).DM.LoadFromMemTableToPortInterfRel(ptrPortInterfRel, mtPortInterfRels);
|
||
ptrPortInterfRel.IDInterface := TF_Main(GForm).DM.GetIDInterfaceByIDInterfRelFromMemTable(ptrPortInterfRel.IDInterfRel, FmeInterfaceRel.mtInterfaces, nil);
|
||
ptrPortInterfRel.UnitInterfKolvo := TF_Main(GForm).DM.GetIntFromTableByID(tnInterfaceRelation, fnKolvo, ptrPortInterfRel.IDInterfRel, qmPhisical);
|
||
CurrPortInterRels.Add(ptrPortInterfRel);
|
||
|
||
mtPortInterfRels.Next;
|
||
end;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FmeInterfaceRel.mtPorts.First;
|
||
while Not FmeInterfaceRel.mtPorts.Eof do
|
||
begin
|
||
if FmeInterfaceRel.mtPorts.FieldByName(fnIsNative).AsBoolean = true then
|
||
begin
|
||
FmeInterfaceRel.mtPortInterfRel.First;
|
||
while Not FmeInterfaceRel.mtPortInterfRel.Eof do
|
||
begin
|
||
InterfRelsInPorts.Add(FmeInterfaceRel.mtPortInterfRel.FieldByName(fnIDInterfRel).AsInteger);
|
||
FmeInterfaceRel.mtPortInterfRel.Next;
|
||
end;
|
||
end;
|
||
FmeInterfaceRel.mtPorts.Next;
|
||
end;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>.
|
||
FmeInterfaceRel.mtPorts.First;
|
||
while Not FmeInterfaceRel.mtPorts.Eof do
|
||
begin
|
||
if FmeInterfaceRel.mtPorts.FieldByName(fnIsNative).AsBoolean = true then
|
||
if FmeInterfaceRel.mtPortInterfRel.RecordCount = 0 then
|
||
for i := 0 to CurrPortInterRels.Count - 1 do
|
||
begin
|
||
ptrPortInterfRel := CurrPortInterRels[i];
|
||
PortInterfRel := ptrPortInterfRel^;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
IDInterfRel := 0;
|
||
IDInterfRel := TF_Main(GForm).DM.GetIDInterfRelByIDInterfaceFromMTThatNoInList(PortInterfRel.IDInterface,
|
||
PortInterfRel.UnitInterfKolvo, FmeInterfaceRel.mtInterfaces, InterfRelsInPorts);
|
||
if IDInterfRel <> 0 then
|
||
begin
|
||
PortInterfRel.IDInterfRel := IDInterfRel;
|
||
|
||
MakeEditPortInterfaceRel(meMake, FmeInterfaceRel.mtPortInterfRel,
|
||
FmeInterfaceRel.mtPorts.FieldByName(fnID).AsInteger,
|
||
PortInterfRel.IDInterfRel,
|
||
PortInterfRel.UnitInterfKolvo,
|
||
F_NormBase.GSCSBase.NBSpravochnik.GetInterfaceNameByID(PortInterfRel.IDInterface));
|
||
InterfRelsInPorts.Add(PortInterfRel.IDInterfRel);
|
||
end;
|
||
end;
|
||
|
||
FmeInterfaceRel.mtPorts.Next;
|
||
end;
|
||
finally
|
||
InterfRelsInPorts.Free;
|
||
FreeList(CurrPortInterRels);
|
||
FmeInterfaceRel.mtPorts.RecNo := PortRecNo;
|
||
FmeInterfaceRel.mtInterfaces.RecNo := InterfRelRecNo;
|
||
end;
|
||
end;
|
||
|
||
|
||
{
|
||
procedure TF_AddInterface.DefineInterfaceKolvoByPortKolvo(AIDInterfRel, ANewPortKolvo, AUnitInterfKolvo: Integer);
|
||
var
|
||
InterfRelRecNo: Integer;
|
||
InterfKolvo: Integer;
|
||
begin
|
||
InterfRelRecNo := FmeInterfaceRel.mtInterfaces.RecNo;
|
||
try
|
||
InterfKolvo := AUnitInterfKolvo;
|
||
if ANewPortKolvo > 0 then
|
||
InterfKolvo := InterfKolvo * ANewPortKolvo;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FmeInterfaceRel.mtInterfaces.First;
|
||
while Not FmeInterfaceRel.mtInterfaces.Eof do
|
||
begin
|
||
//*** <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if FmeInterfaceRel.mtInterfaces.FieldByName(fnID).AsInteger = AIDInterfRel then
|
||
begin
|
||
FmeInterfaceRel.mtInterfaces.Edit;
|
||
FmeInterfaceRel.mtInterfaces.FieldByName(fnIsModified).AsBoolean := true;
|
||
FmeInterfaceRel.mtInterfaces.FieldByName(fnKolvo).AsInteger := InterfKolvo;
|
||
FmeInterfaceRel.mtInterfaces.Post;
|
||
Break; //// BREAK ////
|
||
end;
|
||
FmeInterfaceRel.mtInterfaces.Next;
|
||
end;
|
||
finally
|
||
FmeInterfaceRel.mtInterfaces.RecNo := InterfRelRecNo;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.DefineInterfacesKolvoByDeletedPortInterfRels;
|
||
var
|
||
i: Integer;
|
||
begin
|
||
for i := 0 to GDeletedPortInterfRelIDs.Count - 1 do
|
||
DefineInterfaceKolvoByPortKolvo(GDeletedPortInterfRelIDs[i], 0, GDeletedPortInterfRelKolvos[i]);
|
||
end;
|
||
|
||
|
||
procedure TF_AddInterface.DefineInterfacesKolvoByPortKolvo(ANewPortKolvo: Integer; AOnlyForNewPortInterfRels: Boolean);
|
||
var
|
||
PortInterfRelRecNo: Integer;
|
||
InterfRelRecNo: Integer;
|
||
|
||
PortIDInterfRel: Integer;
|
||
UnitInterfKolvo: Integer;
|
||
begin
|
||
if (ANewPortKolvo > 0) and (FmeInterfaceRel.mtPortInterfRel.RecordCount > 0) then
|
||
begin
|
||
PortInterfRelRecNo := FmeInterfaceRel.mtPortInterfRel.RecNo;
|
||
InterfRelRecNo := FmeInterfaceRel.mtInterfaces.RecNo;
|
||
try
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FmeInterfaceRel.mtPortInterfRel.First;
|
||
while Not FmeInterfaceRel.mtPortInterfRel.Eof do
|
||
begin
|
||
if (Not AOnlyForNewPortInterfRels) or FmeInterfaceRel.mtPortInterfRel.FieldByName(fnIsNew).AsBoolean then
|
||
begin
|
||
PortIDInterfRel := FmeInterfaceRel.mtPortInterfRel.FieldByName(fnIDInterfRel).AsInteger;
|
||
UnitInterfKolvo := FmeInterfaceRel.mtPortInterfRel.FieldByName(fnUnitInterfKolvo).AsInteger;
|
||
if UnitInterfKolvo > 0 then
|
||
DefineInterfaceKolvoByPortKolvo(PortIDInterfRel, ANewPortKolvo, UnitInterfKolvo);
|
||
end;
|
||
FmeInterfaceRel.mtPortInterfRel.Next;
|
||
end;
|
||
finally
|
||
FmeInterfaceRel.mtPortInterfRel.RecNo := PortInterfRelRecNo;
|
||
FmeInterfaceRel.mtInterfaces.RecNo := InterfRelRecNo;
|
||
end;
|
||
end;
|
||
end;
|
||
}
|
||
|
||
|
||
procedure TF_AddInterface.DefineInternalRelControls;
|
||
var
|
||
CanShow: Boolean;
|
||
begin
|
||
CanShow := false;
|
||
//if CheckBox_IsPort.Checked then
|
||
// if (SpinEdit_Kolvo.Value = 1) or (GFormMode = fmEdit) then
|
||
|
||
tsPortInterfRel.TabVisible := CheckBox_IsPort.Checked;
|
||
if tsPortInterfRel.TabVisible then
|
||
pcInternalRelation.ActivePage := tsPortInterfRel
|
||
else
|
||
pcInternalRelation.ActivePage := tsInternalInterfConn;
|
||
//tsInternalInterfConn.cli
|
||
//if CheckBox_IsPort.Checked then
|
||
if rbTypeFunctional.Checked then
|
||
CanShow := true;
|
||
if gbPortInterfaes.Visible <> CanShow then
|
||
begin
|
||
gbPortInterfaes.Visible := CanShow;
|
||
if CanShow then
|
||
Height := Height + gbPortInterfaes.Height
|
||
else
|
||
Height := Height - gbPortInterfaes.Height;
|
||
end;
|
||
|
||
cbConnectToAnyGender.Visible := rbTypeFunctional.Checked;
|
||
|
||
cbApplyForAllNoRelPorts.Visible := FmeInterfaceRel.ServiceShowApplyForAllNoRelPorts and (TF_Main(GForm).GDBMode = bkNormBase);
|
||
end;
|
||
|
||
procedure TF_AddInterface.DefineNotice;
|
||
var
|
||
Spravochnik: TSpravochnik;
|
||
IDInterf: Integer;
|
||
GUIDInterf: String;
|
||
SprInterface: TNBInterface;
|
||
OldInterfNoticeFromSpr: String;
|
||
begin
|
||
try
|
||
OldInterfNoticeFromSpr := '';
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
Spravochnik := nil;
|
||
if TF_Main(GForm).GDBMode = bkNormBase then
|
||
Spravochnik := TF_Main(GForm).GSCSBase.NBSpravochnik
|
||
else
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
Spravochnik := TF_Main(GForm).GSCSBase.CurrProject.Spravochnik;
|
||
|
||
if Spravochnik <> nil then
|
||
begin
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
SprInterface := Spravochnik.GetInterfaceByID(FCurrInterfID);
|
||
if SprInterface = nil then
|
||
SprInterface := Spravochnik.GetInterfaceByGUID(FCurrInterfGUID);
|
||
if SprInterface <> nil then
|
||
OldInterfNoticeFromSpr := SprInterface.Description;
|
||
|
||
if (Edit_Notice.Text = '') or (Edit_Notice.Text = OldInterfNoticeFromSpr) then
|
||
begin
|
||
IDInterf := GetIDFromComboBox(ComboBox_Name);
|
||
GUIDInterf := GetGUIDFromComboBox(ComboBox_Name);
|
||
|
||
SprInterface := Spravochnik.GetInterfaceByID(IDInterf);
|
||
if SprInterface = nil then
|
||
SprInterface := Spravochnik.GetInterfaceByGUID(GUIDInterf);
|
||
if SprInterface <> nil then
|
||
Edit_Notice.Text := SprInterface.Description;
|
||
|
||
{if TF_Main(GForm).GDBMode = bkNormBase then
|
||
begin
|
||
Edit_Notice.Text := TF_Main(GForm).DM.GetStringFromTableByID(tnInterface, fnDescription, IDInterf, qmPhisical);
|
||
end
|
||
else
|
||
if TF_Main(GForm).GDBMode = bkProjectManager then
|
||
begin
|
||
SprInterface := TF_Main(GForm).GSCSBase.CurrProject.Spravochnik.GetInterfaceByGUID(GUIDInterf);
|
||
if SprInterface <> nil then
|
||
Edit_Notice.Text := SprInterface.Description;
|
||
end;}
|
||
end;
|
||
end;
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_AddInterface.DefineNotice', E.Message);
|
||
end;
|
||
end;
|
||
|
||
|
||
{
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure TF_AddInterface.DefineInterfRelIDsForKolvo(AClearPrevios: Boolean);
|
||
var
|
||
i: Integer;
|
||
PortInterfRelRecNo: Integer;
|
||
begin
|
||
if AClearPrevios then
|
||
begin
|
||
FInterfRelIDsForKolvo.Clear;
|
||
FInterfRelKolvosForKolvo.Clear;
|
||
end;
|
||
if FmeInterfaceRel.mtPortInterfRel.RecordCount > 0 then
|
||
begin
|
||
PortInterfRelRecNo := FmeInterfaceRel.mtPortInterfRel.RecNo;
|
||
try
|
||
FmeInterfaceRel.mtPortInterfRel.First;
|
||
while Not FmeInterfaceRel.mtPortInterfRel.Eof do
|
||
begin
|
||
if FInterfRelIDsForKolvo.IndexOf(FmeInterfaceRel.mtPortInterfRel.FieldByName(fnIDInterfRel).AsInteger) = -1 then
|
||
begin
|
||
FInterfRelIDsForKolvo.Add(FmeInterfaceRel.mtPortInterfRel.FieldByName(fnIDInterfRel).AsInteger);
|
||
FInterfRelKolvosForKolvo.Add(FmeInterfaceRel.mtPortInterfRel.FieldByName(fnUnitInterfKolvo).AsInteger);
|
||
end;
|
||
FmeInterfaceRel.mtPortInterfRel.Next;
|
||
end;
|
||
finally
|
||
FmeInterfaceRel.mtPortInterfRel.RecNo := PortInterfRelRecNo;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.DefineInterfacesKolvoByPortKolvo(ANewPortKolvo: Integer);
|
||
var
|
||
InterfRelRecNo: Integer;
|
||
InterfKolvo: Integer;
|
||
i: Integer;
|
||
begin
|
||
if FmeInterfaceRel.mtInterfaces.RecordCount > 0 then
|
||
begin
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
DefineInterfRelIDsForKolvo(false);
|
||
|
||
InterfRelRecNo := FmeInterfaceRel.mtInterfaces.RecNo;
|
||
try
|
||
for i := 0 to FInterfRelIDsForKolvo.Count - 1 do
|
||
begin
|
||
InterfKolvo := FInterfRelKolvosForKolvo[i];
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
if (FmeInterfaceRel.mtPortInterfRel.Locate(fnIDInterfRel, FInterfRelIDsForKolvo[i], [])) and
|
||
(ANewPortKolvo > 0) then
|
||
InterfKolvo := InterfKolvo * ANewPortKolvo;
|
||
|
||
//*** <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if FmeInterfaceRel.mtInterfaces.Locate(fnID, FInterfRelIDsForKolvo[i], []) then
|
||
if FmeInterfaceRel.mtInterfaces.FieldByName(fnKolvo).AsInteger <> InterfKolvo then
|
||
begin
|
||
FmeInterfaceRel.mtInterfaces.Edit;
|
||
FmeInterfaceRel.mtInterfaces.FieldByName(fnIsModified).AsBoolean := true;
|
||
FmeInterfaceRel.mtInterfaces.FieldByName(fnKolvo).AsInteger := InterfKolvo;
|
||
FmeInterfaceRel.mtInterfaces.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
FmeInterfaceRel.mtInterfaces.RecNo := InterfRelRecNo;
|
||
end;
|
||
end;
|
||
end; }
|
||
|
||
procedure TF_AddInterface.EnableControlsInterfInternalConn;
|
||
var
|
||
EnableEditDel: Boolean;
|
||
begin
|
||
EnableEditDel := false;
|
||
if mtInterfInternalConnection.Active then
|
||
if mtInterfInternalConnection.RecordCount > 0 then
|
||
EnableEditDel := true;
|
||
Act_EditInterfInternalConn.Enabled := EnableEditDel;
|
||
Act_DelInterfInternalConn.Enabled := EnableEditDel;
|
||
end;
|
||
|
||
procedure TF_AddInterface.EnableControlsPortInterfRel;
|
||
var
|
||
EnableEditDel: Boolean;
|
||
begin
|
||
EnableEditDel := false;
|
||
if CheckBox_IsPort.Checked then
|
||
if mtPortInterfRels.Active then
|
||
if mtPortInterfRels.RecordCount > 0 then
|
||
EnableEditDel := true;
|
||
Act_EditPortInterface.Enabled := EnableEditDel;
|
||
Act_DelPortInterface.Enabled := EnableEditDel;
|
||
end;
|
||
|
||
procedure TF_AddInterface.MakeEditInterfInternalConnWizard(AMakeEdit: TMakeEdit);
|
||
var
|
||
IgnoreIDPort: Integer;
|
||
begin
|
||
IgnoreIDPort := -1;
|
||
if GFormMode = fmEdit then
|
||
IgnoreIDPort := FmeInterfaceRel.ID;
|
||
with TF_Main(GForm) do
|
||
begin
|
||
if CreateFMakeEditPortInterfRel.SelectInterfForInternalConn(AMakeEdit, FmeInterfaceRel,
|
||
mtInterfInternalConnection, IgnoreIDPort) then
|
||
begin
|
||
case AMakeEdit of
|
||
meMake:
|
||
begin
|
||
mtInterfInternalConnection.Append;
|
||
mtInterfInternalConnection.FieldByName(fnIsNew).AsBoolean := true;
|
||
mtInterfInternalConnection.FieldByName(fnIsModified).AsBoolean := false;
|
||
end;
|
||
meEdit:
|
||
begin
|
||
mtInterfInternalConnection.Edit;
|
||
mtInterfInternalConnection.FieldByName(fnIsModified).AsBoolean := true;
|
||
end;
|
||
end;
|
||
if mtInterfInternalConnection.State <> dsBrowse then
|
||
begin
|
||
mtInterfInternalConnection.FieldByName(fnRelType).AsInteger := rtInterfInternalConn;
|
||
mtInterfInternalConnection.FieldByName(fnIDPort).AsInteger := FmeInterfaceRel.ID;
|
||
mtInterfInternalConnection.FieldByName(fnIDInterfRel).AsInteger := F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnID).AsInteger;
|
||
mtInterfInternalConnection.FieldByName(fnGender).AsInteger := F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnGender).AsInteger;
|
||
mtInterfInternalConnection.FieldByName(fnUnitInterfKolvo).AsInteger := F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnKolvo).AsInteger;
|
||
mtInterfInternalConnection.FieldByName(fnName).AsString := F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnName).AsString;
|
||
mtInterfInternalConnection.Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.MakeEditPortInterfaceRelWizard(AMakeEdit: TMakeEdit);
|
||
var
|
||
IgnoreIDPort: Integer;
|
||
begin
|
||
IgnoreIDPort := -1;
|
||
if GFormMode = fmEdit then
|
||
IgnoreIDPort := FmeInterfaceRel.ID;
|
||
with TF_Main(GForm) do
|
||
begin
|
||
if CreateFMakeEditPortInterfRel.Execute(AMakeEdit, FmeInterfaceRel, mtPortInterfRels, IgnoreIDPort) then
|
||
begin
|
||
MakeEditPortInterfaceRel(AMakeEdit, mtPortInterfRels,
|
||
FmeInterfaceRel.ID,
|
||
F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnID).AsInteger,
|
||
F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnKolvo).AsInteger,
|
||
F_MakeEditPortInterfRel.mtInterfaces.FieldByName(fnName).AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.MakeEditPortInterfaceRel(AMakeEdit: TMakeEdit; AMemTable: TkbmMemTable;
|
||
AIDPort, AIDInterfRel, AUnitInterfKolvo: Integer; AInterfName: String);
|
||
begin
|
||
case AMakeEdit of
|
||
meMake:
|
||
begin
|
||
AMemTable.Append;
|
||
AMemTable.FieldByName(fnIsNew).AsBoolean := true;
|
||
AMemTable.FieldByName(fnIsModified).AsBoolean := false;
|
||
end;
|
||
meEdit:
|
||
begin
|
||
AMemTable.Edit;
|
||
AMemTable.FieldByName(fnIsModified).AsBoolean := true;
|
||
end;
|
||
end;
|
||
|
||
if AMemTable.State <> dsBrowse then
|
||
begin
|
||
AMemTable.FieldByName(fnRelType).AsInteger := rtPortInterfRel;
|
||
AMemTable.FieldByName(fnIDPort).AsInteger := AIDPort;
|
||
AMemTable.FieldByName(fnIDInterfRel).AsInteger := AIDInterfRel;
|
||
AMemTable.FieldByName(fnUnitInterfKolvo).AsInteger := AUnitInterfKolvo;
|
||
AMemTable.FieldByName(fnName).AsString := AInterfName;
|
||
AMemTable.Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.OnChangeInterfName;
|
||
begin
|
||
DefineNotice;
|
||
FCurrInterfID := GetIDFromComboBox(ComboBox_Name);
|
||
FCurrInterfGUID := GetGUIDFromComboBox(ComboBox_Name);
|
||
end;
|
||
|
||
procedure TF_AddInterface.ShowPairKolvo;
|
||
begin
|
||
Label_PairKolvo.Caption := IntToStr(Round(SpinEdit_Kolvo.Value));
|
||
end;
|
||
|
||
procedure TF_AddInterface.ThrowDownIDAdverse(AIDInterfRel, AIDAdverse, ANewTypeI: Integer; AMemTable: TkbmMemTable);
|
||
var
|
||
//SavedBookMark: String;
|
||
SavedBookMark: TBookMark;
|
||
FindedCount: Integer;
|
||
begin
|
||
if Assigned(AMemTable) then
|
||
if AMemTable.Active then
|
||
begin
|
||
//SavedBookMark := AMemTable.Bookmark;
|
||
SavedBookMark := AMemTable.GetBookmark;
|
||
AMemTable.DisableControls;
|
||
try
|
||
FindedCount := 0;
|
||
|
||
AMemTable.First;
|
||
while Not AMemTable.Eof do
|
||
begin
|
||
if (AMemTable.FieldByName(fnID).AsInteger = AIDInterfRel) or
|
||
(AMemTable.FieldByName(fnID).AsInteger = AIDAdverse) then
|
||
begin
|
||
AMemTable.Edit;
|
||
AMemTable.FieldByName(fnIDAdverse).AsInteger := 0;
|
||
AMemTable.FieldByName(fnNumPair).AsInteger := 0;
|
||
TF_Main(GForm).DM.DefineInterfaceNumPairsStr(AMemTable, 0, AMemTable.FieldByName(fnKolvo).AsInteger);
|
||
AMemTable.FieldByName(fnSide).AsInteger := 0;
|
||
AMemTable.FieldByName(fnTypeI).AsInteger := ANewTypeI;
|
||
AMemTable.FieldByName(fnIsModified).AsBoolean := true;
|
||
AMemTable.Post;
|
||
|
||
Inc(FindedCount);
|
||
// 2 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if FindedCount = 2 then
|
||
Break; //// BREAK ////
|
||
end;
|
||
AMemTable.Next;
|
||
end;
|
||
//AMemTable.Bookmark := SavedBookMark;
|
||
if SavedBookMark <> nil then
|
||
begin
|
||
AMemTable.GotoBookmark(SavedBookMark);
|
||
AMemTable.FreeBookmark(SavedBookMark);
|
||
end;
|
||
finally
|
||
AMemTable.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_AddPortInterfaceExecute(Sender: TObject);
|
||
begin
|
||
if (mtPortInterfRels.RecordCount = 0) or (SpinEdit_Kolvo.Value = 1) then
|
||
MakeEditPortInterfaceRelWizard(meMake)
|
||
else
|
||
MessageModal(CControlPortInterfRelCount, ApplicationName, MB_ICONINFORMATION or MB_OK);
|
||
EnableControlsPortInterfRel;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_EditPortInterfaceExecute(Sender: TObject);
|
||
begin
|
||
MakeEditPortInterfaceRelWizard(meEdit);
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_DelPortInterfaceExecute(Sender: TObject);
|
||
var
|
||
InterfName: String;
|
||
begin
|
||
InterfName := mtPortInterfRels.FieldByName(fnName).AsString;
|
||
|
||
if MessageModal(cQuastRemoveInterface+' "'+InterfName+'"?', Application.Title, MB_ICONQUESTION or MB_YESNO) = IDYES then
|
||
begin
|
||
if mtPortInterfRels.FieldByName(fnIsNew).AsBoolean = false then
|
||
begin
|
||
GDeletedPortInterfRelIDs.Add(mtPortInterfRels.FieldByName(fnID).AsInteger);
|
||
end;
|
||
mtPortInterfRels.Delete;
|
||
EnableControlsPortInterfRel;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.CheckBox_MultiplePropertiesChange(
|
||
Sender: TObject);
|
||
begin
|
||
SetControls;
|
||
end;
|
||
|
||
procedure TF_AddInterface.SpinEdit_KolvoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
begin
|
||
//if (DisplayValue > 1) and mtPortInterfRels.Active and (mtPortInterfRels.RecordCount > 1) then
|
||
// begin
|
||
// DisplayValue := TcxSpinEdit(Sender).Value;
|
||
// MessageModal(CControlPortInterfRelCount +
|
||
// ' <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.',
|
||
// ApplicationName, MB_ICONINFORMATION or MB_OK);
|
||
// end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.rbTypeFunctionalClick(Sender: TObject);
|
||
begin
|
||
if GIsLineCompon = biTrue then
|
||
if rbTypeFunctional.Checked then
|
||
CheckBox_IsPair.Checked := true;
|
||
|
||
DefineInternalRelControls;
|
||
SetControls;
|
||
end;
|
||
|
||
procedure TF_AddInterface.GT_InterfInternalConnGenderGetDisplayText(
|
||
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
||
var AText: String);
|
||
begin
|
||
AText := GetInterfaceGenderName(AText);
|
||
end;
|
||
|
||
procedure TF_AddInterface.pcInternalRelationChange(Sender: TObject);
|
||
var
|
||
ActAdd: TAction;
|
||
ActEdit: TAction;
|
||
ActDel: TAction;
|
||
begin
|
||
ActAdd := nil;
|
||
ActEdit := nil;
|
||
ActDel := nil;
|
||
if pcInternalRelation.ActivePage = tsPortInterfRel then
|
||
begin
|
||
ActAdd := Act_AddPortInterface;
|
||
ActEdit := Act_EditPortInterface;
|
||
ActDel := Act_DelPortInterface;
|
||
end
|
||
else
|
||
if pcInternalRelation.ActivePage = tsInternalInterfConn then
|
||
begin
|
||
ActAdd := Act_AddInterfInternalConn;
|
||
ActEdit := Act_EditInterfInternalConn;
|
||
ActDel := Act_DelInterfInternalConn;
|
||
end;
|
||
tbAdd.Action := ActAdd;
|
||
tbEdit.Action := ActEdit;
|
||
tbDelete.Action := ActDel;
|
||
|
||
pmnuAdd.Action := ActAdd;
|
||
pmnuEdit.Action := ActEdit;
|
||
pmnuDel.Action := ActDel;
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_AddInterfInternalConnExecute(
|
||
Sender: TObject);
|
||
begin
|
||
if GFormMode = fmEdit then
|
||
begin
|
||
MakeEditInterfInternalConnWizard(meMake);
|
||
EnableControlsInterfInternalConn;
|
||
end
|
||
else
|
||
if GFormMode = fmMake then
|
||
MessageModal(cbMessage11, ApplicationName, MB_OK or MB_ICONINFORMATION);
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_EditInterfInternalConnExecute(
|
||
Sender: TObject);
|
||
begin
|
||
MakeEditInterfInternalConnWizard(meEdit);
|
||
end;
|
||
|
||
procedure TF_AddInterface.Act_DelInterfInternalConnExecute(
|
||
Sender: TObject);
|
||
var
|
||
Quest: String;
|
||
InterfName: String;
|
||
begin
|
||
|
||
Quest := cQuastDisconnectInterface;
|
||
case FmeInterfaceRel.IsPort of
|
||
biTrue:
|
||
Quest := cQuastDisconnectPort;
|
||
biFalse:
|
||
Quest := cQuastDisconnectInterface;
|
||
end;
|
||
|
||
InterfName := mtInterfInternalConnection.FieldByName(fnName).AsString;
|
||
if MessageModal(Quest+' "'+InterfName+'"?', Application.Title, MB_ICONQUESTION or MB_YESNO) = IDYES then
|
||
begin
|
||
if mtInterfInternalConnection.FieldByName(fnIsNew).AsBoolean = false then
|
||
begin
|
||
GDeletedPortInterfRelIDs.Add(mtInterfInternalConnection.FieldByName(fnID).AsInteger);
|
||
end;
|
||
mtInterfInternalConnection.Delete;
|
||
EnableControlsInterfInternalConn;
|
||
end;
|
||
end;
|
||
|
||
procedure TF_AddInterface.ComboBox_NamePropertiesChange(Sender: TObject);
|
||
begin
|
||
OnChangeInterfName;
|
||
end;
|
||
|
||
procedure TF_AddInterface.btSectionSideClick(Sender: TObject);
|
||
begin
|
||
TF_Main(GForm).FNormBase.DM.SendTextToInputStringsWithAddToTStrings(cbSectionSide.Text, stDimensions, true, cbSectionSide.Properties.Items);
|
||
end;
|
||
|
||
end.
|