900 lines
23 KiB
ObjectPascal
900 lines
23 KiB
ObjectPascal
![]() |
unit U_FLManage;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
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, U_SLT, ComObj, Menus,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxTLdxBarBuiltInMenu, cxNavigator,
|
|||
|
dxBarBuiltInMenu, cxPC, Math, RM_BarCode;
|
|||
|
|
|||
|
type
|
|||
|
FdDy = record
|
|||
|
inc: integer; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD>־<EFBFBD><D6BE><EFBFBD>
|
|||
|
FDdys: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
FdDysName: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
end;
|
|||
|
|
|||
|
TfrmflManage = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ADOQueryTree20: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Panel1: TPanel;
|
|||
|
Label2: TLabel;
|
|||
|
CYID: TEdit;
|
|||
|
TBFilter: TToolButton;
|
|||
|
v1CYNo: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
TBExport: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
ODPat: TOpenDialog;
|
|||
|
IdFTP1: TIdFTP;
|
|||
|
SaveDialog1: TSaveDialog;
|
|||
|
TBUP: TToolButton;
|
|||
|
Label3: TLabel;
|
|||
|
CYNO: TEdit;
|
|||
|
TBCopy: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
DSCYNO: TDataSource;
|
|||
|
CDS_CYNO: TClientDataSet;
|
|||
|
ADOQueryTree: TClientDataSet;
|
|||
|
Label11: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Panel3: TPanel;
|
|||
|
GroupBox1: TGroupBox;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
adoqueryPicture: TADOQuery;
|
|||
|
v1Column39: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
CYEName: TEdit;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
CYColor: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
CYCF: TEdit;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
OpenDialog1: TOpenDialog;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
cxgrdCYCNHS: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
RMBarCodeObject1: TRMBarCodeObject;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
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 TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBFilterClick(Sender: TObject);
|
|||
|
procedure CYIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure CYNoChange(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBUPClick(Sender: TObject);
|
|||
|
procedure TBImportClick(Sender: TObject);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TBCopyClick(Sender: TObject);
|
|||
|
procedure CYNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TBMLEditClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
CPID: string;
|
|||
|
PState: Integer;
|
|||
|
FCPID, FTopID: string;
|
|||
|
FJurisdiction: string;
|
|||
|
procedure InitTree();
|
|||
|
procedure InitGrid();
|
|||
|
procedure ReadINIFile();
|
|||
|
procedure InitImage();
|
|||
|
procedure LookImage(FileName: string);
|
|||
|
public
|
|||
|
dFdDy: array[0..20] of FdDy; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
Mach: array of TfrmSlt;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_CPAdd, U_FileUp, U_YPCR, U_YPTypeHelp, U_YPGL_YGDJ,
|
|||
|
StrUtils, U_FLAddPN;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmflManage.LookImage(FileName: string);
|
|||
|
var
|
|||
|
sFieldName: string;
|
|||
|
// ff: TADOBlobStream;
|
|||
|
// FJStream : TMemoryStream;
|
|||
|
begin
|
|||
|
|
|||
|
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
|
|||
|
|
|||
|
if not DirectoryExists(pchar(sFieldName)) then
|
|||
|
CreateDirectory(pchar(sFieldName), nil);
|
|||
|
|
|||
|
sFieldName := sFieldName + '\' + trim(FileName);
|
|||
|
|
|||
|
try
|
|||
|
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
|||
|
IdFTP1.Username := 'three';
|
|||
|
IdFTP1.Password := '641010';
|
|||
|
IdFTP1.Connect();
|
|||
|
except
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if IdFTP1.Connected then
|
|||
|
begin
|
|||
|
application.ProcessMessages;
|
|||
|
try
|
|||
|
// ShowMessage(PChar(Trim('D:\' + Trim(FileName))));
|
|||
|
IdFTP1.Get(Trim(UserDataFlag + 'YP\' + FileName), sFieldName, true, false);
|
|||
|
except
|
|||
|
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
IdFTP1.Quit;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
IdFTP1.Quit;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if IdFTP1.Connected then
|
|||
|
IdFTP1.Quit;
|
|||
|
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.InitTree();
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
with ADOQueryTree20 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from CP_Type order by CPlevel,CPOrder,CPName');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTree20, ADOQueryTree);
|
|||
|
SInitCDSData20(ADOQueryTree20, ADOQueryTree);
|
|||
|
|
|||
|
//cxDBTreeList1.Items[1].Expand(False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
Panel2.Visible := True;
|
|||
|
Panel2.Refresh;
|
|||
|
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
begin
|
|||
|
|
|||
|
fwhere := fwhere + ' and ' + trim(Pwhere)
|
|||
|
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered := False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select *,IsImg=cast((case when (select COUNT(T.CYID) from XD_File T where T.FileType = ''YP'' and T.CYID=A.CYID)=0 then 0 else 1 end) as bit ) from fl_ydang A where 1=1 ');
|
|||
|
sql.Add(fwhere);
|
|||
|
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
Panel2.Visible := False;
|
|||
|
end;
|
|||
|
// 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 TfrmflManage.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
//frmCPManage:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
var
|
|||
|
i, j: integer;
|
|||
|
begin
|
|||
|
j := length(Mach);
|
|||
|
if j > 0 then
|
|||
|
begin
|
|||
|
for i := 0 to j - 1 do
|
|||
|
begin
|
|||
|
Mach[i].free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
SetLength(Mach, 0);
|
|||
|
// writeCxGrid(self.Caption+tv1.Name,tv1);
|
|||
|
// Application := mainApplication;
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption, 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 TfrmflManage.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;
|
|||
|
|
|||
|
while CDS_Main.Locate('SSel', true, []) do
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('CYID').AsString) <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('delete FL_YDang where CYID=''' + Trim(CDS_Main.fieldbyname('CYID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Align := alclient;
|
|||
|
|
|||
|
ReadCxGrid(self.Caption, Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.cxDBTreeList1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBFilterClick(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 TfrmflManage.CYIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.CYNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
//if Length(Trim(TEdit(Sender).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 TfrmflManage.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBUPClick(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;
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBImportClick(Sender: TObject);
|
|||
|
var
|
|||
|
excelApp, WorkBook: Variant;
|
|||
|
i, j, k, LX, ExcelRowCount: integer;
|
|||
|
maxId, FCPID, FCPName, t1, t2, t3: string;
|
|||
|
begin
|
|||
|
FCPID := Trim(Self.ADOQueryTree.fieldbyname('CPID').AsString);
|
|||
|
FCPName := Trim(Self.ADOQueryTree.fieldbyname('CPName').AsString);
|
|||
|
|
|||
|
if GetLSNo(ADOQueryCmd, maxId, 'Y', 'FL_YDang', 2, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(FCPID) = '' then
|
|||
|
exit;
|
|||
|
try
|
|||
|
excelApp := CreateOleObject('Excel.Application');
|
|||
|
openDialog1.Filter := '*.CSV;*.xls';
|
|||
|
if opendialog1.Execute then
|
|||
|
begin
|
|||
|
WorkBook := excelApp.WorkBooks.Open(OpenDialog1.FileName);
|
|||
|
end
|
|||
|
else
|
|||
|
exit;
|
|||
|
|
|||
|
excelApp.Visible := false;
|
|||
|
ExcelRowCount := WorkBook.WorkSheets[1].UsedRange.Rows.Count;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>EXCEL<45><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
k := 0;
|
|||
|
for i := 1 to 20 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = '' then
|
|||
|
break;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
LX := i;
|
|||
|
dFdDy[k].FDdys := 'CPName';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYNo';
|
|||
|
dFdDy[k].FdDysName := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYName';
|
|||
|
dFdDy[k].FdDysName := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = 'ԭ<>ϳɷ<CFB3>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYSpec';
|
|||
|
dFdDy[k].FdDysName := 'ԭ<>ϳɷ<CFB3>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27>ɷ<EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYCF';
|
|||
|
dFdDy[k].FdDysName := '<27>ɷ<EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27>ŷ<EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYMF';
|
|||
|
dFdDy[k].FdDysName := '<27>ŷ<EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYKZ';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYHX';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><>ɫ' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYColor';
|
|||
|
dFdDy[k].FdDysName := '<27><>ɫ';
|
|||
|
end;
|
|||
|
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'ZhenXing';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CarType';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYCL';
|
|||
|
dFdDy[k].FdDysName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
if trim(excelApp.Cells[1, i].value) = 'ɴ<><C9B4>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'ShaChang';
|
|||
|
dFdDy[k].FdDysName := 'ɴ<><C9B4>';
|
|||
|
end;
|
|||
|
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><>ע' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'CYNote';
|
|||
|
dFdDy[k].FdDysName := '<27><>ע';
|
|||
|
end;
|
|||
|
k := k + 1;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
for i := 2 to ExcelRowCount do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from FL_YDang where 1=2');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if trim(excelApp.Cells[i, LX].value) <> trim(FCPName) then
|
|||
|
continue;
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for j := 0 to k - 1 do
|
|||
|
begin
|
|||
|
if trim(dFdDy[j].FDdys) = '' then
|
|||
|
continue;
|
|||
|
t1 := dFdDy[j].FDdys;
|
|||
|
t2 := inttostr(dFdDy[j].inc);
|
|||
|
t3 := excelApp.Cells[i, dFdDy[j].inc].Value;
|
|||
|
if trim(dFdDy[j].FDdys) <> 'CPName' then
|
|||
|
ADOQueryCmd.fieldbyname(dFdDy[j].FDdys).Value := excelApp.Cells[i, dFdDy[j].inc].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('CYValid').Value := 'Y';
|
|||
|
ADOQueryCmd.FieldByName('CYType').Value := Trim(FCPID);
|
|||
|
ADOQueryCmd.FieldByName('CYID').Value := maxId + inttostr(i);
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
end;
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.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 TfrmflManage.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,[]); }
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.InitImage();
|
|||
|
var
|
|||
|
i, j: integer;
|
|||
|
jpg: TJpegImage;
|
|||
|
myStream: TADOBlobStream;
|
|||
|
begin
|
|||
|
j := length(Mach);
|
|||
|
if j > 0 then
|
|||
|
begin
|
|||
|
for i := 0 to j - 1 do
|
|||
|
begin
|
|||
|
Mach[i].free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
SetLength(Mach, 0);
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with adoqueryPicture do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.TFID,A.WBID,A.FilesOther,B.FileName from TP_File A,XD_File B ');
|
|||
|
sql.add('where A.TFID =B.XFID and A.WBID=' + quotedstr(trim(CDS_Main.fieldbyname('CYID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
j := adoqueryPicture.RecordCount;
|
|||
|
if j < 1 then
|
|||
|
exit;
|
|||
|
adoqueryPicture.DisableControls;
|
|||
|
adoqueryPicture.First;
|
|||
|
SetLength(Mach, j);
|
|||
|
jpg := TJpegImage.Create();
|
|||
|
for i := 0 to j - 1 do
|
|||
|
begin
|
|||
|
if triM(adoqueryPicture.fieldbyname('FilesOther').AsString) <> '' then
|
|||
|
begin
|
|||
|
myStream := tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('FilesOther')), bmread);
|
|||
|
jpg.LoadFromStream(myStream);
|
|||
|
Mach[i] := TfrmSlt.Create(Self);
|
|||
|
Mach[i].Name := trim(adoqueryPicture.fieldbyname('TFID').AsString);
|
|||
|
Mach[i].Parent := ScrollBox1;
|
|||
|
Mach[i].Left := 0 + i * 165;
|
|||
|
Mach[i].Init(adoqueryPicture.fieldbyname('TFID').AsString, adoqueryPicture.fieldbyname('FileName').AsString, jpg);
|
|||
|
end;
|
|||
|
adoqueryPicture.Next;
|
|||
|
end;
|
|||
|
adoqueryPicture.EnableControls;
|
|||
|
finally
|
|||
|
jpg.free;
|
|||
|
application.ProcessMessages;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBCopyClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmflAddPN := tfrmflAddPN.Create(Application);
|
|||
|
with frmflAddPN 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();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmflAddPN.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.CYNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
FieldName: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmflAddPN := TfrmflAddPN.Create(Application);
|
|||
|
with frmflAddPN do
|
|||
|
begin
|
|||
|
CopyInt := 0;
|
|||
|
FCYID := '';
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmflAddPN.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmflAddPN := tfrmflAddPN.Create(Application);
|
|||
|
with frmflAddPN do
|
|||
|
begin
|
|||
|
CopyInt := 0;
|
|||
|
FCYID := Trim(Self.CDS_Main.fieldbyname('CYID').AsString);
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmflAddPN.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from XD_File ');
|
|||
|
sql.add('where CYID =' + quotedstr(trim(CDS_Main.fieldbyname('CYID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
LookImage(Trim(Self.ADOQueryTemp.fieldbyname('FileName').AsString));
|
|||
|
|
|||
|
|
|||
|
// try
|
|||
|
// frmCPAddPN := TfrmCPAddPN.Create(Application);
|
|||
|
// with frmCPAddPN 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);
|
|||
|
// FCPName := Trim(Self.ADOQueryTree.fieldbyname('CPName').AsString);
|
|||
|
// if FJurisdiction = '<27><>ѯ' then
|
|||
|
// begin
|
|||
|
// ToolButton1.Visible := False;
|
|||
|
// end;
|
|||
|
// if trim(self.Caption) = '<27><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2>ѯ(<28><>Ȩ<EFBFBD><C8A8>)' then
|
|||
|
// begin
|
|||
|
// lbl2.Visible := False;
|
|||
|
// CYCNHS.Visible := False;
|
|||
|
// end;
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// Self.CDS_Main.Edit;
|
|||
|
// CDS_Main.FieldByName('CPName').Value := FCPName;
|
|||
|
// CDS_Main.FieldByName('CYID').Value := FCYID;
|
|||
|
// CDS_Main.FieldByName('CYType').Value := FCPID;
|
|||
|
// CDS_Main.FieldByName('CYNo').Value := CYNo.Text;
|
|||
|
// CDS_Main.FieldByName('CYName').Value := CYName.Text;
|
|||
|
//
|
|||
|
// Self.CDS_Main.Post;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmCPAddPN.Free;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.TBMLEditClick(Sender: TObject);
|
|||
|
var
|
|||
|
fYPType: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('ssel', true, []) = false then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
fYPType := '';
|
|||
|
|
|||
|
frmYPTypeHelp := TfrmYPTypeHelp.create(self);
|
|||
|
with frmYPTypeHelp do
|
|||
|
begin
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
fYPType := trim(ADOQueryHelp.fieldbyname('CPID').asstring);
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(fYPType) = '' then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update FL_YDang SET CYType=''' + trim(fYPType) + ''' ');
|
|||
|
sql.Add('where CYID=' + quotedstr(trim(CDS_Main.fieldbyname('CYID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
initgrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmflManage.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmflAddPN := tfrmflAddPN.Create(Application);
|
|||
|
with frmflAddPN do
|
|||
|
begin
|
|||
|
CopyInt := 0;
|
|||
|
ToolButton1.Visible := False;
|
|||
|
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();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmflAddPN.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|