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

264 lines
7.3 KiB
Plaintext

12 months ago
unit u_op_seae_invoice_sign_detail;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, StdCtrls, dxExEdtr, DB, dxTL, dxDBCtrl,
dxDBGrid, dxCntner, ADODB, bsdbctrls, cxDBLabel, cxControls, cxContainer,
cxEdit, cxLabel, dxDBTLCl, dxGrClms, Mask, DBCtrlsEh, wwdblook, RxLookup,
wwdbdatetimepicker, ComCtrls, bsSkinTabs, OleCtrls, iWebPDFEditorLib_TLB,EncdDecd,ShellAPI,
Menus, kbmMemTable;
type
Tfrm_op_seae_invoice_sign_detail = class(TForm)
bsknpnl5: TbsSkinPanel;
dxdbgrd_mx: TdxDBGrid;
dxdbgrdclmndxdbgrd2Column1: TdxDBGridColumn;
dxdbgrdclmn_mxColumn3: TdxDBGridColumn;
dxdbgrdclmn_mxColumn4: TdxDBGridColumn;
dxdbgrdclmn_mxColumn5: TdxDBGridColumn;
dxdbgrdclmn_mxColumn6: TdxDBGridColumn;
dxdbgrdchckclmndxdbgrd2Column2: TdxDBGridCheckColumn;
bsknpnl7: TbsSkinPanel;
cxlbl1: TcxLabel;
cxlbl2: TcxLabel;
cxlbl3: TcxLabel;
cxlbl4: TcxLabel;
cxlbl5: TcxLabel;
cxlbl7: TcxLabel;
cxlbl8: TcxLabel;
cxdblbl1: TcxDBLabel;
cxdblbl2: TcxDBLabel;
cxdblbl3: TcxDBLabel;
cxdblbl4: TcxDBLabel;
cxdblbl5: TcxDBLabel;
cxdblbl6: TcxDBLabel;
bsknpnl3: TbsSkinPanel;
btn8: TbsSkinButton;
btn5_sign: TbsSkinButton;
btn11: TbsSkinButton;
btn3_custprint: TbsSkinButton;
btn9_exit: TbsSkinButton;
btn8_confirmsign: TbsSkinButton;
btn10_viewsign: TbsSkinButton;
btn2_CancelSignItem: TbsSkinButton;
bsknpnl8: TbsSkinPanel;
shp7: TShape;
shp6: TShape;
shp5: TShape;
shp4: TShape;
shp1: TShape;
bskndbtxt1: TbsSkinDBText;
bskndbtxt2: TbsSkinDBText;
bskndbtxt5_czr: TbsSkinDBText;
bskndbtxtd: TbsSkinDBText;
bskndbtxt6: TbsSkinDBText;
lbl1_signtip: TLabel;
cxlbl9: TcxLabel;
cxlbl10: TcxLabel;
cxlbl11: TcxLabel;
cxlbl13: TcxLabel;
cxlbl15: TcxLabel;
dxdbgrd1: TdxDBGrid;
dxdbgrdclmn1: TdxDBGridColumn;
dxdbgrdclmn2: TdxDBGridColumn;
dxdbgrdclmn3: TdxDBGridColumn;
dxdbgrdclmn4: TdxDBGridColumn;
dxdbgrdclmn5: TdxDBGridColumn;
bsknpnl6: TbsSkinPanel;
img1: TImage;
cxlbl6: TcxLabel;
cxlbl18: TcxLabel;
cxlbl19: TcxLabel;
qry1_qdtm: TADOQuery;
ds1_qdtm: TDataSource;
ds2_qdtd: TDataSource;
qry2_qdtd: TADOQuery;
iwbpdfdtr1: TiWebPDFEditor;
procedure btn5_signClick(Sender: TObject);
procedure btn8Click(Sender: TObject);
procedure btn11Click(Sender: TObject);
procedure btn3_custprintClick(Sender: TObject);
procedure btn8_confirmsignClick(Sender: TObject);
procedure iwbpdfdtr1SignFinish(Sender: TObject;
const bSucceed: WideString);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
m_newfilename:string;
m_qry_qdm,m_qry_qdd:TADOQuery;
m_isNewSign:Boolean;
m_fpqz:string;
public
{ Public declarations }
procedure SetSignDatasource(qrym:TADOQuery;qryd:TADOQuery);
end;
var
frm_op_seae_invoice_sign_detail: Tfrm_op_seae_invoice_sign_detail;
implementation
uses my_sys_function;
{$R *.dfm}
procedure Tfrm_op_seae_invoice_sign_detail.SetSignDatasource(qrym:TADOQuery;qryd:TADOQuery);
begin
//
// qry1_qdtm:= qrym;
// qry2_qdtd:=qryd;
m_qry_qdm:=qrym;
m_qry_qdd:=qryd;
ds1_qdtm.DataSet:=m_qry_qdm;
ds2_qdtd.DataSet:=m_qry_qdd;
end;
///<2F><>Bitmapλͼת<CDBC><D7AA>Ϊbase64<36>ַ<EFBFBD><D6B7><EFBFBD>
function BitmapToString(img:TBitmap):string ;
var
ms:TMemoryStream;
ss:TStringStream;
s:string;
begin
ms := TMemoryStream.Create;
img.SaveToStream(ms);
ss := TStringStream.Create('');
ms.Position:=0;
EncodeStream(ms,ss);//<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊbase64<36>ַ<EFBFBD><D6B7><EFBFBD>
s:=ss.DataString;
ms.Free;
ss.Free;
result:=s;
end;
function StringToBitmap(imgStr:string):TBitmap;
var ss:TStringStream;
ms:TMemoryStream;
bitmap:TBitmap;
begin
ss := TStringStream.Create(imgStr);
ms := TMemoryStream.Create;
DecodeStream(ss,ms);//<2F><>base64<36>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ԭΪ<D4AD>ڴ<EFBFBD><DAB4><EFBFBD>
ms.Position:=0;
bitmap := TBitmap.Create;
bitmap.LoadFromStream(ms);
ss.Free;
ms.Free;
result :=bitmap;
end;
function GetWinTempPath: string;
var
TempDir: array[0..255] of char;
begin
GetTempPath(255, @TempDir);
Result := strPas(TempDir);
end;
procedure Tfrm_op_seae_invoice_sign_detail.btn5_signClick(Sender: TObject);
var
strpath:string;
oldfilename:string;
msg:Integer;
pzt:WideString;
i1:Integer;
i2:Integer;
i3:Integer;
i4:Integer;
i5:Integer;
str :string;
aQuery:TADOQuery;
begin
//
str:= 'INSERT INTO t_sys_signid (mainorderno) VALUES (''222'');';
aQuery.SQL.Add(str) ;
aQuery.ExecSQL();
aQuery.sql.Clear();
str:= 'select MAX(signid) as qdtbh,GETDATE()as FDate from t_sys_signid; ';
aQuery.sql.add(str);
str:= 'select MAX(signid) as qdtbh,GETDATE()as FDate from t_sys_signid; ';
aQuery.sql.add(str);
aQuery.Open;
aQuery.First;
m_fpqz:='fpqz'+ aQuery.FieldByName('qdtbh').AsString;
strpath:= GetWinTempPath() ;
oldfilename:= strpath+ 'cwsgn222.PDF' ;
m_newfilename := strpath+m_fpqz+'_'+ IntToStr(Random(10))+ '.PDF' ;
sys_frprintFile('<27><>Ʊǩ<C6B1><C7A9>','PDF',ds1_qdtm,ds2_qdtd,nil,nil,nil,nil,nil,nil,nil,nil,nil,True,'',nil,nil,oldfilename);
deletefile(m_newfilename);
CopyFile(pchar(oldfilename), PChar(m_newfilename),true);
iwbpdfdtr1.LoadFromFile(m_newfilename);
pzt:= '598*94' ;
i1:=1;
i2:=1;
i3:=0;
i4:=50;
i5:=30;
msg := iwbpdfdtr1.HandSignAtTouchMonitor(i1,i2,i3,pzt, i4, i5);
end;
procedure Tfrm_op_seae_invoice_sign_detail.btn8Click(Sender: TObject);
begin
try
sys_print('<27><>Ʊǩ<C6B1><C7A9>',1,ds1_qdtm,ds2_qdtd,nil,nil,nil,nil,nil,nil,nil,nil,nil);
//qry1_qdtm.Edit;
//qry1_qdtm.FieldByName('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>').AsDateTime:=GetDbDatetime();
//qry1_qdtm.Post;
except
//qry1_qdtm.Cancel;
end;
end;
procedure Tfrm_op_seae_invoice_sign_detail.btn11Click(Sender: TObject);
begin
sys_print('<27><>Ʊǩ<C6B1><C7A9>',3,ds1_qdtm,ds2_qdtd,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_invoice_sign_detail.btn3_custprintClick(
Sender: TObject);
begin
sys_print('<27><>Ʊǩ<C6B1><C7A9>',2,ds1_qdtm,ds2_qdtd,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_invoice_sign_detail.btn8_confirmsignClick(
Sender: TObject);
var
picfile:string;
remotePath:string;
begin
if m_newfilename='' then
begin
application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ') ;
exit;
end;
remotePath:='\\223.223.95.160\data\custsign';
//remotePath:='\\dev000\custsign\invsgn';
//remotePath:='\\X6x8-20170109nn\<5C><><EFBFBD>Դ洢<D4B4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>';
//signletterSateDeal();
//
picfile:= copy(m_newfilename,0, length(m_newfilename) - 3)+'bmp';
img1.Picture.SaveToFile(picfile);
UpLoadCustFPSignFile(m_newfilename,picfile ,remotePath,'user','user',m_fpqz);
application.MessageBox(PChar('ȷ<><C8B7>ǩ<EFBFBD>ֳɹ<D6B3><><C7A9><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
close();
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8>¼<EFBFBD>¼
end;
procedure Tfrm_op_seae_invoice_sign_detail.iwbpdfdtr1SignFinish(
Sender: TObject; const bSucceed: WideString);
begin
img1.Picture.Bitmap:= StringToBitmap(iwbpdfdtr1.GetTouchMonitorImageBASE64());
img1.Visible:=True;
iwbpdfdtr1.CloseRead();
m_isNewSign:=True;
lbl1_signtip.Caption:='ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ȷ<EFBFBD><C8B7>ǩ<EFBFBD><C7A9>!';
application.MessageBox(PChar('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ȷ<EFBFBD><C8B7>ǩ<EFBFBD>ֽ<EFBFBD><D6BD>б<EFBFBD><D0B1><EFBFBD>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
end;
procedure Tfrm_op_seae_invoice_sign_detail.FormShow(Sender: TObject);
begin
//
end;
end.