unit crm_OnLineBooking;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, BusinessSkinForm, bsSkinCtrls, dxExEdtr, dxCntner, dxTL,
dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Grids, DBGridEh, StdCtrls, Mask,
bsSkinBoxCtrls, u_op_seae_DsWebService, SoapHTTPClient, InvokeRegistry, Menus,
kbmMemTable, my_sys_function, DBCtrls, ExtCtrls, ComCtrls, ActnList,
cxLookAndFeelPainters, cxCheckBox, cxButtons, cxLabel, cxDBEdit, cxControls,
cxContainer, cxEdit, cxTextEdit, cxMemo, DBGrids;
type
Tfrm_crm_OnLineBooking = class(TForm)
bsSkinPanel2: TbsSkinPanel;
bsSkinPanel3: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
MT1: TkbmMemTable;
ds1: TDataSource;
qryInsert: TADOQuery;
MT1BSNO: TStringField;
MT1BSSTATUS: TStringField;
MT1BSDATE: TStringField;
MT1MBLNO: TStringField;
MT1CUSTNO: TStringField;
MT1SHIPPERID: TStringField;
MT1ETD: TStringField;
MT1ETA: TStringField;
MT1PORTLOADID: TStringField;
MT1PORTDISCHARGEID: TStringField;
MT1DESTINATIONID: TStringField;
MT1INPUTBY: TStringField;
MT1AUDITOR: TStringField;
MT1FORWARDER: TStringField;
MT1CARRIER: TStringField;
qrysearch: TADOQuery;
MT2: TkbmMemTable;
StringField1: TStringField;
StringField2: TStringField;
StringField3: TStringField;
StringField4: TStringField;
StringField5: TStringField;
StringField6: TStringField;
StringField7: TStringField;
StringField8: TStringField;
StringField9: TStringField;
StringField10: TStringField;
StringField11: TStringField;
StringField12: TStringField;
StringField13: TStringField;
StringField14: TStringField;
StringField15: TStringField;
MT1CtnInfo: TStringField;
MT1CNTR: TStringField;
MT1TimeMark: TStringField;
MT1VESSEL: TStringField;
MT1VOYNO: TStringField;
MT1ISSUEPLACE: TStringField;
MT1BOOKINGTYPE: TStringField;
MT1OLDBSNO: TStringField;
MT1CONSIGNEE: TStringField;
MT1NOTIFYPARTY: TStringField;
MT1DESCRIPTION: TStringField;
MT1NOPKGS: TStringField;
MT1PKGS: TStringField;
MT1GROSSWEIGHT: TStringField;
MT1KGS: TStringField;
MT1MEASUREMENT: TStringField;
MT1CBM: TStringField;
MT1BOOKINGDESCRIPTION: TStringField;
MT1PLACEDELIVERY: TStringField;
MT1PLACEDELIVERYID: TStringField;
MT1SERVICE: TStringField;
MT1BLFRT: TStringField;
MT1SHIPPER: TStringField;
MT1PORTLOAD: TStringField;
MT1PORTDISCHARGE: TStringField;
MT1DESTINATION: TStringField;
MT1MARKS: TStringField;
MT1TOTALNO: TStringField;
MT1SENDERCOMPANY: TStringField;
MT1SENDERCOMPANYID: TStringField;
MT1SENDERNAME: TStringField;
bsSkinButton3: TbsSkinButton;
t_ch_fee: TADOQuery;
bsSkinButton10: TbsSkinButton;
MT1CARGOID: TStringField;
MT1COMPANYID: TStringField;
qryGetOpseae: TADOQuery;
qryGetOpseae2: TADOQuery;
qryGetCompany: TADOQuery;
MT1KINDPKGS: TStringField;
MT1SenderMobile: TStringField;
MT1SenderEmail: TStringField;
MT1PAYABLEAT: TStringField;
GetCtnCodeQry: TADOQuery;
MT1CONTRACTNO: TStringField;
bsSkinNotebook1: TbsSkinNotebook;
bsSkinButton2: TbsSkinButton;
MT1PendingReason: TStringField;
MT1CLOSEDOCDATE: TStringField;
MT1BSTYPE: TStringField;
pnl2: TPanel;
dbmmoYARDRemark: TDBMemo;
lbl23: TLabel;
lbl24: TLabel;
dbedtYARDAddress: TDBEdit;
dbedtYARDTel: TDBEdit;
lbl26: TLabel;
lbl27: TLabel;
dbedtCLOSEDOCDATE: TDBEdit;
lbl29: TLabel;
dbedtCLOSINGDATE: TDBEdit;
lbl30: TLabel;
MT1YARD: TStringField;
MT1YARDAddress: TStringField;
MT1YARDLinkman: TStringField;
MT1YARDTel: TStringField;
dbedtCLOSEDOCDATE1: TDBEdit;
MT1YARDFAX: TStringField;
MT1YARDRemark: TStringField;
qry_op_letter: TADOQuery;
qry_op_letter_rh: TADOQuery;
ds_op_letter_rh1: TDataSource;
ds_op_letter1: TDataSource;
dbedtYARDAddress1: TDBEdit;
lbl25: TLabel;
lbl2: TLabel;
dbedtYARD1: TDBEdit;
lbl28: TLabel;
dbedtYARD2: TDBEdit;
lbl32: TLabel;
dbedtYARD3: TDBEdit;
lbl33: TLabel;
dbedtYARD4: TDBEdit;
lbl34: TLabel;
dbedtYARD5: TDBEdit;
lbl35: TLabel;
dbedtYARD6: TDBEdit;
lbl36: TLabel;
dbedtYARD7: TDBEdit;
lbl37: TLabel;
dbedtYARD8: TDBEdit;
lbl38: TLabel;
dbedtPORTLOAD: TDBEdit;
dbedtVOYNO: TDBEdit;
lbl39: TLabel;
dbedtVESSEL: TDBEdit;
lbl42: TLabel;
lbl40: TLabel;
lbl41: TLabel;
dbedtVOYNO1: TDBEdit;
lbl43: TLabel;
dbedtVESSEL1: TDBEdit;
lbl44: TLabel;
dbedtVOYNO2: TDBEdit;
lbl45: TLabel;
dbedtVESSEL2: TDBEdit;
lbl46: TLabel;
lbl47: TLabel;
lbl31: TLabel;
lbl50: TLabel;
MT1Remark: TStringField;
pnl3: TPanel;
MT1GID: TStringField;
MT1RECDate: TStringField;
spl1: TSplitter;
MT_MSG: TkbmMemTable;
StringField16: TStringField;
StringField17: TStringField;
MT1MSGDate: TStringField;
StringField18: TStringField;
MT1SENDERCOMPANYNAME: TStringField;
MT1FieldValue: TStringField;
StringField19: TStringField;
MT1Received: TStringField;
MT1SendMail: TStringField;
ds2: TDataSource;
pm1: TPopupMenu;
N2: TMenuItem;
N1: TMenuItem;
N3: TMenuItem;
pnl4: TPanel;
pnl5: TPanel;
btn1: TButton;
chk1: TCheckBox;
mmo2: TMemo;
dxDBGrid: TdxDBGrid;
colFX: TdxDBGridColumn;
colSenderCompany: TdxDBGridColumn;
colSender: TdxDBGridColumn;
colMESDate: TdxDBGridColumn;
colFieldValue: TdxDBGridMemoColumn;
dxDBGridColumn6: TdxDBGridColumn;
actlst1: TActionList;
act1: TAction;
act2: TAction;
pnl6: TPanel;
dxdbgrd1: TdxDBGrid;
dxdbgrd1Column8: TdxDBGridColumn;
dxdbgrd1Column10: TdxDBGridColumn;
dxdbgrd1Column1: TdxDBGridColumn;
dxdbgrd1Column3: TdxDBGridColumn;
dxdbgrd1Column2: TdxDBGridColumn;
dxdbgrd1Column7: TdxDBGridColumn;
dxdbgrd1Column6: TdxDBGridColumn;
dxdbgrd1Column5: TdxDBGridColumn;
dxdbgrd1Column9: TdxDBGridColumn;
bsSkinPanel1: TbsSkinPanel;
cxDBMemo3: TcxDBMemo;
cxDBTextEdit1: TcxDBTextEdit;
cxDBTextEdit2: TcxDBTextEdit;
cxDBTextEdit3: TcxDBTextEdit;
cxDBTextEdit4: TcxDBTextEdit;
cxDBTextEdit5: TcxDBTextEdit;
cxDBTextEdit6: TcxDBTextEdit;
cxDBMemo4: TcxDBMemo;
cxDBMemo5: TcxDBMemo;
cxLabel16: TcxLabel;
cxDBTextEdit8: TcxDBTextEdit;
cxDBTextEdit9: TcxDBTextEdit;
cxDBTextEdit11: TcxDBTextEdit;
cxButton6: TcxButton;
cxDBTextEdit15: TcxDBTextEdit;
cxDBTextEdit16: TcxDBTextEdit;
cxDBTextEdit17: TcxDBTextEdit;
cxDBTextEdit18: TcxDBTextEdit;
cxDBTextEdit19: TcxDBTextEdit;
cxDBTextEdit20: TcxDBTextEdit;
cxDBTextEdit21: TcxDBTextEdit;
cxDBMemo2: TcxDBMemo;
cxDBMemo1: TcxDBMemo;
cxButton8: TcxButton;
cxButton9: TcxButton;
cxButton10: TcxButton;
DBEdit1: TDBEdit;
cxCheckBox1: TcxCheckBox;
cxButton11: TcxButton;
cxCheckBox2: TcxCheckBox;
cxCheckBox3: TcxCheckBox;
cxCheckBox4: TcxCheckBox;
cxCheckBox5: TcxCheckBox;
cxCheckBox6: TcxCheckBox;
cxCheckBox7: TcxCheckBox;
cxCheckBox9: TcxCheckBox;
cxCheckBox8: TcxCheckBox;
cxCheckBox11: TcxCheckBox;
cxCheckBox12: TcxCheckBox;
cxCheckBox13: TcxCheckBox;
cxCheckBox15: TcxCheckBox;
cxCheckBox16: TcxCheckBox;
cxCheckBox17: TcxCheckBox;
cxCheckBox22: TcxCheckBox;
cxCheckBox23: TcxCheckBox;
cxCheckBox24: TcxCheckBox;
cxCheckBox25: TcxCheckBox;
cxCheckBox26: TcxCheckBox;
cxCheckBox21: TcxCheckBox;
cxDBMemo6: TcxDBMemo;
cxCheckBox14: TcxCheckBox;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
Memo4: TMemo;
t_op_seae1: TDataSource;
t_op_seae: TADOQuery;
t_op_ctn1: TDataSource;
t_op_ctn: TADOQuery;
MT1Field: TMemoField;
MT1Field2: TMemoField;
MT1Field3: TMemoField;
MT1Field4: TStringField;
MT1Field5: TStringField;
MT1Field6: TStringField;
MT1Field7: TStringField;
MT1Field8: TStringField;
MT1Field9: TStringField;
MT1Field10: TStringField;
MT1Field11: TStringField;
MT1Field12: TStringField;
MT1Field13: TStringField;
MT1Field14: TIntegerField;
MT1Field15: TStringField;
MT1Field16: TFloatField;
MT1Field17: TFloatField;
MT1Field18: TMemoField;
MT1Field19: TMemoField;
MT1StringField: TStringField;
MT1Field20: TStringField;
MT1Field21: TMemoField;
memtblwebCtn: TkbmMemTable;
memtblwebCtn1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
MT1INDEX_ID: TIntegerField;
cxButton1: TcxButton;
bsSkinButton4: TbsSkinButton;
pnl1: TPanel;
cxDBMemo7: TcxDBMemo;
cxDBTextEdit7: TcxDBTextEdit;
cxDBTextEdit10: TcxDBTextEdit;
cxDBTextEdit12: TcxDBTextEdit;
cxDBTextEdit13: TcxDBTextEdit;
cxDBTextEdit22: TcxDBTextEdit;
cxDBTextEdit23: TcxDBTextEdit;
cxDBMemo8: TcxDBMemo;
cxDBMemo9: TcxDBMemo;
cxDBTextEdit24: TcxDBTextEdit;
cxDBTextEdit25: TcxDBTextEdit;
cxDBTextEdit26: TcxDBTextEdit;
cxDBTextEdit27: TcxDBTextEdit;
cxDBTextEdit28: TcxDBTextEdit;
cxDBTextEdit29: TcxDBTextEdit;
cxDBMemo10: TcxDBMemo;
cxDBMemo11: TcxDBMemo;
cxDBMemo12: TcxDBMemo;
lbl1: TLabel;
lbl3: TLabel;
lbl4: TLabel;
lbl5: TLabel;
lbl6: TLabel;
lbl7: TLabel;
lbl8: TLabel;
lbl9: TLabel;
lbl10: TLabel;
lbl12: TLabel;
lbl13: TLabel;
lbl14: TLabel;
lbl15: TLabel;
lbl16: TLabel;
lbl17: TLabel;
lbl18: TLabel;
lbl19: TLabel;
lbl20: TLabel;
bsSkinButton5: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
Qry1: TADOQuery;
Label1: TLabel;
procedure bsSkinButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure dxdbgrd1DblClick(Sender: TObject);
function UnformatAfrstr(str: string): string;
procedure bsSkinButton3Click(Sender: TObject);
procedure SaveBooking;
procedure DoSaveBook;
procedure Pending;
procedure SaveShippingOrder;
procedure DoPending(BSNO, PendingReason: string);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure ssagetaChange(Sender: TObject; Field: TField);
procedure bsSkinButton2Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure dxdbgrd1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
procedure dxdbgrd1Click(Sender: TObject);
procedure dxdbgrd1Column1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
procedure dxDBGridCustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
procedure N2Click(Sender: TObject);
procedure SetReceived(GID: string);
procedure SetReceivedList;
procedure N3Click(Sender: TObject);
procedure act1Execute(Sender: TObject);
procedure act2Execute(Sender: TObject);
procedure DBEdit1Change(Sender: TObject);
procedure dxDBGrid1DblClick(Sender: TObject);
procedure dxDBGrid1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
procedure dxDBGrid1Column1CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column2CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column4CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column5CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column6CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column7CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure dxDBGrid1Column8CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
procedure cxDBMemo1DblClick(Sender: TObject);
procedure cxDBMemo2DblClick(Sender: TObject);
procedure cxDBMemo3DblClick(Sender: TObject);
procedure cxDBMemo4DblClick(Sender: TObject);
procedure cxDBMemo5DblClick(Sender: TObject);
procedure cxDBMemo6DblClick(Sender: TObject);
procedure cxButton8Click(Sender: TObject);
procedure cxButton9Click(Sender: TObject);
procedure cxButton10Click(Sender: TObject);
procedure cxButton11Click(Sender: TObject);
procedure cxButton6Click(Sender: TObject);
procedure cxButton1Click(Sender: TObject);
procedure cxDBTextEdit16DblClick(Sender: TObject);
procedure cxDBTextEdit17DblClick(Sender: TObject);
procedure cxDBTextEdit18DblClick(Sender: TObject);
procedure cxDBTextEdit19DblClick(Sender: TObject);
procedure cxDBTextEdit8DblClick(Sender: TObject);
procedure cxDBTextEdit9DblClick(Sender: TObject);
procedure cxDBTextEdit2DblClick(Sender: TObject);
procedure cxDBTextEdit3DblClick(Sender: TObject);
procedure cxDBTextEdit1DblClick(Sender: TObject);
procedure cxDBTextEdit4DblClick(Sender: TObject);
procedure cxDBTextEdit5DblClick(Sender: TObject);
procedure cxDBTextEdit6DblClick(Sender: TObject);
procedure cxDBTextEdit11DblClick(Sender: TObject);
procedure cxDBTextEdit15DblClick(Sender: TObject);
procedure cxDBTextEdit21DblClick(Sender: TObject);
procedure cxDBTextEdit20DblClick(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
private
mServiceSoap_Ds: DsWebServiceSoap;
mHttpRIO_ds: THTTPRIO;
hdgsSPXNO: string;
XML, OPTYPE, sysNOExistCtn: string;
OpSeaeCount: Integer;
Loaded: Boolean;
function REHH(str: string): string;
function formatAfrstr(str: string): string;
procedure getwebservice_ds;
procedure GETMSG(BSNO: string);
public
function GetXML: integer;
procedure Creatememtblctn;
procedure CreatememtblctnDiff;
procedure setdiffcolor;
procedure GetCtnConfirm(BSNO: string);
procedure update_ctn(table: Tadoquery); //更新箱量
procedure update_Seae(table: Tadoquery); //更新箱量
function GetSIData: boolean;
procedure Deleteopctn(BSNO: string);
procedure Insertopctn(BSNO: string;kbmMemTable:TkbmMemTable);
end;
var
frm_crm_OnLineBooking: Tfrm_crm_OnLineBooking;
implementation
uses
u_op_seae, u_data_share, U_SelectLinkMan, u_sys_progress, u_main, u_op_letter,
u_op_seae_assistant, u_tree_main, U_MSG, u_op_seae_diffctn, u_op_seae_difftd;
//using
{$R *.dfm}
procedure Tfrm_crm_OnLineBooking.bsSkinButton1Click(Sender: TObject);
var
_s, url, username, CancelReason: string;
aa: DsWebServiceSoap;
begin
//username:=frm_data_share.t_load_employee.fieldbyname('姓名').asstring;
if MessageDlg('退舱/拒绝接受此票订舱吗?', mtWarning, [mbyes, mbno], 0) = mryes then
begin
if InputQueryMEMO('退舱/业务拒绝', '退舱/拒绝业务的理由:', CancelReason) then
begin
//BSNO:= MT1.fieldbyname('BSNO').AsString;
//DoSaveBook;
//DoPending(BSNO,formatAfrstr(PendingReason));
end;
getwebservice_ds;
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
if MT1.fieldbyname('BSTYPE').asstring = '提单确认' then
_s := _s + ' 9 '
else
_s := _s + ' 7 ';
_s := _s + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + MT1.fieldbyname('BSNO').asstring + ' ';
_s := _s + ' ' + CancelReason + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := mServiceSoap_Ds.SetBookingCargoSpaceAudit(_s);
//aa.SetBookingCargoSpaceAudit(_s);
if (pos('成功', XML) > 0) then
begin
ShowMessage('驳回成功');
MT1.Delete;
//MT1.Post;
end
else
begin
ShowMessage('驳回失败');
end;
end;
end;
function Tfrm_crm_OnLineBooking.GetXML: integer;
var
_s, url, block: string;
aa: DsWebServiceSoap;
p1, p2: integer;
begin
try
frm_data_share.t_load_employee.open;
qryGetCompany.close;
qryGetCompany.Parameters.ParamByName('分部名称').Value := frm_data_share.t_load_employee.fieldbyname('分部名称').AsString;
qryGetCompany.open;
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, get_WebseviceURL); //'http://192.168.1.105:5427/webservice/DsWebService.asmx');
//首先获取订舱信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' ' + qryGetCompany.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' ' + OPTYPE + ' ';
_s := _s + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
//ShowMessage(_s);
XML := aa.ReceiveBookingCargoSpace(_s);
XML := StringReplace(XML, '#$A', '', [rfReplaceAll]);
p1 := frm_data_share.GettimePotion(1, '', XML);
p2 := frm_data_share.GettimePotion(1, '', xml);
XML := copy(XML, p1, p2 - p1);
//ShowMessage(XML);
Opseaecount := frm_data_share.countString('Opseae', xml);
result := Opseaecount;
finally
if (XML = '') then
begin
result := 0;
//showmessage('没有连接到服务器');
end;
end;
//if assigned(MT1) then MT1.first;
end;
procedure Tfrm_crm_OnLineBooking.FormShow(Sender: TObject);
var
_ts: widestring;
_s, Opseae, ctn, block, ctnblock, mes: string;
ctncount, p1, p2, p3, p4, _i: integer;
begin
//1.计算有多少个opseae单元,并据此分块
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress := tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText := '正在获取数据请等候。。。';
frm_sys_progress.bsSkinGauge1.MaxValue := OpSeaeCount;
frm_sys_progress.bsSkinGauge1.MinValue := 0;
frm_sys_progress.Show;
Loaded := False;
Creatememtblctn;
dxDBGrid1.DataSource := memtblwebCtn1;
MT1.close;
if (OpSeaeCount = 0) then
begin
ShowMessage('没有待接收的订舱信息。您可能需要<同步shippingbox信息>');
close;
end
else
begin
MT1.Open;
MT1.Edit;
MT1.DisableControls;
for _i := 1 to OpSeaeCount do
begin
frm_sys_progress.bsSkinGauge1.Value := _i;
p1 := frm_data_share.GettimePotion(_i, '', xml);
p2 := frm_data_share.GettimePotion(_i, '', xml);
block := Copy(xml, p1, p2 - p1);
ctncount := frm_data_share.countString('CTNINFO', block);
if (ctncount > 0) then
begin
p3 := frm_data_share.GettimePotion(1, '', block); //第一条
p4 := frm_data_share.GettimePotion(ctncount, '', block) + 10; //最后一条
ctnblock := Copy(block, p3, p4 - p3);
//把集装箱信息去掉
//p2:=frm_data_share.GettimePotion(_i,'',xml);
block := Copy(xml, p1, (p2 - p1) - (p4 - p3));
end;
if (frm_data_share.GetXMLValue('BSTYPE', block) = '提单确认') then
begin
MT1.Insert;
MT1['INDEX_ID'] := _i;
MT1['BSTYPE'] := frm_data_share.GetXMLValue('BSTYPE', block);
MT1['BSNO'] := frm_data_share.GetXMLValue('BSNO', block);
MT1['SENDERCOMPANY'] := frm_data_share.GetXMLValue('SENDERCOMPANY', block);
MT1['SENDERNAME'] := frm_data_share.GetXMLValue('SENDERNAME', block);
MT1['CNTR'] := frm_data_share.GetXMLValue('CNTR', block);
MT1['ETD'] := frm_data_share.GetXMLValue('ETD', block);
MT1['MBLNO'] := frm_data_share.GetXMLValue('MBLNO', block);
MT1['BOOKINGTYPE'] := frm_data_share.GetXMLValue('BOOKINGTYPE', block);
MT1.FieldByName('主提单号').AsString := frm_data_share.GetXMLValue('MBLNO', block);
MT1.FieldByName('发货人代码').value := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('SHIPPER', block)));
MT1.FieldByName('收货人代码').value := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('CONSIGNEE', block)));
MT1.FieldByName('通知人代码').value := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('NOTIFYPARTY', block)));
MT1.FieldByName('唛头').value := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('MARKS', block))); //
MT1.FieldByName('销售订舱说明').value := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('BOOKINGDESCRIPTION', block)));
MT1.FieldByName('货物描述').value := REHH(frm_data_share.GetXMLValue('DESCRIPTION', block));
MT1.FieldByName('船名').value := frm_data_share.GetXMLValue('VESSEL', block);
MT1.FieldByName('航次').value := frm_data_share.GetXMLValue('VOYNO', block);
MT1.FieldByName('付费方式').value := frm_data_share.GetXMLValue('BLFRT', block);
MT1.FieldByName('装货港').value := frm_data_share.GetXMLValue('PORTLOAD', block);
MT1.FieldByName('卸货港').value := frm_data_share.GetXMLValue('PORTDISCHARGE', block);
MT1.FieldByName('目的地').value := frm_data_share.GetXMLValue('DESTINATION', block);
MT1.FieldByName('运输条款').value := frm_data_share.GetXMLValue('SERVICE', block); //SERVIC
MT1.FieldByName('运费协议号').value := frm_data_share.GetXMLValue('CONTRACTNO', block); //CONTRACTNO
MT1.FieldByName('运输方式').value := frm_data_share.GetXMLValue('HSCODE', block); ///
if frm_data_share.GetXMLValue('PKGS', block) <> '' then
MT1.FieldByName('件数').value := StrToInt(frm_data_share.GetXMLValue('PKGS', block));
MT1.FieldByName('包装').value := frm_data_share.GetXMLValue('KINDPKGS', block);
if frm_data_share.GetXMLValue('KGS', block) <> '' then
MT1.FieldByName('重量').value := StrToFloat(frm_data_share.GetXMLValue('KGS', block));
if frm_data_share.GetXMLValue('CBM', block) <> '' then
MT1.FieldByName('尺码').value := StrToFloat(frm_data_share.GetXMLValue('CBM', block));
MT1.FieldByName('件数大写').value := frm_data_share.GetXMLValue('TOTALNO', block);
MT1.FieldByName('集装箱').value := frm_data_share.GetXMLValue('CNTR', block);
MT1.FieldByName('TIMEMARK').value := frm_data_share.GetXMLValue('TIMEMARK', block);
MT1.FieldByName('ctnInfo').value := ctnblock;
MT1.Post;
end
else
begin
MT1.Insert;
MT1['INDEX_ID'] := _i;
MT1.FieldByName('主提单号').AsString := frm_data_share.GetXMLValue('MBLNO', block);
MT1['BSSTATUS'] := frm_data_share.GetXMLValue('BSSTATUS', block);
MT1['BSNO'] := frm_data_share.GetXMLValue('BSNO', block);
MT1['BSDATE'] := frm_data_share.GetXMLValue('BSDATE', block);
MT1['MBLNO'] := frm_data_share.GetXMLValue('MBLNO', block);
MT1['CUSTNO'] := frm_data_share.GetXMLValue('CUSTNO', block);
MT1['SHIPPER'] := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('SHIPPER', block)));
MT1['SHIPPERID'] := frm_data_share.GetXMLValue('SHIPPERID', block);
MT1['ETD'] := frm_data_share.GetXMLValue('ETD', block);
MT1['CLOSINGDATE'] := frm_data_share.GetXMLValue('CLOSINGDATE', block);
MT1['PORTLOADID'] := frm_data_share.GetXMLValue('PORTLOADID', block);
MT1['PORTDISCHARGEID'] := frm_data_share.GetXMLValue('PORTDISCHARGEID', block);
MT1['DESTINATIONID'] := frm_data_share.GetXMLValue('DESTINATIONID', block);
MT1['PORTLOAD'] := frm_data_share.GetXMLValue('PORTLOAD', block);
MT1['PORTDISCHARGE'] := frm_data_share.GetXMLValue('PORTDISCHARGE', block);
MT1['DESTINATION'] := frm_data_share.GetXMLValue('DESTINATION', block);
MT1['INPUTBY'] := frm_data_share.GetXMLValue('INPUTBY', block);
MT1['AUDITOR'] := frm_data_share.GetXMLValue('AUDITOR', block);
MT1['FORWARDER'] := frm_data_share.GetXMLValue('FORWARDER', block);
MT1['CARRIER'] := frm_data_share.GetXMLValue('CARRIER', block);
MT1['CNTR'] := frm_data_share.GetXMLValue('CNTR', block);
//showmessage(frm_data_share.GetXMLValue('CNTR',block));
MT1['TIMEMARK'] := frm_data_share.GetXMLValue('TIMEMARK', block);
MT1['CTNINFO'] := ctnblock;
MT1['VESSEL'] := frm_data_share.GetXMLValue('VESSEL', block);
MT1['VOYNO'] := frm_data_share.GetXMLValue('VOYNO', block);
MT1['ISSUEPLACE'] := frm_data_share.GetXMLValue('ISSUEPLACE', block);
MT1['BOOKINGTYPE'] := frm_data_share.GetXMLValue('BOOKINGTYPE', block);
//MT1['OLDBSNO']:=frm_data_share.GetXMLValue('OLDBSNO',block);
MT1['CONSIGNEE'] := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('CONSIGNEE', block)));
MT1['NOTIFYPARTY'] := REHH(UnformatAfrstr(frm_data_share.GetXMLValue('NOTIFYPARTY', block)));
MT1['DESCRIPTION'] := REHH(frm_data_share.GetXMLValue('DESCRIPTION', block));
MT1['NOPKGS'] := REHH(frm_data_share.GetXMLValue('NOPKGS', block));
MT1['PKGS'] := frm_data_share.GetXMLValue('PKGS', block);
MT1['KINDPKGS'] := frm_data_share.GetXMLValue('KINDPKGS', block);
//showmessage(frm_data_share.GetXMLValue('KINDPKGS',block));
MT1['GROSSWEIGHT'] := REHH(frm_data_share.GetXMLValue('GROSSWEIGHT', block));
MT1['KGS'] := frm_data_share.GetXMLValue('KGS', block);
MT1['MEASUREMENT'] := REHH(frm_data_share.GetXMLValue('MEASUREMENT', block));
MT1['CBM'] := frm_data_share.GetXMLValue('CBM', block);
MT1['BOOKINGDESCRIPTION'] := REHH(frm_data_share.GetXMLValue('BOOKINGDESCRIPTION', block));
MT1['PLACEDELIVERY'] := frm_data_share.GetXMLValue('PLACEDELIVERY', block);
MT1['PLACEDELIVERYID'] := frm_data_share.GetXMLValue('PLACEDELIVERYID', block);
MT1['SERVICE'] := frm_data_share.GetXMLValue('SERVICE', block);
MT1['BLFRT'] := frm_data_share.GetXMLValue('BLFRT', block);
MT1['MARKS'] := REHH(frm_data_share.GetXMLValue('MARKS', block));
MT1['TOTALNO'] := frm_data_share.GetXMLValue('TOTALNO', block);
MT1['SENDERNAME'] := frm_data_share.GetXMLValue('SENDERNAME', block);
MT1['SENDERCOMPANY'] := frm_data_share.GetXMLValue('SENDERCOMPANY', block);
MT1['SENDERCOMPANYID'] := frm_data_share.GetXMLValue('SENDERCOMPANYID', block);
MT1['CARGOID'] := frm_data_share.GetXMLValue('CARGOID', block);
MT1['SenderMobile'] := frm_data_share.GetXMLValue('SenderMobile', block);
MT1['SenderEmail'] := frm_data_share.GetXMLValue('SenderEmail', block);
MT1['PAYABLEAT'] := frm_data_share.GetXMLValue('PAYABLEAT', block);
MT1['CONTRACTNO'] := frm_data_share.GetXMLValue('CONTRACTNO', block);
MT1['PendingReason'] := REHH(frm_data_share.GetXMLValue('PendingReason', block));
MT1['CLOSEDOCDATE'] := frm_data_share.GetXMLValue('CLOSEDOCDATE', block);
MT1['BSTYPE'] := frm_data_share.GetXMLValue('BSTYPE', block);
MT1['YARD'] := frm_data_share.GetXMLValue('YARD', block);
MT1['YARDAddress'] := frm_data_share.GetXMLValue('YARDAddress', block);
MT1['YARDLinkman'] := frm_data_share.GetXMLValue('YARDLinkman', block);
MT1['YARDTel'] := frm_data_share.GetXMLValue('YARDTel', block);
MT1['YARDFAX'] := frm_data_share.GetXMLValue('YARDFAX', block);
MT1['YARDREMARK'] := REHH(frm_data_share.GetXMLValue('YARDRemark', block));
MT1['GID'] := frm_data_share.GetXMLValue('GID', block);
MT1['RECDate'] := REHH(frm_data_share.GetXMLValue('RECDate', block));
MT1.Post;
end;
end;
end;
MT1.EnableControls;
MT1.first;
loaded := true;
if (MT1.FieldByName('BSTYPE').AsString = '沟通消息') then
begin
GETMSG(MT1.fieldbyname('BSNO').AsString);
end;
setdiffcolor;
GetCtnConfirm(mt1.FieldByName('bsno').AsString);
finally
frm_sys_progress.Close;
frm_sys_progress.Free;
frm_sys_progress := nil;
end;
end;
procedure Tfrm_crm_OnLineBooking.SaveBooking;
var
mes: string;
begin
if MT1.FieldByName('BSTYPE').AsString = '订舱' then
begin
if (MT1.FieldByName('BOOKINGTYPE').AsString = '申请退舱') or (MT1.FieldByName('BOOKINGTYPE').AsString = '驳回') then
mes := '退舱'
else
mes := '订舱';
end;
if MessageDlg('接受此票' + mes + '吗?', mtWarning, [mbyes, mbno], 0) = mryes then
begin
DoSaveBook;
end;
end;
procedure Tfrm_crm_OnLineBooking.DoSaveBook;
var
_s, _t, _id, _no, block, xml, onlinetimemark, onlinePosted, mttimemark, url, kjqj, wtdw, ETD, CLOSINGDATE, CTN, stl: string; //保存
aa: DsWebServiceSoap;
p1, p2, _c, _i: Integer;
username, marks, WTBH, HBLNO, code_trade, code_source, bstype, BSNO: string;
_Time: Tdatetime;
begin
//1 查询发送订舱者所在公司 是否于本系统内存在。如不存在则报警并退出事件。
username := frm_data_share.t_load_employee.fieldbyname('姓名').asstring;
Qrysearch.Close;
Qrysearch.SQL.Text := 'select 客户简称 from t_crm_client where 订舱系统序列号=''' + MT1.fieldbyname('SENDERCOMPANYID').AsString + '''';
Qrysearch.Open;
if (Qrysearch.RecordCount = 0) then
begin
ShowMessage('本地系统中没有“' + MT1.fieldbyname('SENDERCOMPANY').AsString + '”,请联系相关管理员建立或同步此公司信息。');
exit;
end
else
begin
wtdw := Qrysearch.fieldbyname('客户简称').AsString;
end;
//2 查询该bsno的时间标签是否
BSNO := MT1.fieldbyname('BSNO').AsString;
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, url);
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
xml := aa.GetBsnoInfo(_s);
p1 := frm_data_share.GettimePotion(1, '', xml);
p2 := frm_data_share.GettimePotion(1, '', xml);
block := Copy(xml, p1, p2 - p1);
onlinetimemark := frm_data_share.GetXMLValue('TimeMark', block);
onlinePosted := frm_data_share.GetXMLValue('ISPOSTED', block);
mttimemark := MT1.fieldbyname('TIMEMARK').AsString;
if (onlinetimemark <> mttimemark) then
begin
ShowMessage('此条业务内容发生变化,请点击“重新查询”');
end
else
begin
if (MT1.fieldbyname('CLOSINGDATE').asstring = '') then
begin
CLOSINGDATE := 'null';
end
else
begin
CLOSINGDATE := StringReplace('''' + MT1.fieldbyname('CLOSINGDATE').asstring + '''', '/', '-', [rfReplaceAll]);
end;
//StringReplace (str, '\\\\', #13#10, [rfReplaceAll]);
if (MT1.fieldbyname('ETD').asstring = '') then
begin
ETD := 'null';
end
else
begin
ETD := StringReplace('''' + MT1.fieldbyname('ETD').asstring + '''', '/', '-', [rfReplaceAll]);
end;
//ShowMessage(ETD+' ### '+CLOSINGDATE);
if (MT1.fieldbyname('BSSTATUS').asstring = 'CI20150711000004') then //0 新增
begin
//if optype='1'
Qrysearch.Close;
Qrysearch.SQL.Text := 'select * from t_op_seae where 订舱序列号=''' + BSNO + '''';
Qrysearch.Open;
if (Qrysearch.RecordCount = 0) then //0 新增
begin
_time := StrToDate(MT1.fieldbyname('ETD').asstring);
if strtobool(get_parameters_value(185, 'false')) then
with frm_op_seae do
begin
if frm_data_share.t_sys_noset.Locate('编号类型', '委托编号', []) then
begin
if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring) = '自动取号' then
if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring) = '会计期间' then
WTBH := getwtno(1, subComp, department, employee, NOW)
else
WTBH := getwtno(1, subComp, department, employee, _time);
end;
end
else
begin
if (trim(frm_op_seae.t_op_seae.fieldbyname('装运方式').asstring) = '其他') then
begin
end
else
begin
if Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring) = '自动取号' then
if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring) = '会计期间' then
WTBH := getwtno(1, subComp, department, employee, NOW)
else
WTBH := getwtno(1, subComp, department, employee, _time);
end;
end;
if frm_data_share.t_sys_noset_hblno.Locate('编号类型', '分提单号', []) then
with frm_op_seae do
begin
if frm_data_share.t_code_free.Locate('付费方式', trim(MT1.fieldbyname('BLFRT').asstring), []) then
begin
stl := frm_data_share.t_code_free.fieldbyname('中文名称').Asstring;
end;
if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('出号规则').Asstring) = '自动取号' then
begin
if strtobool(get_parameters_value(311, 'false')) then
begin
code_trade := ''; //t_op_seae.fieldByName('航线').AsString;
code_source := ''; //t_op_seae.fieldByName('业务来源').AsString;
bstype := ''; //frm_op_seae.t_op_seae.fieldByName('装运方式').AsString;
if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('日期规则').Asstring) = '会计期间' then
HBLNO := gethblno_custom(1, subComp, department, employee, code_trade, code_source, bstype, NOW)
else
HBLNO := gethblno_custom(1, subComp, department, employee, code_trade, code_source, bstype, _time);
end
else
begin
if Trim(frm_data_share.t_sys_noset_hblno.fieldbyname('日期规则').Asstring) = '会计期间' then
HBLNO := gethblno(1, subComp, department, employee, stl, NOW)
else
HBLNO := gethblno(1, subComp, department, employee, stl, _time);
end;
end;
end;
with Qryinsert do
begin
Close; //function WeekofYear(Date: TDate): integer; //取得当前日期的周次
_id := get_id;
_no := get_no(Date, 'SE');
sql.clear;
SQL.Add('Insert into t_op_seae (业务类型,主编号,主提单标准,分提单标准,委托标准,编号,订舱序列号, 录入日期, 主提单号, 业务编号, 发货人,发货人代码, 开船日期, 截港日期,装货港,卸货港,目的地, 货代公司, 船公司 '); //, 装货港, 卸货港,目的地
SQL.Add(' ,核销标准,报关标准,报检标准,业务状态,费用状态,会计期间,录入人,操作员,集装箱,船名,航次,签单地点,装运方式 ');
SQL.Add(' ,收货人代码,通知人代码,货物描述,件数包装,件数,包装,货物重量,重量,货物尺码,尺码,销售订舱说明,交货地点,交货代码,运输条款,付费方式,唛头,件数大写,委托单位,货物标识,委托编号,分提单号,到付地点,运费协议号,备注)');
SQL.Add('values (:ywlx,:idz,:ZTB,:FTB,:WTB,:id,:BSNO,:BSDATE,:MBLNO,:CUSTNO,:SHIPPERID,:SHIPPER,' + ETD + ',' + CLOSINGDATE + ',:PORTLOAD,:PORTDISCHARGE,:DESTINATION,:FORWARDER,:CARRIER '); //,:PORTLOAD,:PORTDISCHARGE,:DESTINATION
SQL.Add(' ,:hxbz,:bgbz,:bjbz,:ywzt,:fyzt,:kjqj,''' + username + ''',''' + username + ''',:CNTR,:VESSEL,:VOYNO,:ISSUEPLACE,:zyfs');
SQL.Add(' ,:CONSIGNEE,:NOTIFYPARTY,:DESCRIPTION,:NOPKGS,:PKGS,:KINDPKGS,:GROSSWEIGHT,:KGS,:MEASUREMENT,:CBM,:BOOKINGDESCRIPTION,:PLACEDELIVERY,:PLACEDELIVERYID,:SERVICE,:BLFRT,:MARKS,:TOTALNO,:wtdw,:CARGOID,:WTBH,:HBLNO,:PAYABLEAT,:CONTRACTNO,:Remark)');
Parameters.ParamByName('BSNO').Value := BSNO;
Parameters.ParamByName('id').Value := _id;
Parameters.ParamByName('ZTB').Value := _no;
Parameters.ParamByName('FTB').Value := _no;
Parameters.ParamByName('WTB').Value := _id;
Parameters.ParamByName('idz').Value := _id;
Parameters.ParamByName('BSDATE').Value := MT1.fieldbyname('BSDATE').asstring;
Parameters.ParamByName('MBLNO').Value := MT1.fieldbyname('MBLNO').asstring;
Parameters.ParamByName('CUSTNO').Value := _no; //
Parameters.ParamByName('SHIPPER').Value := MT1.fieldbyname('SHIPPER').asstring;
Parameters.ParamByName('SHIPPERID').Value := ''; //MT1.fieldbyname('SHIPPERID').asstring;
//Parameters.ParamByName('ETD').Value:=MT1.fieldbyname('ETD').asstring;
//Parameters.ParamByName('ETA').Value:=MT1.fieldbyname('ETA').asstring;
Parameters.ParamByName('PORTLOAD').Value := MT1.fieldbyname('PORTLOAD').asstring;
//Parameters.ParamByName('PORTLOADID').Value:=MT1.fieldbyname('PORTLOADID').asstring;
Parameters.ParamByName('PORTDISCHARGE').Value := MT1.fieldbyname('PORTDISCHARGE').asstring;
//Parameters.ParamByName('PORTDISCHARGEID').Value:=MT1.fieldbyname('PORTDISCHARGEID').asstring;
Parameters.ParamByName('DESTINATION').Value := MT1.fieldbyname('DESTINATION').asstring;
//Parameters.ParamByName('DESTINATIONID').Value:=MT1.fieldbyname('DESTINATIONID').asstring;
//Parameters.ParamByName('INPUTBY').Value:=MT1.fieldbyname('INPUTBY').asstring;
Parameters.ParamByName('FORWARDER').Value := MT1.fieldbyname('FORWARDER').asstring;
Parameters.ParamByName('CARRIER').Value := MT1.fieldbyname('CARRIER').asstring;
Parameters.ParamByName('hxbz').Value := _id;
Parameters.ParamByName('bgbz').Value := _id;
Parameters.ParamByName('bjbz').Value := _id;
Parameters.ParamByName('ywzt').Value := '接受委托';
Parameters.ParamByName('fyzt').Value := '录入费用';
Parameters.ParamByName('ywlx').Value := '普通货';
Parameters.ParamByName('kjqj').Value := MT1.fieldbyname('BSDATE').asstring;
Parameters.ParamByName('CNTR').Value := MT1.fieldbyname('CNTR').asstring;
Parameters.ParamByName('VESSEL').Value := MT1.fieldbyname('VESSEL').asstring;
Parameters.ParamByName('VOYNO').Value := MT1.fieldbyname('VOYNO').asstring;
Parameters.ParamByName('ISSUEPLACE').Value := MT1.fieldbyname('ISSUEPLACE').asstring;
Parameters.ParamByName('zyfs').Value := '整箱';
Parameters.ParamByName('CONSIGNEE').Value := MT1.fieldbyname('CONSIGNEE').asstring;
Parameters.ParamByName('NOTIFYPARTY').Value := MT1.fieldbyname('NOTIFYPARTY').asstring;
Parameters.ParamByName('DESCRIPTION').Value := MT1.fieldbyname('DESCRIPTION').asstring;
Parameters.ParamByName('NOPKGS').Value := MT1.fieldbyname('NOPKGS').asstring;
Parameters.ParamByName('PKGS').Value := MT1.fieldbyname('PKGS').asstring;
Parameters.ParamByName('KINDPKGS').Value := MT1.fieldbyname('KINDPKGS').asstring;
Parameters.ParamByName('GROSSWEIGHT').Value := MT1.fieldbyname('GROSSWEIGHT').asstring;
Parameters.ParamByName('KGS').Value := MT1.fieldbyname('KGS').asstring;
Parameters.ParamByName('MEASUREMENT').Value := MT1.fieldbyname('MEASUREMENT').asstring;
Parameters.ParamByName('CBM').Value := MT1.fieldbyname('CBM').asstring;
Parameters.ParamByName('BOOKINGDESCRIPTION').Value := MT1.fieldbyname('BOOKINGDESCRIPTION').asstring;
Parameters.ParamByName('PLACEDELIVERY').Value := MT1.fieldbyname('PLACEDELIVERY').asstring;
Parameters.ParamByName('PLACEDELIVERYID').Value := MT1.fieldbyname('PLACEDELIVERYID').asstring;
Parameters.ParamByName('SERVICE').Value := MT1.fieldbyname('SERVICE').asstring;
Parameters.ParamByName('BLFRT').Value := MT1.fieldbyname('BLFRT').asstring;
Parameters.ParamByName('MARKS').Value := MT1.fieldbyname('MARKS').asstring;
Parameters.ParamByName('TOTALNO').Value := MT1.fieldbyname('TOTALNO').asstring;
Parameters.ParamByName('CARGOID').Value := MT1.fieldbyname('CARGOID').asstring;
Parameters.ParamByName('wtdw').Value := wtdw;
Parameters.ParamByName('WTBH').Value := WTBH;
Parameters.ParamByName('HBLNO').Value := HBLNO;
Parameters.ParamByName('PAYABLEAT').Value := MT1.fieldbyname('PAYABLEAT').asstring;
Parameters.ParamByName('CONTRACTNO').Value := MT1.fieldbyname('CONTRACTNO').asstring;
Parameters.ParamByName('Remark').Value := MT1.fieldbyname('Remark').asstring;
ExecSQL;
end;
//showmessage(MT1.fieldbyname('Ctninfo').asstring);
//处理集装箱数据
_c := frm_data_share.countString('CTNINFO', MT1.fieldbyname('Ctninfo').asstring);
for _i := 1 to _c do
begin
with Qryinsert do
begin
p1 := frm_data_share.GettimePotion(_i, '', MT1.fieldbyname('Ctninfo').asstring);
p2 := frm_data_share.GettimePotion(_i, '', MT1.fieldbyname('Ctninfo').asstring);
block := Copy(MT1.fieldbyname('Ctninfo').asstring, p1, p2);
GetCtnCodeQry.close;
CTN := trim(frm_data_share.GetXMLValue('CTN', block));
if CTN = '' then
begin
showmessage('该票业务内的集装箱信息没有箱型');
exit;
end;
GetCtnCodeQry.Parameters.ParamByName('CTN').value := CTN;
GetCtnCodeQry.Open;
sql.clear;
SQL.Add('Insert into t_op_ctn ( 编号,代码,箱型,数量,箱号,封号,件数,重量,尺码,备注,包装,尺寸,TEU,表现形式)');
SQL.Add('values ( :编号,:代码,:箱型,:数量,:箱号,:封号,:件数,:重量,:尺码,:备注,:包装,:尺寸,:TEU,:表现形式)');
//Parameters.ParamByName('CTN_ID').Value:=frm_data_share.GetXMLValue('CTN_ID',block);
Parameters.ParamByName('编号').Value := _id;
Parameters.ParamByName('代码').Value := GetCtnCodeQry.fieldbyname('代码').AsString;
Parameters.ParamByName('箱型').Value := GetCtnCodeQry.fieldbyname('箱型').AsString;
Parameters.ParamByName('数量').Value := frm_data_share.GetXMLValue('CTNNUM', block);
Parameters.ParamByName('箱号').Value := frm_data_share.GetXMLValue('CNTRNO', block);
Parameters.ParamByName('封号').Value := frm_data_share.GetXMLValue('SEALNO', block);
Parameters.ParamByName('件数').Value := frm_data_share.GetXMLValue('PKGS', block);
Parameters.ParamByName('重量').Value := frm_data_share.GetXMLValue('KGS', block);
Parameters.ParamByName('尺码').Value := frm_data_share.GetXMLValue('CBM', block);
Parameters.ParamByName('备注').Value := frm_data_share.GetXMLValue('REMARK', block);
Parameters.ParamByName('包装').Value := frm_data_share.GetXMLValue('KINDPKGS', block);
Parameters.ParamByName('尺寸').Value := GetCtnCodeQry.fieldbyname('尺寸').AsString;
Parameters.ParamByName('TEU').Value := '0';
Parameters.ParamByName('表现形式').Value := GetCtnCodeQry.fieldbyname('表现形式').AsString;
ExecSQL;
end;
end;
showmessage('接收成功');
//记录日志
qryGetOpseae.Close;
qryGetOpseae.Parameters.ParamByName('编号').Value := _id;
qryGetOpseae.Open;
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接收订舱');
//发送接收信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 2 '; //1驳回 2接受
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
MT1.Delete;
//MT1.Post;
end
else if (Qrysearch.RecordCount > 0) then //1更新
begin
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := MT1.fieldbyname('BSNO').asstring;
qryGetOpseae2.Open;
with Qryinsert do
begin
Close; //function WeekofYear(Date: TDate): integer; //取得当前日期的周次
_id := qryGetOpseae2.fieldbyname('编号').asstring;
kjqj := inttostr(WeekofYear(Date));
sql.clear;
SQL.Add(' delete from t_op_ctn where 编号 in (select 编号 from t_op_seae where 订舱序列号=''' + BSNO + ''') ');
SQL.Add(' update t_op_seae set ');
SQL.Add(' 录入日期=:BSDATE, 主提单号=:MBLNO, 发货人=:SHIPPERID,发货人代码=:SHIPPER'); //业务编号=:CUSTNO
SQL.Add(' , 开船日期=' + ETD + ', 截港日期=' + CLOSINGDATE + ',装货港=:PORTLOAD'); //, 装货港=:PORTLOAD , 卸货港=:PORTDISCHARGE
SQL.Add(' ,卸货港=:PORTDISCHARGE,目的地=:DESTINATION, 货代公司='''''); //,目的地=:DESTINATION
SQL.Add(' ,船公司=:CARRIER ,业务状态=''接受委托'',费用状态=''录入费用'''); //核销标准=:hxbz,报关标准=:bgbz,报检标准=:bjbz,
SQL.Add(' ,会计期间=:kjqj,录入人=''' + username + ''',操作员=''' + username + ''',集装箱=:CNTR,船名=:VESSEL,航次=:VOYNO');
SQL.Add(' ,签单地点=:ISSUEPLACE,装运方式=''整箱'',收货人代码=:CONSIGNEE,通知人代码=:NOTIFYPARTY');
SQL.Add(' ,货物描述=:DESCRIPTION,件数包装=:NOPKGS,件数=:PKGS,包装=:KINDPKGS,货物重量=:GROSSWEIGHT');
SQL.Add(' ,重量=:KGS,货物尺码=:MEASUREMENT,尺码=:CBM,销售订舱说明=:BOOKINGDESCRIPTION');
SQL.Add(' ,交货地点=:PLACEDELIVERY,交货代码=:PLACEDELIVERYID,运输条款=:SERVICE,付费方式=:BLFRT');
SQL.Add(' ,唛头=:MARKS,件数大写=:TOTALNO,委托单位=:wtdw,货物标识=:CARGOID,到付地点=:PAYABLEAT,运费协议号=:CONTRACTNO');
SQL.Add(' where 订舱序列号=:BSNO');
Parameters.ParamByName('BSNO').Value := MT1.fieldbyname('BSNO').asstring;
Parameters.ParamByName('BSDATE').Value := MT1.fieldbyname('BSDATE').asstring;
Parameters.ParamByName('MBLNO').Value := MT1.fieldbyname('MBLNO').asstring;
Parameters.ParamByName('SHIPPER').Value := MT1.fieldbyname('SHIPPER').asstring;
Parameters.ParamByName('SHIPPERID').Value := ''; //MT1.fieldbyname('SHIPPERID').asstring;
Parameters.ParamByName('PORTLOAD').Value := MT1.fieldbyname('PORTLOAD').asstring;
//Parameters.ParamByName('PORTLOADID').Value:=MT1.fieldbyname('PORTLOADID').asstring;
Parameters.ParamByName('PORTDISCHARGE').Value := MT1.fieldbyname('PORTDISCHARGE').asstring;
//Parameters.ParamByName('PORTDISCHARGEID').Value:=MT1.fieldbyname('PORTDISCHARGEID').asstring;
Parameters.ParamByName('DESTINATION').Value := MT1.fieldbyname('DESTINATION').asstring;
//Parameters.ParamByName('DESTINATIONID').Value:=MT1.fieldbyname('DESTINATIONID').asstring;
Parameters.ParamByName('CARRIER').Value := MT1.fieldbyname('CARRIER').asstring;
Parameters.ParamByName('kjqj').Value := MT1.fieldbyname('BSDATE').asstring;
Parameters.ParamByName('CNTR').Value := MT1.fieldbyname('CNTR').asstring;
Parameters.ParamByName('VESSEL').Value := MT1.fieldbyname('VESSEL').asstring;
Parameters.ParamByName('VOYNO').Value := MT1.fieldbyname('VOYNO').asstring;
Parameters.ParamByName('ISSUEPLACE').Value := MT1.fieldbyname('ISSUEPLACE').asstring;
Parameters.ParamByName('CONSIGNEE').Value := MT1.fieldbyname('CONSIGNEE').asstring;
Parameters.ParamByName('NOTIFYPARTY').Value := MT1.fieldbyname('NOTIFYPARTY').asstring;
{ SQL.Add(' ,货物描述=:DESCRIPTION,件数包装=:NOPKGS,件数=:PKGS,包装=:KINDPKGS,货物重量=:GROSSWEIGHT');
SQL.Add(' ,重量=:KGS,货物尺码=:MEASUREMENT,尺码=:CBM,销售订舱说明=:BOOKINGDESCRIPTION');
SQL.Add(' ,交货地点=:PLACEDELIVERY,交货代码=:PLACEDELIVERYID,运输条款=:SERVICE,付费方式=:BLFRT');
SQL.Add(' ,唛头=:MARKS,件数大写=:TOTALNO,委托单位=:wtdw,货物标识=:CARGOID');}
Parameters.ParamByName('DESCRIPTION').Value := MT1.fieldbyname('DESCRIPTION').asstring;
Parameters.ParamByName('NOPKGS').Value := MT1.fieldbyname('NOPKGS').asstring;
Parameters.ParamByName('PKGS').Value := MT1.fieldbyname('PKGS').asstring;
Parameters.ParamByName('KINDPKGS').Value := MT1.fieldbyname('KINDPKGS').asstring;
Parameters.ParamByName('GROSSWEIGHT').Value := MT1.fieldbyname('GROSSWEIGHT').asstring;
Parameters.ParamByName('KGS').Value := MT1.fieldbyname('KGS').asstring;
Parameters.ParamByName('MEASUREMENT').Value := MT1.fieldbyname('MEASUREMENT').asstring;
Parameters.ParamByName('CBM').Value := MT1.fieldbyname('CBM').asstring;
Parameters.ParamByName('BOOKINGDESCRIPTION').Value := MT1.fieldbyname('BOOKINGDESCRIPTION').asstring;
Parameters.ParamByName('PLACEDELIVERY').Value := MT1.fieldbyname('PLACEDELIVERY').asstring;
Parameters.ParamByName('PLACEDELIVERYID').Value := MT1.fieldbyname('PLACEDELIVERYID').asstring;
Parameters.ParamByName('SERVICE').Value := MT1.fieldbyname('SERVICE').asstring;
Parameters.ParamByName('BLFRT').Value := MT1.fieldbyname('BLFRT').asstring;
Parameters.ParamByName('MARKS').Value := MT1.fieldbyname('MARKS').asstring;
Parameters.ParamByName('TOTALNO').Value := MT1.fieldbyname('TOTALNO').asstring;
Parameters.ParamByName('wtdw').Value := wtdw;
Parameters.ParamByName('CARGOID').Value := MT1.fieldbyname('CARGOID').asstring;
Parameters.ParamByName('PAYABLEAT').Value := MT1.fieldbyname('PAYABLEAT').asstring;
Parameters.ParamByName('CONTRACTNO').Value := MT1.fieldbyname('CONTRACTNO').asstring;
ExecSQL;
end;
//showmessage(MT1.fieldbyname('Ctninfo').asstring);
//处理集装箱数据
_c := frm_data_share.countString('CTNINFO', MT1.fieldbyname('Ctninfo').asstring);
for _i := 1 to _c do
begin
with Qryinsert do
begin
p1 := frm_data_share.GettimePotion(_i, '', MT1.fieldbyname('Ctninfo').asstring);
p2 := frm_data_share.GettimePotion(_i, '', MT1.fieldbyname('Ctninfo').asstring);
block := Copy(MT1.fieldbyname('Ctninfo').asstring, p1, p2);
GetCtnCodeQry.close;
CTN := trim(frm_data_share.GetXMLValue('CTN', block));
if CTN = '' then
begin
showmessage('该票业务内的集装箱信息没有箱型');
exit;
end;
GetCtnCodeQry.Parameters.ParamByName('CTN').value := CTN;
GetCtnCodeQry.Open;
sql.clear;
SQL.Add('Insert into t_op_ctn ( 编号,代码,箱型,数量,箱号,封号,件数,重量,尺码,备注,包装,尺寸,TEU,表现形式)');
SQL.Add('values ( :编号,:代码,:箱型,:数量,:箱号,:封号,:件数,:重量,:尺码,:备注,:包装,:尺寸,:TEU,:表现形式)');
//Parameters.ParamByName('CTN_ID').Value:=frm_data_share.GetXMLValue('CTN_ID',block);
Parameters.ParamByName('编号').Value := _id;
Parameters.ParamByName('代码').Value := GetCtnCodeQry.fieldbyname('代码').AsString;
Parameters.ParamByName('箱型').Value := GetCtnCodeQry.fieldbyname('箱型').AsString;
Parameters.ParamByName('数量').Value := frm_data_share.GetXMLValue('CTNNUM', block);
Parameters.ParamByName('箱号').Value := frm_data_share.GetXMLValue('CNTRNO', block);
Parameters.ParamByName('封号').Value := frm_data_share.GetXMLValue('SEALNO', block);
Parameters.ParamByName('件数').Value := frm_data_share.GetXMLValue('PKGS', block);
Parameters.ParamByName('重量').Value := frm_data_share.GetXMLValue('KGS', block);
Parameters.ParamByName('尺码').Value := frm_data_share.GetXMLValue('CBM', block);
Parameters.ParamByName('备注').Value := frm_data_share.GetXMLValue('REMARK', block);
Parameters.ParamByName('包装').Value := frm_data_share.GetXMLValue('KINDPKGS', block);
Parameters.ParamByName('尺寸').Value := GetCtnCodeQry.fieldbyname('尺寸').AsString;
Parameters.ParamByName('TEU').Value := '0';
Parameters.ParamByName('表现形式').Value := GetCtnCodeQry.fieldbyname('表现形式').AsString;
ExecSQL;
end;
end;
//发送接收信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 2 '; //1驳回 2接受
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
MT1.Delete;
//记录日志
qryGetOpseae.Close;
qryGetOpseae.Parameters.ParamByName('编号').Value := _id;
qryGetOpseae.Open;
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接收订舱');
showmessage('接收成功');
end
end
else
////////////////////////
if (MT1.fieldbyname('BSSTATUS').asstring = 'CI20150711000007') or (MT1.fieldbyname('BSSTATUS').asstring = 'CI20150711000005') then
begin
if (MT1.fieldbyname('BSSTATUS').asstring = 'CI20150711000007') then
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接受退舱');
if (MT1.fieldbyname('BSSTATUS').asstring = 'CI20150711000005') then
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接受拒绝订舱');
with Qryinsert do
begin
{
SQL.clear;
SQL.Add(' delete from t_op_ctn where 编号=(select 编号 from t_op_seae where 订舱序列号=:BSNO) ');
SQL.Add(' delete from t_op_seae where 编号=(select 编号 from t_op_seae where 订舱序列号=:BSNO2) ');
Parameters.ParamByName('BSNO').Value:=MT1.fieldbyname('BSNO').asstring;
Parameters.ParamByName('BSNO2').Value:=MT1.fieldbyname('BSNO').asstring;
ExecSQL; }
//发送接收信息
_s := '';
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 5 '; //5 接受退仓
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
MT1.Delete;
//showmessage('接受退舱成功');
end;
//记录日志
end;
end;
BringToFront;
end;
function Tfrm_crm_OnLineBooking.UnformatAfrstr(str: string): string;
begin
Result := Trim(str);
Result := StringReplace(Result, '&', '&', [rfReplaceAll]);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
Result := StringReplace(Result, '"', '"', [rfReplaceAll]);
Result := StringReplace(Result, '>', '>', [rfReplaceAll]);
Result := StringReplace(Result, ''', '''', [rfReplaceAll]);
//Result:=StringReplace(Result,'\n;','#13#10',[rfReplaceAll]);
end;
function Tfrm_crm_OnLineBooking.REHH(str: string): string;
var
_r: string;
begin
_r := StringReplace(str, '\\\\', #13#10, [rfReplaceAll]);
result := _r;
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton3Click(Sender: TObject);
var
_s, url,_id: string;
aa: DsWebServiceSoap;
b_recive: boolean;
begin
if (MT1.fieldbyname('BSTYPE').AsString = '订舱') then
begin
SaveBooking;
end
else
if (MT1.fieldbyname('BSTYPE').AsString = '入货通知') then
begin
SaveShippingOrder;
end
else
if (MT1.fieldbyname('BSTYPE').AsString = '沟通消息') then
begin
frm_op_seae.Edit9.text := MT1.fieldbyname('BSNO').AsString;
frm_op_seae.bsSkinButton44Click(self);
frm_op_seae.bsSkinButton11.Caption := '返回列表';
frm_op_seae.Notebook1.PageIndex := 1;
frm_op_seae.Edit9.text := '';
frm_tree_main.Act101Execute(self);
end
else
begin
b_recive := GetSIData;
if not b_recive then
begin
if not assigned(frm_op_seae) then
frm_op_seae:=tfrm_op_seae.Create (self);
frm_op_seae.ManualDock(frm_main.SearchTabs('frm_op_seae',frm_op_seae.caption,'101'),nil,alClient);
frm_op_seae.show;
frm_op_seae.Edit9.text := MT1.fieldbyname('BSNO').AsString;
frm_op_seae.bsSkinButton44.OnClick(Sender);
frm_op_seae.Notebook1.PageIndex := 1;
Booking_add(frm_op_seae.t_op_seae, frm_op_seae.t_op_seae.fieldbyname('编号').AsString, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, MT1.fieldbyname('BSNO').asstring, '接收提单确认');
MT1.Delete;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxdbgrd1DblClick(Sender: TObject);
begin
bsSkinButton3Click(Self);
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton4Click(Sender: TObject);
var
_s, XML: string;
//frm_msg: Tfrm_MSG;
begin
try
if ASSIGNED(frm_MSG) then
frm_MSG.Free;
frm_MSG := Tfrm_MSG.Create(self);
frm_MSG.Caption := '收发业务信息';
frm_MSG.FormStyle := fsStayOnTop;
frm_MSG.SetBSNO(MT1.fieldbyname('BSNO').asstring);
frm_MSG.Show;
finally
//Form2.Free;
end;
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton10Click(Sender: TObject);
begin
Loaded := false;
GetXML();
FormShow(Sender);
Loaded := True;
end;
procedure Tfrm_crm_OnLineBooking.ssagetaChange(Sender: TObject; Field: TField);
begin
//ShowMessage(MT1.fieldbyname('Bookingtype').AsString);
{
if (MT1.fieldbyname('Bookingtype').AsString='申请退舱')
or (MT1.fieldbyname('Bookingtype').AsString='驳回') then
begin
bsSkinButton1.Enabled:=false;
bsSkinButton2.Enabled:=true;
bsSkinButton3.Enabled:=true;
end else
if (MT1.fieldbyname('Bookingtype').AsString='待定') then
begin
bsSkinButton1.Enabled:=false;
bsSkinButton2.Enabled:=false;
bsSkinButton3.Enabled:=false;
end else
if (MT1.fieldbyname('BSTYPE').AsString='入货通知') then
begin
bsSkinButton1.Enabled:=false;
bsSkinButton2.Enabled:=false;
bsSkinButton3.Enabled:=true;
end else
if (MT1.fieldbyname('BSTYPE').AsString='沟通消息') then
begin
bsSkinButton1.Enabled:=false;
bsSkinButton2.Enabled:=false;
bsSkinButton3.Enabled:=true;
if loaded then
GETMSG(MT1.fieldbyname('BSNO').AsString);
end
else
begin
bsSkinButton1.Enabled:=true;
bsSkinButton2.Enabled:=true;
bsSkinButton3.Enabled:=true;
end;
if (MT1.fieldbyname('BSTYPE').AsString='订舱') then
begin
bsSkinNotebook1.PageIndex:=2;
end
else
if (MT1.fieldbyname('BSTYPE').AsString='入货通知') then
begin
bsSkinNotebook1.PageIndex:=1;
end
else
if (MT1.fieldbyname('BSTYPE').AsString='沟通消息') then
begin
bsSkinNotebook1.PageIndex:=3;
end
else
begin
bsSkinNotebook1.PageIndex:=0;
end;
}
end;
procedure Tfrm_crm_OnLineBooking.Pending;
var
_s, _t, _id, _no, block, xml, onlinetimemark, onlinePosted, mttimemark, url, kjqj, wtdw, ETD, CLOSINGDATE, PendingReason: string; //保存
aa: DsWebServiceSoap;
p1, p2, _c, _i: Integer;
username, marks, WTBH, HBLNO, code_trade, code_source, bstype, BSNO: string;
_Time: Tdate;
begin
username := frm_data_share.t_load_employee.fieldbyname('姓名').asstring;
if InputQueryMEMO('业务待定', '业务待定的理由:', PendingReason) then
begin
BSNO := MT1.fieldbyname('BSNO').AsString;
DoSaveBook;
DoPending(BSNO, formatAfrstr(PendingReason));
end;
end;
procedure Tfrm_crm_OnLineBooking.DoPending(BSNO, PendingReason: string);
var
_s, _t, _id, _no, block, xml, onlinetimemark, onlinePosted, mttimemark, url, kjqj, wtdw, ETD, CLOSINGDATE: string; //保存
p1, p2, _c, _i: Integer;
username, marks, WTBH, HBLNO, code_trade, code_source, bstype: string;
_Time: Tdate;
begin
getwebservice_ds;
//发送待定信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 8 '; //1驳回 2接受
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ' + PendingReason + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := mServiceSoap_Ds.SetBookingCargoSpaceAudit(_s);
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton2Click(Sender: TObject);
begin
Pending;
end;
procedure Tfrm_crm_OnLineBooking.SaveShippingOrder;
var
_s, _t, _id, _no, block, xml, onlinetimemark, onlinePosted, mttimemark, url, kjqj, wtdw, ETD, CLOSINGDATE, CLOSEDOCDATE, BSNO: string; //保存
aa: DsWebServiceSoap;
p1, p2, _c, _i, _r, _L: Integer;
username, marks: string;
UPDField, MTField: TStringList;
begin
username := frm_data_share.t_load_employee.fieldbyname('姓名').asstring;
UPDField := TStringList.Create;
MTField := TStringList.Create;
UPDField.Add('主提单号');
MTField.Add('MBLNO');
UPDField.Add('船名');
MTField.Add('VESSEL');
UPDField.Add('航次');
MTField.Add('VOYNO');
UPDField.Add('卸货港');
MTField.Add('PORTDISCHARGE');
UPDField.Add('截港日期');
MTField.Add('CLOSINGDATE');
UPDField.Add('截单日期');
MTField.Add('CLOSEDOCDATE');
UPDField.Add('开船日期');
MTField.Add('ETD');
if (MT1.fieldbyname('CLOSINGDATE').asstring = '') then
begin
CLOSINGDATE := 'null';
end
else
begin
CLOSINGDATE := StringReplace('''' + MT1.fieldbyname('CLOSINGDATE').asstring + '''', '/', '-', [rfReplaceAll]);
end;
if (MT1.fieldbyname('ETD').asstring = '') then
begin
ETD := 'null';
end
else
begin
ETD := StringReplace('''' + MT1.fieldbyname('ETD').asstring + '''', '/', '-', [rfReplaceAll]);
end;
if (MT1.fieldbyname('CLOSEDOCDATE').asstring = '') then
begin
CLOSEDOCDATE := 'null';
end
else
begin
CLOSEDOCDATE := StringReplace('''' + MT1.fieldbyname('CLOSEDOCDATE').asstring + '''', '/', '-', [rfReplaceAll]);
end;
BSNO := MT1.fieldbyname('BSNO').AsString;
_r := MessageDlg('接受此票入货通知吗? ' + #13#10 + '选择“Yes”:提单号、船名/航次、卸货港、截港日期和开船日期 将会更新到本票业务当中' + #13#10 + '选择“NO”:将不会覆盖您的现有内容,只更新目前未填的内容', mtWarning, [mbyes, mbno], 0);
case _r of
mrYes:
begin
//2 查询该bsno的时间标签是否
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, url);
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
xml := aa.GetBsnoInfo(_s);
p1 := frm_data_share.GettimePotion(1, '', xml);
p2 := frm_data_share.GettimePotion(1, '', xml);
block := Copy(xml, p1, p2 - p1);
onlinetimemark := frm_data_share.GetXMLValue('TimeMark', block);
onlinePosted := frm_data_share.GetXMLValue('ISPOSTED', block);
mttimemark := MT1.fieldbyname('TimeMark').AsString;
if (onlinetimemark <> mttimemark) then
begin
ShowMessage('此条业务内容发生变化,请点击“重新查询”');
end
else
begin
//if optype='1'
Qrysearch.Close;
Qrysearch.SQL.Text := 'select * from t_op_seae where 订舱序列号=''' + BSNO + '''';
Qrysearch.Open;
_id := Qrysearch.fieldbyname('编号').asstring;
if (Qrysearch.RecordCount = 0) then //0 新增
begin
//判断该订舱序列号是否于系统内存在,如不存在则报警并退出。
showmessage('本业务于本系统中不存在,可能是该业务已被删除或发生变更,请联系相关业务人员。');
end
else if (Qrysearch.RecordCount > 0) then //1更新
begin
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := BSNO;
qryGetOpseae2.Open;
with Qryinsert do
begin
Close; //function WeekofYear(Date: TDate): integer; //取得当前日期的周次
//_no:=get_no(Date,'SE');
//kjqj:=inttostr(WeekofYear(Date));
sql.clear;
//SQL.Add(' delete from t_op_ctn where 编号 in (select 编号 from t_op_seae where 订舱序列号='''+MT1.fieldbyname('OLDBSNO').asstring+''') ');
SQL.Add(' update t_op_seae set ');
SQL.Add(' 主提单号=:MBLNO, 开船日期=' + ETD + ', 截港日期=' + CLOSINGDATE + ', 卸货港=:PORTDISCHARGE');
SQL.Add(' ,卸货代码=:PORTDISCHARGEID ');
SQL.Add(' ,船名=:VESSEL,航次=:VOYNO,截单日期=' + CLOSEDOCDATE);
SQL.Add(' where 订舱序列号=:BSNO');
Parameters.ParamByName('BSNO').Value := BSNO;
Parameters.ParamByName('MBLNO').Value := MT1.fieldbyname('MBLNO').asstring;
// Parameters.ParamByName('CUSTNO').Value:=_no;//
//Parameters.ParamByName('ETD').Value:=MT1.fieldbyname('ETD').asstring;
//Parameters.ParamByName('ETA').Value:=MT1.fieldbyname('ETA').asstring;
Parameters.ParamByName('PORTDISCHARGE').Value := MT1.fieldbyname('PORTDISCHARGE').asstring;
Parameters.ParamByName('PORTDISCHARGEID').Value := MT1.fieldbyname('PORTDISCHARGEID').asstring;
Parameters.ParamByName('VESSEL').Value := MT1.fieldbyname('VESSEL').asstring;
Parameters.ParamByName('VOYNO').Value := MT1.fieldbyname('VOYNO').asstring;
// Parameters.ParamByName('CLOSEDOCDATE').Value:=MT1.fieldbyname('CLOSEDOCDATE').asstring;
ExecSQL;
end;
//发送接收信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_crm_client_weituo.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 3 '; //3 入货通知
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
//记录日志
qryGetOpseae.Close;
qryGetOpseae.Parameters.ParamByName('编号').Value := _id;
qryGetOpseae.Open;
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接收入货通知');
showmessage('接收成功');
end
end;
end;
mrNo:
begin
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, url);
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
xml := aa.GetBsnoInfo(_s);
p1 := frm_data_share.GettimePotion(1, '', xml);
p2 := frm_data_share.GettimePotion(1, '', xml);
block := Copy(xml, p1, p2 - p1);
onlinetimemark := frm_data_share.GetXMLValue('TimeMark', block);
onlinePosted := frm_data_share.GetXMLValue('ISPOSTED', block);
mttimemark := MT1.fieldbyname('TimeMark').AsString;
if (onlinetimemark <> mttimemark) then
begin
ShowMessage('此条业务内容发生变化,请点击“重新查询”');
end
else
begin
//if optype='1'
Qrysearch.Close;
Qrysearch.SQL.Text := 'select * from t_op_seae where 订舱序列号=''' + BSNO + '''';
Qrysearch.Open;
_id := Qrysearch.fieldbyname('编号').asstring;
if (Qrysearch.RecordCount = 0) then //0 新增
begin
//判断该订舱序列号是否于系统内存在,如不存在则报警并退出。
showmessage('本业务于本系统中不存在,可能是该业务已被删除或发生变更,请联系相关业务人员。');
end
else if (Qrysearch.RecordCount > 0) then //1更新
begin
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := BSNO;
qryGetOpseae2.Open;
_L := UPDField.Count;
for _i := 0 to _L - 1 do
begin
with Qryinsert do
begin
Close; //function WeekofYear(Date: TDate): integer; //取得当前日期的周次
if qryGetOpseae2.FieldByName(UPDField[_i]).AsString <> '' then
Continue;
sql.clear;
//SQL.Add(' delete from t_op_ctn where 编号 in (select 编号 from t_op_seae where 订舱序列号='''+MT1.fieldbyname('OLDBSNO').asstring+''') ');
SQL.Add(' update t_op_seae set ');
SQL.Add(UPDField[_i] + '=:' + MTField[_i]);
//ShowMessage(UPDField[_i]+'=:'+MTField[_i]);
SQL.Add(' where 订舱序列号=:BSNO');
Parameters.ParamByName('BSNO').Value := BSNO;
Parameters.ParamByName(MTField[_i]).Value := MT1.fieldbyname(MTField[_i]).asstring;
ExecSQL;
end;
end;
//发送接收信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_crm_client_weituo.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 3 '; //3 入货通知
_s := _s + ' ' + datetimetostr(Date) + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
//记录日志
qryGetOpseae.Close;
qryGetOpseae.Parameters.ParamByName('编号').Value := _id;
qryGetOpseae.Open;
Booking_add(qryGetOpseae, _id, MT1.fieldbyname('SENDERNAME').asstring, MT1.fieldbyname('SENDERCOMPANY').asstring, BSNO, '接收入货通知');
showmessage('接收成功');
end
end;
end;
end;
frm_tree_main.Act101Execute(self);
frm_op_seae.bsSkinButton44Click(self);
frm_op_seae.t_op_seae.Locate('订舱序列号', MT1.fieldbyname('BSNO').AsString, []);
//20150723 生成一条入货通知的函电信息
qry_op_letter.Close;
qry_op_letter.open;
qry_op_letter.Insert;
qry_op_letter['编号'] := _id;
qry_op_letter['函电名称'] := '入货通知';
qry_op_letter['签发人'] := frm_data_share.t_load_employee.fieldbyname('姓名').asstring;
qry_op_letter['签发日期'] := FormatDateTime('c', now);
qry_op_letter['HEAD_TO'] := '';
qry_op_letter.Post;
qry_op_letter_rh.close;
// qry_op_letter_rh.Parameters.ParamByName('LE_ID').Value:=qry_op_letter.fieldbyname('LE_ID');
qry_op_letter_rh.open;
qry_op_letter_rh.insert;
qry_op_letter_rh['LE_ID'] := qry_op_letter.fieldbyname('LE_ID').AsString;
qry_op_letter_rh['入货场站'] := MT1.fieldbyname('YARD').asstring;
qry_op_letter_rh['入货截至时间'] := MT1.fieldbyname('CLOSINGDATE').asstring;
qry_op_letter_rh['场站联系人'] := MT1.fieldbyname('YARDLinkman').asstring;
qry_op_letter_rh['场站联系电话'] := MT1.fieldbyname('YARDTel').asstring;
qry_op_letter_rh['场站联系传真'] := MT1.fieldbyname('YARDFAX').asstring;
qry_op_letter_rh['场站地址'] := MT1.fieldbyname('YARDAddress').asstring;
qry_op_letter_rh['截单时间'] := MT1.fieldbyname('CLOSEDOCDATE').asstring;
qry_op_letter_rh['出口口岸'] := MT1.fieldbyname('PORTLOAD').asstring;
qry_op_letter_rh['备注'] := MT1.fieldbyname('YARDRemark').asstring;
qry_op_letter_rh.post;
bringtofront;
MT1.Delete;
end;
function Tfrm_crm_OnLineBooking.formatAfrstr(str: string): string;
begin
Result := Trim(str);
Result := StringReplace(Result, '&', '&', [rfReplaceAll]);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
Result := StringReplace(Result, '"', '"', [rfReplaceAll]);
Result := StringReplace(Result, '>', '>', [rfReplaceAll]);
Result := StringReplace(Result, '''', ''', [rfReplaceAll]);
end;
procedure Tfrm_crm_OnLineBooking.getwebservice_ds;
var
URL: string;
begin
try
URL := get_WebseviceURL;
mHttpRIO_ds := THTTPRIO.Create(nil);
mHttpRIO_ds.WSDLLocation := URL + '?WSDL';
mHttpRIO_ds.URL := URL;
// mHttpRIO_ds.WSDLLocation:='http://192.168.1.5:8086/webservice/DsWebService.asmx?WSDL';
// mHttpRIO_ds.URL:='http://192.168.1.5:8086/webservice/DsWebService.asmx';
mHttpRIO_ds.Port := 'DsWebServiceSoap';
mHttpRIO_ds.Service := 'DsWebService';
mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader := true;
InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap), ioDocument); //就是这一行
mServiceSoap_Ds := mHttpRIO_ds as DsWebServiceSoap;
except
on E: Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.btn1Click(Sender: TObject);
begin
if mmo2.Lines.text <> '' then
begin
getwebservice_ds;
_s := '';
_s := _s + '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 沟通消息 ';
_s := _s + ' ' + MT1.fieldbyname('BSNO').asstring + ' ';
_s := _s + ' 信息内容 ';
_s := _s + ' ' + mmo2.Lines.Text + ' ';
if (chk1.Checked) then
begin
_s := _s + ' Send ';
end;
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := mServiceSoap_Ds.SendMSG(_s);
if (pos('', XML) > 0) then
begin
Qry1.Close;
Qry1.SQL.Text:='select '''+mmo2.Lines.Text+''' 消息';
Qry1.Open;
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := MT1.fieldbyname('BSNO').asstring;
qryGetOpseae2.Open;
Booking_add(Qry1, qryGetOpseae2.fieldbyname('编号').asstring
, XML, MT1.fieldbyname('BSNO').asstring
, '发送 沟通消息');
mmo2.Clear;
GETMSG(MT1.fieldbyname('BSNO').AsString);
end
else
begin
showmessage('发送失败');
end;
end
else
begin
GETMSG(MT1.fieldbyname('BSNO').AsString);
end;
end;
procedure Tfrm_crm_OnLineBooking.FormClose(Sender: TObject; var Action: TCloseAction);
begin
frm_crm_OnLineBooking.Hide;
frm_crm_OnLineBooking.ManualFloat(frm_crm_OnLineBooking.BoundsRect);
frm_main.freeTabs('frm_crm_OnLineBooking');
action := cafree;
frm_crm_OnLineBooking := nil;
end;
procedure Tfrm_crm_OnLineBooking.dxdbgrd1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if (ANode.Strings[dxDBGrd1Column1.Index] = '未读') then
begin
AFont.Style := [fsBold];
exit;
end;
{
if (ANode.Strings[dxDBGrd1Column1.Index]='提交订舱') then begin
AFont.Color:=clBlue;
exit;
end;
if (ANode.Strings[dxDBGrd1Column1.Index]='待定') or (ANode.Strings[dxDBGrd1Column1.Index]='申请退舱') then begin
AFont.Color:=clRed;
exit;
end; }
end;
procedure Tfrm_crm_OnLineBooking.dxdbgrd1Click(Sender: TObject);
begin
//如果loaded=true 才进行消息的已读未读判断
end;
procedure Tfrm_crm_OnLineBooking.dxdbgrd1Column1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if (ANode.Strings[dxDBGrd1Column1.Index] = '提交订舱') then
begin
AFont.Color := clBlue;
exit;
end;
if (ANode.Strings[dxDBGrd1Column1.Index] = '待定') or (ANode.Strings[dxDBGrd1Column1.Index] = '申请退舱') then
begin
AFont.Color := clRed;
exit;
end;
end;
procedure Tfrm_crm_OnLineBooking.GETMSG(BSNO: string);
var
_s, url, block: string;
p1, p2, _i, MSGCount: integer;
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress := tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText := '正在获取数据请等候。。。';
frm_sys_progress.bsSkinGauge1.MaxValue := 100;
frm_sys_progress.bsSkinGauge1.MinValue := 0;
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.Value := 0;
try
getwebservice_ds;
//获取该业务的沟通信息
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
// _s:=_s+' SENDERCOMPANYID ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
//ShowMessage(_s);
XML := mServiceSoap_Ds.ReceiveMSG(_s);
XML := StringReplace(XML, '#$A', '', [rfReplaceAll]);
p1 := frm_data_share.GettimePotion(1, '', XML);
p2 := frm_data_share.GettimePotion(1, '', xml);
XML := copy(XML, p1, p2 - p1);
//ShowMessage(XML);
MSGcount := frm_data_share.countString('MSGInfo', xml);
//result:= MSGcount;
finally
frm_sys_progress.Close;
frm_sys_progress.Free;
frm_sys_progress := nil;
end;
if (MSGCount > 0) then
begin
MT_MSG.close;
for _i := 1 to MSGCount do
begin
p1 := frm_data_share.GettimePotion(_i, '', xml);
p2 := frm_data_share.GettimePotion(_i, '', xml);
block := Copy(xml, p1, p2 - p1);
MT_MSG.Open;
MT_MSG.Edit;
MT_MSG.Insert;
MT_MSG['BSNO'] := frm_data_share.GetXMLValue('BSNO', block);
MT_MSG['GID'] := frm_data_share.GetXMLValue('GID', block);
MT_MSG['SENDERNAME'] := frm_data_share.GetXMLValue('SENDERNAME', block);
MT_MSG['SENDERCOMPANYNAME'] := frm_data_share.GetXMLValue('SENDERCOMPANYNAME', block);
MT_MSG['FieldValue'] := frm_data_share.REHH(frm_data_share.GetXMLValue('FieldValue', block));
MT_MSG['MSGDate'] := frm_data_share.GetXMLValue('MSGDate', block);
MT_MSG['RECDate'] := frm_data_share.GetXMLValue('RECDate', block);
MT_MSG['Received'] := frm_data_share.GetXMLValue('Received', block);
MT_MSG['SendMail'] := frm_data_share.GetXMLValue('SendMail', block);
MT_MSG.Post;
end;
//label14.Caption:='订舱'+#10+'说明';
// MT1.Open;
MT_MSG.Last;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGridCustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if (ANode.Strings[colFX.Index] = '未读') then
begin
AFont.Style := [fsBold];
end;
if ANode.Index mod 2 = 0 then
AColor := clWhite
else
AColor := clLtGray;
end;
procedure Tfrm_crm_OnLineBooking.N2Click(Sender: TObject);
begin
SetReceived(MT_MSG.fieldbyname('GID').asstring);
end;
procedure Tfrm_crm_OnLineBooking.SetReceived(GID: string);
//设定信息接收
var
_s, XML: string;
begin
//接收
if MT_MSG.fieldbyname('Received').Asstring= '未读' then begin
getwebservice_ds;
_s := '';
_s := _s + '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 沟通消息 ';
_s := _s + ' ' + GID + ' ';
_s := _s + ' 信息内容 ';
//_s:=_s+' '+mmo1.Lines.Text+' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := mServiceSoap_Ds.SetMSGRec(_s);
if (pos('成功', XML) > 0) then
begin
MT_MSG.edit;
MT_MSG['Received'] := '已读';
MT_MSG.Post;
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := MT1.fieldbyname('BSNO').asstring;
qryGetOpseae2.Open;
Qry1.Close;
Qry1.SQL.Text:='select '''+MT_MSG.fieldbyname('FieldValue').AsString+''' 消息';
Qry1.Open;
Booking_add(Qry1, qryGetOpseae2.fieldbyname('编号').asstring
, MT_MSG.fieldbyname('SENDERNAME').AsString
, MT_MSG.fieldbyname('SENDERCOMPANYNAME').AsString
, MT1.fieldbyname('BSNO').asstring, '接收 沟通消息');
//GETMSG(MT_MSG.fieldbyname('BSNO').asstring);
end
else
begin
//showmessage('发送失败');
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.SetReceivedList;
//设定信息接收
var
_s, XML: string;
begin
//发出
getwebservice_ds;
_s := '';
_s := _s + '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 沟通消息 ';
_s := _s + ' ' + MT1.fieldbyname('BSNO').asstring + ' ';
_s := _s + ' 信息内容 ';
//_s:=_s+' '+mmo1.Lines.Text+' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := mServiceSoap_Ds.SetMSGRec(_s);
if (pos('成功', XML) > 0) then
begin
MT_MSG.First;
qryGetOpseae2.Close;
qryGetOpseae2.Parameters.ParamByName('订舱序列号').Value := MT1.fieldbyname('BSNO').asstring;
qryGetOpseae2.Open;
while not MT_MSG.Eof do begin
if (MT_MSG.FieldByName('Received').AsString='未读') then begin
Qry1.Close;
Qry1.SQL.Text:='select '''+MT_MSG.fieldbyname('FieldValue').AsString+''' 消息';
Qry1.Open;
Booking_add(Qry1, qryGetOpseae2.fieldbyname('编号').asstring
, MT_MSG.fieldbyname('SENDERNAME').AsString
, MT_MSG.fieldbyname('SENDERCOMPANYNAME').AsString
, MT1.fieldbyname('BSNO').asstring, '接收 沟通消息');
end;
MT_MSG.next;
end;
GETMSG(MT_MSG.fieldbyname('BSNO').asstring);
end
else
begin
//showmessage('发送失败');
end;
end;
procedure Tfrm_crm_OnLineBooking.N3Click(Sender: TObject);
begin
SetReceivedList;
end;
procedure Tfrm_crm_OnLineBooking.act1Execute(Sender: TObject);
begin
btn1Click(self);
end;
procedure Tfrm_crm_OnLineBooking.act2Execute(Sender: TObject);
var
_TB: Boolean;
begin
_TB := chk1.Checked;
chk1.Checked := True;
btn1Click(self);
chk1.Checked := _TB;
end;
procedure Tfrm_crm_OnLineBooking.DBEdit1Change(Sender: TObject);
begin
if (MT1.fieldbyname('BSTYPE').AsString = '订舱') then
begin
if (MT1.fieldbyname('Bookingtype').AsString = '申请退舱') or (MT1.fieldbyname('Bookingtype').AsString = '驳回') then
begin
bsSkinButton1.Enabled := false;
//bsSkinButton2.Enabled := true;
bsSkinButton3.Enabled := true;
bsSkinButton5.Visible := false;
bsSkinButton6.Visible := false;
end
else if (MT1.fieldbyname('Bookingtype').AsString = '待定') then
begin
bsSkinButton1.Enabled := false;
//bsSkinButton2.Enabled := false;
bsSkinButton3.Enabled := false;
bsSkinButton5.Visible := false;
bsSkinButton6.Visible := false;
end else begin
bsSkinButton1.Enabled := true;
bsSkinButton3.Enabled := true;
end;
end
else if (MT1.fieldbyname('BSTYPE').AsString = '入货通知') then
begin
bsSkinButton1.Enabled := false;
bsSkinButton2.Enabled := false;
bsSkinButton3.Enabled := true;
bsSkinButton5.Visible := false;
bsSkinButton6.Visible := false;
end
else if (MT1.fieldbyname('BSTYPE').AsString = '沟通消息') then
begin
bsSkinButton1.Enabled := false;
bsSkinButton2.Enabled := false;
bsSkinButton3.Enabled := true;
bsSkinButton5.Visible := false;
bsSkinButton6.Visible := false;
if loaded then
GETMSG(MT1.fieldbyname('BSNO').AsString);
end
else
begin
bsSkinButton1.Enabled := true;
bsSkinButton2.Enabled := true;
bsSkinButton3.Enabled := true;
bsSkinButton5.Visible := true;
bsSkinButton6.Visible := true;
end;
if (MT1.fieldbyname('BSTYPE').AsString = '订舱') then
begin
bsSkinNotebook1.PageIndex := 2;
end
else if (MT1.fieldbyname('BSTYPE').AsString = '入货通知') then
begin
bsSkinNotebook1.PageIndex := 1;
end
else if (MT1.fieldbyname('BSTYPE').AsString = '沟通消息') then
begin
bsSkinNotebook1.PageIndex := 3;
end
else
begin
bsSkinNotebook1.PageIndex := 0;
end;
if trim(MT1.fieldbyname('bstype').asstring) = '提单确认' then
begin
setdiffcolor;
GetCtnConfirm(mt1.FieldByName('bsno').AsString);
if MT1.fieldbyname('Bookingtype').AsString = '拒绝' then
begin
bsSkinButton1.Enabled := false;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.setdiffcolor;
var
i, j: integer;
myfield, Source, Dest: string;
SourceList, DestList: TStringList;
begin
SourceList := TStringList.Create;
DestList := TStringList.Create;
if not t_op_seae.Active then
t_op_seae.Open;
for i := 0 to bsSkinPanel1.ControlCount - 1 do
with bsSkinPanel1 do
if (bsSkinPanel1.Controls[i] is TcxDBMemo) then
begin
myfield := (Controls[i] as TcxDBMemo).databinding.DataField;
if (MT1.FindField(myfield) <> nil) and (t_op_seae.FindField(myfield) <> nil) then
begin
SourceList.Text := t_op_seae.fieldbyname(myfield).asstring;
DestList.Text := MT1.fieldbyname(myfield).asstring;
Source := '';
for j := 0 to SourceList.Count - 1 do
begin
if Source = '' then
Source := StringReplace(trim(SourceList.Strings[j]), ' ', ' ', [rfReplaceAll])
else
Source := Source + ' ' + StringReplace(trim(SourceList.Strings[j]), ' ', ' ', [rfReplaceAll]);
end;
Dest := '';
for j := 0 to DestList.Count - 1 do
begin
if Dest = '' then
Dest := StringReplace(trim(DestList.Strings[j]), ' ', ' ', [rfReplaceAll])
else
Dest := Dest + ' ' + StringReplace(trim(DestList.Strings[j]), ' ', ' ', [rfReplaceAll]);
end;
if AnsiCompareStr(Source, Dest) <> 0 then
(bsSkinPanel1.Controls[i] as TcxDBMemo).Style.Font.Color := clred
else
(bsSkinPanel1.Controls[i] as TcxDBMemo).Style.Font.Color := clblack;
//showmessage(Source+#13#10+Dest);
end;
end
else if (bsSkinPanel1.Controls[i] is TcxDBTextEdit) then
begin
myfield := (Controls[i] as TcxDBTextEdit).databinding.DataField;
if (MT1.FindField(myfield) <> nil) and (t_op_seae.FindField(myfield) <> nil) then
if AnsiCompareStr(MT1.Fieldbyname(myfield).asstring, t_op_seae.fieldbyname(myfield).asstring) <> 0 then
(bsSkinPanel1.Controls[i] as TcxDBTextEdit).Style.Font.Color := clred
else
(bsSkinPanel1.Controls[i] as TcxDBTextEdit).Style.Font.Color := clblack;
end;
try
finally
SourceList.Free;
DestList.Free;
end;
end;
procedure Tfrm_crm_OnLineBooking.CreatememtblctnDiff;
var
i: integer;
begin
with frm_op_seae_diffctn.memtblwebctn do
begin
Close;
EmptyTable;
Fields.Clear;
FieldDefs.Clear;
FieldDefs.Add('id', ftInteger, 0, false);
FieldDefs.Add('代码', ftString, 10, false);
FieldDefs.Add('尺寸', ftString, 10, false);
FieldDefs.Add('箱型', ftString, 10, false);
FieldDefs.Add('箱号', ftString, 20, false);
FieldDefs.Add('封号', ftString, 20, false);
FieldDefs.Add('件数', ftInteger, 0, false);
FieldDefs.Add('包装', ftString, 40, false);
FieldDefs.Add('重量', ftFloat, 0, false);
FieldDefs.Add('尺码', ftFloat, 0, false);
FieldDefs.Add('本地代码', ftString, 10, false);
FieldDefs.Add('本地尺寸', ftString, 10, false);
FieldDefs.Add('本地箱型', ftString, 10, false);
FieldDefs.Add('本地箱号', ftString, 20, false);
FieldDefs.Add('本地封号', ftString, 20, false);
FieldDefs.Add('本地件数', ftInteger, 0, false);
FieldDefs.Add('本地包装', ftString, 40, false);
FieldDefs.Add('本地重量', ftFloat, 0, false);
FieldDefs.Add('本地尺码', ftFloat, 0, false);
FieldDefs.Add('Exist', ftString, 1, false);
FieldDefs.Add('FindCtn', ftString, 1, false);
CreateTable;
IndexFieldNames := 'FindCtn;箱号;id';
Open;
end;
i := 0;
// frm_op_seae_diffctn.memtblwebctn.First;
with memtblwebCtn do
begin
First;
while not eof do
begin
i := i + 1;
frm_op_seae_diffctn.memtblwebctn.Insert;
frm_op_seae_diffctn.memtblwebctn.FieldByName('id').AsInteger := i;
frm_op_seae_diffctn.memtblwebctn.FieldByName('代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := 0;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := '';
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := 0;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := 0;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '0';
frm_op_seae_diffctn.memtblwebctn.post;
Next;
end;
end;
//frm_op_seae_diffctn.memtblwebctn.First;
with t_op_ctn do
begin
First;
while not eof do
begin
i := i + 1;
if trim(FieldByName('箱号').AsString)<>'' then
begin
if frm_op_seae_diffctn.memtblwebctn.Locate('箱号;Exist', varArrayof([FieldByName('箱号').AsString,'0']), []) then
begin
frm_op_seae_diffctn.memtblwebctn.Edit;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '0';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.post;
end
else
if frm_op_seae_diffctn.memtblwebctn.Locate('Exist', '0', []) then
begin
frm_op_seae_diffctn.memtblwebctn.Edit;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.post;
end
else
if not frm_op_seae_diffctn.memtblwebctn.Locate('Exist', '0', []) then
begin
frm_op_seae_diffctn.memtblwebctn.Insert;
frm_op_seae_diffctn.memtblwebctn.FieldByName('id').AsInteger := i;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.post;
end;
end;
Next;
end;
end;
with t_op_ctn do
begin
First;
while not eof do
begin
i := i + 1;
if trim(FieldByName('箱号').AsString)='' then
begin
if frm_op_seae_diffctn.memtblwebctn.Locate('Exist', '0', []) then
begin
frm_op_seae_diffctn.memtblwebctn.Edit;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.post;
end
else
begin
frm_op_seae_diffctn.memtblwebctn.Insert;
frm_op_seae_diffctn.memtblwebctn.FieldByName('id').AsInteger := i;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地代码').AsString := FieldByName('代码').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺寸').AsString := FieldByName('尺寸').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱型').AsString := FieldByName('箱型').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地箱号').AsString := FieldByName('箱号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地封号').AsString := FieldByName('封号').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地件数').AsInteger := FieldByName('件数').AsInteger;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地包装').AsString := FieldByName('包装').AsString;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地重量').AsFloat := FieldByName('重量').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('本地尺码').AsFloat := FieldByName('尺码').AsFloat;
frm_op_seae_diffctn.memtblwebctn.FieldByName('FindCtn').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.FieldByName('Exist').AsString := '1';
frm_op_seae_diffctn.memtblwebctn.post;
end;
end;
Next;
end;
end;
frm_op_seae_diffctn.memtblwebctn.SortOn('FindCtn;箱号;id', []);
end;
procedure Tfrm_crm_OnLineBooking.Creatememtblctn;
begin
memtblwebCtn.Close;
memtblwebCtn.EmptyTable;
memtblwebCtn.Fields.Clear;
memtblwebCtn.FieldDefs.Clear;
memtblwebCtn.FieldDefs.Add('ID', ftInteger, 0, false);
memtblwebCtn.FieldDefs.Add('bsno', ftString, 40, false);
memtblwebCtn.FieldDefs.Add('代码', ftString, 10, false);
memtblwebCtn.FieldDefs.Add('尺寸', ftString, 10, false);
memtblwebCtn.FieldDefs.Add('箱型', ftString, 10, false);
memtblwebCtn.FieldDefs.Add('表现形式', ftString, 20, false);
memtblwebCtn.FieldDefs.Add('箱号', ftString, 20, false);
memtblwebCtn.FieldDefs.Add('封号', ftString, 20, false);
memtblwebCtn.FieldDefs.Add('件数', ftInteger, 0, false);
memtblwebCtn.FieldDefs.Add('数量', ftInteger, 0, false);
memtblwebCtn.FieldDefs.Add('包装', ftString, 40, false);
memtblwebCtn.FieldDefs.Add('重量', ftFloat, 0, false);
memtblwebCtn.FieldDefs.Add('尺码', ftFloat, 0, false);
memtblwebCtn.FieldDefs.Add('TEU', ftInteger, 0, false);
memtblwebCtn.CreateTable;
memtblwebCtn.IndexFieldNames := 'ID';
memtblwebCtn.Open;
end;
procedure Tfrm_crm_OnLineBooking.GetCtnConfirm(bsNo: string);
var
_s, _t, _id, _no, block, xml, onlinetimemark, onlinePosted, mttimemark, url, kjqj, wtdw, ETD, CLOSINGDATE, CTN, stl, CtnNoOne: string; //保存
p1, p2, _c, _i, cntcount: Integer;
username, marks, WTBH, HBLNO, code_trade, code_source, bstype: string;
_Time: Tdatetime;
aAdoQuery: TAdoQuery;
begin
sysNOExistCtn := '';
Label1.Visible:=false;
Label1.Caption := '';
Label1.Font.Color:= clWindowText;
Label1.Font.Style:= [];
// bsSkinLabel1.DefaultFont.Styl
getwebservice_ds;
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + BSNO + ' ';
_s := _s + ' ';
_s := _s + ' ';
xml := mServiceSoap_Ds.GetBsnoInfo(_s);
p1 := frm_data_share.GettimePotion(1, '', xml);
p2 := frm_data_share.GettimePotion(1, '', xml);
block := Copy(xml, p1, p2 - p1);
onlinetimemark := frm_data_share.GetXMLValue('TimeMark', block);
onlinePosted := frm_data_share.GetXMLValue('ISPOSTED', block);
mttimemark := mt1.fieldbyname('TIMEMARK').AsString;
memtblwebCtn.EmptyTable;
memtblwebCtn.open;
memtblwebCtn.DisableControls;
_c := frm_data_share.countString('CTNINFO', mt1.fieldbyname('Ctninfo').asstring);
//showmessage(inttostr(_c));
//showmessage(mt1.fieldbyname('Ctninfo').asstring);
for _i := 1 to _c do
begin
with memtblwebCtn do
begin
p1 := frm_data_share.GettimePotion(_i, '', mt1.fieldbyname('Ctninfo').asstring);
p2 := frm_data_share.GettimePotion(_i, '', mt1.fieldbyname('Ctninfo').asstring);
block := Copy(mt1.fieldbyname('Ctninfo').asstring, p1, p2-p1);
CTN := trim(frm_data_share.GetXMLValue('CTN', block));
if CTN = '' then
begin
showmessage('该票业务内的集装箱信息没有箱型');
exit;
end;
// showmessage(frm_data_share.GetXMLValue('CNTRNO', block));
Append;
// showmessage(inttostr(_i)+' '+frm_data_share.GetXMLValue('CNTRNO', block)+' '+frm_data_share.GetXMLValue('SEALNO', block)+#13#10+block);
// WriteLog(inttostr(P1)+'_'+inttostr(P2)+'__'+#13#10+block);
fieldbyname('ID').AsInteger := _i;
fieldbyname('数量').Value := frm_data_share.GetXMLValue('CTNNUM', block);
if frm_data_share.t_code_ctn.Locate('海关EDI代码', CTN, []) then
begin
fieldbyname('代码').AsString := frm_data_share.t_code_ctn.fieldbyname('代码').AsString;
fieldbyname('箱型').Value := frm_data_share.t_code_ctn.fieldbyname('箱型').AsString;
fieldbyname('尺寸').Value := frm_data_share.t_code_ctn.fieldbyname('尺寸').AsString;
fieldbyname('表现形式').Value := frm_data_share.t_code_ctn.fieldbyname('表现形式').AsString;
if FieldByName('尺寸').asstring = '20' then
FieldByName('TEU').asInteger := 1;
if (FieldByName('尺寸').asstring = '40') or (FieldByName('尺寸').asstring = '45') then
FieldByName('TEU').asInteger := 2;
end;
fieldbyname('bsno').AsString := bsno;
fieldbyname('箱号').Value := frm_data_share.GetXMLValue('CNTRNO', block);
fieldbyname('封号').Value := frm_data_share.GetXMLValue('SEALNO', block);
if frm_data_share.GetXMLValue('PKGS', block) <> '' then
fieldbyname('件数').AsInteger := StrToInt(frm_data_share.GetXMLValue('PKGS', block));
if frm_data_share.GetXMLValue('KGS', block) <> '' then
fieldbyname('重量').AsFloat := strtofloatdef(frm_data_share.GetXMLValue('KGS', block), 0);
if frm_data_share.GetXMLValue('CBM', block) <> '' then
fieldbyname('尺码').AsFloat := strtofloatdef(frm_data_share.GetXMLValue('CBM', block), 0);
fieldbyname('包装').Value := frm_data_share.GetXMLValue('KINDPKGS', block);
post;
end;
end;
memtblwebCtn.EnableControls;
if not t_op_ctn.Active then
t_op_ctn.Active := true;
with t_op_ctn do
try
DisableControls;
First;
while not eof do
begin
if not memtblwebCtn.Locate('箱号', FieldByName('箱号').AsString, []) then
begin
if sysNOExistCtn = '' then
sysNOExistCtn := FieldByName('箱号').AsString
else
sysNOExistCtn := sysNOExistCtn + #13#10 + FieldByName('箱号').AsString;
cntcount := cntcount + 1;
CtnNoOne := FieldByName('箱号').AsString;
end;
Next;
end;
finally
if cntcount = 0 then
begin
Label1.Visible:=false;
Label1.Caption := '';
Label1.Font.Color:= clWindowText;
Label1.Font.Style:= [];
end;
if sysNOExistCtn <> '' then
begin
if cntcount = 1 then
begin
Label1.Visible:=true;
Label1.Font.Style:= [fsUnderline];
Label1.Caption := '客户确认集装数据和本地数据差异(单击查看明细):' + CtnNoOne;
Label1.Font.Color := ClBlue;
end
else
begin
Label1.Font.Style:= [fsUnderline];
Label1.Caption := '客户确认集装数据和本地数据差异(单击查看明细):' + CtnNoOne + '...';
Label1.Font.Color := ClBlue;
end;
end;
EnableControls;
end;
{
t_op_ctn.Close;
t_op_ctn.Parameters.ParamByName('编号').Value:=t_op_seae.FieldByName('编号').AsString;
t_op_ctn.Open;
}
end;
procedure Tfrm_crm_OnLineBooking.update_ctn(table: Tadoquery);//更新箱量
var
num_ctn,ctn1,ctn2,ctn3,ctn4,ctn5,ctn6,ctn7,ctn8,ctn9,ctn10,ctnother,ctn20,ctn40,ctn40h,ctn45,ttlCtn: integer;
ctn_string, str: widestring;
if_first: boolean;
str_list: Tstringlist;
bok: Tbookmark;
aAdoQuery:TAdoQuery;
begin
// table.Open;
table.First;
if table.IsEmpty then
begin
end
else
begin
str_list := Tstringlist.Create();
frm_main.t_sum_ctn.close;
frm_main.t_sum_ctn.open;
// bok:=table.GetBookmark;
try
// table.Open;
try
table.DisableControls;
frm_main.t_sum_ctn.DisableControls;
table.first;
while not table.eof do
begin
if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型1').asstring then
begin
ctn1 := ctn1 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型2').asstring then
begin
ctn2 := ctn2 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型3').asstring then
begin
ctn3 := ctn3 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型4').asstring then
begin
ctn4 := ctn4 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型5').asstring then
begin
ctn5 := ctn5 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型6').asstring then
begin
ctn6 := ctn6 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型7').asstring then
begin
ctn7 := ctn7 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型8').asstring then
begin
ctn8 := ctn8 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型9').asstring then
begin
ctn9 := ctn9 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else if table.fieldbyname('代码').asstring = frm_data_share.t_code_ctn_de.fieldbyname('箱型10').asstring then
begin
ctn10 := ctn10 + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end
else
begin
ctnother := ctnother + table.fieldbyname('数量').asinteger;
ttlCtn:= ttlCtn + table.fieldbyname('TEU').asinteger;
end;
if not frm_main.t_sum_ctn.locate('代码', table.fieldbyname('代码').asstring, []) then
begin
frm_main.t_sum_ctn.Append;
frm_main.t_sum_ctn['代码'] := table.fieldbyname('代码').asstring;
frm_main.t_sum_ctn['表现形式'] := table.fieldbyname('表现形式').asstring;
frm_main.t_sum_ctn['数量'] := table.fieldbyname('数量').asinteger;
frm_main.t_sum_ctn.post;
end
else
begin
frm_main.t_sum_ctn.edit;
frm_main.t_sum_ctn['数量'] := frm_main.t_sum_ctn['数量'] + table.fieldbyname('数量').asinteger;
frm_main.t_sum_ctn.post;
end;
if table.fieldbyname('尺寸').asstring = '20' then
ctn20 := ctn20 + table.fieldbyname('数量').asinteger
else if table.fieldbyname('尺寸').asstring = '40' then
begin
if (table.fieldbyname('箱型').asstring = 'GP') or (table.fieldbyname('箱型').asstring = 'RF') or (table.fieldbyname('箱型').asstring = 'OT') or (table.fieldbyname('箱型').asstring = 'GOH') then
begin
ctn40 := ctn40 + table.fieldbyname('数量').asinteger
end
else
begin
ctn40h := ctn40h + table.fieldbyname('数量').asinteger
end;
end
else if (table.fieldbyname('尺寸').asstring) = '45' then
ctn45 := ctn45 + table.fieldbyname('数量').asinteger;
table.next;
end;
finally
table.EnableControls;
frm_main.t_sum_ctn.EnableControls;
//table.GotoBookmark(bok);
end;
ctn_string := '';
if_first := true;
num_ctn := 0;
str := '';
try
frm_main.t_sum_ctn.DisableControls;
frm_main.t_sum_ctn.first;
while not frm_main.t_sum_ctn.eof do
begin
if ctn_string = '' then
begin
ctn_string := frm_main.t_sum_ctn.fieldbyname('表现形式').asstring + '*' + frm_main.t_sum_ctn.fieldbyname('数量').asstring;
end
else
begin
ctn_string := ctn_string + ' ' + frm_main.t_sum_ctn.fieldbyname('表现形式').asstring + '*' + frm_main.t_sum_ctn.fieldbyname('数量').asstring;
end;
if if_first then
begin
str := ntoc(frm_main.t_sum_ctn.fieldbyname('数量').asfloat, true) + '(' + frm_main.t_sum_ctn.fieldbyname('表现形式').asstring + '*' + frm_main.t_sum_ctn.fieldbyname('数量').asstring + ')';
if_first := false;
end
else
begin
str := str + ' AND ' + ntoc(frm_main.t_sum_ctn.fieldbyname('数量').asfloat, true) + '(' + frm_main.t_sum_ctn.fieldbyname('表现形式').asstring + '*' + frm_main.t_sum_ctn.fieldbyname('数量').asstring + ')';
end;
num_ctn := num_ctn + frm_main.t_sum_ctn.fieldbyname('数量').asinteger;
str_list.Add(frm_main.t_sum_ctn.fieldbyname('表现形式').asstring + '*' + frm_main.t_sum_ctn.fieldbyname('数量').asstring + '-' + frm_main.t_sum_ctn.fieldbyname('表现形式').asstring);
frm_main.t_sum_ctn.next;
end;
if num_ctn > 1 then
begin
str := 'SAY: ' + str + ' CONTAINERS ONLY.'
end
else
begin
str := 'SAY: ' + str + ' CONTAINER ONLY.'
end;
finally
frm_main.t_sum_ctn.EnableControls;
end;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('Update t_op_seae set');
sql.Add('箱型1=:箱型1');
sql.Add(',箱型2=:箱型2');
sql.Add(',箱型3=:箱型3');
sql.Add(',箱型4=:箱型4');
sql.Add(',箱型5=:箱型5');
sql.Add(',箱型6=:箱型6');
sql.Add(',箱型7=:箱型7');
sql.Add(',箱型8=:箱型8');
sql.Add(',箱型9=:箱型9');
sql.Add(',箱型10=:箱型10');
sql.Add(',其他箱型=:其他箱型');
sql.Add(',箱TEU=:箱TEU');
sql.Add(',集装箱=:集装箱');
sql.Add(',计费标准=:计费标准');
sql.Add(',箱数大写=:箱数大写');
sql.Add(',合计20=:合计20');
sql.Add(',合计40=:合计40');
sql.Add(',合计40H=:合计40H');
sql.Add(',合计45=:合计45');
sql.Add('where 编号=:编号');
Parameters.ParamByName('箱型1').Value:=ctn1;
Parameters.ParamByName('箱型2').Value:=ctn2;
Parameters.ParamByName('箱型3').Value:=ctn3;
Parameters.ParamByName('箱型4').Value:=ctn4;
Parameters.ParamByName('箱型5').Value:=ctn5;
Parameters.ParamByName('箱型6').Value:=ctn6;
Parameters.ParamByName('箱型7').Value:=ctn7;
Parameters.ParamByName('箱型8').Value:=ctn8;
Parameters.ParamByName('箱型9').Value:=ctn9;
Parameters.ParamByName('箱型10').Value:=ctn10;
Parameters.ParamByName('其他箱型').Value:=ctnother;
Parameters.ParamByName('箱TEU').Value:=ttlCtn;
Parameters.ParamByName('集装箱').Value:=ctn_string;
Parameters.ParamByName('计费标准').Value:=str_list.Text;
Parameters.ParamByName('箱数大写').Value:=str;
Parameters.ParamByName('合计20').Value:=ctn20;
Parameters.ParamByName('合计40').Value:=ctn40;
Parameters.ParamByName('合计40H').Value:=ctn40H;
Parameters.ParamByName('合计45').Value:=ctn45;
Parameters.ParamByName('编号').Value:=t_op_seae.FieldByName('编号').asstring;
ExecSQL;
finally
Free;
end;
except
on e: exception do
begin
showmessage('更新失败!!????');
showmessage(e.Message);
str_list.free;
/// table.GotoBookmark(bok);
end;
end;
str_list.free;
end;
end;
procedure Tfrm_crm_OnLineBooking.update_seae(table: Tadoquery);//更新箱量
var
if_first: boolean;
pkgs: integer;
kgs, cbm: double;
s, package: string;
aAdoQuery:tAdoQuery;
begin
if table.IsEmpty then
exit;
table.First;
if_first := true;
pkgs := 0;
kgs := 0.00;
cbm := 0.00;
memo1.Lines.Clear;
memo2.Lines.Clear;
memo3.Lines.Clear;
memo4.Lines.Clear;
try
table.DisableControls;
while not table.Eof do
begin
if strtobool(get_parameters_value(139, 'true')) then
begin
if if_first then
begin
if (Trim(table.fieldbyname('箱号').asstring) <> '') then
memo1.Lines.Text := table.fieldbyname('箱号').asstring + '/' + table.fieldbyname('封号').asstring;
memo2.Lines.Text := table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring;
memo3.Lines.Text := table.fieldbyname('重量').asstring + 'KGS';
memo4.Lines.Text := table.fieldbyname('尺码').asstring + 'CBM';
pkgs := table.fieldbyname('件数').asinteger;
kgs := table.fieldbyname('重量').asfloat;
cbm := table.fieldbyname('尺码').asfloat;
package:=table.fieldbyname('包装').asstring;
if_first := false;
end
else
begin
if (Trim(table.fieldbyname('箱号').asstring) <> '') then
memo1.Lines.Add(table.fieldbyname('箱号').asstring + '/' + table.fieldbyname('封号').asstring);
memo2.Lines.Add(table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring);
memo3.Lines.Add(table.fieldbyname('重量').asstring + 'KGS');
memo4.Lines.Add(table.fieldbyname('尺码').asstring + 'CBM');
pkgs := pkgs + table.fieldbyname('件数').asinteger;
kgs := kgs + table.fieldbyname('重量').asfloat;
cbm := cbm + table.fieldbyname('尺码').asfloat;
package:=table.fieldbyname('包装').asstring;
end;
end
else
begin
if if_first then
begin
memo1.Lines.Text := table.fieldbyname('箱号').asstring + '/' + table.fieldbyname('封号').asstring + '/' + table.fieldbyname('表现形式').asstring + '/' + table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring + '/' + table.fieldbyname('重量').asstring + 'KGS' + '/' + table.fieldbyname('尺码').asstring + 'CBM';
memo2.Lines.Text := table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring;
memo3.Lines.Text := table.fieldbyname('重量').asstring + 'KGS';
memo4.Lines.Text := table.fieldbyname('尺码').asstring + 'CBM';
pkgs := table.fieldbyname('件数').asinteger;
kgs := table.fieldbyname('重量').asfloat;
cbm := table.fieldbyname('尺码').asfloat;
package:=table.fieldbyname('包装').asstring;
if_first := false;
end
else
begin
memo1.Lines.Add(table.fieldbyname('箱号').asstring + '/' + table.fieldbyname('封号').asstring + '/' + table.fieldbyname('表现形式').asstring + '/' + table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring + '/' + table.fieldbyname('重量').asstring + 'KGS' + '/' + table.fieldbyname('尺码').asstring + 'CBM');
memo2.Lines.Add(table.fieldbyname('件数').asstring + table.fieldbyname('包装').asstring);
memo3.Lines.Add(table.fieldbyname('重量').asstring + 'KGS');
memo4.Lines.Add(table.fieldbyname('尺码').asstring + 'CBM');
pkgs := pkgs + table.fieldbyname('件数').asinteger;
kgs := kgs + table.fieldbyname('重量').asfloat;
cbm := cbm + table.fieldbyname('尺码').asfloat;
package:=table.fieldbyname('包装').asstring;
end;
end;
table.next;
end;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('Update t_op_seae set');
sql.Add('箱号封号=:箱号封号');
sql.Add(',件数包装=:件数包装');
sql.Add(',货物重量=:货物重量');
sql.Add(',货物尺码=:货物尺码');
sql.Add(',件数=:件数');
sql.Add(',重量=:重量');
sql.Add(',尺码=:尺码');
sql.Add('where 编号=:编号');
Parameters.ParamByName('箱号封号').Value:=memo1.Lines.Text;
Parameters.ParamByName('件数包装').Value:=memo2.Lines.Text;
Parameters.ParamByName('货物重量').Value:=memo3.Lines.Text;
Parameters.ParamByName('货物尺码').Value:=memo4.Lines.Text;
Parameters.ParamByName('件数').Value:=pkgs;
Parameters.ParamByName('重量').Value:=kgs;
Parameters.ParamByName('尺码').Value:=cbm;
Parameters.ParamByName('编号').Value:=t_op_seae.FieldByName('编号').asstring;
ExecSQL;
finally
Free;
end;
finally
table.EnableControls;
end;
end;
procedure Tfrm_crm_OnLineBooking.Deleteopctn(BSNO: string);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
SQL.Add('Delete from t_op_ctn');
SQL.Add('Where 编号=:编号');
parameters.ParamByName('编号').Value:=BSNO;
ExecSQL;
finally
Free;
end;
end;
procedure Tfrm_crm_OnLineBooking.Insertopctn(BSNO: string;kbmMemTable:TkbmMemTable);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;Sql.Clear;
SQL.Add('Insert into t_op_ctn (编号,代码,尺寸,箱型,表现形式,箱号,封号,件数,包装,重量,尺码,TEU,数量)');
SQL.Add('values (:编号,:代码,:尺寸,:箱型,:表现形式,:箱号,:封号,:件数,:包装,:重量,:尺码,:TEU,:数量)');
Parameters.ParamByName('编号').value := BSNO;
Parameters.ParamByName('代码').value := kbmMemTable.FieldByName('代码').AsString;
Parameters.ParamByName('尺寸').value := kbmMemTable.FieldByName('尺寸').AsString;
Parameters.ParamByName('箱型').value := kbmMemTable.FieldByName('箱型').AsString;
Parameters.ParamByName('表现形式').value := kbmMemTable.FieldByName('表现形式').AsString;
Parameters.ParamByName('箱号').value := kbmMemTable.FieldByName('箱号').AsString;
Parameters.ParamByName('封号').value := kbmMemTable.FieldByName('封号').AsString;
Parameters.ParamByName('件数').value := kbmMemTable.FieldByName('件数').AsInteger;
Parameters.ParamByName('包装').value := kbmMemTable.FieldByName('包装').AsString;
Parameters.ParamByName('重量').value := kbmMemTable.FieldByName('重量').AsFloat;
Parameters.ParamByName('尺码').value := kbmMemTable.FieldByName('尺码').AsFloat;
Parameters.ParamByName('TEU').value := kbmMemTable.FieldByName('TEU').AsInteger;
Parameters.ParamByName('数量').value := kbmMemTable.FieldByName('数量').AsInteger;
ExecSQL;
finally
Free;
end;
end;
function Tfrm_crm_OnLineBooking.GetSIData: boolean;//更新箱量
var
aAdoQueryUpdate,at_op_ctn: TAdoQuery;
i, p1, p2, pkgs: integer;
b_checked: boolean;
s, s_ctnItems: string;
_s, url, onlinetimemark, onlinePosted, block, mttimemark: string;
aa: DsWebServiceSoap;
begin
result := false;
pkgs := 0;
b_checked := false;
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, url);
_s := ' ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + mt1.FieldByName('BSNO').value + ' ';
_s := _s + ' ';
_s := _s + ' ';
xml := aa.GetBsnoInfo(_s);
p1 := frm_data_share.GettimePotion(1, '', xml);
p2 := frm_data_share.GettimePotion(1, '', xml);
block := Copy(xml, p1, p2 - p1);
onlinetimemark := frm_data_share.GetXMLValue('TimeMark', block);
onlinePosted := frm_data_share.GetXMLValue('ISPOSTED', block);
mttimemark := mt1.fieldbyname('TIMEMARK').AsString;
if (onlinetimemark <> mttimemark) then
begin
ShowMessage('此条业务内容发生变化,请点击“刷新数据”');
result := true;
exit;
end;
for i := 0 to bsSkinPanel1.ControlCount - 1 do
with bsSkinPanel1 do
if (bsSkinPanel1.Controls[i] is TcxCheckBox) then
begin
if (bsSkinPanel1.Controls[i] as TcxCheckBox).Checked then
begin
b_checked := true;
end;
end;
if not b_checked then
begin
showmessage('没有选择数据,没有需要更新的数据');
end;
aAdoQueryUpdate := CreateAdoQuery;
at_op_ctn := CreateAdoQuery;
with aAdoQueryUpdate do
try
close;
sql.Clear;
sql.Add('Update t_op_seae set ');
if cxCheckBox1.Checked then
begin
if s = '' then
sql.Add('发货人代码=:发货人代码 ')
else
sql.Add(',发货人代码=:发货人代码 ');
Parameters.ParamByName('发货人代码').Value := mt1.FieldByName('发货人代码').value;
if s = '' then
s := '发货人代码'
else
s := s + #13#10 + '发货人代码';
end;
if cxCheckBox2.Checked then
begin
if s = '' then
sql.Add('收货人代码=:收货人代码 ')
else
sql.Add(',收货人代码=:收货人代码 ');
Parameters.ParamByName('收货人代码').Value := mt1.FieldByName('收货人代码').value;
if s = '' then
s := '收货人代码'
else
s := s + #13#10 + '收货人代码';
end;
if cxCheckBox3.Checked then
begin
if s = '' then
sql.Add('通知人代码=:通知人代码 ')
else
sql.Add(',通知人代码=:通知人代码 ');
Parameters.ParamByName('通知人代码').Value := mt1.FieldByName('通知人代码').value;
if s = '' then
s := '通知人代码'
else
s := s + #13#10 + '通知人代码';
end;
if cxCheckBox4.Checked then
begin
if s = '' then
sql.Add('货物描述=:货物描述 ')
else
sql.Add(',货物描述=:货物描述 ');
Parameters.ParamByName('货物描述').Value := mt1.FieldByName('货物描述').value;
if s = '' then
s := '货物描述'
else
s := s + #13#10 + '货物描述';
end;
if cxCheckBox5.Checked then
begin
if s = '' then
sql.Add('唛头=:唛头 ')
else
sql.Add(',唛头=:唛头 ');
Parameters.ParamByName('唛头').Value := mt1.FieldByName('唛头').value;
if s = '' then
s := '唛头'
else
s := s + #13#10 + '唛头';
end;
if cxCheckBox7.Checked then
begin
if s = '' then
sql.Add('船名=:船名 ')
else
sql.Add(',船名=:船名 ');
Parameters.ParamByName('船名').Value := mt1.FieldByName('船名').value;
if s = '' then
s := '船名'
else
s := s + #13#10 + '船名';
end;
if cxCheckBox9.Checked then
begin
if s = '' then
sql.Add('航次=:航次 ')
else
sql.Add(',航次=:航次 ');
Parameters.ParamByName('航次').Value := mt1.FieldByName('航次').value;
if s = '' then
s := '航次'
else
s := s + #13#10 + '航次';
end;
if cxCheckBox15.Checked then
begin
if s = '' then
sql.Add('运输条款=:运输条款 ')
else
sql.Add(',运输条款=:运输条款');
Parameters.ParamByName('运输条款').Value := mt1.FieldByName('运输条款').value;
if s = '' then
s := '运输条款'
else
s := s + #13#10 + '运输条款';
end;
if cxCheckBox16.Checked then
begin
if s = '' then
sql.Add('运费协议号=:运费协议号 ')
else
sql.Add(',运费协议号=:运费协议号 ');
Parameters.ParamByName('运费协议号').Value := mt1.FieldByName('运费协议号').value;
if s = '' then
s := '运费协议号'
else
s := s + #13#10 + '运费协议号';
end;
if cxCheckBox17.Checked then
begin
if s = '' then
sql.Add('运输方式=:运输方式 ')
else
sql.Add(',运输方式=:运输方式 ');
Parameters.ParamByName('运输方式').Value := mt1.FieldByName('运输方式').value;
if s = '' then
s := 'HS CODE'
else
s := s + #13#10 + 'HS CODE';
end;
if cxCheckBox8.Checked then
begin
if s = '' then
sql.Add('付费方式=:付费方式')
else
sql.Add(',付费方式=:付费方式');
Parameters.ParamByName('付费方式').Value := mt1.FieldByName('付费方式').value;
if s = '' then
s := '付费方式'
else
s := s + #13#10 + '付费方式';
end;
if cxCheckBox11.Checked then
begin
if s = '' then
sql.Add('装货港=:装货港')
else
sql.Add(',装货港=:装货港');
Parameters.ParamByName('装货港').Value := mt1.FieldByName('装货港').value;
if s = '' then
s := '装货港'
else
s := s + #13#10 + '装货港';
end;
if cxCheckBox12.Checked then
begin
if s = '' then
sql.Add('卸货港=:卸货港')
else
sql.Add(',卸货港=:卸货港');
Parameters.ParamByName('卸货港').Value := mt1.FieldByName('卸货港').value;
if s = '' then
s := '卸货港'
else
s := s + #13#10 + '卸货港';
end;
if cxCheckBox13.Checked then
begin
if s = '' then
sql.Add('目的地=:目的地')
else
sql.Add(',目的地=:目的地');
Parameters.ParamByName('目的地').Value := mt1.FieldByName('目的地').value;
if s = '' then
s := '目的地'
else
s := s + #13#10 + '目的地';
end;
if cxCheckBox22.Checked then
begin
if s = '' then
sql.Add('件数=:件数')
else
sql.Add(',件数=:件数');
Parameters.ParamByName('件数').Value := mt1.FieldByName('件数').value;
if s = '' then
s := '件数'
else
s := s + #13#10 + '件数';
end;
if cxCheckBox23.Checked then
begin
if s = '' then
sql.Add('包装=:包装')
else
sql.Add(',包装=:包装');
Parameters.ParamByName('包装').Value := mt1.FieldByName('包装').value;
if s = '' then
s := '包装'
else
s := s + #13#10 + '包装';
end;
if cxCheckBox24.Checked then
begin
if s = '' then
sql.Add('重量=:重量')
else
sql.Add(',重量=:重量');
Parameters.ParamByName('重量').Value := mt1.FieldByName('重量').value;
if s = '' then
s := '重量'
else
s := s + #13#10 + '重量';
end;
if cxCheckBox25.Checked then
begin
if s = '' then
sql.Add('尺码=:尺码')
else
sql.Add(',尺码=:尺码');
Parameters.ParamByName('尺码').Value := mt1.FieldByName('尺码').value;
if s = '' then
s := '尺码'
else
s := s + #13#10 + '尺码';
end;
if cxCheckBox21.Checked then
begin
if s = '' then
sql.Add('件数大写=:件数大写')
else
sql.Add(',件数大写=:件数大写');
Parameters.ParamByName('件数大写').Value := mt1.FieldByName('件数大写').value;
if s = '' then
s := '件数大写'
else
s := s + #13#10 + '件数大写';
end;
if cxCheckBox26.Checked then
begin
s_ctnItems := '装箱明细'
end;
if s <> '' then
begin
if MessageDlg('确实要<接收>数据吗?', mtWarning, [mbyes, mbno], 0) <> mryes then
begin
result := true;
Exit;
end;
sql.Add('where 订舱序列号=:订舱序列号');
Parameters.ParamByName('订舱序列号').Value := mt1.FieldByName('BSNO').value;
ExecSQL;
end
else
begin
if s_ctnItems <> '' then
if MessageDlg('确实要<接收>数据吗?', mtWarning, [mbyes, mbno], 0) <> mryes then
begin
result := true;
Exit;
end;
end;
if cxCheckBox26.Checked then
begin
with memtblwebCtn do
try
frm_main.db.BeginTrans;
Deleteopctn(t_op_seae.FieldByName('编号').AsString);
First;
while not eof do
begin
Insertopctn(t_op_seae.FieldByName('编号').AsString,memtblwebCtn);
pkgs := pkgs + FieldByName('件数').AsInteger;
Next;
end;
at_op_ctn.Close;
at_op_ctn.SQL.Clear;
at_op_ctn.SQL.Add('select * from t_op_ctn');
at_op_ctn.SQL.Add('where 编号=:编号');
at_op_ctn.Parameters.ParamByName('编号').Value :=t_op_seae.FieldByName('编号').AsString;
at_op_ctn.Open;
update_ctn(at_op_ctn);
if pkgs <> 0 then
update_seae(at_op_ctn);
frm_main.db.CommitTrans;
finally
EnableControls;
if frm_main.db.InTransaction then
begin
ShowMessage('接受数据出错!');
frm_main.db.RollbackTrans;
end;
end;
end;
{
if s_ctnItems+s<>'' then
showmessage('以下为<接收>数据项:'+#13#10+s+#13#10+s_ctnItems);
}
url := get_WebseviceURL;
aa := GetDsWebServiceSoap(false, get_WebseviceURL); //'http://192.168.1.105:5427/webservice/DsWebService.asmx');
//首先获取订舱信息
_s := '';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring + ' ';
_s := _s + ' 4 ';
_s := _s + ' ';
_s := _s + ' 1.0 ';
_s := _s + ' ';
_s := _s + ' ';
_s := _s + ' ' + mt1.fieldbyname('BSNO').asstring + ' ';
_s := _s + ' ';
_s := _s + ' ';
XML := aa.SetBookingCargoSpaceAudit(_s);
//XML:=aa.ReceiveBookingCargoSpace(_s);
//Opseaecount:= frm_data_share.countString('Opseae',xml);
//result:= Opseaecount;
if (pos('成功', XML) > 0) then
begin
ShowMessage('接受成功');
end
else
begin
ShowMessage('接受失败');
end;
//GetWebData;
finally
Free;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1DblClick(Sender: TObject);
begin
frm_op_seae_diffctn := Tfrm_op_seae_diffctn.Create(self);
CreatememtblctnDiff;
frm_op_seae_diffctn.dsrWebCtn := memtblwebCtn1;
frm_op_seae_diffctn.cxLabel1.Caption:='本地集装箱个数:'+IntToStr(t_op_ctn1.DataSet.recordcount);
frm_op_seae_diffctn.cxLabel2.Caption:='客户确认集装箱个数:'+IntToStr(memtblwebCtn1.DataSet.recordcount);
frm_op_seae_diffctn.dsrCtn := t_op_ctn1;
frm_op_seae_diffctn.bsNo := '';
frm_op_seae_diffctn.showchgtd(memtblwebCtn1, t_op_ctn1);
frm_op_seae_diffctn.Free;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if not t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
AFont.Color := clRed;
exit;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column1CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if t_op_ctn.FieldByName('尺寸').AsString <> ANode.Strings[dxDBGrid1Column1.Index] then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column2CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if t_op_ctn.FieldByName('箱型').AsString <> ANode.Strings[dxDBGrid1Column2.Index] then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column4CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if t_op_ctn.FieldByName('封号').AsString <> ANode.Strings[dxDBGrid1Column4.Index] then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column5CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if t_op_ctn.FieldByName('件数').AsInteger <> StrToFloatdef(ANode.Strings[dxDBGrid1Column5.Index], 0) then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column6CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if t_op_ctn.FieldByName('包装').AsString <> ANode.Strings[dxDBGrid1Column6.Index] then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column7CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if FormatFloat('0.000;0.000;0', t_op_ctn.FieldByName('重量').AsFloat) <> FormatFloat('0.000;0.000;0', StrToFloatdef(ANode.Strings[dxDBGrid1Column7.Index], 0)) then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.dxDBGrid1Column8CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: string; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean);
begin
if t_op_ctn.Locate('箱号', uppercase(ANode.Strings[dxDBGrid1Column3.Index]), []) then
begin
if FormatFloat('0.000;0.000;0', t_op_ctn.FieldByName('尺码').AsFloat) <> FormatFloat('0.000;0.000;0', StrToFloatdef(ANode.Strings[dxDBGrid1Column8.Index], 0)) then
begin
AFont.Color := clRed;
end;
end;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo1DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo2DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo3DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo4DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo5DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBMemo6DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxButton8Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '发货人代码', true);
end;
procedure Tfrm_crm_OnLineBooking.cxButton9Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '收货人代码', true);
end;
procedure Tfrm_crm_OnLineBooking.cxButton10Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '通知人代码', true);
end;
procedure Tfrm_crm_OnLineBooking.cxButton11Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '唛头', true);
end;
procedure Tfrm_crm_OnLineBooking.cxButton6Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '货物描述', true);
end;
procedure Tfrm_crm_OnLineBooking.cxButton1Click(Sender: TObject);
begin
frm_main.view_momo(ds1, '销售订舱说明', true);
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit16DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit17DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit18DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit19DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit8DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit9DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit2DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit3DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit1DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit4DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit5DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit6DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit11DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit15DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit21DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.cxDBTextEdit20DblClick(Sender: TObject);
begin
frm_op_seae_difftd := Tfrm_op_seae_difftd.Create(self);
frm_op_seae_difftd.showchgtd(ds1, t_op_seae1, TcxDBMemo(sender).databinding.DataField);
frm_op_seae_difftd.Free;
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton5Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to bsSkinPanel1.ControlCount - 1 do
with bsSkinPanel1 do
if (bsSkinPanel1.Controls[i] is TcxCheckBox) then
begin
(bsSkinPanel1.Controls[i] as TcxCheckBox).Checked := true;
end
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton6Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to bsSkinPanel1.ControlCount - 1 do
with bsSkinPanel1 do
if (bsSkinPanel1.Controls[i] is TcxCheckBox) then
begin
(bsSkinPanel1.Controls[i] as TcxCheckBox).Checked := false;
end
end;
procedure Tfrm_crm_OnLineBooking.bsSkinButton7Click(Sender: TObject);
begin
Close;
end;
end.