📄 filesparam.pas
字号:
unit FilesParam;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TFlatButtonUnit,ADODB,Inifiles,StrUtils;
type
TfrmFilesParam = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
GroupBox3: TGroupBox;
Label2: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
GroupBox4: TGroupBox;
Label3: TLabel;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
GroupBox5: TGroupBox;
Label4: TLabel;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Edit16: TEdit;
GroupBox6: TGroupBox;
Label5: TLabel;
Edit17: TEdit;
Edit18: TEdit;
Edit19: TEdit;
Edit20: TEdit;
GroupBox7: TGroupBox;
Label6: TLabel;
Edit21: TEdit;
Edit22: TEdit;
Edit23: TEdit;
Edit24: TEdit;
GroupBox8: TGroupBox;
Label7: TLabel;
Edit25: TEdit;
Edit26: TEdit;
Edit27: TEdit;
Edit28: TEdit;
GroupBox9: TGroupBox;
Label8: TLabel;
Edit29: TEdit;
Edit30: TEdit;
Edit31: TEdit;
Edit32: TEdit;
GroupBox10: TGroupBox;
Label9: TLabel;
Edit33: TEdit;
Edit34: TEdit;
Edit35: TEdit;
Edit36: TEdit;
GroupBox11: TGroupBox;
Label10: TLabel;
Edit37: TEdit;
Edit38: TEdit;
Edit39: TEdit;
Edit40: TEdit;
GroupBox12: TGroupBox;
Label11: TLabel;
Edit41: TEdit;
Edit42: TEdit;
Edit43: TEdit;
Edit44: TEdit;
GroupBox13: TGroupBox;
Label12: TLabel;
Edit45: TEdit;
Edit46: TEdit;
Edit47: TEdit;
Edit48: TEdit;
GroupBox14: TGroupBox;
Label15: TLabel;
Edit49: TEdit;
Edit50: TEdit;
Edit51: TEdit;
Edit52: TEdit;
btnCancel: TFlatButton;
btnSure: TFlatButton;
Label14: TLabel;
Label13: TLabel;
procedure FormShow(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnSureClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmFilesParam: TfrmFilesParam;
implementation
uses dbConn, userLogin;
{$R *.dfm}
procedure TfrmFilesParam.FormShow(Sender: TObject);
var
i,p,j,k:Integer;
GrBox:TGroupBox;
edt:TEdit;
tmp:String;
rs:TADODataSet;
param:Array of String;
show:TStrings;
begin
SetLength(param,13);
//Clear all edit's data
for i:=0 to Groupbox1.ControlCount-1 do
begin
if Groupbox1.Controls[i].ClassName='TGroupBox' then
begin
GrBox:=TGroupBox(GroupBox1.Controls[i]);
tmp:='';
for p:=0 to GrBox.ControlCount-1 do
begin
if GrBox.Controls[p].ClassName='TEdit' then
begin
edt:=TEdit(GrBox.Controls[p]);
end;
end;
end;
end;
//Show data from db
rs:=TADODataSet.Create(nil);
rs.Connection := cn_public;
rs.CommandText :='SELECT * FROM photocheck.P_FILEPARAM ';
rs.Open ;
if rs.Recordset.RecordCount=0 then
begin
MessageBox(0,'您还未设置,请一定要谨慎设置', '文件名参数设置', 64);
exit;
end;
if not rs.Recordset.EOF then
begin
param[0]:=rs.Recordset.Fields[0].Value ;
param[1]:=rs.Recordset.Fields[1].Value ;
param[2]:=rs.Recordset.Fields[2].Value ;
param[3]:=rs.Recordset.Fields[3].Value ;
param[4]:=rs.Recordset.Fields[4].Value ;
param[5]:=rs.Recordset.Fields[5].Value ;
param[6]:=rs.Recordset.Fields[6].Value ;
param[7]:=rs.Recordset.Fields[7].Value ;
param[8]:=rs.Recordset.Fields[8].Value ;
param[9]:=rs.Recordset.Fields[9].Value ;
param[10]:=rs.Recordset.Fields[10].Value ;
param[11]:=rs.Recordset.Fields[11].Value ;
param[12]:=rs.Recordset.Fields[12].Value ;
end;
for i:=0 to Groupbox1.ControlCount-1 do
begin
if Groupbox1.Controls[i].ClassName='TGroupBox' then
begin
GrBox:=TGroupBox(GroupBox1.Controls[i]);
show:=TStringList.Create ;
show.Delimiter :=',';
show.DelimitedText := param[i];
for p:=0 to GrBox.ControlCount-1 do
begin
if GrBox.Controls[p].ClassName='TEdit' then
begin
edt:=TEdit(GrBox.Controls[p]);
edt.Text := show[k]; //相互对应的显示
k:=k+1;
end;
end;
k:=0;
show.Free ;
end;
end;
end;
procedure TfrmFilesParam.btnCancelClick(Sender: TObject);
begin
CurrentOperateItem:='文件命名参数设置返回';
dbConn.SaveOperateLog(frmLogin.spLog ,CurrentUserID,CurrentUser,now,CurrentOperateItem);
Close;
end;
procedure TfrmFilesParam.btnSureClick(Sender: TObject);
var
i,p:Integer;
GrBox:TGroupBox;
edt:TEdit;
tmp:String;
list:TStrings;
ary:array of char;
arry:Array of String;
sql:String;
IniFile:TInifile;
begin
sql:='';
sql :='DELETE FROM photocheck.P_FILEPARAM';
dbConn.Execute_SQL(sql);
SetLength(arry,13);
//Clear all edit's data
for i:=0 to Groupbox1.ControlCount-1 do
begin
if Groupbox1.Controls[i].ClassName='TGroupBox' then
begin
GrBox:=TGroupBox(GroupBox1.Controls[i]);
tmp:='';
for p:=0 to GrBox.ControlCount-1 do
begin
if GrBox.Controls[p].ClassName='TEdit' then
begin
edt:=TEdit(GrBox.Controls[p]);
tmp:=tmp+edt.Text+',';
end;
end;
// Copy(tmp,0,Length(tmp)-1);
arry[i]:=tmp;
// ShowMEssage(aryy[i]);
end;
end;
sql:='';
sql:='INSERT INTO photocheck.P_FILEPARAM VALUES (';
sql:= sql +' '''+arry[0]+''',';
sql:= sql +' '''+arry[1]+''',';
sql:= sql +' '''+arry[2]+''',';
sql:= sql +' '''+arry[3]+''',';
sql:= sql +' '''+arry[4]+''',';
sql:= sql +' '''+arry[5]+''',';
sql:= sql +' '''+arry[6]+''',';
sql:= sql +' '''+arry[7]+''',';
sql:= sql +' '''+arry[8]+''',';
sql:= sql +' '''+arry[9]+''',';
sql:= sql +' '''+arry[10]+''',';
sql:= sql +' '''+arry[11]+''',';
sql:= sql +' '''+arry[12]+''',';
sql:= sql +' to_date('''+FormatDateTime('YYYY-MM-DD HH:MM:SS',now)+''',''YYYY-MM-DD HH24:Mi:SS''))';
dbConn.Execute_SQL(sql);
////另外保存到配置文件中,只需要每次启动,即可获得相关的设置信息内容,与数据库存放有差别
CurDir:=ExtractFilePath(Application.ExeName);
IniFile:=TInifile.Create(CurDir+'config.INI');
IniFile.WriteInteger('文件命名参数设置','fileModeStart',StrToInt(Trim(edit1.text))); //设备Start
inifile.WriteInteger('文件命名参数设置','fileModeCount',StrToInt(Trim(edit2.text))); //设备 count
IniFile.WriteInteger('文件命名参数设置','fileEquipmentStart',StrToInt(Trim(edit5.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileEquipmentCount',StrToInt(Trim(edit6.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileYearStart',StrToInt(Trim(edit9.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileYearCount',StrToInt(Trim(edit10.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileMonthStart',StrToInt(Trim(edit13.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileMonthCount',StrToInt(Trim(edit14.text)));// count
IniFile.WriteInteger('文件命名参数设置','fileDayStart',StrToInt(Trim(edit17.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileDayCount',StrToInt(Trim(edit18.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileHourStart',StrToInt(Trim(edit21.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileHourCount',StrToInt(Trim(edit22.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileMinuteStart',StrToInt(Trim(edit25.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileMinuteCount',StrToInt(Trim(edit26.text))); //count
IniFile.WriteInteger('文件命名参数设置','fileSecondStart',StrToInt(Trim(edit29.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileSecondCount',StrToInt(Trim(edit30.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileRedLightStart',StrToInt(Trim(edit33.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileRedLightCount',StrToInt(Trim(edit34.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileRunDirStart',StrToInt(Trim(edit37.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileRunDirCount',StrToInt(Trim(edit38.text))); // count
IniFile.WriteInteger('文件命名参数设置','filePicSeqStart',StrToInt(Trim(edit41.text))); //Start
inifile.WriteInteger('文件命名参数设置','filePicSeqCount',StrToInt(Trim(edit42.text))); // count
IniFile.WriteInteger('文件命名参数设置','fileMemoBitStart',StrToInt(Trim(edit45.text))); //Start
inifile.WriteInteger('文件命名参数设置','fileMemoBitCount',StrToInt(Trim(edit46.text))); // count
//IniFile.WriteInteger('文件命名参数设置','fileSpeedStart',StrToInt(Trim(edit49.text))); //Start
//inifile.WriteInteger('文件命名参数设置','fileSpeedCount',StrToInt(Trim(edit50.text))); // count
Inifile.Free ;
CurrentOperateItem:='文件命名参数设置成功';
dbConn.SaveOperateLog(frmLogin.spLog ,CurrentUserID,CurrentUser,now,CurrentOperateItem);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -