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_signqtdnotify.pas

442 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_seae_signqtdnotify;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, bsSkinCtrls, DB,
ADODB, ExtCtrls, RxLookup, StdCtrls, wwdbdatetimepicker, wwdblook, Menus,
Mask, bsSkinBoxCtrls, bsdbctrls,DateUtils, kbmMemTable, DBCtrlsEh,
ComCtrls, bsSkinTabs, dxDBTLCl, dxGrClms, cxDBLabel, cxControls,
cxContainer, cxEdit, cxLabel;
type
Tfrm_op_seae_signqtdnotify = class(TForm)
kbmMemTable1: TkbmMemTable;
kbmMemTable1Field: TStringField;
kbmMemTable1Field3: TStringField;
kbmMemTable1Field4: TStringField;
kbmMemTable1Field5: TStringField;
kbmMemTable1Field6: TStringField;
kbmMemTable1Field7: TStringField;
kbmMemTable1Field2: TStringField;
kbmMemTable1Field9: TStringField;
kbmMemTable1Field10: TStringField;
kbmMemTable1Field8: TStringField;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
kbmMemTable1Field11: TStringField;
kbmMemTable1Field12: TStringField;
kbmMemTable1Field13: TStringField;
kbmMemTable1Field14: TStringField;
kbmMemTable1Field15: TStringField;
kbmMemTable1Field16: TStringField;
bsSkinPanel3: TbsSkinPanel;
btn6_notify_exit: TbsSkinButton;
btn1_notify_search: TbsSkinButton;
btn2_notify_clear: TbsSkinButton;
bsSkinPanel4: TbsSkinPanel;
Label13: TLabel;
Label14: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Edit6_searchkhmch: TEdit;
Label8: TLabel;
kbmMemTable1Field17: TStringField;
kbmMemTable1Field18: TStringField;
kbmMemTable1Field19: TStringField;
kbmMemTable1Field20: TStringField;
kbmMemTable1Field21: TStringField;
kbmMemTable1Field22: TBooleanField;
kbmMemTable1Field23: TStringField;
kbmMemTable1Field24_xuanxiang: TBooleanField;
Edit1_qdtbh: TEdit;
lbl14: TLabel;
lbl15_searchqdthm: TLabel;
Edit15_searchqdthm: TEdit;
bsknpnl1_m: TbsSkinPanel;
qry1_qdtm: TADOQuery;
ds1_notify: TDataSource;
lbl10: TLabel;
cbb1_zht: TDBComboBoxEh;
dxdbgrd3_notify: TdxDBGrid;
dxdbgrdclmnDBGrid1Column12: TdxDBGridColumn;
dxdbgrdclmn1: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn6: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn7: TdxDBGridColumn;
dxdbgrdclmn2: TdxDBGridColumn;
dxdbgrdclmn3: TdxDBGridColumn;
dxdbgrdclmn4: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn8: TdxDBGridColumn;
dxdbgrdclmnDBGrid1Column10: TdxDBGridColumn;
dxdbgrdclmnDBGrid1Column11: TdxDBGridColumn;
dxdbgrdclmnDBGrid1Column13: TdxDBGridColumn;
dxdbgrdclmnDBGrid1Column14: TdxDBGridColumn;
dxdbgrdchckclmndxdbgrd3_notifyColumn13b: TdxDBGridCheckColumn;
dxdbgrdclmndxdbgrd3_notifyColumn14: TdxDBGridColumn;
dxdbgrdchckclmnDBGrid1Column14_tf: TdxDBGridCheckColumn;
dxdbgrdclmndxdbgrd3_notifyColumn16: TdxDBGridColumn;
procedure btn4_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N1Click(Sender: TObject);
procedure btn1_notify_searchClick(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure btn6_notify_exitClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure searchqdt(bh:string);
procedure Edit1_qdtbhKeyPress(Sender: TObject; var Key: Char);
procedure dxdbgrd3_notifyDblClick(Sender: TObject);
procedure btn3_notifyClick(Sender: TObject);
procedure btn2_notify_clearClick(Sender: TObject);
procedure Edit6_searchkhmchKeyPress(Sender: TObject; var Key: Char);
procedure dxdbgrd3_notifyCustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
private
{ Private declarations }
employeePhone:string;
public
{ Public declarations }
op:integer;
function GetmblState(bsno:string):Boolean;
function GetmblStateOut(bsno:string):Boolean;
function GetSeaeStateDate(bsno,billstate:string):string;
function _GetmblStateout(bsno,bsstatus:string):string;
procedure Initsql_ts(AdoQuery:TAdoQuery);
procedure initialEmployeePhone();
procedure show_qdtxx(qdtbh:string;iway:Integer);
end;
var
frm_op_seae_signqtdnotify: Tfrm_op_seae_signqtdnotify;
implementation
uses u_main,my_sys_function, u_op_seae_teshufandan,u_sys_progress,u_op_seae_sign_info,
u_op_seae_sign;
{$R *.dfm}
const stateNewQD = '<27><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>';
//
function Tfrm_op_seae_signqtdnotify._GetmblStateout(bsno,bsstatus:string):string;
var aAdoQuery:TAdoQuery;
begin
result:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><D2B5>״̬,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add('from t_op_state where <20><><EFBFBD><EFBFBD>=:bsNo1 and ҵ<><D2B5>״̬=:bsstatus ');
Parameters.ParamByName('bsNo1').value:=bsno;
Parameters.ParamByName('bsstatus').value:=bsstatus;
Open;
if not IsEmpty then
result:=FieldByName('ҵ<><D2B5>״̬').AsString;
finally
aAdoQuery.Free;
end;
end;
function Tfrm_op_seae_signqtdnotify.GetSeaeStateDate(bsno,billstate:string):string;
var aAdoQuery:TAdoQuery;
begin
Result:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_op_state');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:bsNo and ҵ<><D2B5>״̬=:billstate');
Parameters.ParamByName('bsNo').value:=bsno;
Parameters.ParamByName('billstate').value:=billstate;
open;
if not IsEmpty then
Result:=FormatDateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
finally
aAdoQuery.Free;
end;
end;
function Tfrm_op_seae_signqtdnotify.GetmblState(bsno:string):Boolean;
var aAdoQuery:TAdoQuery;
b1,b2,b3:Boolean;
begin
result:=false;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><D2B5>״̬');
SQL.Add('from t_op_state where ҵ<><D2B5>״̬=''֪ͨ<CDA8>ŵ<EFBFBD>'' and <20><><EFBFBD><EFBFBD>=:bsNo');
Parameters.ParamByName('bsNo').value:=bsno;
Open;
b1:=RecordCount>=1;
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><D2B5>״̬');
SQL.Add('from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' and <20><><EFBFBD><EFBFBD>=:bsNo');
Parameters.ParamByName('bsNo').value:=bsno;
Open;
b2:=RecordCount>=1;
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><D2B5>״̬');
SQL.Add('from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' and <20><><EFBFBD><EFBFBD>=:bsNo');
Parameters.ParamByName('bsNo').value:=bsno;
Open;
b3:= isempty or (RecordCount=0);
result:=(b1 or b2) and b3;
finally
aAdoQuery.Free;
end;
end;
function Tfrm_op_seae_signqtdnotify.GetmblStateOut(bsno:string):Boolean;
var aAdoQuery:TAdoQuery;
begin
result:=false;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><><D2B5>״̬');
SQL.Add('from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' and <20><><EFBFBD><EFBFBD>=:bsNo');
Parameters.ParamByName('bsNo').value:=bsno;
Open;
result:=RecordCount=1;
finally
aAdoQuery.Free;
end;
end;
procedure Tfrm_op_seae_signqtdnotify.btn4_exitClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_signqtdnotify.FormShow(Sender: TObject);
var str,mblstatus:string;
begin
wwDBDateTimePicker5.Date:=Date-7 ;//StrToDateTime(Formatdatetime('YYYY-MM-DD',date-3));
wwDBDateTimePicker6.Date:=Date ;//StrToDateTime(Formatdatetime('YYYY-MM-DD',date));
Width :=width-1;
dxdbgrd3_notify.Width :=dxdbgrd3_notify.width-1;
bsSkinPanel3.Height :=34;
show_qdtxx('',1);
Edit1_qdtbh.SetFocus();
end;
procedure Tfrm_op_seae_signqtdnotify.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrd3_notify,caption);
frm_op_seae_signqtdnotify.Hide;
frm_op_seae_signqtdnotify.ManualFloat(frm_op_seae_signqtdnotify.BoundsRect );
frm_main.freeTabs('frm_op_seae_signqtdnotify');
action:=cafree;
frm_op_seae_signqtdnotify:=nil;
end;
procedure Tfrm_op_seae_signqtdnotify.Initsql_ts(AdoQuery:TAdoQuery);
begin
with AdoQuery do
begin
Close;Sql.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,<2C>ŵ<EFBFBD>״̬ from t_op_fangdan');
sql.add('order by <20><><EFBFBD><EFBFBD>');
Open;First;
end;
end;
procedure Tfrm_op_seae_signqtdnotify.N1Click(Sender: TObject);
begin
//grid_save_xls(dxdbgrd2);
end;
procedure Tfrm_op_seae_signqtdnotify.btn1_notify_searchClick(Sender: TObject);
begin
//
show_qdtxx ('',31);
end;
procedure Tfrm_op_seae_signqtdnotify.MenuItem1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrd3_notify);
end;
procedure Tfrm_op_seae_signqtdnotify.btn6_notify_exitClick(Sender: TObject);
begin
Close();
end;
procedure Tfrm_op_seae_signqtdnotify.show_qdtxx (qdtbh:string;iway:Integer);
var
str:string;
begin
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if not assigned(frm_op_seae_sign_info) then
frm_op_seae_sign_info:=Tfrm_op_seae_sign_info.Create (self);
//˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ϸ
if iway=2 then
begin
//<2F>½<EFBFBD><C2BD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD>
frm_op_seae_sign_info.InitialUserinfo(qdtbh,31);
frm_op_seae_sign_info.SigninfoShow( );
qry1_qdtm.Requery();
Exit;
end;
//<2F><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9> Ʊ<><C6B1> ǩ<><C7A9><EFBFBD><EFBFBD> from 2017-08-08
if(qdtbh<>'') then
str :=' where ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''Ʊ<><C6B1>'' AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =''' +qdtbh + ''''
else
begin
//<2F><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9> Ʊ<><C6B1> ǩ<><C7A9><EFBFBD><EFBFBD> from 2017-08-08
str:=' where ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''Ʊ<><C6B1>'' AND ״̬='''+ cbb1_zht.text +'''';
if wwDBDateTimePicker5.text<>''then
str:=str+' and t_op_seae_sign_main.֪ͨǩ<D6AA><C7A9>ʱ<EFBFBD><CAB1>>='+''''+wwDBDateTimePicker5.text+'''';
if wwDBDateTimePicker6.text<>''then
str:=str+' and t_op_seae_sign_main.֪ͨǩ<D6AA><C7A9>ʱ<EFBFBD><CAB1><='+''''+wwDBDateTimePicker6.text+' 23:59:59''';
if Edit6_searchkhmch.text<>''then
str:=str+' and t_op_seae_sign_main.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> like'+'''%'
+ StringReplace(trim(Edit6_searchkhmch.text),'''','''''',[rfReplaceall])+'%''';
end;
str:='SELECT * FROM [t_op_seae_sign_main] ' +str;
qry1_qdtm.Close() ;
qry1_qdtm.SQL.Clear;
qry1_qdtm.SQL.Add(str);
qry1_qdtm.open;
qry1_qdtm.First;
if qry1_qdtm.IsEmpty then
begin
showmessage('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ҵļ<D2B5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>');
exit;
end;
if (qry1_qdtm.Recordset.RecordCount=1) and (qdtbh<>'') and (iway=0) then
begin
frm_op_seae_sign_info.InitialUserinfo(qdtbh,31);
frm_op_seae_sign_info.SigninfoShow();
end;
qry1_qdtm.close();
qry1_qdtm.open();
end;
procedure Tfrm_op_seae_signqtdnotify.initialEmployeePhone();
var
empQuery:TADOQuery;
begin
//
empQuery:=CreateAdoQuery();
with empQuery do
begin
SQL.Add('select [<5B>̶<EFBFBD><CCB6>绰],[<5B>ƶ<EFBFBD><C6B6>绰] from [t_sys_employee] where [<5B><><EFBFBD><EFBFBD>]='''+ employee +''' ');
Open;First;
employeePhone :=FieldByName('<27>̶<EFBFBD><CCB6>绰').AsString;
close();
end;
end;
procedure Tfrm_op_seae_signqtdnotify.searchqdt(bh:string);
begin
//
if bh<>'' then
begin
//
show_qdtxx(bh,1);
end;
end;
procedure Tfrm_op_seae_signqtdnotify.Edit1_qdtbhKeyPress(Sender: TObject;
var Key: Char);
var
str:string;
begin
//
if key=#13 then
begin
str:= Edit1_qdtbh.Text;
Edit1_qdtbh.Clear();
Edit15_searchqdthm.Text:=str;
show_qdtxx(str,0);
end;
end;
procedure Tfrm_op_seae_signqtdnotify.dxdbgrd3_notifyDblClick(Sender: TObject);
var
str:string;
begin
//
str:=qry1_qdtm.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
show_qdtxx(str,2);
end;
procedure Tfrm_op_seae_signqtdnotify.btn3_notifyClick(Sender: TObject);
var
qdtzht,str:string;
i,noticecount:integer;
aQuery:TADOQuery;
DatabaseDateTime:TDatetime;
begin
//
{ if (dxdbgrd3_notify.SelectedCount<1) and (qry1_qdtm.Recordset.RecordCount<1) then
Exit;
str:=qry1_qdtm.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
show_qdtxx(str,2);
qry1_qdtm.Requery();
Exit;
}
end;
procedure Tfrm_op_seae_signqtdnotify.btn2_notify_clearClick(Sender: TObject);
begin
wwDBDateTimePicker5.Clear;
wwDBDateTimePicker6.Clear();
Edit6_searchkhmch.Text:='';
end;
procedure Tfrm_op_seae_signqtdnotify.Edit6_searchkhmchKeyPress(
Sender: TObject; var Key: Char);
begin
//<2F>س<EFBFBD><D8B3><EFBFBD>ѯִ<D1AF><D6B4>
if key=#13 then
begin
btn1_notify_searchClick(Self.btn1_notify_search);
end;
end;
procedure Tfrm_op_seae_signqtdnotify.dxdbgrd3_notifyCustomDraw(
Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
var
value:string;
begin
value:=ANode.Strings[dxdbgrdchckclmnDBGrid1Column14_tf.Index];
if value ='True' then
begin
AFont.Color:=clgreen;
end
else
AFont.Color:=clblack;
end;
end.