670 lines
19 KiB
ObjectPascal
670 lines
19 KiB
ObjectPascal
unit U_CPManageCX;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,U_SLT,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, jpeg, cxLookAndFeels,
|
||
cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
|
||
dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
|
||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter, cxNavigator, cxTLdxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmCPManageCX = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
DataSource1: TDataSource;
|
||
ADOQueryTree: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
cxSplitter1: TcxSplitter;
|
||
Panel1: TPanel;
|
||
Label2: TLabel;
|
||
CYID: TEdit;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
DataSource2: TDataSource;
|
||
ADOQueryMain: TADOQuery;
|
||
CDS_Main: TClientDataSet;
|
||
ToolButton1: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
ODPat: TOpenDialog;
|
||
IdFTP1: TIdFTP;
|
||
SaveDialog1: TSaveDialog;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
ToolButton8: TToolButton;
|
||
ToolButton9: TToolButton;
|
||
Panel2: TPanel;
|
||
Label1: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label3: TLabel;
|
||
Label6: TLabel;
|
||
CYName: TEdit;
|
||
CYEName: TEdit;
|
||
CYSpec: TEdit;
|
||
CYNO: TEdit;
|
||
Edit1: TEdit;
|
||
Label7: TLabel;
|
||
CYKZ: TEdit;
|
||
defstr1: TEdit;
|
||
Label13: TLabel;
|
||
Panel3: TPanel;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column42: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
v1Column24: TcxGridDBColumn;
|
||
v1Column25: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
adoqueryPicture: TADOQuery;
|
||
Panel5: TPanel;
|
||
cxDBTreeList1: TcxDBTreeList;
|
||
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure cxDBTreeList1DblClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure CYIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure CYNoChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure FormKeyDown(Sender: TObject; var Key: Word;
|
||
Shift: TShiftState);
|
||
procedure Tv1KeyDown(Sender: TObject; var Key: Word;
|
||
Shift: TShiftState);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure ToolButton9Click(Sender: TObject);
|
||
procedure CYSpecChange(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
CPID:string;
|
||
PState:Integer;
|
||
FCPID,FTopID:String;
|
||
procedure InitTree();
|
||
procedure InitGrid();
|
||
procedure ReadINIFile();
|
||
|
||
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmCPManageCX: TfrmCPManageCX;
|
||
Mach: array of TfrmSlt;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_CPAdd,U_FileUp,U_YPCR;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmCPManageCX.InitTree();
|
||
var
|
||
i:Integer;
|
||
begin
|
||
with ADOQueryTree do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from CP_Type order by CPlevel,CPOrder,CPName');
|
||
Open;
|
||
end;
|
||
cxDBTreeList1.Items[0].Expand(false);
|
||
//cxDBTreeList1.Items[1].Expand(False);
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.InitGrid();
|
||
begin
|
||
Panel2.Visible:=True;
|
||
Panel2.Refresh;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Select_CP_YDang :Code,:PState,:CYType');
|
||
Parameters.ParamByName('Code').Value:='';
|
||
Parameters.ParamByName('PState').Value:=0;
|
||
Parameters.ParamByName('CYType').Value:=Trim(ADOQueryTree.fieldbyname('CPID').AsString);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
Panel2.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCPManageCX:=nil;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><>Ʒ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>ѯ',Tv1,'<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
||
if DirectoryExists(ExtractFileDir('D:\Right1209')) then
|
||
winexec('cmd /c rd /s /q D:\Right1209',sw_hide);
|
||
Close;
|
||
end;
|
||
procedure TfrmCPManageCX.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if Trim(CDS_Main.fieldbyname('CYID').AsString)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete CP_YDang where CYID='''+Trim(CDS_Main.fieldbyname('CYID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
CDS_Main.Delete;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.FormShow(Sender: TObject);
|
||
begin
|
||
InitTree();
|
||
ReadCxGrid('<27><>Ʒ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>ѯ',Tv1,'<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
||
if DParameters1='1' then
|
||
begin
|
||
TBAdd.Visible:=False;
|
||
TBDel.Visible:=False;
|
||
ToolButton3.Visible:=False;
|
||
ToolButton5.Visible:=False;
|
||
end;
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.cxDBTreeList1DblClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCPAdd:=TfrmCPAdd.Create(Application);
|
||
with frmCPAdd do
|
||
begin
|
||
CopyInt:=0;
|
||
FCYID:='';
|
||
FCPID:=Trim(Self.ADOQueryTree.fieldbyname('CPID').AsString);
|
||
FCPNo:=Trim(Self.ADOQueryTree.fieldbyname('CPNo').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPAdd.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCPAdd:=TfrmCPAdd.Create(Application);
|
||
with frmCPAdd do
|
||
begin
|
||
CopyInt:=0;
|
||
FCYID:=Trim(Self.CDS_Main.fieldbyname('CYID').AsString);
|
||
FCPID:=Trim(Self.ADOQueryTree.fieldbyname('CPID').AsString);
|
||
FCPNo:=Trim(Self.ADOQueryTree.fieldbyname('CPNo').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
Self.CDS_Main.Locate('CYID',FCYID,[]);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPAdd.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.CYIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CP_YDang where CYID='''+Trim(CYID.Text)+'''');
|
||
Open;
|
||
end;
|
||
CPID:=Trim(ADOQueryTemp.fieldbyname('CYType').AsString);
|
||
if Trim(CYID.Text)='' then Exit;
|
||
SDofilter(ADOQueryMain,' CYID='''+Trim(CYID.Text)+''' ');
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
CYID.Text:='';
|
||
ADOQueryTree.Locate('CPID',CPID,[]);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.CYNoChange(Sender: TObject);
|
||
begin
|
||
// if Length(Trim(CYNO.Text))<4 then Exit;
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
TcxGridToExcel('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>',cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton4Click(Sender: TObject);
|
||
var
|
||
fPrintFile,FFCYID:string;
|
||
DPS,i,j:Integer;
|
||
Txt,fImagePath:string;
|
||
Moudle: THandle;
|
||
Makebar:TMakebar;
|
||
Mixtext:TMixtext;
|
||
begin
|
||
CYID.SetFocus;
|
||
if CDS_Main.IsEmpty then Exit;
|
||
//if CDS_CYNO.IsEmpty then Exit;
|
||
if Trim(Edit1.Text)<>'' then
|
||
begin
|
||
if TryStrToInt(Edit1.Text,i)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7>ǩ.rmf';
|
||
CDS_Main.DisableControls;
|
||
DPS:=0;
|
||
FFCYID:='';
|
||
i:=1;
|
||
if Trim(Edit1.Text)='' then
|
||
begin
|
||
j:=1;
|
||
end else
|
||
begin
|
||
j:=StrToInt(Edit1.Text);
|
||
end;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if CDS_Main.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
try
|
||
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar:=GetProcAddress(Moudle,'Make');
|
||
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
||
Txt:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
|
||
if FileExists(fImagePath) then DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
RMVariables['QRBARCODE']:=fImagePath;
|
||
for i:=1 to j do
|
||
begin
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.PrintReport;
|
||
end else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><>Ʒ<EFBFBD><C6B7>ǩ.rmf'),'<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if DPS=0 then
|
||
begin
|
||
FFCYID:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
end;
|
||
end;
|
||
//CDS_Main.Locate('CYID',Trim(CDS_CYNO.fieldbyname('CYID').AsString),[]);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
CDS_Main.Locate('CYID',FFCYID,[]);
|
||
Edit1.Text:='1';
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmFileUp:=TfrmFileUp.Create(Application);
|
||
with frmFileUp do
|
||
begin
|
||
Code.Text:=Trim(Self.CDS_Main.fieldbyname('CYNO').AsString);
|
||
CYID:=Trim(Self.CDS_Main.fieldbyname('CYID').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
Self.CDS_Main.Locate('CYID',CYID,[]);
|
||
end;
|
||
end;
|
||
finally
|
||
frmFileUp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton6Click(Sender: TObject);
|
||
var
|
||
fHandle:THandle;
|
||
FInt:Integer;
|
||
FFName,FPath:String;
|
||
begin
|
||
{FPath:='C:\HTTP1209\';
|
||
if DirectoryExists(ExtractFileDir(FPath)) then
|
||
winexec('cmd /c rd /s /q C:\HTTP1209',sw_hide);}
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from XD_File where CYNO='''+Trim(CDS_Main.fieldbyname('CYNO').AsString)+'''');
|
||
Open;
|
||
if IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ƷͼƬδ<C6AC>ϴ<EFBFBD><CFB4><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
try
|
||
ReadINIFile();
|
||
server:=ReadINIFileStr('SYSTEMSET.INI','SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
||
if Length(server)<6 then
|
||
begin
|
||
server:='127.0.0.1';
|
||
end;
|
||
IdFTP1.Host :=server;//PicSvr;
|
||
IdFTP1.Username := 'three';
|
||
IdFTP1.Password := '641010';
|
||
IdFTP1.Connect();
|
||
except
|
||
IdFTP1.Quit;
|
||
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡', '<27><>ʾ', MB_ICONWARNING);
|
||
Exit;
|
||
end;
|
||
FPath:='D:\Right1209\';
|
||
if not DirectoryExists(ExtractFileDir(FPath)) then
|
||
CreateDir(ExtractFileDir(FPath));
|
||
FFName:=Trim(ADOQueryTemp.fieldbyname('FileName').AsString);
|
||
FFName:=FPath+FFName;
|
||
if FileExists(FFName) then
|
||
begin
|
||
FInt:=1;
|
||
end;
|
||
if FInt<>1 then
|
||
IdFTP1.Get('YP\'+Trim(ADOQueryTemp.fieldbyname('FileName').AsString),
|
||
FPath+Trim(ADOQueryTemp.fieldbyname('FileName').AsString)
|
||
);
|
||
if IdFTP1.Connected then IdFTP1.Quit;
|
||
ShellExecute(Handle, 'open',PChar(FPath+Trim(ADOQueryTemp.fieldbyname('FileName').AsString)),'', '', SW_SHOWNORMAL);
|
||
|
||
end;
|
||
procedure TfrmCPManageCX.ReadINIFile();
|
||
var
|
||
programIni:Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
FileName:string;
|
||
begin
|
||
FileName:=ExtractFilePath(Paramstr(0))+'SYSTEMSET.INI';
|
||
programIni:=Tinifile.create(FileName);
|
||
server:=programIni.ReadString('SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
||
programIni.Free;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ToolButton6.Click;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.Tv1CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CP_YDang where CYID='''+Trim(CDS_Main.fieldbyname('CYID').asstring)+'''');
|
||
Open;
|
||
end;
|
||
CPID:=Trim(ADOQueryTemp.fieldbyname('CYType').AsString);
|
||
ADOQueryTree.Locate('CPID',CPID,[]);
|
||
|
||
end;
|
||
|
||
|
||
procedure TfrmCPManageCX.FormKeyDown(Sender: TObject; var Key: Word;
|
||
Shift: TShiftState);
|
||
begin
|
||
{if Key= then
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>6666Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if Trim(CDS_Main.fieldbyname('CYID').AsString)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete CP_YDang where CYID='''+Trim(CDS_Main.fieldbyname('CYID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
CDS_Main.Delete;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.Tv1KeyDown(Sender: TObject; var Key: Word;
|
||
Shift: TShiftState);
|
||
begin
|
||
if Key=46 then
|
||
begin
|
||
TBDel.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCPAdd:=TfrmCPAdd.Create(Application);
|
||
with frmCPAdd do
|
||
begin
|
||
CopyInt:=1;
|
||
FCYID:=Trim(Self.CDS_Main.fieldbyname('CYID').AsString);
|
||
FCPID:=Trim(Self.ADOQueryTree.fieldbyname('CPID').AsString);
|
||
FCPNo:=Trim(Self.ADOQueryTree.fieldbyname('CPNo').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
Self.CDS_Main.Locate('CYID',FCYID,[]);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPAdd.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmYPCR:=TfrmYPCR.Create(Application);
|
||
with frmYPCR do
|
||
begin
|
||
FCYID:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
RKFlag:='<27><><EFBFBD><EFBFBD>';
|
||
frmYPCR.InitGrid();
|
||
with CDS_HZ do
|
||
begin
|
||
Append;
|
||
FieldByName('CYID').Value:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
FieldByName('CYName').Value:=Trim(CDS_Main.fieldbyname('CYName').AsString);
|
||
FieldByName('CYSpec').Value:=Trim(CDS_Main.fieldbyname('CYSpec').AsString);
|
||
FieldByName('KCUnit').Value:=Trim(CDS_Main.fieldbyname('KCUnit').AsString);
|
||
Post;
|
||
end;
|
||
frmYPCR.SaveData();
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmYPCR.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.ToolButton9Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmYPCR:=TfrmYPCR.Create(Application);
|
||
with frmYPCR do
|
||
begin
|
||
FCYID:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
RKFlag:='<27><><EFBFBD><EFBFBD>';
|
||
frmYPCR.InitGrid();
|
||
frmYPCR.cxGridDBColumn1.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
frmYPCR.cxGridDBColumn5.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
with CDS_HZ do
|
||
begin
|
||
Append;
|
||
FieldByName('CYID').Value:=Trim(CDS_Main.fieldbyname('CYID').AsString);
|
||
FieldByName('CYName').Value:=Trim(CDS_Main.fieldbyname('CYName').AsString);
|
||
FieldByName('CYSpec').Value:=Trim(CDS_Main.fieldbyname('CYSpec').AsString);
|
||
FieldByName('KCUnit').Value:=Trim(CDS_Main.fieldbyname('KCUnit').AsString);
|
||
Post;
|
||
end;
|
||
frmYPCR.SaveData();
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmYPCR.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCPManageCX.CYSpecChange(Sender: TObject);
|
||
begin
|
||
// if Length(Trim(CYSpec.Text))<3 then Exit;
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
end.
|