You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

411 lines
11 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_code_port;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
dxExEdtr, RxLookup, Wwkeycb, StdCtrls, Mask, wwdbedit, Wwdotdot,
Wwdbcomb, bsSkinCtrls, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid,
dxCntner, BusinessSkinForm, DB, ADODB, ExtCtrls, Menus, XPMenu, Dialogs,
DBCtrls;
type
Tfrm_code_port = class(TForm)
Panel2: TPanel;
Image2: TImage;
Image3: TImage;
t_code_disport: TADOQuery;
t_code_disport1: TDataSource;
bsSkinPanel1: TbsSkinPanel;
Panel1: TPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column3: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridLookupColumn;
bsSkinGroupBox1: TbsSkinGroupBox;
DBMemo1: TDBMemo;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
bsSkinPanel2: TbsSkinPanel;
Edit1: TEdit;
Label21: TLabel;
wwIncrementalSearch1: TwwIncrementalSearch;
wwDBComboBox22: TwwDBComboBox;
Label7: TLabel;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
Panel3: TPanel;
Image1: TImage;
bsSkinButton1: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
DBEdit1: TDBEdit;
dxDBGrid1Column8: TdxDBGridColumn;
btnWeb: TButton;
procedure t_code_disportBeforePost(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure draw_port;
procedure wwDBComboBox22Exit(Sender: TObject);
procedure wwIncrementalSearch1Exit(Sender: TObject);
procedure wwIncrementalSearch1Enter(Sender: TObject);
procedure wwIncrementalSearch1KeyPress(Sender: TObject; var Key: Char);
procedure RxDBLookupCombo20Change(Sender: TObject);
procedure RxDBLookupCombo1Change(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinPanel1Resize(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure DBEdit1Change(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure btnWebClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_code_port: Tfrm_code_port;
code_port_open:boolean;
implementation
uses my_sys_function,u_main, u_data_share, u_code_port_modify,
u_sys_progress;
{$R *.dfm}
procedure Tfrm_code_port.draw_port;
var
x,y:integer;
begin
if not code_port_open then
exit;
if bsSkinButton1.Caption='<27><>ʾ' then
exit;
if (t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='')
or (t_code_disport.fieldbyname('γ<><CEB3>').AsString='') then
BEGIN
Image3.Picture.loadfromFile(ExtractFilePath(ParamStr(0))+'map.bmp');
exit;
END;
Image3.Picture.loadfromFile(ExtractFilePath(ParamStr(0))+'map.bmp');
if (t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='E') then
begin
x:=round(213+
strtofloat(t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_1').AsString
+'.'+t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_2').AsString)/30*38);
end
else
begin
if strtofloat(t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_1').AsString
+'.'+t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_2').AsString)>90 then
begin
x:=round(213+(360-
strtofloat(t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_1').AsString
+'.'+t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_2').AsString))/30*38);
end
else
begin
x:=round(213-
strtofloat(t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_1').AsString
+'.'+t_code_disport.fieldbyname('<27><><EFBFBD><EFBFBD>_2').AsString)/30*38);
end;
end;
if (t_code_disport.fieldbyname('γ<><CEB3>').AsString='N') then
begin
Y:=round(132-
strtofloat(t_code_disport.fieldbyname('γ<><CEB3>_1').AsString
+'.'+t_code_disport.fieldbyname('γ<><CEB3>_2').AsString)/15*21);
END
ELSE
BEGIN
Y:=round(132+
strtofloat(t_code_disport.fieldbyname('γ<><CEB3>_1').AsString
+'.'+t_code_disport.fieldbyname('γ<><CEB3>_2').AsString)/15*21);
END;
Image3.Canvas.Brush.Color:=clYellow;
Image3.Canvas.FillRect(Rect(x-2,y-2,x+2,y+2));
end;
procedure Tfrm_code_port.t_code_disportBeforePost(DataSet: TDataSet);
begin
// table_before_post(t_code_disport,'<27>ۿڴ<DBBF><DAB4><EFBFBD>');
table_before_post(t_code_disport,'Ӣ<><D3A2><EFBFBD><EFBFBD>');
table_before_post(t_code_disport,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// table_before_post(t_code_disport,'<27><><EFBFBD><EFBFBD>');
// table_before_post(t_code_disport,'<27><><EFBFBD><EFBFBD>');
// table_before_post(t_code_disport,'<27>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>');
// table_before_post(t_code_disport,'<27><>');
t_code_disport['Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=UpperCase(copy(trim(t_code_disport.fieldbyname('Ӣ<><D3A2><EFBFBD><EFBFBD>').asstring),1,1));
//t_code_disport['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=
end;
procedure Tfrm_code_port.FormShow(Sender: TObject);
begin
IF NOT FileExists(ExtractFilePath(ParamStr(0))+'map.bmp') then
Image3.Picture.SaveToFile(ExtractFilePath(ParamStr(0))+'map.bmp');
t_code_disport.OPEN;
code_port_open:=true;
wwDBComboBox22.text:='Ӣ<><D3A2><EFBFBD><EFBFBD>';
btnWeb.Visible:=strtobool(get_parameters_value(154,'false'));
end;
procedure Tfrm_code_port.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_code_port.Hide;
frm_code_port.ManualFloat(frm_code_port.BoundsRect );
frm_main.freeTabs('frm_code_port');
action:=cafree;
frm_code_port:=nil;
end;
procedure Tfrm_code_port.wwDBComboBox22Exit(Sender: TObject);
begin
if wwDBComboBox22.ItemIndex<>-1 then
begin
wwIncrementalSearch1.SearchField:=wwDBComboBox22.text;
wwIncrementalSearch1.Text:='';
end;
end;
procedure Tfrm_code_port.wwIncrementalSearch1Exit(Sender: TObject);
begin
code_port_open:=true;
frm_code_port.draw_port;
end;
procedure Tfrm_code_port.wwIncrementalSearch1Enter(Sender: TObject);
begin
code_port_open:=FALSE;
t_code_disport.Filtered:=FALSE;
Image3.Picture.loadfromFile(ExtractFilePath(ParamStr(0))+'map.bmp');
end;
procedure Tfrm_code_port.wwIncrementalSearch1KeyPress(Sender: TObject;
var Key: Char);
begin
IF KEY=#13 THEN
BEGIN
KEY:=#0;
code_port_open:=true;
frm_code_port.draw_port;
code_port_open:=FALSE;
END;
end;
procedure Tfrm_code_port.RxDBLookupCombo20Change(Sender: TObject);
begin
{ code_port_open:=FALSE;
IF RxDBLookupCombo20.DisplayValue=''THEN
BEGIN
t_code_disport.Filtered:=false;
END
ELSE
BEGIN
t_code_disport.Filtered:=false;
t_code_disport.Filter:='<27><><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo20.DisplayValues[1]+'''';
t_code_disport.Filtered:=true;
END;
code_port_open:=true;
frm_code_port.draw_port; }
end;
procedure Tfrm_code_port.RxDBLookupCombo1Change(Sender: TObject);
begin
{ code_port_open:=FALSE;
IF RxDBLookupCombo1.DisplayValue=''THEN
BEGIN
t_code_disport.Filtered:=false;
END
ELSE
BEGIN
t_code_disport.Filtered:=false;
t_code_disport.Filter:='<27><><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo1.DisplayValues[0]+'''';
t_code_disport.Filtered:=true;
END;
code_port_open:=true;
frm_code_port.draw_port; }
end;
procedure Tfrm_code_port.bsSkinButton1Click(Sender: TObject);
begin
if bsSkinButton1.Caption='<27><><EFBFBD>ص<EFBFBD>ͼ'then
begin
Panel2.height:=26;
bsSkinButton1.Caption:='<27><>ʾ<EFBFBD><CABE>ͼ';
end
else
begin
Panel2.height:=278;
bsSkinButton1.Caption:='<27><><EFBFBD>ص<EFBFBD>ͼ';
frm_code_port.draw_port;
end;
end;
procedure Tfrm_code_port.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_code_port.bsSkinButton6Click(Sender: TObject);
begin
if not if_open('011') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
try
code_port_open:=false;
frm_code_port_modify:=tfrm_code_port_modify.Create (self);
frm_code_port_modify.ShowModal;
finally
frm_code_port_modify.Free;
frm_code_port_modify:=nil;
code_port_open:=true;
frm_code_port.draw_port;
end;
end;
procedure Tfrm_code_port.bsSkinPanel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round((bsSkinPanel1.width-bsSkinPanel2.width)/5);
bsSkinButton2.width:=i;
bsSkinButton6.width:=i;
bsSkinButton7.width:=i;
bsSkinButton4.width:=i;
end;
procedure Tfrm_code_port.bsSkinButton12Click(Sender: TObject);
begin
if bsSkinButton12.Caption='չ <20><>' then
begin
dxdbgrid1.FullExpand;
bsSkinButton12.Caption:='<27><> <20><>';
end
else
begin
dxdbgrid1.FullCollapse;
bsSkinButton12.Caption:='չ <20><>';
end;
end;
procedure Tfrm_code_port.DBEdit1Change(Sender: TObject);
begin
frm_code_port.draw_port;
end;
procedure Tfrm_code_port.bsSkinButton2Click(Sender: TObject);
var
str_tiaojian:string;
str:widestring;
begin
IF TRIM(Edit1.TEXT)=''THEN
EXIT;
str_tiaojian:=' like '+''''+'%'+TRIM(Edit1.TEXT)+'%'+'''';
str:='where Ӣ<><D3A2><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or <20><><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or <20><><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or <20>ۿ<EFBFBD>ȫ<EFBFBD><C8AB>'+str_tiaojian;
str:=str+' or <20><>'+str_tiaojian;
str:=str+' or <20>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or <20>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>'+str_tiaojian;
str:=str+' or ʡ<><CAA1>'+str_tiaojian;
str:='select * from t_code_disport '+str+' order by <20><>,<2C><><EFBFBD><EFBFBD><><D3A2><EFBFBD><EFBFBD>';
code_port_open:=false;
t_code_disport.close;
t_code_disport.sql.Clear;
t_code_disport.sql.add(str);
t_code_disport.open;
code_port_open:=true;
frm_code_port.draw_port;
end;
procedure Tfrm_code_port.bsSkinButton7Click(Sender: TObject);
begin
if not if_open('011') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
try
code_port_open:=false;
frm_code_port_modify:=tfrm_code_port_modify.Create (self);
t_code_disport.insert;
frm_code_port_modify.ShowModal;
finally
frm_code_port_modify.Free;
frm_code_port_modify:=nil;
code_port_open:=true;
frm_code_port.draw_port;
end;
end;
procedure Tfrm_code_port.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_code_disport);
end;
procedure Tfrm_code_port.btnWebClick(Sender: TObject);
var aAdoQuery:TAdoQuery;
i:Integer;
begin
aAdoQuery:=CreateAdoQuery;
with t_code_disport do
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=t_code_disport.RecordCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
DisableControls;
frm_main.qryweb.close;
frm_main.qryweb.sql.clear;
frm_main.qryweb.sql.add('select * from t_code_disport where Ӣ<><D3A2><EFBFBD><EFBFBD>=:ENNo');
First;
while not Eof do
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_main.qryweb.close;
frm_main.qryweb.Parameters.ParamByName('ENNo').Value:=FieldByName('Ӣ<><D3A2><EFBFBD><EFBFBD>').AsString;
frm_main.qryweb.open;
if frm_main.qryweb.IsEmpty then
begin
frm_main.qryweb.Insert;
for i:=0 to frm_main.qryweb.FieldCount-1 do
begin
if (FindField(frm_main.qryweb.Fields[i].fieldname)<>nil) and (frm_main.qryweb.Fields[i].fieldname<>'<27>ۿڴ<DBBF><DAB4><EFBFBD>') then
frm_main.qryweb.Fields[i].Value:=fieldbyname(frm_main.qryweb.Fields[i].FieldName).Value;
end;
frm_main.qryweb.post;
end;
Next;
end;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
EnableControls;
FreeAndNil(aAdoQuery);
end;
end;
end.