694 lines
20 KiB
ObjectPascal
694 lines
20 KiB
ObjectPascal
|
unit U_TradeLabelSel;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, StrUtils, 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, cxCalendar, cxButtonEdit,
|
|||
|
cxTextEdit, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
dxBarBuiltInMenu, U_BaseList, cxContainer, dxCore, cxDateUtils, cxImage,
|
|||
|
cxDBEdit, IdExplicitTLSClientServerBase, RM_Preview, cxPC, U_BaseHelp,
|
|||
|
System.ImageList, Vcl.ImgList, RTComboBox, RM_BarCode, RM_e_Xls, RM_e_Jpeg,
|
|||
|
RM_E_llPDF, RM_e_main, RM_e_htm, RM_e_Tiff, RM_e_emf, RM_e_Graphic, RM_e_bmp,
|
|||
|
RM_e_csv, RM_e_txt, RM_DialogCtls, RM_Cross, RM_Diagonal, RM_ChineseMoneyMemo,
|
|||
|
RM_Ole, RM_CheckBox, RM_RichEdit, RM_AngLbl, RM_FormReport, RM_PDBGrid,
|
|||
|
RMD_Dbx, RMD_ADO, RMD_ReportExplorer, RM_DsgGridReport, RM_Designer, dxSkinWXI,
|
|||
|
dxScrollbarAnnotations;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTradeLabelSel = class(TfrmBaseHelp)
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryLabel: TADOQuery;
|
|||
|
ADO_1: TADOQuery;
|
|||
|
DS_Label: TDataSource;
|
|||
|
CDS_Label: TClientDataSet;
|
|||
|
RMDB_1: TRMDBDataSet;
|
|||
|
RMLabel: TRMGridReport;
|
|||
|
RMBarCodeObject1: TRMBarCodeObject;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDataDictionary1: TRMDataDictionary;
|
|||
|
ADO_Down: TADOQuery;
|
|||
|
RMReport1: TRMReport;
|
|||
|
RMCompositeReport1: TRMCompositeReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RMUserDataset1: TRMUserDataset;
|
|||
|
RMAngledLabelObject1: TRMAngledLabelObject;
|
|||
|
RMRichObject1: TRMRichObject;
|
|||
|
RMCheckBoxObject1: TRMCheckBoxObject;
|
|||
|
RMOLEObject1: TRMOLEObject;
|
|||
|
RMChineseMoneyObject1: TRMChineseMoneyObject;
|
|||
|
RMDiagonalObject1: TRMDiagonalObject;
|
|||
|
RMCrossObject1: TRMCrossObject;
|
|||
|
RMDialogControls1: TRMDialogControls;
|
|||
|
RMTextExport1: TRMTextExport;
|
|||
|
RMCSVExport1: TRMCSVExport;
|
|||
|
RMBMPExport1: TRMBMPExport;
|
|||
|
RMEMFExport1: TRMEMFExport;
|
|||
|
RMTiffExport1: TRMTiffExport;
|
|||
|
RMHTMExport1: TRMHTMExport;
|
|||
|
RMllPDFExport1: TRMllPDFExport;
|
|||
|
RMJPEGExport1: TRMJPEGExport;
|
|||
|
RMDesigner1: TRMDesigner;
|
|||
|
RMGridReportDesigner1: TRMGridReportDesigner;
|
|||
|
RMReportExplorer1: TRMReportExplorer;
|
|||
|
RMDADOComponents1: TRMDADOComponents;
|
|||
|
RMDDBXComponents1: TRMDDBXComponents;
|
|||
|
RMFormReport1: TRMFormReport;
|
|||
|
RMPrintDBGrid1: TRMPrintDBGrid;
|
|||
|
RMDB_UP: TRMDBDataSet;
|
|||
|
RMUP: TRMGridReport;
|
|||
|
ADO_I1: TADOQuery;
|
|||
|
DS_I1: TDataSource;
|
|||
|
IdFTP1: TIdFTP;
|
|||
|
ToolBar2: TToolBar;
|
|||
|
Tadd: TToolButton;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Tdel: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
Tupd: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Panel2: TPanel;
|
|||
|
cxGridLabel: TcxGrid;
|
|||
|
TVLabel: TcxGridDBTableView;
|
|||
|
TVLabellabelId: TcxGridDBColumn;
|
|||
|
TVLabellabeltype: TcxGridDBColumn;
|
|||
|
TVLabellabelCaption: TcxGridDBColumn;
|
|||
|
TVLabellabelFile: TcxGridDBColumn;
|
|||
|
TVLabelColumn2: TcxGridDBColumn;
|
|||
|
TVLabelColumn1: TcxGridDBColumn;
|
|||
|
cxGridLabelLevel1: TcxGridLevel;
|
|||
|
RMPreview3: TRMPreview;
|
|||
|
ToolButton9: TToolButton;
|
|||
|
TVLabelColumn3: TcxGridDBColumn;
|
|||
|
TVLabelColumn4: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
Panel4: TPanel;
|
|||
|
Label10: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
LabelType: TcxComboBox;
|
|||
|
LabelCaption: TcxTextEdit;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure TupdClick(Sender: TObject);
|
|||
|
procedure TdelClick(Sender: TObject);
|
|||
|
procedure TaddClick(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure TVLabelCellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure LabVolumeDblClick(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure TJDblClick(Sender: TObject);
|
|||
|
procedure PackTypeBtnDnClick(Sender: TObject);
|
|||
|
procedure PackTypeBtnUpClick(Sender: TObject);
|
|||
|
procedure cxDBImage1DblClick(Sender: TObject);
|
|||
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
procedure LabelCaptionPropertiesChange(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitLabel();
|
|||
|
function SaveLabel(MLabelID: string): Boolean;
|
|||
|
procedure UpLabelImg(MlabelCaption: string);
|
|||
|
procedure LookImage(FileName: string);
|
|||
|
procedure IintLabelType();
|
|||
|
public
|
|||
|
FDataID: string;
|
|||
|
fFlileFlag: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTradeLabelSel: TfrmTradeLabelSel;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_ZDYHelpSel, U_CompanySel, U_LabelInput,
|
|||
|
U_PictureUpload;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmTradeLabelSel.IintLabelType();
|
|||
|
var
|
|||
|
mSql: string;
|
|||
|
begin
|
|||
|
mSql := 'select Name=ZDYName from KH_ZDY where Type=''BQLX'' ';
|
|||
|
SInitTCXComBoxBySql(ADOQueryTemp, LabelType, False, mSql);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.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
|
|||
|
try
|
|||
|
IdFTP1.Get(fFlileFlag + '\' + Trim(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 TfrmTradeLabelSel.UpLabelImg(MlabelCaption: string);
|
|||
|
var
|
|||
|
fImagePath2: string;
|
|||
|
OpenDiaLog: TOpenDialog;
|
|||
|
fFileName: string;
|
|||
|
fFilePath: string;
|
|||
|
maxNo: string;
|
|||
|
FJStream: TMemoryStream;
|
|||
|
mfileSize: integer;
|
|||
|
mCreationTime: TdateTime;
|
|||
|
mWriteTime: TdateTime;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryLabel do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select top 1 * from RT_FileUpdate');
|
|||
|
sql.Add('where FileName=' + quotedstr(trim(MlabelCaption) + '.rmf'));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryLabel.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
with RMUP do
|
|||
|
begin
|
|||
|
LoadFromBlobField(tblobfield(ADOQueryLabel.fieldbyname('Files')));
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg';
|
|||
|
if FileExists(fImagePath2) then
|
|||
|
DeleteFile(fImagePath2);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.jpg';
|
|||
|
RMUP.PrepareReport;
|
|||
|
RMUP.ExportTo(RMjpegExport1, fImagePath2);
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
fFilePath := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg';
|
|||
|
fFileName := 'label.jpg';
|
|||
|
application.ProcessMessages;
|
|||
|
if GetLSNo(ADOQueryCmd, maxNo, 'FJ', 'TP_File', 4, 1) = False then
|
|||
|
begin
|
|||
|
adoqueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
|||
|
GetFileInfo(fFilePath, mfileSize, mCreationTime, mWriteTime);
|
|||
|
with adoqueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from TP_File ');
|
|||
|
sql.Add('where TFType=''<27><>ǩͼƬ'' and WBID=' + quotedstr(Trim(MlabelCaption)));
|
|||
|
// ShowMessage(SQL.Text) ;
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
FJStream := TMemoryStream.Create;
|
|||
|
with adoqueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from TP_File ');
|
|||
|
sql.Add('where TFID=' + quotedstr(trim(maxNo)));
|
|||
|
open;
|
|||
|
append;
|
|||
|
fieldbyname('TFID').Value := trim(maxNo);
|
|||
|
fieldbyname('WBID').Value := Trim(MlabelCaption);
|
|||
|
fieldbyname('TFType').Value := trim('<27><>ǩͼƬ');
|
|||
|
fieldbyname('Filler').Value := trim(DName);
|
|||
|
fieldbyname('FileName').Value := trim(fFileName);
|
|||
|
fieldbyname('TFDate').Value := mWriteTime;
|
|||
|
FJStream.LoadFromFile(fFilePath);
|
|||
|
tblobfield(FieldByName('Filesother')).LoadFromStream(FJStream);
|
|||
|
post;
|
|||
|
end;
|
|||
|
finally
|
|||
|
FJStream.Free;
|
|||
|
end;
|
|||
|
|
|||
|
adoqueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
adoqueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTradeLabelSel.SaveLabel(MLabelID: string): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Trade_Label');
|
|||
|
sql.Add('where LabelID=' + Quotedstr(MLabelID));
|
|||
|
Open;
|
|||
|
Edit;
|
|||
|
fieldByName('Editer').value := DName;
|
|||
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
// RMLabel.SaveToBlobField(TBlobField(FieldByName('LabelFile')));
|
|||
|
Post;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
result := true;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result := false;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩģ<C7A9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.InitLabel();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from Trade_Label');
|
|||
|
sql.Add(' order by labeltype,labelCaption');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel4, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Label);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Label);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.LabelCaptionPropertiesChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel4, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Label);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Label);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.LabVolumeDblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.PackTypeBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.PackTypeBtnUpClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.TJDblClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TMemo(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
i := 0;
|
|||
|
try
|
|||
|
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
|||
|
with frmZDYHelpSel do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TMemo(Sender).Lines.Clear;
|
|||
|
with ClientDataSet1 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
i := i + 1;
|
|||
|
TMemo(Sender).Lines.Add(inttostr(i) + '.' + FieldByName('ZDYName').AsString) //inttostr(i)+'.'+
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelpSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmTradeLabelSel := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.cxDBImage1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if TcxDBImage(Sender).Picture.Height = 0 then
|
|||
|
exit;
|
|||
|
LookImage(ADO_I1.fieldbyname(TcxDBImage(Sender).Hint).asstring);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.TaddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmLabelInput := TfrmLabelInput.create(self);
|
|||
|
with frmLabelInput do
|
|||
|
begin
|
|||
|
FLabelId := '';
|
|||
|
if showModal = 1 then
|
|||
|
begin
|
|||
|
InitLabel();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
readCxGrid(self.Caption, TVLabel, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
IintLabelType();
|
|||
|
ExportFtErpFile('ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryTemp);
|
|||
|
fFlileFlag := UserDataFlag + 'HX';
|
|||
|
with ADO_1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('exec P_BS_Label_Get_Test');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Initlabel();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.TdelClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
begin
|
|||
|
if CDS_Label.IsEmpty then
|
|||
|
exit;
|
|||
|
if TRIM(DName) <> 'ADMIN' then
|
|||
|
begin
|
|||
|
if TRIM(CDS_Label.fieldByName('Filler').asString) <> TRIM(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('delete Trade_Label');
|
|||
|
sql.Add('where labelId=' + quotedstr(CDS_Label.fieldByName('LabelID').asString));
|
|||
|
sql.Add('delete RT_FileUpdate');
|
|||
|
sql.Add('where FileName=' + quotedstr(trim(CDS_Label.fieldByName('labelCaption').asString) + '.rmf'));
|
|||
|
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ǩɾ<C7A9><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ǩ<EFBFBD><C7A9><EFBFBD>ƣ<EFBFBD>' + trim(CDS_Label.fieldByName('labelCaption').asString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execSql;
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'report\' + trim(CDS_Label.fieldByName('labelCaption').asString) + '.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
DeleteFile(fPrintFile);
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Label.Delete;
|
|||
|
except
|
|||
|
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
LabelCaption.SetFocus;
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
fFileName, fPrintFile: string;
|
|||
|
MLabelID, MLabelCaption: string;
|
|||
|
begin
|
|||
|
if CDS_Label.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if TRIM(DName) <> 'ADMIN' then
|
|||
|
begin
|
|||
|
if TRIM(CDS_Label.fieldByName('Filler').asString) <> TRIM(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
MLabelID := TRIM(CDS_Label.fieldByName('LabelID').asString);
|
|||
|
MLabelCaption := TRIM(CDS_Label.fieldByName('LabelCaption').asString);
|
|||
|
ExportFtErpFile(MLabelCaption + '.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'report\' + MLabelCaption + '.rmf';
|
|||
|
|
|||
|
if not FileExists(fPrintFile) then
|
|||
|
CopyFile(PChar(ExtractFilePath(Application.ExeName) + 'Report\ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'), PChar(fPrintFile), False);
|
|||
|
|
|||
|
with RMLabel do
|
|||
|
begin
|
|||
|
RMLabel.Clear;
|
|||
|
RMDB_1.DataSet := nil;
|
|||
|
Dictionary.FieldAliases.Clear;
|
|||
|
Dictionary.FieldAliases['RMDB_1'] := '<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>';
|
|||
|
RMDB_1.DataSet := ADO_1;
|
|||
|
LoadFromFile(fPrintFile);
|
|||
|
application.ProcessMessages;
|
|||
|
DesignReport();
|
|||
|
SaveLabel(MLabelID);
|
|||
|
ExportToFtErp(fPrintFile, ADOQueryCmd);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(' update RT_FileUpdate set FileEditDate=GETDATE() ');
|
|||
|
sql.Add(',LastEditer=' + quotedstr(dname));
|
|||
|
sql.Add(',Files=(SELECT top 1 Files from RT_FileUpdate where FileName=' + quotedstr(trim(CDS_Label.fieldbyname('labelCaption').asstring) + '.rmf') + ') ');
|
|||
|
sql.Add('where FileName=''ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'' ');
|
|||
|
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('ģ<><C4A3><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ǩ<EFBFBD><C7A9><EFBFBD>ƣ<EFBFBD>' + trim(CDS_Label.fieldByName('labelCaption').asString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execSql;
|
|||
|
end;
|
|||
|
DeleteFile(PChar(ExtractFilePath(Application.ExeName) + 'Report\ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'));
|
|||
|
ExportFtErpFile('ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryTemp);
|
|||
|
application.MessageBox('<27><><EFBFBD>óɹ<C3B3>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
|
|||
|
except
|
|||
|
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption, TVLabel, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton7Click(Sender: TObject);
|
|||
|
var
|
|||
|
MFromLabelId: string;
|
|||
|
begin
|
|||
|
MFromLabelId := trim(CDS_Label.fieldbyname('LabelId').asstring);
|
|||
|
try
|
|||
|
frmLabelInput := TfrmLabelInput.create(self);
|
|||
|
with frmLabelInput do
|
|||
|
begin
|
|||
|
FLabelId := '';
|
|||
|
if showModal = 1 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(' exec P_BS_Label_Copy');
|
|||
|
sql.Add(' @FromLabelId=' + quotedstr(trim(MFromLabelId)));
|
|||
|
sql.Add(',@ToLabelId=' + quotedstr(trim(FLabelId)));
|
|||
|
execSql;
|
|||
|
end;
|
|||
|
InitLabel();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'BQLX';
|
|||
|
flagname := '<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
IintLabelType();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.ToolButton9Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.TupdClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Label.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
frmLabelInput := TfrmLabelInput.create(self);
|
|||
|
with frmLabelInput do
|
|||
|
begin
|
|||
|
fLabelId := CDS_Label.fieldByName('LabelId').AsString;
|
|||
|
if showModal = 1 then
|
|||
|
begin
|
|||
|
InitLabel();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeLabelSel.TVLabelCellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
begin
|
|||
|
if CDS_Label.IsEmpty then
|
|||
|
exit;
|
|||
|
ExportFtErpFile(TRIM(CDS_Label.fieldByName('LabelCaption').asString) + '.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + CDS_Label.fieldbyname('LabelCaption').AsString + '.rmf';
|
|||
|
if not FileExists(fPrintFile) then
|
|||
|
CopyFile(PChar(ExtractFilePath(Application.ExeName) + 'Report\ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'), PChar(fPrintFile), False);
|
|||
|
|
|||
|
with RMLabel do
|
|||
|
begin
|
|||
|
RMLabel.LoadFromFile(fPrintFile);
|
|||
|
Preview := RMPreview3;
|
|||
|
ShowReport;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|