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.

1920 lines
60 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_letter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,DateUtils,
Dialogs, DB, ADODB, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, ActiveX,
dxDBGrid, StdCtrls, Mask, DBCtrls, Menus, wwdbdatetimepicker, Grids,IdHTTP,superobject,
DBGrids, XPMenu, RxLookup, bsdbctrls, ExtCtrls, DBCtrlsEh, bsSkinBoxCtrls,Clipbrd,
kbmMemTable;
type
TDsThread = class(TThread)
protected
PostUrl:string;
JSONSTR:string;
ScriptPath:string;
procedure Execute; override;
public
constructor create(mPostUrl, mJSONSTR, mScriptPath: string);virtual;
destructor destroy; override;
end;
Tfrm_op_letter = class(TForm)
t_op_letter1: TDataSource;
t_op_letter_cq: TADOQuery;
t_op_letter_cq1: TDataSource;
t_op_letter_cz: TADOQuery;
t_op_letter_cz1: TDataSource;
t_op_letter_df: TADOQuery;
t_op_letter_df1: TDataSource;
t_op_letter_dq: TADOQuery;
t_op_letter_dq1: TDataSource;
t_op_letter_gg: TADOQuery;
t_op_letter_gg1: TDataSource;
t_op_letter_hc: TADOQuery;
t_op_letter_hc1: TDataSource;
t_op_letter_pc: TADOQuery;
t_op_letter_pc1: TDataSource;
t_op_letter_rh: TADOQuery;
t_op_letter_rh1: TDataSource;
t_op_letter_yj1: TDataSource;
t_op_letter_yj: TADOQuery;
bsSkinPanel2: TbsSkinPanel;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1HEAD_TO: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
bsSkinButton9: TbsSkinButton;
bsSkinPanel3: TbsSkinPanel;
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
PopupMenu1: TPopupMenu;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
DBEdit3: TDBEdit;
DataSource1: TDataSource;
PopupMenu2: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N20: TMenuItem;
t_op_letter: TADOQuery;
XPMenu1: TXPMenu;
N21: TMenuItem;
N22: TMenuItem;
t_op_letter_hd: TADOQuery;
t_op_letter_hd1: TDataSource;
N23: TMenuItem;
N24: TMenuItem;
N25: TMenuItem;
N26: TMenuItem;
bsSkinNotebook1: TbsSkinNotebook;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
DBMemo1: TDBMemo;
DBMemo2: TDBMemo;
DBMemo3: TDBMemo;
DBMemo4: TDBMemo;
DBMemo5: TDBMemo;
Label8: TLabel;
Label9: TLabel;
DBEdit4: TDBEdit;
DBMemo6: TDBMemo;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBMemo7: TDBMemo;
Label14: TLabel;
Label15: TLabel;
DBEdit8: TDBEdit;
DBMemo8: TDBMemo;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DBMemo9: TDBMemo;
DBMemo10: TDBMemo;
DBMemo11: TDBMemo;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBEdit12: TDBEdit;
DBEdit13: TDBEdit;
DBEdit15: TDBEdit;
DBEdit16: TDBEdit;
DBMemo12: TDBMemo;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label28: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label49: TLabel;
Label50: TLabel;
DBEdit14: TDBEdit;
DBEdit17: TDBEdit;
DBEdit18: TDBEdit;
DBEdit19: TDBEdit;
DBEdit20: TDBEdit;
DBEdit11: TDBEdit;
DBEdit21: TDBEdit;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
DBEdit24: TDBEdit;
DBEdit25: TDBEdit;
DBMemo13: TDBMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
DBEdit31: TDBEdit;
DBEdit32: TDBEdit;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label51: TLabel;
DBEdit26: TDBEdit;
DBEdit27: TDBEdit;
DBEdit29: TDBEdit;
DBMemo14: TDBMemo;
Button4: TButton;
DBEdit33: TDBEdit;
DBComboBox1: TDBComboBox;
Label45: TLabel;
Label46: TLabel;
DBEdit30: TDBEdit;
DBMemo15: TDBMemo;
Label47: TLabel;
Label48: TLabel;
DBMemo16: TDBMemo;
DBMemo17: TDBMemo;
Label52: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
t_crm_client_cd: TADOQuery;
t_crm_client_cd1: TDataSource;
DBEdit28: TDBEdit;
Label53: TLabel;
DBEdit34: TDBEdit;
Label54: TLabel;
Label55: TLabel;
DBEdit35: TDBEdit;
Label56: TLabel;
DBEdit36: TDBEdit;
Label57: TLabel;
DBMemo18: TDBMemo;
Label58: TLabel;
DBMemo19: TDBMemo;
Label59: TLabel;
DBEdit37: TDBEdit;
DBMemo20: TDBMemo;
Label60: TLabel;
Label61: TLabel;
DBMemo21: TDBMemo;
Label62: TLabel;
Label63: TLabel;
Label64: TLabel;
DBEdit38: TDBEdit;
DBEdit39: TDBEdit;
DBEdit40: TDBEdit;
Label65: TLabel;
bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox;
DBEdit41: TDBEdit;
Label66: TLabel;
bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox5: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox6: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox7: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox8: TbsSkinDBCheckRadioBox;
DBEdit42: TDBEdit;
DBEdit43: TDBEdit;
t_op_letter_bgmx: TADOQuery;
t_op_letter_bgmx1: TDataSource;
DBMemo22: TDBMemo;
Label67: TLabel;
N27: TMenuItem;
N28: TMenuItem;
DBEdit44: TDBEdit;
Label68: TLabel;
DBEdit45: TDBEdit;
Label69: TLabel;
Button5: TButton;
DBComboBox2: TDBComboBox;
N29: TMenuItem;
N30: TMenuItem;
bsSkinStdLabel1: TbsSkinStdLabel;
bsSkinStdLabel2: TbsSkinStdLabel;
bsSkinStdLabel3: TbsSkinStdLabel;
bsSkinStdLabel4: TbsSkinStdLabel;
bsSkinStdLabel5: TbsSkinStdLabel;
bsSkinStdLabel6: TbsSkinStdLabel;
bsSkinStdLabel7: TbsSkinStdLabel;
bsSkinStdLabel8: TbsSkinStdLabel;
bsSkinStdLabel9: TbsSkinStdLabel;
bsSkinStdLabel10: TbsSkinStdLabel;
bsSkinStdLabel11: TbsSkinStdLabel;
bsSkinStdLabel12: TbsSkinStdLabel;
bsSkinStdLabel13: TbsSkinStdLabel;
bsSkinStdLabel14: TbsSkinStdLabel;
bsSkinDBEdit1: TbsSkinDBEdit;
bsSkinDBEdit2: TbsSkinDBEdit;
bsSkinDBEdit3: TbsSkinDBEdit;
bsSkinDBEdit4: TbsSkinDBEdit;
bsSkinDBEdit5: TbsSkinDBEdit;
bsSkinDBEdit6: TbsSkinDBEdit;
bsSkinDBEdit7: TbsSkinDBEdit;
bsSkinDBEdit8: TbsSkinDBEdit;
bsSkinDBEdit9: TbsSkinDBEdit;
bsSkinDBEdit10: TbsSkinDBEdit;
bsSkinDBEdit11: TbsSkinDBEdit;
bsSkinDBEdit12: TbsSkinDBEdit;
bsSkinDBEdit13: TbsSkinDBEdit;
bsSkinDBEdit14: TbsSkinDBEdit;
bsSkinStdLabel15: TbsSkinStdLabel;
bsSkinDBMemo1: TbsSkinDBMemo;
t_op_railway_cnt: TADOQuery;
t_op_railway_cnt1: TDataSource;
Label70: TLabel;
DBEdit2: TDBEdit;
Label71: TLabel;
DBEdit46: TDBEdit;
Label72: TLabel;
DBEdit47: TDBEdit;
Label73: TLabel;
DBEdit48: TDBEdit;
Label74: TLabel;
DBEdit49: TDBEdit;
t_sys_op: TADOQuery;
t_sys_op1: TDataSource;
DataSource2: TDataSource;
mailSend: TkbmMemTable;
mailSendStringField: TStringField;
mailSendField: TStringField;
mailSendField2: TStringField;
mailSendField3: TStringField;
mailSendField4: TStringField;
mailSendField5: TStringField;
mailSendField6: TStringField;
mailSendField7: TStringField;
DBEdit50: TDBEdit;
Button6: TButton;
Label75: TLabel;
Button7: TButton;
procedure bsSkinButton1Click(Sender: TObject);
procedure DBEdit3Change(Sender: TObject);
procedure t_op_letterAfterInsert(DataSet: TDataSet);
procedure N3Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N11Click(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure t_op_letter_yjBeforeInsert(DataSet: TDataSet);
procedure t_op_letter_cqAfterInsert(DataSet: TDataSet);
procedure t_op_letter_czAfterInsert(DataSet: TDataSet);
procedure t_op_letter_dfAfterInsert(DataSet: TDataSet);
procedure t_op_letter_dqAfterInsert(DataSet: TDataSet);
procedure t_op_letter_ggAfterInsert(DataSet: TDataSet);
procedure t_op_letter_hcAfterInsert(DataSet: TDataSet);
procedure t_op_letter_pcAfterInsert(DataSet: TDataSet);
procedure t_op_letter_rhAfterInsert(DataSet: TDataSet);
procedure t_op_letter_yjAfterInsert(DataSet: TDataSet);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure t_op_letterBeforeInsert(DataSet: TDataSet);
procedure N20Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinPanel1Resize(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure t_op_letter_hdAfterInsert(DataSet: TDataSet);
procedure N23Click(Sender: TObject);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit5KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit6KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit7KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit8KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit9KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit10KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit12KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit13KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit15KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit16KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit14KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit17KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit18KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit19KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit20KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit11KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit21KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit22KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit23KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit24KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit25KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit26KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit27KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit28KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit29KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit30KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure DBEdit31KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit32KeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure N26Click(Sender: TObject);
procedure t_op_letterBeforeEdit(DataSet: TDataSet);
procedure DBComboBox1Change(Sender: TObject);
procedure DBComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit33KeyPress(Sender: TObject; var Key: Char);
procedure N28Click(Sender: TObject);
procedure t_op_letter_bgmxAfterInsert(DataSet: TDataSet);
procedure DBComboBox2DropDown(Sender: TObject);
procedure bsSkinPanel3Resize(Sender: TObject);
procedure N30Click(Sender: TObject);
procedure DBComboBox2Change(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
function GetNewId():string;
function getYTCode(yard:string):string;
{ Private declarations }
public
{ Public declarations }
bsTypeid:Integer;
carrs,trucks,ships,txxp:string;
function GetCorpCName(SName:string):string;
end;
var
frm_op_letter: Tfrm_op_letter;
frm_op_letter_insert:boolean;
implementation
uses u_main, my_sys_function, u_data_share, u_code_truck_client,
u_code_truck_changzhan, u_code_send_head, u_op_letter_his;
{$R *.dfm}
function Tfrm_op_letter.GetCorpCName(SName:string):string;
var AdoQuery:TAdoQuery;
begin
Result:='';
AdoQuery:=CreateAdoQuery;
with AdoQuery do
try
Close;SQL.Clear;
SQL.Add('Select <20>ͻ<EFBFBD>ȫ<EFBFBD><C8AB> From t_crm_Client');
SQL.Add('Where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+SName+'''');
Open;
if not IsEmpty then Result:=FieldByName('<27>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>').AsString
else Result:='';
finally
FreeAndNil(AdoQuery);
end;
end;
procedure Tfrm_op_letter.bsSkinButton1Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_letter.DBEdit3Change(Sender: TObject);
begin
DataSource1.Enabled:=false;
if t_op_letter.IsEmpty then
begin
bsSkinNotebook1.PageIndex:=9;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>' then
begin
bsSkinNotebook1.PageIndex:=11;
DataSource1.Enabled:=false;
DataSource1.DataSet:=t_op_letter_bgmx;
end
else if DBEdit3.Text='<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=0;
DataSource1.Enabled:=false;
DataSource1.DataSet:=t_op_letter_cq;
end
else if DBEdit3.Text='<27><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=1;
DataSource1.DataSet:=t_op_letter_cz;
end
else if DBEdit3.Text='<27><><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=2;
DataSource1.DataSet:=t_op_letter_df;
end
else if DBEdit3.Text='<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=3;
DataSource1.DataSet:=t_op_letter_dq;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=4;
DataSource1.DataSet:=t_op_letter_gg;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=5;
DataSource1.DataSet:=t_op_letter_hc;
end
else if DBEdit3.Text='<27>ɳ<EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=6;
DataSource1.DataSet:=t_op_letter_pc;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=7;
DataSource1.DataSet:=t_op_letter_rh;
end
else if DBEdit3.Text='Ԥ<><EFBFBD><E8B1A3>' then
begin
bsSkinNotebook1.PageIndex:=8;
DataSource1.DataSet:=t_op_letter_yj;
end
else if DBEdit3.Text='ҵ<>񺯵<EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=10;
DataSource1.DataSet:=t_op_letter_hd;
end
else if DBEdit3.Text='<27><>ó<EFBFBD>ɳ<EFBFBD>' then
begin
bsSkinNotebook1.PageIndex:=12;
DataSource1.DataSet:=t_op_letter_pc;
end;
DataSource1.Enabled:=true;
end;
procedure Tfrm_op_letter.t_op_letterAfterInsert(DataSet: TDataSet);
begin
t_op_letter['<27><><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter['ǩ<><C7A9><EFBFBD><EFBFBD>']:=employee;
t_op_letter['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
//ShowMessage(N3.Caption);
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').asstring);
frm_op_letter_insert:=false;
end;
procedure Tfrm_op_letter.N3Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N3.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>').asstring);
t_op_letter.Post;
t_op_letter_pc.insert;
end;
procedure Tfrm_op_letter.N7Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N7.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').asstring);
t_op_letter.Post;
t_op_letter_rh.insert;
end;
procedure Tfrm_op_letter.N5Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N5.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').asstring);
t_op_letter.Post;
t_op_letter_hc.insert;
end;
procedure Tfrm_op_letter.N9Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N9.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_gg.insert;
end;
procedure Tfrm_op_letter.N11Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N11.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_yj.insert;
end;
procedure Tfrm_op_letter.N13Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N13.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_dq.insert;
end;
procedure Tfrm_op_letter.N19Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N19.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_cq.insert;
end;
procedure Tfrm_op_letter.N17Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N17.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_cz.insert;
end;
procedure Tfrm_op_letter.N15Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N15.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').asstring);
t_op_letter.Post;
t_op_letter_df.insert;
end;
procedure Tfrm_op_letter.bsSkinButton2Click(Sender: TObject);
begin
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if DataSource1.DataSet=nil then
exit;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
end;
procedure Tfrm_op_letter.bsSkinButton3Click(Sender: TObject);
begin
if DataSource1.DataSet=nil then
exit;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.cancel;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.cancel;
end;
procedure Tfrm_op_letter.bsSkinButton4Click(Sender: TObject);
begin
if t_op_letter.IsEmpty then
exit;
if DataSource1.DataSet=nil then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
begin
if not DataSource1.DataSet.IsEmpty then
DataSource1.DataSet.Delete;
t_op_letter.delete;
end;
end;
procedure Tfrm_op_letter.t_op_letter_yjBeforeInsert(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
end;
procedure Tfrm_op_letter.t_op_letter_cqAfterInsert(DataSet: TDataSet);
begin
t_op_letter_cq['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_czAfterInsert(DataSet: TDataSet);
begin
t_op_letter_cz['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_dfAfterInsert(DataSet: TDataSet);
begin
t_op_letter_df['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_dqAfterInsert(DataSet: TDataSet);
begin
t_op_letter_dq['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_ggAfterInsert(DataSet: TDataSet);
begin
t_op_letter_gg['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_hcAfterInsert(DataSet: TDataSet);
begin
t_op_letter_hc['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><EFBFBD><E1B5A5>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD><E1B5A5>'];
end;
procedure Tfrm_op_letter.t_op_letter_pcAfterInsert(DataSet: TDataSet);
begin
t_op_letter_pc['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>װ<EFBFBD><D7B0>').asstring;
if frm_data_share.t_code_truck_client.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>ҵ<EFBFBD>ַ']:=frm_data_share.t_code_truck_client['<27><><EFBFBD>ҵ<EFBFBD>ַ'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_code_truck_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰'];
end else begin
if frm_data_share.t_crm_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>ҵ<EFBFBD>ַ']:=frm_data_share.t_crm_client['ͨѶ<CDA8><D1B6>ַ'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
end;
end;
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
if frm_data_share.t_code_truck_changzhan.Locate('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>'];
t_op_letter_pc['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><>վ<EFBFBD>绰']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD>绰'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD>绰'];
end else begin
if frm_data_share.t_crm_client.Locate('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><>վ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
end;
end;
{
if frm_data_share.t_crm_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>ҵ<EFBFBD>ַ']:=frm_data_share.t_crm_client['ͨѶ<CDA8><D1B6>ַ'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
end;
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
if frm_data_share.t_crm_client.Locate('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><>վ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client['<27><><EFBFBD>˵绰'];
end;
}
end;
procedure Tfrm_op_letter.t_op_letter_rhAfterInsert(DataSet: TDataSet);
var
aQuery,bQuery:TADOQuery;
Hour, Min, Sec, MSec: Word;
aDateTime:TDateTime;
begin
t_op_letter_rh['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ']:=t_op_letter.DataSource.DataSet['<27><>վ'];
aDateTime:=t_op_letter.DataSource.DataSet.FieldByName('<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
DecodeTime(aDateTime,Hour, Min, Sec, MSec);
if t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>']<>null then
if Hour<>0 then
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD hh:mm',t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>'])
else t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD',t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>'])
else
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD',Now);
bQuery:=CreateAdoQuery;
with bQuery do try
Close;SQL.Clear;
SQL.Add('Select voy.<2E>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add('From t_code_voyage voy');
SQL.Add('Left join t_code_vessel vsl on (voy.vs_id=vsl.vs_id)');
SQL.Add('Where vsl.Ӣ<>Ĵ<EFBFBD><C4B4><EFBFBD>=:VSL and voy.<2E><><EFBFBD><EFBFBD>=:Voy');
Parameters.ParamByName('VSL').Value:=t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
Parameters.ParamByName('Voy').Value:=t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
Open;
if not IsEmpty then begin
aDateTime:=FieldByName('<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
end;
finally
FreeAndNil(bQuery);
end;
DecodeTime(aDateTime,Hour, Min, Sec, MSec);
if YearOf(aDateTime)<>1899 then
if Hour<>0 then
t_op_letter_rh['<27>ص<EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD hh:mm',aDateTime)
else t_op_letter_rh['<27>ص<EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD',aDateTime)
else
t_op_letter_rh['<27>ص<EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD hh:mm',Now);
if not t_op_letter.DataSource.DataSet.FieldByName('<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>').IsNull then
t_op_letter_rh['<27>ص<EFBFBD>ʱ<EFBFBD><CAB1>']:=FormatDateTime('YYYY-MM-DD hh:mm',t_op_letter.DataSource.DataSet['<27>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>']);
DBComboBox1.Items.Clear;
if frm_data_share.t_crm_client_changzhan.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ַ']:=frm_data_share.t_crm_client_changzhan['ͨѶ<CDA8><D1B6>ַ'];
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client_changzhan['<27>绰'];
try
aQuery:=CreateAdoQuery;
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰,<2C><>ͥ<EFBFBD>绰 from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring+'''');
if t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>').asstring<>'' then
SQL.Add('and <20><><EFBFBD><EFBFBD> ='''+t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>').asstring+'''');
Open;
if not IsEmpty then begin
while not Eof do begin
DBComboBox1.Items.Add(FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
Next;
end;
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=FieldByName('<27><EFBFBD>绰').AsString;
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>']:=FieldByName('<27><>ͥ<EFBFBD>绰').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
if t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>').asstring<>'' then
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>').asstring;
Button6.OnClick(nil);
end;
procedure Tfrm_op_letter.t_op_letter_yjAfterInsert(DataSet: TDataSet);
begin
t_op_letter_yj['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_op_letter.Hide;
frm_op_letter.ManualFloat(frm_op_letter.BoundsRect );
action:=cafree;
frm_op_letter:=nil;
end;
procedure Tfrm_op_letter.FormShow(Sender: TObject);
begin
bsSkinNotebook1.PageIndex:=9;
if (not t_op_letter.Active) then
t_op_letter.Open;
t_op_letter_cq.Open;
t_op_letter_cz.Open;
t_op_letter_df.Open;
t_op_letter_dq.Open;
t_op_letter_gg.Open;
t_op_letter_hc.Open;
t_op_letter_pc.Open;
if (not t_op_letter_rh.Active) then
t_op_letter_rh.Open;
t_op_letter_yj.Open;
t_op_letter_hd.Open;
t_op_letter_bgmx.Open;
t_crm_client_cd.Open ;
// carrs:=GetCorpCName('<27><><EFBFBD><EFBFBD>˾'):string;
// trucks:=GetCorpCName(''):string;
// ships:=GetCorpCName('ί<>е<EFBFBD>λ'):string;
bsSkinButton1.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton2.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton3.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton4.Width:=round(bsSkinPanel1.Width/5);
DBEdit1.Width:=bsSkinPanel3.Width-DBEdit1.Left-6;
// DBComboBox2.Width:=DBEdit1.Width-20;
N26.Visible:=false; //<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
N25.Visible:=false; //---
N23.Visible:=false; //'ҵ<>񺯵<EFBFBD>'
N24.Visible:=false; // '-'
N3.Visible:=false; // '<27>ɳ<EFBFBD>֪ͨ'
N4.Visible:=false; // '-'
N5.Visible:=false; // '<27><><EFBFBD><EFBFBD>֪ͨ'
N6.Visible:=false; // '-'
N7.Visible:=false; //'<27><><EFBFBD><EFBFBD>֪ͨ'
N8.Visible:=false; // '-'
N9.Visible:=false; //'<27><><EFBFBD><EFBFBD>֪ͨ'
N27.Visible:=false; // '-'
N28.Visible:=false; //'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>'
N10.Visible:=false; // '-'
N11.Visible:=false; //'Ԥ<><EFBFBD><E8B1A3>'
N12.Visible:=false; // '-'
N13.Visible:=false; //'<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>'
N14.Visible:=false; // '-'
N15.Visible:=false; //'<27><><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>'
N16.Visible:=false; //'-'
N17.Visible:=false; //'<27><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>'
N18.Visible:=false; // '-'
N19.Visible:=false; //'<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>'
N29.Visible:=false; // '-'
N30.Visible:=false; //'<27><>ó<EFBFBD>ɳ<EFBFBD>'
case bsTypeid of
0:
begin
N26.Visible:=True; //<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
N25.Visible:=True; //---
N23.Visible:=True; //'ҵ<>񺯵<EFBFBD>'
N24.Visible:=True; // '-'
N3.Visible:=True; // '<27>ɳ<EFBFBD>֪ͨ'
N4.Visible:=True; // '-'
N5.Visible:=True; // '<27><><EFBFBD><EFBFBD>֪ͨ'
N6.Visible:=True; // '-'
N7.Visible:=True; //'<27><><EFBFBD><EFBFBD>֪ͨ'
N8.Visible:=True; // '-'
N9.Visible:=True; //'<27><><EFBFBD><EFBFBD>֪ͨ'
N27.Visible:=True; // '-'
N28.Visible:=True; //'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>'
N10.Visible:=True; // '-'
N11.Visible:=True; //'Ԥ<><EFBFBD><E8B1A3>'
N12.Visible:=True; // '-'
N13.Visible:=True; //'<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>'
N14.Visible:=True; // '-'
N15.Visible:=True; //'<27><><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>'
N16.Visible:=True; //'-'
N17.Visible:=True; //'<27><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>'
N18.Visible:=True; // '-'
N19.Visible:=True; //'<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>'
end;
1:
begin
N29.Visible:=True; // '-'
N30.Visible:=True; //'<27><>ó<EFBFBD>ɳ<EFBFBD>'
end;
end;
if (bsTypeid=3) then N7Click(Sender);
end;
procedure Tfrm_op_letter.t_op_letterBeforeInsert(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if t_op_letter.DataSource.DataSet.State=dsinsert then
t_op_letter.DataSource.DataSet.post;
if not frm_op_letter_insert then
abort;
end;
procedure Tfrm_op_letter.N20Click(Sender: TObject);
var
book1:Tbookmark;
aQuery:TADOQuery;
str:string;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
with t_op_railway_cnt do
begin
Close;SQL.Clear;
sql.Add('select * from t_op_railway');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:bsno and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD>');
Parameters.ParamByName('bsno').Value:=t_op_letter.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
Open;
end;
with t_sys_op do
begin
Close;SQL.Clear;
sql.Add('select * from t_sys_employee');
sql.Add('where <20><><EFBFBD><EFBFBD>=:SNAME');
Parameters.ParamByName('SNAME').Value:=t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
Open;
end;
try
t_op_letter.DataSource.DataSet.DisableControls;
// book1:=t_op_letter.GetBookmark;
t_op_letter.DisableControls;
if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then begin
if t_op_letter.DataSource.DataSet.FieldByName('<27>ͻ<EFBFBD><CDBB>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString<>'' then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;sql.Clear;
SQL.Add('select * from t_code_cust_mailproject_detail where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter.DataSource.DataSet.FieldByName('<27>ͻ<EFBFBD><CDBB>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD>֪ͨ'' ');
Open;
if not IsEmpty then begin
mailSend.EmptyTable;
mailSend.Open;
mailSend.Insert;
mailSend.FieldByName('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString:=fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString;
str:=fieldbyname('<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
// <20><><EFBFBD><EFBFBD>ί<EFBFBD>б<EFBFBD><D0B1><EFBFBD> <20>̽<EFBFBD><CCBD><EFBFBD> 2017-07-20
str:=StringReplace(str,'[ί<>б<EFBFBD><D0B1><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
str:=fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
// <20><><EFBFBD><EFBFBD>ί<EFBFBD>б<EFBFBD><D0B1><EFBFBD> <20>̽<EFBFBD><CCBD><EFBFBD> 2017-07-20
str:=StringReplace(str,'[ί<>б<EFBFBD><D0B1><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ]',t_op_letter_rh.fieldbyname('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
frm_data_share.t_sys_employee.Locate('<27><><EFBFBD><EFBFBD>',employee,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD>ǩ<EFBFBD><C7A9>').AsString:=MailSignName;//frm_data_share.t_sys_employee.fieldbyname('<27>ʼ<EFBFBD>ǩ<EFBFBD><C7A9>').AsString;
str:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
// <20><><EFBFBD><EFBFBD>ί<EFBFBD>б<EFBFBD><D0B1><EFBFBD> <20>̽<EFBFBD><CCBD><EFBFBD> 2017-07-22
str:=StringReplace(str,'[ί<>б<EFBFBD><D0B1><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString:=t_op_letter.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
mailSend.Post;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,2,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil,True,'',nil,nil,mailSend);
end else sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,2,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil);
end;
finally
FreeAndNil(aQuery);
end;
end else begin
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,2,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil);
end;
end else
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,2,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
// t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.N1Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
with t_op_railway_cnt do
begin
Close;SQL.Clear;
sql.Add('select * from t_op_railway');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:bsno and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD>');
Parameters.ParamByName('bsno').Value:=t_op_letter.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
Open;
end;
with t_sys_op do
begin
Close;SQL.Clear;
sql.Add('select * from t_sys_employee');
sql.Add('where <20><><EFBFBD><EFBFBD>=:SNAME');
Parameters.ParamByName('SNAME').Value:=t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
Open;
end;
try
// book1:=t_op_letter.GetBookmark;
t_op_letter.DisableControls;
t_op_letter.DataSource.DataSet.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,1,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
// t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.bsSkinButton9Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
PopupMenu2.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_letter.bsSkinPanel1Resize(Sender: TObject);
begin
bsSkinButton1.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton2.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton3.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton4.Width:=round(bsSkinPanel1.Width/5);
end;
procedure Tfrm_op_letter.N21Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
with t_op_railway_cnt do
begin
Close;SQL.Clear;
sql.Add('select * from t_op_railway');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:bsno and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><3E><><EFBFBD><EFBFBD>');
Parameters.ParamByName('bsno').Value:=t_op_letter.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
Open;
end;
with t_sys_op do
begin
Close;SQL.Clear;
sql.Add('select * from t_sys_employee');
sql.Add('where <20><><EFBFBD><EFBFBD>=:SNAME');
Parameters.ParamByName('SNAME').Value:=t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
Open;
end;
try
// book1:=t_op_letter.GetBookmark;
t_op_letter.DataSource.DataSet.DisableControls;
t_op_letter.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,3,t_op_letter.DataSource,t_op_letter1,DataSource1,t_op_railway_cnt1,t_sys_op1,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
// t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.t_op_letter_hdAfterInsert(DataSet: TDataSet);
begin
t_op_letter_hd['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.N23Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N23.Caption;
t_op_letter['Head_To']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString);
t_op_letter.Post;
t_op_letter_hd.insert;
end;
procedure Tfrm_op_letter.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
key_DBComboBox(Key,DBComboBox2);
end;
procedure Tfrm_op_letter.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bsSkinNotebook1.SetFocus;
end;
end;
procedure Tfrm_op_letter.DBEdit4KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo6);
end;
procedure Tfrm_op_letter.DBEdit5KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit6);
end;
procedure Tfrm_op_letter.DBEdit6KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit7);
end;
procedure Tfrm_op_letter.DBEdit7KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo7);
end;
procedure Tfrm_op_letter.DBEdit8KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo8);
end;
procedure Tfrm_op_letter.DBEdit9KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit10);
end;
procedure Tfrm_op_letter.DBEdit10KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit12);
end;
procedure Tfrm_op_letter.DBEdit12KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit13);
end;
procedure Tfrm_op_letter.DBEdit13KeyPress(Sender: TObject; var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker1);
end;
procedure Tfrm_op_letter.wwDBDateTimePicker1KeyPress(Sender: TObject;
var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker2);
end;
procedure Tfrm_op_letter.wwDBDateTimePicker2KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBEdit(Key,DBEdit15);
end;
procedure Tfrm_op_letter.DBEdit15KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit16);
end;
procedure Tfrm_op_letter.DBEdit16KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo12);
end;
procedure Tfrm_op_letter.DBEdit14KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit31);
end;
procedure Tfrm_op_letter.DBEdit17KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit18);
end;
procedure Tfrm_op_letter.DBEdit18KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit19);
end;
procedure Tfrm_op_letter.DBEdit19KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit20);
end;
procedure Tfrm_op_letter.DBEdit20KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit11);
end;
procedure Tfrm_op_letter.DBEdit11KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit21);
end;
procedure Tfrm_op_letter.DBEdit21KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit22);
end;
procedure Tfrm_op_letter.DBEdit22KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit23);
end;
procedure Tfrm_op_letter.DBEdit23KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit24);
end;
procedure Tfrm_op_letter.DBEdit24KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit25);
end;
procedure Tfrm_op_letter.DBEdit25KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo13);
end;
procedure Tfrm_op_letter.DBEdit26KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit27);
end;
procedure Tfrm_op_letter.DBEdit27KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit28);
end;
procedure Tfrm_op_letter.DBEdit28KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
DBComboBox1.SetFocus;
end;
end;
procedure Tfrm_op_letter.DBEdit29KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit33);
end;
procedure Tfrm_op_letter.DBEdit30KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo15);
end;
procedure Tfrm_op_letter.Button1Click(Sender: TObject);
begin
if t_op_letter_pc.IsEmpty then
exit;
try
frm_code_truck_client:=tfrm_code_truck_client.Create (self);
code_truck_client_num:=1;
frm_code_truck_client.ShowModal;
finally
frm_code_truck_client.Free;
frm_code_truck_client:=nil;
end;
end;
procedure Tfrm_op_letter.Button2Click(Sender: TObject);
begin
if t_op_letter_pc.IsEmpty then
exit;
try
frm_code_truck_changzhan:=tfrm_code_truck_changzhan.Create (self);
code_truck_changzhan_num:=1;
frm_code_truck_changzhan.ShowModal;
finally
frm_code_truck_changzhan.Free;
frm_code_truck_changzhan:=nil;
end;
end;
procedure Tfrm_op_letter.Button3Click(Sender: TObject);
begin
if t_op_letter_pc.IsEmpty then
exit;
try
frm_code_truck_changzhan:=tfrm_code_truck_changzhan.Create (self);
code_truck_changzhan_num:=2;
frm_code_truck_changzhan.ShowModal;
finally
frm_code_truck_changzhan.Free;
frm_code_truck_changzhan:=nil;
end;
end;
procedure Tfrm_op_letter.Button4Click(Sender: TObject);
begin
if t_op_letter_rh.IsEmpty then
exit;
try
frm_code_truck_changzhan:=tfrm_code_truck_changzhan.Create (self);
code_truck_changzhan_num:=3;
frm_code_truck_changzhan.ShowModal;
finally
frm_code_truck_changzhan.Free;
frm_code_truck_changzhan:=nil;
end;
end;
procedure Tfrm_op_letter.Button5Click(Sender: TObject);
begin
if t_op_letter.isempty then
exit;
{
if not if_open('144') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
}
try
frm_code_send_head:=tfrm_code_send_head.Create (self);
code_send_head_num:=1;
frm_code_send_head.ShowModal;
finally
frm_code_send_head.Free;
frm_code_send_head:=nil;
end;
end;
procedure Tfrm_op_letter.DBEdit31KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit32);
end;
procedure Tfrm_op_letter.DBEdit32KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit17);
end;
procedure Tfrm_op_letter.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,t_op_letter,'LF');
end;
procedure Tfrm_op_letter.N26Click(Sender: TObject);
begin
try
if not assigned(frm_op_letter_his) then
frm_op_letter_his:=tfrm_op_letter_his.Create (self);
frm_op_letter_his.ShowModal;
finally
frm_op_letter_his.free;
frm_op_letter_his:=nil;
end;
end;
procedure Tfrm_op_letter.t_op_letterBeforeEdit(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if (not txxp='1') then begin
if not do_data('0001',t_op_letter.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>').asstring,'','','','','') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
end;
end;
procedure Tfrm_op_letter.DBComboBox1Change(Sender: TObject);
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰 from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring+''' AND <20><><EFBFBD><EFBFBD>='''+DBComboBox1.Text+'''');
Open;
if not IsEmpty then begin
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=FieldByName('<27><EFBFBD>绰').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_letter.DBComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBEdit(Key,DBEdit29);
end;
procedure Tfrm_op_letter.DBEdit33KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo14);
end;
procedure Tfrm_op_letter.N28Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N28.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').asstring);
t_op_letter.Post;
t_op_letter_bgmx.insert;
end;
procedure Tfrm_op_letter.t_op_letter_bgmxAfterInsert(DataSet: TDataSet);
begin
t_op_letter_bgmx['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.DBComboBox2DropDown(Sender: TObject);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=createAdoQuery;
with aAdoQuery do try
Close;Sql.Clear;
Sql.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰,<2C><>ͥ<EFBFBD>绰 From t_crm_client_linkman');
Sql.Add('Where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').AsString;
Open;First;
DBComboBox2.Clear;
while not eof do begin
DBComboBox2.Items.Add(FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
Next;
end;
finally
FreeAndNil(aAdoQuery);
end;
end;
procedure Tfrm_op_letter.bsSkinPanel3Resize(Sender: TObject);
begin
DBEdit1.Width:=bsSkinPanel3.Width-DBEdit1.left-6;
// DBComboBox2.Width:=DBEdit1.Width-20;
// Button5.Left:=DBComboBox2.left+DBComboBox2.Width;
end;
procedure Tfrm_op_letter.N30Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N30.Caption;
t_op_letter['HEAD_TO']:=GetCorpCName(t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').asstring);
t_op_letter.Post;
t_op_letter_pc.insert;
end;
procedure Tfrm_op_letter.DBComboBox2Change(Sender: TObject);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=createAdoQuery;
with aAdoQuery do try
Close;Sql.Clear;
Sql.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰,<2C><>ͥ<EFBFBD>绰,<2C><><EFBFBD><EFBFBD> From t_crm_client_linkman');
Sql.Add('Where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_letter.DataSource.DataSet.FieldByName('ί<>е<EFBFBD>λ').AsString;
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=Trim(DBComboBox2.Text);
Open;First;
if not IsEmpty then
begin
t_op_letter.FieldByName('HEAD_TEL').AsString:=FieldByName('<27><EFBFBD>绰').AsString;
t_op_letter.FieldByName('HEAD_FAX').AsString:=FieldByName('<27><>ͥ<EFBFBD>绰').AsString;
t_op_letter.FieldByName('HEAD_MAIL').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
finally
FreeAndNil(aAdoQuery);
end;
end;
procedure Tfrm_op_letter.Button6Click(Sender: TObject);
var
IdHttp : TIdHTTP;
PostUrl,Url,StrL,JSONSTR,errmsg,userid,UserName,userpsw,WebUserName,Webuserpsw,NEWID,YARD,CTNSTR,str,AgentName : string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
ResponseStream : TStringStream; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
ResponseStr: string;
RequestStr : string; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
RequestStream : TStringStream;
jo: ISuperObject;
i,k:Integer;
aAdoQuery:TADOQuery;
isfirst:Boolean;
// sl:TStrings;
begin
Url:=get_parameters_value(2114,'');
UserName:=get_parameters_value(2112,'');
userpsw:=get_parameters_value(2113,'');
// sl:=TStringList.create();
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do begin
close;SQL.Clear;
sql.add('SELECT <20><><EFBFBD><EFBFBD>СƱ<D0A1>˺<EFBFBD>,<2C><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1><EFBFBD><EFBFBD> from t_crm_client '
+' where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString+'''');
open;
if not IsEmpty then begin
WebUserName:=fieldbyname('<27><><EFBFBD><EFBFBD>СƱ<D0A1>˺<EFBFBD>').asstring;
Webuserpsw:=fieldbyname('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1><EFBFBD><EFBFBD>').asstring;
end;
close;SQL.Clear;
sql.add('SELECT <20><><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4><EFBFBD> from t_crm_emloyee_djy '
+' where <20><><EFBFBD><EFBFBD>='+''''+employee+'''');
open;
if not IsEmpty then begin
userid:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4><EFBFBD>').asstring;
end;
end;
{
if (frm_data_share.t_crm_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString,[])) then begin
WebUserName:=frm_data_share.t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>СƱ<D0A1>˺<EFBFBD>').asstring;
Webuserpsw:=frm_data_share.t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1><EFBFBD><EFBFBD>').asstring;
end;
}
if(WebUserName='') then begin
WebUserName:=get_parameters_value(2110,'');
Webuserpsw:=get_parameters_value(2111,'');
end;
PostUrl:=get_parameters_value(2115,'');
AgentName:=frm_data_share.t_sys_company.fieldbyname('ȫ<><C8AB>').AsString;
with aAdoQuery do begin
close;SQL.Clear;
sql.add('SELECT TXXPGID from t_op_seae_txxp '
+' where <20><><EFBFBD><EFBFBD>='+''''+t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'''');
open;
if not IsEmpty then begin
NEWID:=Fieldbyname('TXXPGID').AsString;
end;
end;
if (Trim(NEWID)='') then begin
NEWID:=GetNewId();
NEWID:=StringReplace(NEWID,'{','',[]);
NEWID:=StringReplace(NEWID,'}','',[]);
with aAdoQuery do begin
close;SQL.Clear;
sql.add('insert into t_op_seae_txxp (<28><><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,TXXPGID) '
+' Values ('''+t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+''','''+employee+''','''+FormatDateTime('YYYY-MM-DD hh:mm:ss',now)+''','''+NEWID+''')');
ExecSQL;
end;
end;
{
if (Trim(t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString)<>'') then begin
NEWID:=StringReplace(Trim(t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString),Url,'',[]);
end else begin
//end;
}
YARD:=getYTCode(t_op_letter.DataSource.dataset.FieldByName('<27><>վ').AsString);
if (YARD='') then begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>վ<EFBFBD><D5BE>ͨ<EFBFBD><CDA8><EFBFBD>룡');
Exit;
end;
with t_sys_op do
begin
Close;SQL.Clear;
sql.Add('select * from t_sys_employee');
sql.Add('where <20><><EFBFBD><EFBFBD>=:SNAME');
Parameters.ParamByName('SNAME').Value:=t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
Open;
end;
with aAdoQuery do begin
close;SQL.Clear;
sql.add('SELECT <20>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ,sum(<28><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD> from t_op_ctn '
+' where <20><><EFBFBD><EFBFBD>='+''''+t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+''''
+' group by <20>ߴ<EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ');
open;
end;
str:=str+'{';
str:=str+'"billOrderId":"'+ NEWID+'"';
str:=str+',"sendOrderCode":"'+t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString+'"';
str:=str+',"userId":"'+userid+'"';
str:=str+',"userName":"'+UserName+'"';
str:=str+',"userPassword":"'+userpsw+'"';
str:=str+',"AgentName":"'+AgentName+'"';
str:=str+',"CustomerName":"'+t_op_letter.DataSource.dataset.FieldByName('ί<>е<EFBFBD>λ').AsString+'"';
str:=str+',"operatorName":"'+ t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString+'"';
str:=str+',"depotCode":""';
str:=str+',"depotName":"'+ YARD+'"';
str:=str+',"linkName":"'+ t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString+'"';
str:=str+',"linkMobile":"'+ t_sys_op.FieldByName('<27>̶<EFBFBD><CCB6>绰').AsString+'"';
str:=str+',"CarrierCode":"'+ getYTCode(t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString)+'"';
str:=str+',"portdischarge":"'+ t_op_letter.DataSource.dataset.FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString+'"';
str:=str+',"portdischargeCode":"'+ t_op_letter.DataSource.dataset.FieldByName('ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'"';
str:=str+',"ShipName":"'+ t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'"';
str:=str+',"VoyNo":"'+ t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'"';
str:=str+',"EtdTimeStr":"'+ t_op_letter.DataSource.dataset.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'"';
str:=str+',"memo":""';
str:=str+',boxInfo:[';
isfirst:=true;
while not aAdoQuery.Eof do begin
if (isfirst) then str:=str+'{' else str:=str+',{';
CTNSTR:=aAdoQuery.FieldByName('<27>ߴ<EFBFBD>').AsString+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
CTNSTR:=StringReplace(CTNSTR,'20GP','20ST',[rfReplaceAll]);
CTNSTR:=StringReplace(CTNSTR,'40GP','40ST',[rfReplaceAll]);
str:=str+'"boxType":"'+ CTNSTR+'"';
str:=str+',"boxCount":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'"';
str:=str+'}';
isfirst:=false;
aAdoQuery.Next;
end;
str:=str+']';
str:=str+',"sysLoginName":"'+webUserName+'"';
str:=str+',"sysPsssword":"'+webuserpsw+'"';
str:=str+',"SystemCode":"dongsheng6"';
str:=str+'}';
// sl.add(str);
// sl.SaveToFile('d:\11.txt');
TDsThread.create(PostUrl,str,'');
txxp:='1';
if not (t_op_letter_rh.State in [dsinsert,dsedit]) then t_op_letter_rh.Edit;
t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString:=Url+NEWID;
t_op_letter_rh.Post;
txxp:='0';
{
try
IdHttp := TIdHTTP.Create(nil);
IdHTTP.HTTPOptions := IdHTTP.HTTPOptions + [hoKeepOrigProtocol]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><E6B1BE>Ч
IdHTTP.ProtocolVersion := pv1_1;
IdHttp.Request.UserAgent:='Mozilla/3.0 (compatible; Indy Library)';
idhttp.Request.ContentType:='application/json;charset=UTF-8';
ResponseStream := TStringStream.Create('');
RequestStream := TStringStream.Create('');
jo := SO(str);
if (UserName<>'') and (userpsw<>'') then
try
try
RequestStr:=jo.AsJSon(True); //<2F><>С<EFBFBD><D0A1>
RequestStream.WriteString(RequestStr);
IdHttp.post(PostUrl,RequestStream,ResponseStream);
except
on e : Exception do
begin
errmsg:=e.Message;
end;
end;
ResponseStr := ResponseStream.DataString;
ResponseStr := UTF8Decode(ResponseStr);
if Pos('"status":true',ResponseStr)>0 then begin
if not (t_op_letter_rh.State in [dsinsert,dsedit]) then t_op_letter_rh.Edit;
t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString:=Url+NEWID;
t_op_letter_rh.Post;
end else
begin
i:= Pos('"Message":' ,ResponseStr);
errmsg :=Copy(ResponseStr ,i+11,Length(ResponseStr)-i-11);
MessageDlg('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,'+errmsg,mtWarning,[mbOk],0);
end;
finally
IdHttp.Free;
RequestStream.Free;
ResponseStream.Free;
end;
finally
end;
}
end;
function Tfrm_op_letter.GetNewId: string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Text:='SELECT NEWID() ID';
Open;
Result:=Fieldbyname('ID').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_letter.getYTCode(yard:string): string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> EDI<44><49><EFBFBD><EFBFBD> from T_CRM_CLIENT where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+yard+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI<44><49><EFBFBD><EFBFBD>').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_letter.Button7Click(Sender: TObject);
begin
Clipboard.SetTextBuf(PChar(t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString));
end;
{ TDsThread }
constructor TDsThread.create(mPostUrl, mJSONSTR, mScriptPath: string);
begin
inherited Create(True);
PostUrl:=mPostUrl;
JSONSTR:=mJSONSTR;
ScriptPath:=mScriptPath;
FreeOnTerminate:=True;
Resume;
end;
destructor TDsThread.destroy;
begin
inherited;
end;
procedure TDsThread.Execute;
var
IdHttp : TIdHTTP;
errmsg : string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
ResponseStream : TStringStream; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
ResponseStr: string;
RequestStr : string; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
RequestStream : TStringStream;
jo: ISuperObject;
i,k:Integer;
begin
inherited;
CoInitialize(Nil);
try
IdHttp := TIdHTTP.Create(nil);
IdHTTP.HTTPOptions := IdHTTP.HTTPOptions + [hoKeepOrigProtocol]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><E6B1BE>Ч
IdHTTP.ProtocolVersion := pv1_1;
IdHttp.Request.UserAgent:='Mozilla/3.0 (compatible; Indy Library)';
idhttp.Request.ContentType:='application/json;charset=UTF-8';
ResponseStream := TStringStream.Create('');
RequestStream := TStringStream.Create('');
jo := SO(JSONSTR);
try
try
RequestStr:=jo.AsJSon(True); //<2F><>С<EFBFBD><D0A1>
RequestStream.WriteString(RequestStr);
IdHttp.post(PostUrl,RequestStream,ResponseStream);
except
IdHttp.post(PostUrl,RequestStream,ResponseStream);
{
on e : Exception do
begin
errmsg:=e.Message;
end;
}
end;
ResponseStr := ResponseStream.DataString;
ResponseStr := UTF8Decode(ResponseStr);
if Pos('"status":true',ResponseStr)>0 then begin
{
if not (t_op_letter_rh.State in [dsinsert,dsedit]) then t_op_letter_rh.Edit;
t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString:=Url+NEWID;
t_op_letter_rh.Post;
}
end else
begin
i:= Pos('"message":' ,ResponseStr);
errmsg :=Copy(ResponseStr ,i+11,Length(ResponseStr)-i-11);
errmsg :=Copy(errmsg ,0,Pos('"' ,errmsg));
Application.MessageBox(pchar('<27>ϴ<EFBFBD>СƱ<D0A1><C6B1><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!"'+errmsg),'<27><>ʾ',MB_OK+MB_IconInformation);
if not (frm_op_letter.t_op_letter_rh.State in [dsedit,dsinsert]) then begin
frm_op_letter.t_op_letter_rh.Edit;
end;
frm_op_letter.t_op_letter_rh.FieldByName('<27><><EFBFBD><EFBFBD>СƱ<D0A1><C6B1>ַ').AsString:='';
frm_op_letter.t_op_letter_rh.Post;
// MessageDlg('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,'+errmsg,mtWarning,[mbOk],0);
end;
finally
IdHttp.Free;
RequestStream.Free;
ResponseStream.Free;
end;
finally
CoUninitialize;
end;
end;
end.