1268 lines
33 KiB
ObjectPascal
1268 lines
33 KiB
ObjectPascal
![]() |
unit U_CPManageSel;
|
|||
|
|
|||
|
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, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
dxDateRanges, IdExplicitTLSClientServerBase, U_BaseList, cxContainer,
|
|||
|
dxDBBarCode, dxBarCode;
|
|||
|
|
|||
|
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;
|
|||
|
|
|||
|
TfrmCPManageSel = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ADOQueryTree20: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
Panel1: TPanel;
|
|||
|
Label2: TLabel;
|
|||
|
CYID: TEdit;
|
|||
|
TBFilter: TToolButton;
|
|||
|
v1CYNo: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
TBExport: TToolButton;
|
|||
|
ToolButton4: 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;
|
|||
|
Panel5: TPanel;
|
|||
|
cxDBTreeList1: TcxDBTreeList;
|
|||
|
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
|||
|
Label11: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Panel3: TPanel;
|
|||
|
GroupBox1: TGroupBox;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
adoqueryPicture: TADOQuery;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
CYName: TEdit;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBMLEdit: TToolButton;
|
|||
|
Edit1: TEdit;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
SuoLv: TEdit;
|
|||
|
TBImport: TToolButton;
|
|||
|
OpenDialog1: TOpenDialog;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Label9: TLabel;
|
|||
|
CYKZ: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
CYMF: TEdit;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
Panel7: TPanel;
|
|||
|
Panel8: TPanel;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Panel4: TPanel;
|
|||
|
Label14: TLabel;
|
|||
|
LBCPAP1: TLabel;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
TCBNOR1: TComboBox;
|
|||
|
RMBarCodeObject1: TRMBarCodeObject;
|
|||
|
Label10: TLabel;
|
|||
|
PBLengthXS: TEdit;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Label5: TLabel;
|
|||
|
CYTiJi: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cv1Column10: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_Sub: TClientDataSet;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
HuoMiao: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
CYCF: TEdit;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Label13: TLabel;
|
|||
|
CYJGGY: TEdit;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
btnTY: TToolButton;
|
|||
|
btnQY: TToolButton;
|
|||
|
Tv1Column8: 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 ToolButton4Click(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 ToolButton8Click(Sender: TObject);
|
|||
|
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 TCBNOR1Change(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure btnQYClick(Sender: TObject);
|
|||
|
procedure btnTYClick(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
CPID: string;
|
|||
|
PState: Integer;
|
|||
|
FCPID, FTopID: string;
|
|||
|
FJurisdiction: string;
|
|||
|
procedure SetStatus();
|
|||
|
procedure InitTree();
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitSub(MCYID: string);
|
|||
|
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_RTFun, U_CPAdd, U_FileUp, U_YPCR, U_YPTypeHelp, U_YPGL_YGDJ,
|
|||
|
StrUtils;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmCPManageSel.InitSub(MCYID: string);
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.*,B.CYNo,B.CYName,B.CYMF,B.CYKZ from ');
|
|||
|
sql.Add(' CP_YDang_Link A inner join CP_YDang B on A.ChildCYID=B.CYID');
|
|||
|
sql.Add(' where A.CYID= ' + quotedstr(MCYID));
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_Sub);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_Sub);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.LookImage(FileName: string);
|
|||
|
var
|
|||
|
sFieldName: string;
|
|||
|
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 TfrmCPManageSel.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.InitTree();
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTree20 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('exec P_YP_Get_Type @CYType=''CP2206250001'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
SCreateCDS(ADOQueryTree20, ADOQueryTree);
|
|||
|
SInitCDSData(ADOQueryTree20, ADOQueryTree);
|
|||
|
cxDBTreeList1.Items[0].Expand(false);
|
|||
|
//cxDBTreeList1.Items[1].Expand(False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
Panel2.Visible := True;
|
|||
|
Panel2.Refresh;
|
|||
|
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
begin
|
|||
|
if fwhere <> '' then
|
|||
|
fwhere := fwhere + ' and ' + trim(Pwhere)
|
|||
|
else
|
|||
|
fwhere := ' where ' + trim(Pwhere);
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered := False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Page_YP ');
|
|||
|
sql.Add('@CYType=' + quotedstr(Trim(ADOQueryTree.fieldbyname('CPID').AsString)));
|
|||
|
sql.Add(',@pageIndex=' + inttostr(CurrentPage));
|
|||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
|||
|
sql.Add(',@criteria= ' + quotedstr(fwhere));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
|
|||
|
LBCPAP1.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
|||
|
|
|||
|
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;
|
|||
|
// SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
// SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
// finally
|
|||
|
// ADOQueryMain.EnableControls;
|
|||
|
// end;
|
|||
|
// Panel2.Visible := False;
|
|||
|
//end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
//frmCPManage:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
var
|
|||
|
i, j: integer;
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
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 TfrmCPManageSel.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 TfrmCPManageSel.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 CP_YDang where CYID=''' + Trim(CDS_Main.fieldbyname('CYID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
FJurisdiction := Self.fParameters1;
|
|||
|
|
|||
|
ReadCxGrid(self.Caption, Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
RecordsNumber := 100;
|
|||
|
CurrentPage := 1;
|
|||
|
InitTree();
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.cxDBTreeList1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitTree();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.TBFilterClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.CYIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Trim(CYID.Text) = '' then
|
|||
|
Exit;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered := False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Select_CP_YDang :Code,1,'''' ');
|
|||
|
Parameters.ParamByName('Code').Value := Trim(CYID.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
CYID.Text := '';
|
|||
|
ADOQueryTree.Locate('CPID', CPID, []);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.CYNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
//if Length(Trim(TEdit(Sender).Text))<4 then Exit;
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.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 trim(ComboBox1.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
//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;
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(ComboBox1.Text) + '.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.ShowPrintDialog := False;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.PrintReport;
|
|||
|
// RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<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 TfrmCPManageSel.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 TfrmCPManageSel.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', 'CP_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 CP_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 TfrmCPManageSel.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 TfrmCPManageSel.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.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 TfrmCPManageSel.TBCopyClick(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();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPAdd.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.CYNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.ToolButton8Click(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 trim(ComboBox1.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
//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;
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(ComboBox1.Text) + '.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.ShowPrintDialog := True;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
// RM1.PrintReport;
|
|||
|
RM1.ShowReport;
|
|||
|
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 TfrmCPManageSel.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
FieldName: string;
|
|||
|
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);
|
|||
|
FCPName := Trim(Self.ADOQueryTree.fieldbyname('CPName').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPAdd.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
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);
|
|||
|
CYNo.ReadOnly := True;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPAdd.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.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 TfrmCPManageSel.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
initsub(Trim(CDS_Main.fieldbyname('CYID').AsString));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.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 CP_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 TfrmCPManageSel.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.TCBNOR1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
RecordsNumber := StrToInt(TCBNOR1.Text);
|
|||
|
CurrentPage := 1;
|
|||
|
cyno.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.btnQYClick(Sender: TObject);
|
|||
|
begin
|
|||
|
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 CP_YDang SET ISQiYong=1 ');
|
|||
|
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 TfrmCPManageSel.btnTYClick(Sender: TObject);
|
|||
|
begin
|
|||
|
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 CP_YDang SET ISQiYong=0 ');
|
|||
|
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 TfrmCPManageSel.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPManageSel.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPAdd := TfrmCPAdd.Create(Application);
|
|||
|
with frmCPAdd 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
|
|||
|
frmCPAdd.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|