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

10963 lines
379 KiB
Plaintext

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

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

unit u_op_seae_edi_data;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,DateUtils,
Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, ActiveX,
dxDBCtrl, dxDBGrid, ComCtrls, bsSkinTabs, RxLookup, StdCtrls, Mask,inifiles,
DBCtrls, wwdbdatetimepicker, wwdblook, u_op_sate, u_fee, u_op_card, Menus,
dxDBTLCl, dxGrClms, bsdbctrls, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb,
Grids, Wwdbigrd, Wwdbgrid, FtpCli, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdIntercept, IdLogBase, IdLogEvent,DBClient,
IdAntiFreezeBase, IdAntiFreeze, dxEditor, dxEdLib, dxDBELib, DBCtrlsEh
,ComObj,DsWebService,SoapHTTPClient,InvokeRegistry,XMLIntf,XMLDoc, xmldom, Xmlxform,
msxmldom, bsSkinBoxCtrls,DyxtService,Service,jfczService,myService,CaragtQuery_Cxwl,IdHTTP,
kbmMemTable, cxControls, cxContainer, cxCheckListBox, cxDBCheckListBox,Clipbrd,
OleCtrls, SHDocVw, IdExplicitTLSClientServerBase, cxTreeView, Excel,IdMultipartFormData,IdGlobalProtocols,superobject;
type
TMyThread = class(TThread)
protected
filename:string;
filetype:string;
ediname:string;
edipassword:string;
mblno:string;
editype:string;
procedure Execute; override;
public
constructor create(mfilename:string;mfiletype:string;mediname:string;medipassword:string;mmblno:string;meditype:string);virtual;
destructor destroy; override;
end;
TSendDGData = Record //ÏûÏ¢¿Í»§¶ËÏûÏ¢½á¹¹
dgConPerson :String;
dgTel :String;
dgClass :widestring;
temperature :String;
temUnit :String;
humidity :String;
vent :String;
dgNo:String;
end;
TDsThread = class(TThread)
protected
filename:string;
carrierid:string;
ScriptPath:string;
webusername:string;
webpassword:string;
webcustname:string;
senddgdata:TSendDGData;
procedure Execute; override;
public
constructor create(mfilename:string;mcarrierid:string;mScriptPath:string;mwebusername:string;mwebpassword:string;msenddgdata:TSendDGData;mwebcustname:string='');virtual;
destructor destroy; override;
end;
Tfrm_op_seae_edi_data = class(TForm)
Panel2: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton38: TbsSkinButton;
Notebook1: TNotebook;
t_op_seae: TADOQuery;
t_op_seae1: TDataSource;
dxDBGrid1: TdxDBGrid;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPanel1: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
Label38: TLabel;
DBEdit1: TDBEdit;
DBEdit9: TDBEdit;
PopupMenu3: TPopupMenu;
N37: TMenuItem;
N38: TMenuItem;
N62: TMenuItem;
N25: TMenuItem;
N64: TMenuItem;
N63: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N34: TMenuItem;
N35: TMenuItem;
N36: TMenuItem;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridMaskColumn;
dxDBGrid1Column10: TdxDBGridMaskColumn;
dxDBGrid1Column11: TdxDBGridMaskColumn;
dxDBGrid1Column12: TdxDBGridDateColumn;
dxDBGrid1Column13: TdxDBGridMaskColumn;
dxDBGrid1Column14: TdxDBGridMaskColumn;
dxDBGrid1Column15: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridMaskColumn;
dxDBGrid1Column18: TdxDBGridMaskColumn;
dxDBGrid1Column19: TdxDBGridDateColumn;
dxDBGrid1Column17: TdxDBGridColumn;
XPMenu1: TXPMenu;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
bsSkinPanel2: TbsSkinPanel;
Label47: TLabel;
Label49: TLabel;
Label51: TLabel;
wwDBDateTimePicker9: TwwDBDateTimePicker;
wwDBDateTimePicker11: TwwDBDateTimePicker;
Edit3: TEdit;
wwDBDateTimePicker12: TwwDBDateTimePicker;
Label52: TLabel;
wwDBDateTimePicker13: TwwDBDateTimePicker;
Label53: TLabel;
bsSkinButton8: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
Label60: TLabel;
DBEdit10: TDBEdit;
bsSkinButton14: TbsSkinButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
dxDBGrid1Column65: TdxDBGridColumn;
dxDBGrid1Column67: TdxDBGridColumn;
Label45: TLabel;
Label48: TLabel;
wwDBComboBox2: TwwDBComboBox;
bsSkinGroupBox4: TbsSkinGroupBox;
Label54: TLabel;
DBEdit46: TDBEdit;
Label55: TLabel;
DBEdit48: TDBEdit;
Label56: TLabel;
DBEdit50: TDBEdit;
Label59: TLabel;
t_op_ctn1: TDataSource;
t_op_ctn: TADOQuery;
wwDBComboBox3: TwwDBComboBox;
bsSkinPanel5: TbsSkinPanel;
bsSkinGroupBox1: TbsSkinGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
bsSkinSpeedButton1: TbsSkinSpeedButton;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
bsSkinGroupBox2: TbsSkinGroupBox;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
bsSkinSpeedButton2: TbsSkinSpeedButton;
DBEdit17: TDBEdit;
DBEdit19: TDBEdit;
DBEdit20: TDBEdit;
bsSkinGroupBox3: TbsSkinGroupBox;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
bsSkinSpeedButton3: TbsSkinSpeedButton;
DBEdit28: TDBEdit;
DBEdit29: TDBEdit;
DBEdit30: TDBEdit;
bsSkinGroupBox5: TbsSkinGroupBox;
DBMemo3: TDBMemo;
bsSkinGroupBox7: TbsSkinGroupBox;
DBMemo1: TDBMemo;
bsSkinGroupBox8: TbsSkinGroupBox;
DBMemo2: TDBMemo;
SaveDialog1: TSaveDialog;
t_op_ctn_detail: TADOQuery;
IntegerField1: TIntegerField;
StringField8: TStringField;
BCDField1: TBCDField;
BCDField2: TBCDField;
StringField12: TStringField;
StringField13: TStringField;
BCDField3: TBCDField;
t_op_ctn_detail1: TDataSource;
t_op_ctn_detailctn_id: TIntegerField;
bsSkinButton19: TbsSkinButton;
Label73: TLabel;
bsSkinButton20: TbsSkinButton;
Label74: TLabel;
bsSkinButton21: TbsSkinButton;
Label75: TLabel;
RxDBLookupCombo16: TRxDBLookupCombo;
RxDBLookupCombo1: TRxDBLookupCombo;
RxDBLookupCombo2: TRxDBLookupCombo;
t_code_shiper: TADOQuery;
t_code_shiper1: TDataSource;
t_code_consignee: TADOQuery;
t_code_consignee1: TDataSource;
t_code_notifyparty: TADOQuery;
t_code_notifyparty1: TDataSource;
bsSkinGroupBox11: TbsSkinGroupBox;
Label61: TLabel;
Label62: TLabel;
Label70: TLabel;
Label71: TLabel;
Label72: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
EditType: TEdit;
bsSkinButton16: TbsSkinButton;
bsSkinButton17: TbsSkinButton;
bsSkinButton18: TbsSkinButton;
FtpClient1: TFtpClient;
lblstatus: TLabel;
IdFTP1: TIdFTP;
IdLogEvent1: TIdLogEvent;
DebugListBox: TListBox;
StatusBar1: TStatusBar;
ProgressBar1: TProgressBar;
Label76: TLabel;
bsSkinButton22: TbsSkinButton;
PopupMenu4: TPopupMenu;
wwDBDateTimePicker3: TwwDBDateTimePicker;
Label77: TLabel;
Label78: TLabel;
bsSkinButton23: TbsSkinButton;
N4: TMenuItem;
NWD2101: TMenuItem;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
Label80: TLabel;
Edit1: TEdit;
Label217: TLabel;
wwDBLookupCombo26: TwwDBLookupCombo;
Label218: TLabel;
Edit8: TEdit;
Label81: TLabel;
Edit2: TEdit;
N9: TMenuItem;
N19: TMenuItem;
NWY: TMenuItem;
NLD: TMenuItem;
NYD: TMenuItem;
wwDBLookupCombo21: TwwDBLookupCombo;
wwDBLookupCombo20: TwwDBLookupCombo;
NHF: TMenuItem;
Label58: TLabel;
NZH: TMenuItem;
bsSkinButton25: TbsSkinButton;
wwDBLookupCombo3: TwwDBLookupCombo;
wwDBLookupCombo52: TwwDBLookupCombo;
wwDBLookupCombo17: TwwDBLookupCombo;
N6: TMenuItem;
NHGYDT: TMenuItem;
OpenDialog1: TOpenDialog;
t_op_state1: TDataSource;
t_op_state: TADOQuery;
N20: TMenuItem;
Panel1: TPanel;
bsSkinGroupBox9: TbsSkinGroupBox;
Label68: TLabel;
Label169: TLabel;
Label63: TLabel;
Label64: TLabel;
Label65: TLabel;
Label66: TLabel;
Label67: TLabel;
Label106: TLabel;
Label105: TLabel;
Label109: TLabel;
Label108: TLabel;
Label69: TLabel;
Label83: TLabel;
wwDBComboBox15: TwwDBComboBox;
DBEdit81: TDBEdit;
wwDBLookupCombo61: TwwDBLookupCombo;
DBEdit82: TDBEdit;
DBEdit83: TDBEdit;
DBMemo38: TDBMemo;
DBMemo39: TDBMemo;
DBEdit55: TDBEdit;
wwDBComboBox6: TwwDBComboBox;
DBEdit56: TDBEdit;
DBEdit57: TDBEdit;
bsSkinButton47: TbsSkinButton;
bsSkinButton24: TbsSkinButton;
bsSkinButton26: TbsSkinButton;
DBEdit2: TDBEdit;
bsSkinGroupBox6: TbsSkinGroupBox;
bsSkinPanel9: TbsSkinPanel;
bsSkinButton56: TbsSkinButton;
bsSkinButton57: TbsSkinButton;
bsSkinButton58: TbsSkinButton;
bsSkinButton59: TbsSkinButton;
btnMarks: TbsSkinButton;
btnDesc: TbsSkinButton;
btnSeal: TbsSkinButton;
bsSkinButton15: TbsSkinButton;
bsSkinButton28: TbsSkinButton;
bsSkinExPanel1: TbsSkinExPanel;
bsSkinPanel6: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
wwDBGrid2: TwwDBGrid;
N22: TMenuItem;
bsSkinComboBox1: TbsSkinComboBox;
Label3: TLabel;
N2: TMenuItem;
N21: TMenuItem;
N23: TMenuItem;
bsSkinLabel1: TbsSkinLabel;
bsSkinLabel2: TbsSkinLabel;
bsSkinLabel3: TbsSkinLabel;
bsSkinLabel4: TbsSkinLabel;
bsSkinLabel5: TbsSkinLabel;
DBEdit3: TDBEdit;
PopupMenu5: TPopupMenu;
ABC1: TMenuItem;
bsSkinButton27: TbsSkinButton;
dxDBGrid1Column23: TdxDBGridColumn;
bsSkinLabel6: TbsSkinLabel;
kbmMemTable1: TkbmMemTable;
kbmMemTable1StringField: TStringField;
kbmMemTable1StringField2: TStringField;
kbmMemTable1IntegerField: TIntegerField;
kbmMemTable1StringField3: TStringField;
kbmMemTable1FloatField: TFloatField;
kbmMemTable1FloatField2: TFloatField;
kbmMemTable1StringField4: TStringField;
kbmMemTable1StringField5: TStringField;
kbmMemTable1StringField6: TStringField;
cxDBCheckListBox1: TcxDBCheckListBox;
Label36: TLabel;
Label37: TLabel;
Label39: TLabel;
Label44: TLabel;
Label46: TLabel;
DBEdit38: TDBEdit;
DBEdit39: TDBEdit;
DBEdit40: TDBEdit;
DBEdit43: TDBEdit;
wwDBDateTimePicker1: TwwDBDateTimePicker;
bsSkinButton32: TbsSkinButton;
bsSkinButton31: TbsSkinButton;
bsSkinExPanel2: TbsSkinExPanel;
lbl1: TLabel;
dbedt1: TDBEdit;
N24: TMenuItem;
N26: TMenuItem;
N27: TMenuItem;
CL: TMenuItem;
Label10: TLabel;
DBMemo4: TDBMemo;
dxDBGrid1Column22: TdxDBGridColumn;
dxDBGrid1Column24: TdxDBGridColumn;
dxDBGrid1Column25: TdxDBGridColumn;
dxDBGrid1Column26: TdxDBGridColumn;
Label12: TLabel;
RxDBLookupCombo9: TRxDBLookupCombo;
Label4: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit11: TDBEdit;
Label5: TLabel;
DBEdit8: TDBEdit;
DBEdit12: TDBEdit;
Label11: TLabel;
Label13: TLabel;
DBEdit13: TDBEdit;
dxDBGrid1Column27: TdxDBGridColumn;
bsSkinButton34: TbsSkinButton;
dxDBGrid1Column28: TdxDBGridColumn;
bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox;
Label14: TLabel;
Edit9: TEdit;
Label15: TLabel;
Edit10: TEdit;
Label19: TLabel;
Edit11: TEdit;
Label42: TLabel;
wwDBComboBox8: TwwDBComboBox;
idhttp1: TIdHTTP;
bsSkinButton35: TbsSkinButton;
Memo1: TMemo;
cxTreeView1: TcxTreeView;
dxDBGrid1Column29: TdxDBGridColumn;
dxDBGrid1Column30: TdxDBGridColumn;
dxDBGrid1Column31: TdxDBGridColumn;
dxDBGrid1Column33: TdxDBGridColumn;
Label20: TLabel;
Edit12: TEdit;
mmo1: TMemo;
bsSkinButton36: TbsSkinButton;
bsSkinButton37: TbsSkinButton;
t_code_cangdan1: TDataSource;
t_code_cangdan: TADOQuery;
Label21: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Label22: TLabel;
DBEdit14: TDBEdit;
Label23: TLabel;
DBEdit15: TDBEdit;
dxDBGrid1Column32: TdxDBGridColumn;
dxDBGrid1Column34: TdxDBGridColumn;
dxDBGrid1Column35: TdxDBGridColumn;
DBMemo5: TDBMemo;
Label24: TLabel;
Label25: TLabel;
DBEdit16: TDBEdit;
DBEdit18: TDBEdit;
Label439: TLabel;
DBEdit242: TDBEdit;
Label438: TLabel;
DBEdit244: TDBEdit;
Label447: TLabel;
DBEdit251: TDBEdit;
Label29: TLabel;
DBEdit21: TDBEdit;
Label30: TLabel;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
Label31: TLabel;
Label32: TLabel;
DBEdit24: TDBEdit;
Label33: TLabel;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
Label34: TLabel;
Label35: TLabel;
DBEdit27: TDBEdit;
Label40: TLabel;
DBEdit31: TDBEdit;
Label41: TLabel;
DBEdit32: TDBEdit;
bsSkinSpeedButton4: TbsSkinSpeedButton;
bsSkinButton39: TbsSkinButton;
bsSkinButton41: TbsSkinButton;
bsSkinButton40: TbsSkinButton;
wwDBComboBoxOwner: TwwDBComboBox;
wwDBComboBox1: TwwDBComboBox;
wwDBLookupCombo16: TwwDBLookupCombo;
wwDBLookupComboctn: TwwDBLookupCombo;
t_op_seaeDSDesigner: TStringField;
t_op_seaeDSDesigner2: TStringField;
t_op_seaeEDI: TStringField;
t_op_seaeEDI2: TStringField;
t_op_seaeDSDesigner3: TStringField;
t_op_seaeDSDesigner4: TDateTimeField;
t_op_seaeDSDesigner5: TStringField;
t_op_seaeDSDesigner6: TStringField;
t_op_seaeDSDesigner7: TStringField;
t_op_seaeDSDesigner8: TStringField;
t_op_seaeDSDesigner1: TStringField;
t_op_seaeDSDesigner22: TStringField;
t_op_seaeDSDesigner9: TStringField;
t_op_seaeDSDesigner10: TStringField;
t_op_seaeDSDesigner11: TStringField;
t_op_seaeDSDesigner12: TStringField;
t_op_seaeDSDesigner13: TStringField;
t_op_seaeDSDesigner14: TStringField;
t_op_seaeDSDesigner15: TStringField;
t_op_seaeDSDesigner23: TStringField;
t_op_seaeDSDesigner16: TStringField;
t_op_seaeDSDesigner17: TStringField;
t_op_seaeDSDesigner18: TStringField;
t_op_seaeDSDesigner19: TStringField;
t_op_seaeDSDesigner20: TStringField;
t_op_seaeDSDesigner21: TStringField;
t_op_seaeDSDesigner110: TStringField;
t_op_seaeDSDesigner24: TStringField;
t_op_seaeDSDesigner25: TStringField;
t_op_seaeDSDesigner26: TStringField;
t_op_seaeDSDesigner27: TStringField;
t_op_seaeDSDesigner28: TStringField;
t_op_seaeDSDesigner29: TStringField;
t_op_seaeDSDesigner210: TStringField;
t_op_seaeDSDesigner212: TStringField;
t_op_seaeDSDesigner222: TStringField;
t_op_seaeDSDesigner211: TStringField;
t_op_seaeDSDesigner213: TStringField;
t_op_seaeDSDesigner214: TStringField;
t_op_seaeDSDesigner215: TStringField;
t_op_seaeDSDesigner216: TStringField;
t_op_seaeDSDesigner30: TStringField;
t_op_seaeDSDesigner31: TStringField;
t_op_seaeDSDesigner32: TStringField;
t_op_seaeDSDesigner33: TStringField;
t_op_seaeDSDesigner34: TStringField;
t_op_seaeDSDesigner35: TDateTimeField;
t_op_seaeDSDesigner36: TStringField;
t_op_seaeDSDesigner37: TStringField;
t_op_seaeDSDesigner38: TStringField;
t_op_seaeDSDesigner39: TStringField;
t_op_seaeDSDesigner40: TStringField;
t_op_seaeDSDesigner41: TStringField;
t_op_seaeDSDesigner42: TStringField;
t_op_seaeDSDesigner43: TStringField;
t_op_seaeDSDesigner44: TStringField;
t_op_seaeDSDesigner45: TStringField;
t_op_seaeDSDesigner46: TStringField;
t_op_seaeDSDesigner47: TIntegerField;
t_op_seaeDSDesigner48: TStringField;
t_op_seaeDSDesigner49: TBCDField;
t_op_seaeDSDesigner50: TBCDField;
t_op_seaeDSDesigner51: TStringField;
t_op_seaeDSDesigner52: TStringField;
t_op_seaeDSDesigner53: TStringField;
t_op_seaeDSDesigner54: TStringField;
t_op_seaeDSDesigner55: TStringField;
t_op_seaeDSDesigner56: TStringField;
t_op_seaeDSDesigner57: TStringField;
t_op_seaeDSDesigner58: TStringField;
t_op_seaeDSDesigner59: TStringField;
t_op_seaeDSDesigner60: TStringField;
t_op_seaeDSDesigner61: TStringField;
t_op_seaeDSDesigner62: TStringField;
t_op_seaeDSDesigner63: TStringField;
t_op_seaeDSDesigner217: TStringField;
t_op_seaeDSDesigner310: TStringField;
t_op_seaeDSDesigner311: TStringField;
t_op_seaeDSDesigner312: TStringField;
t_op_seaeDSDesigner232: TStringField;
t_op_seaeIMO: TStringField;
t_op_seaeDSDesigner64: TStringField;
t_op_seaeDSDesigner65: TStringField;
t_op_seaeDSDesigner66: TStringField;
t_op_seaeDSDesigner67: TStringField;
t_op_seaeDSDesigner68: TStringField;
t_op_seaeDSDesigner69: TStringField;
t_op_seaeDSDesigner70: TStringField;
t_op_seaeDSDesigner71: TBooleanField;
t_op_seaeDSDesigner72: TBooleanField;
t_op_seaeDSDesigner73: TStringField;
t_op_seaeDSDesigner74: TStringField;
t_op_seaeDSDesigner75: TStringField;
t_op_seaeDSDesigner76: TDateTimeField;
t_op_seaeDSDesigner77: TStringField;
t_op_seaeDSDesigner78: TStringField;
t_op_seaeDSDesigner79: TStringField;
t_op_seaeDSDesigner80: TStringField;
t_op_seaeDSDesigner81: TStringField;
t_op_seaeDSDesigner82: TDateTimeField;
t_op_seaeDSDesigner83: TStringField;
t_op_seaeDSDesigner84: TStringField;
t_op_seaeDSDesigner85: TStringField;
t_op_seaeDSDesigner86: TStringField;
t_op_seaeDSDesigner87: TStringField;
t_op_seaeDSDesigner88: TStringField;
t_op_seaeDSDesigner90: TStringField;
t_op_seaeDSDesigner91: TIntegerField;
t_op_seaeDSDesigner92: TBooleanField;
t_op_seaeDSDesigner93: TStringField;
t_op_seaeDSDesigner94: TDateTimeField;
t_op_seaeDSDesigner95: TStringField;
t_op_seaeDSDesigner96: TStringField;
t_op_seaeDSDesigner97: TBCDField;
t_op_seaeDSDesigner98: TStringField;
t_op_seaeDSDesigner99: TStringField;
t_op_seaeDSDesigner100: TBCDField;
t_op_seaeDSDesigner101: TBCDField;
t_op_seaeDSDesigner102: TBCDField;
t_op_seaeDSDesigner103: TWordField;
t_op_seaeDSDesigner104: TStringField;
t_op_seaeDSDesigner105: TStringField;
t_op_seaeDSDesigner106: TStringField;
t_op_seaeDSDesigner107: TStringField;
t_op_seaeDSDesigner108: TStringField;
t_op_seaeDSDesigner109: TStringField;
wwDBComboBox4: TwwDBComboBox;
wwDBGrid1: TwwDBGrid;
DBEdit33: TDBEdit;
EXCEL1: TMenuItem;
Excel2: TExcel;
SaveDialog: TSaveDialog;
N28: TMenuItem;
wwDBComboBoxOP: TComboBox;
wwDBComboBoxType: TComboBox;
lblmarklength: TLabel;
Label43: TLabel;
bsSkinButton291: TbsSkinButton;
N30: TMenuItem;
N31: TMenuItem;
t_code_carrier1: TDataSource;
t_code_carrier: TADOQuery;
wwDBLookupCombo1: TwwDBLookupCombo;
t_op_seaeDSDesigner89: TStringField;
t_op_seaeDSDesigner111: TStringField;
NZHZF: TMenuItem;
op: TbsSkinButton;
adopingtai: TADOQuery;
t_op_seaeDSDesigner112: TStringField;
dxDBGrid1Column36: TdxDBGridColumn;
Label50: TLabel;
wwDBComboBox5: TwwDBComboBox;
N5: TMenuItem;
N7: TMenuItem;
bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox;
Label57: TLabel;
DBEdit34: TDBEdit;
Label79: TLabel;
DBEdit35: TDBEdit;
t_op_seaeDSDesigner113: TStringField;
t_op_seaeDSDesigner114: TStringField;
t_op_seaeDSDesigner115: TBooleanField;
bsSkinButton29: TbsSkinButton;
DBMemo6: TDBMemo;
Label82: TLabel;
t_op_seaeDSDesigner116: TStringField;
N8: TMenuItem;
Memo2: TMemo;
Button1: TButton;
dxDBGrid1Column37: TdxDBGridColumn;
dxDBGrid1Column38: TdxDBGridColumn;
dxDBGrid1Column39: TdxDBGridColumn;
t_code_cdstatus: TADOQuery;
t_code_cdstatus1: TDataSource;
bsSkinPanel3: TbsSkinPanel;
Label84: TLabel;
wwDBLookupCombo2: TwwDBLookupCombo;
bsSkinButton30: TbsSkinButton;
t_op_seaeDSDesigner117: TStringField;
t_op_seaeDSDesigner118: TStringField;
t_op_seaeDSDesigner119: TDateTimeField;
t_code_goods_not: TADOQuery;
dxDBGrid1Column40: TdxDBGridColumn;
t_op_seaestatus_detai: TStringField;
code_e_carrier: TADOQuery;
dxDBGrid1Column41: TdxDBGridColumn;
lblTSGOOD: TLabel;
N29: TMenuItem;
N32: TMenuItem;
t_code_zy_client: TADOQuery;
t_code_zy_client1: TDataSource;
DBEdit36: TDBEdit;
N33: TMenuItem;
N39: TMenuItem;
RxDBLookupCombo4: TRxDBLookupCombo;
code_cdkehuchuand: TADOQuery;
code_cdkehuchuand1: TDataSource;
CheckBox1: TCheckBox;
dxDBGrid1Column42: TdxDBGridColumn;
N3: TMenuItem;
N40: TMenuItem;
bsSkinButton33: TbsSkinButton;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel2Resize(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinSpeedButton1Click(Sender: TObject);
procedure bsSkinSpeedButton2Click(Sender: TObject);
procedure bsSkinSpeedButton3Click(Sender: TObject);
procedure bsSkinButton56Click(Sender: TObject);
procedure bsSkinButton57Click(Sender: TObject);
procedure bsSkinButton58Click(Sender: TObject);
procedure bsSkinButton59Click(Sender: TObject);
procedure wwDBLookupComboctnChange(Sender: TObject);
procedure btnMarksClick(Sender: TObject);
procedure btnDescClick(Sender: TObject);
procedure t_op_ctnAfterInsert(DataSet: TDataSet);
procedure wwDBGrid1ColEnter(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure t_op_ctn_detailAfterInsert(DataSet: TDataSet);
procedure t_op_ctn_detailBeforePost(DataSet: TDataSet);
procedure t_op_ctn_detailBeforeInsert(DataSet: TDataSet);
procedure bsSkinButton17Click(Sender: TObject);
procedure bsSkinButton19Click(Sender: TObject);
procedure bsSkinButton20Click(Sender: TObject);
procedure bsSkinButton21Click(Sender: TObject);
procedure RxDBLookupCombo16Enter(Sender: TObject);
procedure RxDBLookupCombo16Exit(Sender: TObject);
procedure RxDBLookupCombo1Enter(Sender: TObject);
procedure RxDBLookupCombo1Exit(Sender: TObject);
procedure RxDBLookupCombo2Enter(Sender: TObject);
procedure RxDBLookupCombo2Exit(Sender: TObject);
procedure RxDBLookupCombo16Change(Sender: TObject);
procedure RxDBLookupCombo1Change(Sender: TObject);
procedure RxDBLookupCombo2Change(Sender: TObject);
procedure IdFTP1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: String);
procedure IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Integer);
procedure IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
procedure IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
procedure bsSkinButton22Click(Sender: TObject);
procedure NZYClick(Sender: TObject);
procedure bsSkinButton23Click(Sender: TObject);
procedure NZTClick(Sender: TObject);
procedure NWD2101Click(Sender: TObject);
procedure t_op_ctnBeforePost(DataSet: TDataSet);
procedure NWD1101Click(Sender: TObject);
procedure NYDClick(Sender: TObject);
procedure NLDClick(Sender: TObject);
procedure NWYClick(Sender: TObject);
procedure NHGClick(Sender: TObject);
procedure btnSealClick(Sender: TObject);
procedure NHFClick(Sender: TObject);
procedure wwDBComboBoxOPDropDown(Sender: TObject);
procedure NZHClick(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure bsSkinButton47Click(Sender: TObject);
procedure bsSkinButton24Click(Sender: TObject);
procedure bsSkinButton25Click(Sender: TObject);
procedure bsSkinButton26Click(Sender: TObject);
procedure wwDBLookupCombo3Change(Sender: TObject);
procedure wwDBLookupCombo3Exit(Sender: TObject);
procedure wwDBLookupCombo52Change(Sender: TObject);
procedure wwDBLookupCombo52Exit(Sender: TObject);
procedure wwDBLookupCombo17Change(Sender: TObject);
procedure wwDBLookupCombo17Exit(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure bsSkinButton28Click(Sender: TObject);
procedure NHGYDTClick(Sender: TObject);
procedure bsSkinButton29Click(Sender: TObject);
procedure t_op_seaeBeforeEdit(DataSet: TDataSet);
procedure t_op_ctnBeforeEdit(DataSet: TDataSet);
procedure N20Click(Sender: TObject);
procedure bsSkinButton30Click(Sender: TObject);
procedure bsSkinComboBox1Change(Sender: TObject);
procedure bsSkinButton31Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure bsSkinButton32Click(Sender: TObject);
procedure t_op_seaeBeforeDelete(DataSet: TDataSet);
procedure DBEdit3Change(Sender: TObject);
procedure bsSkinLabel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure bsSkinLabel2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure bsSkinLabel3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure bsSkinLabel4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure bsSkinLabel5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure bsSkinButton27Click(Sender: TObject);
procedure bsSkinLabel6MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure t_op_seaeAfterInsert(DataSet: TDataSet);
procedure bsSkinButton33Click(Sender: TObject);
procedure RxDBLookupCombo9Enter(Sender: TObject);
procedure RxDBLookupCombo9KeyPress(Sender: TObject; var Key: Char);
procedure RxDBLookupCombo9Exit(Sender: TObject);
procedure t_op_ctnNewRecord(DataSet: TDataSet);
procedure CLClick(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 DBEdit1Change(Sender: TObject);
procedure bsSkinButton35Click(Sender: TObject);
procedure t_op_ctnAfterPost(DataSet: TDataSet);
procedure bsSkinButton36Click(Sender: TObject);
procedure bsSkinButton37Click(Sender: TObject);
procedure RxDBLookupCombo3Change(Sender: TObject);
procedure DBEdit11Change(Sender: TObject);
procedure bsSkinSpeedButton4Click(Sender: TObject);
procedure bsSkinButton39Click(Sender: TObject);
procedure bsSkinButton40Click(Sender: TObject);
procedure Notebook1PageChanged(Sender: TObject);
procedure bsSkinButton41Click(Sender: TObject);
procedure DBEdit11Exit(Sender: TObject);
procedure t_op_seaeAfterScroll(DataSet: TDataSet);
procedure EXCEL1Click(Sender: TObject);
procedure N29Click(Sender: TObject);
procedure DBMemo38Change(Sender: TObject);
procedure DBMemo39Change(Sender: TObject);
procedure bsSkinButton291Click(Sender: TObject);
procedure N31Click(Sender: TObject);
procedure wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
State: TGridDrawState; Highlight: Boolean; AFont: TFont;
ABrush: TBrush);
procedure DBEdit4Change(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure opClick(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N30Click(Sender: TObject);
procedure widClick(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure t_op_seaeAfterPost(DataSet: TDataSet);
procedure Button1Click(Sender: TObject);
procedure e1Click(Sender: TObject);
procedure N32Click(Sender: TObject);
procedure N39Click(Sender: TObject);
procedure NZHZFClick(Sender: TObject);
procedure N40Click(Sender: TObject);
private
{ Private declarations }
AbortTransfer: Boolean;
TransferrignData: Boolean;
BytesToTransfer: LongWord;
STime: TDateTime;
mServiceSoap_Ds:DsWebServiceSoap;
mHttpRIO_ds:THTTPRIO;
mServiceSoap_dy:DyxtServiceSoap;
mServiceSoap_yzh:ServiceSoap;
mServiceSoap_zc:CaragtQuery_CxwlSoap;
mHttpRIO_dy,mHttpRIO_yzh,mHttpRIO_zc:THTTPRIO;
function DoPost(_URL:string;_Referer:string;_Order:TStringList):String; //ÏòÍøÒ³·¢ËÍÇëÇó
procedure SetState(response:string) ;
procedure updatelr;
procedure getwebservice_dy; //»ñÈ¡
procedure getwebservice_yzh; //»ñÈ¡
procedure getwebservice_zc; //»ñÈ¡
procedure dewebservice; //¹Ø±Õ
procedure GetdyczInfo_dy(s_caragt,s_key,s_billno,bsno:String);
procedure GetdyczInfo_yzh(s_caragt,s_key,s_billno,bsno:String);
procedure GetdyczInfo_jfcz(s_caragt,s_key,s_billno,bsno:String);
procedure GetdyczInfo_lhcz(s_caragt,s_key,s_billno,bsno:String);
procedure GetdyczInfo_zc(s_caragt,s_key,s_billno,bsno:String);
procedure getssczinfor(mblno:string);
procedure setconcolor; //ÉèÖÿؼþµÄÑÕÉ«
function getCtnAfr(code:string):string;
function getPkgAfr(code:string):string;
function formatAfrstr(str:string):string;
procedure PutToDebugLog(Operation, S1: String);
function isEditrue(DataSet:TDataSet): boolean;
procedure Delay(dwMilliseconds:DWORD);
function get_edi_id:string; //»ñÈ¡È«¾ÖΨһ±äÁ¿
public
{ Public declarations }
dbserver:string;
edi_addseai:boolean;
function GetStrChar(str:String):string;
function GetStrChar_1(str:String):string;
function GetpkgsEdi(pkgs: String): String;
function GetwypkgsEdi(pkgs: String): String;
function GetpkgsEdi2(pkgs: String): String;
function GetpkgsMscEdi(pkgs: String): String;
procedure UpdateCTN(BSNO:STRING);
procedure getwebservice_ds;
function IsZhongwen(Str: String): Boolean;
function CreateSIEdiFile_XML:TStrings;
function GetCtnCode(ctnkind,ctnsize:String): String;
function GetCtnWYCode(ctnkind,ctnsize:String): String;
function GetCtnMSCCode(ctn:String): String;
function GetCtnMSCCodeCode(ctn:String): String;
procedure UpdateInfor;
procedure SelectReciveData(bsno,mblno:string);
function CreateIgengzongxml(SOI:string):TStringlist;
function IgzEdi(EdiStrings:TStrings):Boolean;
function formattel(str:string):string;
function createzhjson(UserName,userpsw:string):string;
procedure Sendzyzf();
procedure Sendzhzf();
procedure Sendqgzf(lhcd:string);
procedure GetDuiBiStr;
procedure Sendzczf();
end;
var
frm_op_seae_edi_data: Tfrm_op_seae_edi_data;
AverageSpeed: Double = 0;
STATE,EVENT,_S:String;
hThread: THandle; {Ï߳̾ä±ú}
implementation
uses u_main,u_data_share, my_sys_function, u_sys_progress, u_code_edicode,
u_op_seae_edi_custom_cosco, u_op_seae_edi_custom_zt,
u_op_seae_edi_custom_WaiDai, u_op_seae_edi_custom_WaiDai_1101,
u_op_seae_edi_custom_yd, u_op_seae_edi_custom_LD, u_op_seae_edi_custom_wy,
u_op_seae_edi_custom_hg, u_op_seae_edi_custom_zh,
u_op_seae_edi_custom_hgydt, u_op_seae_zhedi,
u_op_seae_edi_custom_qgzf, u_op_seae_edi_custom_zyzf,
u_op_seae_edi_custom_lhcd, u_sys_messagedlg, u_code_zy_cust,
u_op_seae_edi_custom_zhzf, u_op_seae_edi_custom_zczf;
{$R *.dfm}
procedure Tfrm_op_seae_edi_data.SetState(response: string);
var
_eventstart,_eventend,_statestart,_stateend:integer;
_temp:string;
begin
_eventstart:=pos('name="__VIEWSTATE" id="',response);
_temp:=copy(response,_eventstart+43,3000);
_eventend:=pos('" />',_temp);
_temp:=copy(_temp,0,_eventend-1);
STATE:=_temp;
//edit1.text:=_eventstart.Tostring();
_statestart:=pos('id="__EVENTVALIDATION" value="',response);
_temp:=copy(response,_statestart+30,3000);
_stateend:=pos('" />',_temp);
_temp:=copy(_temp,0,_stateend-1);
EVENT:=_temp;
end;
function Tfrm_op_seae_edi_data.DoPost(_URL:string;_Referer:string;_order:TStringList):String;
var
Param:TStringList;
RStream:TStringStream;
post:AnsiString;
begin
Param:=TStringList.Create;
RStream:=TStringStream.Create('');
Param:=_order;
IdHTTP1.ProtocolVersion:=pv1_1;
IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoTreat302Like303];
IdHTTP1.Request.Accept:='text/html, application/xhtml+xml, */*';
IdHTTP1.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko';
IdHTTP1.Request.AcceptEncoding:='gzip, deflate';
IdHTTP1.Request.Host:='56.qdcdc.com';
IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';
IdHTTP1.Request.CustomHeaders.Text:='Cookie:'+mmo1.Text;
IdHTTP1.Request.Referer:=_Referer;
try
IdHTTP1.Post(_URL,Param,RStream);
except
on e:Exception do//Å׳öËùÓÐÒì³£
begin
//doing something
raise;
end;
end;
result:=UTF8Decode(RStream.DataString);
end;
procedure Tfrm_op_seae_edi_data.getwebservice_dy;
begin
try
mHttpRIO_dy:=THTTPRIO.Create(nil);
mHttpRIO_dy.WSDLLocation:='http://www.yydy.com/GacoWebService/DyxtService.asmx?WSDL';
mHttpRIO_dy.URL:='http://www.yydy.com/GacoWebService/DyxtService.asmx';
mHttpRIO_dy.Port:='DyxtServiceSoap';
mHttpRIO_dy.Service:='DyxtWebService';
mHttpRIO_dy.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_dy:=mHttpRIO_dy as DyxtServiceSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(DyxtServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.getwebservice_zc;
begin
try
mHttpRIO_zc:=THTTPRIO.Create(nil);
mHttpRIO_zc.WSDLLocation:='http://www.cmlog.com.cn:8003/cmlwebservice/CaragtQuery_Cxwl.asmx?WSDL';
mHttpRIO_zc.URL:='http://www.cmlog.com.cn:8003/cmlwebservice/CaragtQuery_Cxwl.asmx';
mHttpRIO_zc.Port:='CaragtQuery_CxwlSoap';
mHttpRIO_zc.Service:='CaragtQuery_Cxwl';
mHttpRIO_zc.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_zc:=mHttpRIO_zc as CaragtQuery_CxwlSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(CaragtQuery_CxwlSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.getwebservice_yzh;
begin
try
mHttpRIO_yzh:=THTTPRIO.Create(nil);
mHttpRIO_yzh.WSDLLocation:='http://222.173.95.170:78/Service.asmx?WSDL';
mHttpRIO_yzh.URL:='http://222.173.95.170:78/Service.asmx';
mHttpRIO_yzh.Port:='ServiceSoap';
mHttpRIO_yzh.Service:='WebService';
mHttpRIO_yzh.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_yzh:=mHttpRIO_yzh as ServiceSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
{
mHttpRIO_yzh:=THTTPRIO.Create(nil);
mHttpRIO_yzh.WSDLLocation:='http://www.eimskipdepot.com:78/Service.asmx?WSDL';
mHttpRIO_yzh.URL:='http://www.eimskipdepot.com:78/Service.asmx';
mHttpRIO_yzh.Port:='ServiceSoap';
mHttpRIO_yzh.Service:='WebService';
mHttpRIO_yzh.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_yzh:=mHttpRIO_yzh as ServiceSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
}
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.dewebservice;
begin
mHttpRIO_dy.Free;
end;
procedure Tfrm_op_seae_edi_data.GetdyczInfo_jfcz(s_caragt,s_key,s_billno,bsno:String);
var
b:Boolean;
s_web: WideString;
xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_ctnno,s_ctnType:string;
smartWS:jfczServiceSoap;
begin
try
t_op_ctn.DisableControls;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
smartWS:=GetjfczServiceSoap(True,'');
s_web:=smartWS.GetBLNoInfo(s_billno,'18315FA0-8E5A-4935-8369-91BE89BC6B6A');
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\JFCZ.xml');
// ShowMessage('\\'+dbserver+'\jfcz\jfcz.xtr');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\jfcz\jfcz.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
kbmMemTable1.EmptyTable;
kbmMemTable1.Open;
with cds do
begin
First;
while not Eof do
begin
if kbmMemTable1.Locate('ÏäºÅ',Trim(FieldByName('CNTRNO').AsString),[]) then
begin
kbmMemTable1.Edit;
s_ctnno:=Trim(FieldByName('CNTRSIZE').AsString);
s_ctnType:=Trim(FieldByName('CNTRTYPE').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
kbmMemTable1.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
kbmMemTable1.FieldByName('³ß´ç').AsString:=FieldByName('CNTRSIZE').AsString;
kbmMemTable1.FieldByName('ÏäÐÍ').AsString:=FieldByName('CNTRTYPE').AsString;
kbmMemTable1.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
kbmMemTable1.FieldByName('¼þÊý').AsInteger:=kbmMemTable1.FieldByName('¼þÊý').AsInteger+FieldByName('CARGOQTY').AsInteger;
kbmMemTable1.FieldByName('°ü×°').AsString:=FieldByName('CO_PKGCODE').AsString;
kbmMemTable1.FieldByName('ÖØÁ¿').AsFloat:=kbmMemTable1.FieldByName('ÖØÁ¿').AsFloat+FieldByName('CARGOWEIGHT').AsFloat;
kbmMemTable1.FieldByName('³ßÂë').AsFloat:=kbmMemTable1.FieldByName('³ßÂë').AsFloat+FieldByName('CARGOVOLUME').AsFloat;
kbmMemTable1.Post;
end
else
begin
kbmMemTable1.append;
s_ctnno:=Trim(FieldByName('CNTRSIZE').AsString);
s_ctnType:=Trim(FieldByName('CNTRTYPE').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
kbmMemTable1.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
kbmMemTable1.FieldByName('³ß´ç').AsString:=FieldByName('CNTRSIZE').AsString;
kbmMemTable1.FieldByName('ÏäÐÍ').AsString:=FieldByName('CNTRTYPE').AsString;
kbmMemTable1.FieldByName('ÏäºÅ').AsString:=FieldByName('CNTRNO').AsString;
kbmMemTable1.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
kbmMemTable1.FieldByName('¼þÊý').AsInteger:=FieldByName('CARGOQTY').AsInteger;
kbmMemTable1.FieldByName('°ü×°').AsString:=FieldByName('CO_PKGCODE').AsString;
kbmMemTable1.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('CARGOWEIGHT').AsFloat;
kbmMemTable1.FieldByName('³ßÂë').AsFloat:=FieldByName('CARGOVOLUME').AsFloat;
kbmMemTable1.Post;
end;
Next;
end;
end;
with kbmMemTable1 do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('ÏäºÅ').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
// t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('¼þÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=FieldByName('°ü×°').AsString;
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('³ßÂë').AsFloat;
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
// t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=FieldByName('ÏäºÅ').AsString;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('¼þÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=FieldByName('°ü×°').AsString;
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('³ßÂë').AsFloat;
t_op_ctn.Post;
end;
Next;
end;
end;
finally
t_op_ctn.EnableControls;
cds.Free;
end;
end;
procedure Tfrm_op_seae_edi_data.GetdyczInfo_dy(s_caragt,s_key,s_billno,bsno:String);
var
b:Boolean;
s_web: WideString;
xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_ctnno,s_ctnType:string;
begin
try
t_op_ctn.DisableControls;
getwebservice_dy;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
// s_billno:='HLCUTA1130371756'; //QDJY000476
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
s_web:=mServiceSoap_dy.GetCtnChargeXml(s_caragt,s_key,s_billno,'','1');
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\ÌáÏä.xml');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\´óÑdz¡Õ¾\ÌáÏä.xtr';
// XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\´óÑdz¡Õ¾\ÌáÏä.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('CTNNO').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·¢ÏäÈÕÆÚ').AsString:=StringReplace(Copy(FieldByName('EMFUEDT').AsString,1,Pos('.',FieldByName('EMFUEDT').AsString)-1),'T',' ',[]);
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=Trim(FieldByName('CTNNO').AsString);
// t_op_ctn.FieldByName('·¢ÏäÈÕÆÚ').AsString:=StringReplace(Copy(FieldByName('EMFUEDT').AsString,1,Pos('.',FieldByName('EMFUEDT').AsString)-1),'T',' ',[]);
{
t_op_ctn.FieldByName('·âºÅ').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value);
t_op_ctn.FieldByName('¼þÊý').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,6].Value);
t_op_ctn.FieldByName('°ü×°').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,7].Value);
t_op_ctn.FieldByName('ÖØÁ¿').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,8].Value);
t_op_ctn.FieldByName('³ßÂë').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,9].Value);
}
t_op_ctn.Post;
end;
Next;
end;
end;
s_web:=mServiceSoap_dy.GetBackFCtnInfoXml(s_caragt,s_key,s_billno,'','1');
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\ÖØÏä·µ³¡.xml');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\´óÑdz¡Õ¾\ÖØÏä·µ³¡.xtr';
// XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\´óÑdz¡Õ¾\ÖØÏä·µ³¡.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('CTNNO').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('PKGS').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:='';
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ALKWGT').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('ALCUBAGE').AsFloat;
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('PKGS').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:='';
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ALKWGT').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('ALCUBAGE').AsFloat;
t_op_ctn.Post;
end;
Next;
end;
end;
// °ü×°
s_web:=mServiceSoap_dy.GetLoadCargoInfoXml(s_caragt,s_key,s_billno,'','1');
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\°ü×°.xml');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\´óÑdz¡Õ¾\°ü×°.xtr';
// XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\´óÑdz¡Õ¾\°ü×°.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
if not cds.IsEmpty then
begin
try
with t_op_ctn do
begin
First;
while not Eof do
begin
Edit;
FieldByName('°ü×°').AsString:=cds.FieldByName('PKTP').AsString;
Post;
Next;
end;
end;
finally
end;
end;
{
s_web:=mServiceSoap_dy.GetEnterPortInfoXml(s_caragt,s_key,s_billno,'','1');
xmldoc.LoadFromXML(s_web);
/// xmldoc.SaveToFile('c:\¼¯¸Û.xml');
XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\´óÑdz¡Õ¾\¼¯¸Û.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
cds.Close;
cds.ProviderName:='XMLTransformProvider1';
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=True;
// ShowMessage(IntToStr(cds.RecordCount));
s_web:=mServiceSoap_dy.GetCusediInfoXml(s_caragt,s_key,s_billno);
xmldoc.LoadFromXML(s_web);
/// xmldoc.SaveToFile('c:\·ÅÐÐ.xml');
XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\´óÑdz¡Õ¾\·ÅÐÐ.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
BoolToStr(mServiceSoap_dy.GetBillInfo(s_caragt,s_key,s_billno),True);
}
finally
// dewebservice;
t_op_ctn.EnableControls;
// ShowMessage('µ¼ÈëÍê³É,Çë×ÐϸºË¶ÔÏäÊý,ÊÖ¹¤Â¼ÈëµÄ¼¯×°Ïä¿ÉÒÔɾ³ý');
end;
end;
procedure Tfrm_op_seae_edi_data.getssczinfor(mblno:string);//qqctu»ñÈ¡Ô˵ֱ¨¸æºÍ±¨¹ØÐÅÏ¢
var
sl,sl_data:tstringlist;
IdHTTP1:TidHTTP;
i,j,k,m,n:integer;
istrue,QQCT,inmsg:boolean;
sldata:Array [1..13] of string[50];
s,s_ctnno,s_ctnType:widestring;
begin
sl:=tstringlist.Create;
sl_data:=tstringlist.Create;
IdHTTP1 := TidHTTP.Create(nil);
IdHTTP1.HandleRedirects:=true;
QQCT:=false;
istrue:=true;
for i:=1 to 13 do
begin
sldata[i]:='';
end;
n:=0;
try
istrue:=true;
inmsg:=false;
sl_data.text:=Trim(idhttp1.get('http://www.ssqd.cn/agentui.aspx?bl='+mblno));
j:=0;
for i:=0 to sl_data.Count-1 do
begin
s:=Trim(Utf8ToAnsi(sl_data[i]));
if Trim(sl_data[i])<>'' then
if pos('</table>',sl_data[i])>0 then
begin
s:=Copy(s,Pos('</Ìáµ¥ºÅ></td></tr>',s)+16,Length(s)-1);
s:=StringReplace(s,'/tr>','/tr>'+#13#10,[rfReplaceAll]);
n:=1;
sl.text:=s;
end;
end;
for i:=0 to sl.Count-1 do
begin
if pos('</table>',sl[i])>0 then begin
istrue:=false;
Exit;
end;
if pos('ÏäºÅ',sl[i])>0 then
begin
j:=i;
end;
if istrue and (i=j) then
begin
sldata[1]:=twsou('<ÏäºÅ>','</ÏäºÅ>',sl[i]);
end;
if istrue and (i=j+1) then
begin
sldata[2]:=twsou('<³ß´ç>','</³ß´ç>',sl[i]);
end;
if istrue and (i=j+2) then
begin
sldata[3]:=twsou('<ÏäÐÍ>','</ÏäÐÍ>',sl[i]);
end;
if istrue and (i=j+3) then
begin
sldata[4]:=twsou('<³µºÅ>','</³µºÅ>',sl[i]);
end;
if istrue and (i=j+4) then
begin
sldata[5]:=twsou('<±³Ïäʱ¼ä>','</±³Ïäʱ¼ä>',sl[i]);
end;
if istrue and (i=j+5) then
begin
sldata[6]:=twsou('<ƤÖØ>','</ƤÖØ>',sl[i]);
end;
if istrue and (i=j+6) then
begin
sldata[7]:=twsou('<×ܼþÊý>','</×ܼþÊý>',sl[i]);
end;
if istrue and (i=j+7) then
begin
sldata[8]:=twsou('<ÖØÁ¿>','</ÖØÁ¿>',sl[i]);
end;
if istrue and (i=j+8) then
begin
sldata[9]:=twsou('<×ܳßÂë>','</×ܳßÂë>',sl[i]);
end;
if istrue and (i=j+9) then
begin
sldata[10]:=twsou('<Ǧ·âºÅ>','</Ǧ·âºÅ>',sl[i]);
end;
if istrue and (i=j+10) then
begin
sldata[11]:=twsou('<¼¯¸Ûʱ¼ä>','</¼¯¸Ûʱ¼ä>',sl[i]);
if t_op_ctn.Locate('ÏäºÅ',Trim(sldata[1]),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(sldata[2]);
s_ctnType:=Trim(sldata[3]);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=sldata[1];
t_op_ctn.FieldByName('·âºÅ').AsString:=sldata[10];
if sldata[7]<>'' then
t_op_ctn.FieldByName('¼þÊý').AsInteger:=StrToInt(sldata[7]);
t_op_ctn.FieldByName('°ü×°').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('°ü×°').AsString;
if sldata[8]<>'' then
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=StrToFloat(sldata[8]);
if sldata[9]<>'' then
t_op_ctn.FieldByName('³ßÂë').AsFloat:=StrToFloat(sldata[9]);
t_op_ctn.Post;
end
else
begin
t_op_ctn.Append;
s_ctnno:=Trim(sldata[2]);
s_ctnType:=Trim(sldata[3]);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=sldata[1];
t_op_ctn.FieldByName('·âºÅ').AsString:=sldata[10];
if sldata[7]<>'' then
t_op_ctn.FieldByName('¼þÊý').AsInteger:=StrToInt(sldata[7]);
t_op_ctn.FieldByName('°ü×°').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('°ü×°').AsString;
if sldata[8]<>'' then
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=StrToFloat(sldata[8]);
if sldata[9]<>'' then
t_op_ctn.FieldByName('³ßÂë').AsFloat:=StrToFloat(sldata[9]);
t_op_ctn.Post;
end;
end;
end;
finally
freeandnil(sl);
end;
end;
procedure Tfrm_op_seae_edi_data.GetdyczInfo_zc(s_caragt,s_key,s_billno,bsno:String);
var
b:Boolean;
s_web: WideString;
xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_ctnno,s_ctnType:string;
begin
try
t_op_ctn.DisableControls;
getwebservice_zc;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
// s_billno:='HLCUTA1130371756'; //QDJY000476
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
s_web:=mServiceSoap_zc.GetInfo(s_billno,s_key);
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\ÌáÏä.xml');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\Öд´³¡Õ¾\¼¯×°ÏäÐÅÏ¢.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('ÏäºÅ').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('Ǧ·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('×ܼþÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('°ü×°').AsString;
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('×ܳßÂë').AsFloat;
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=FieldByName('ÏäºÅ').AsString;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('Ǧ·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('×ܼþÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('°ü×°').AsString;
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('×ܳßÂë').AsFloat;
t_op_ctn.Post;
end;
Next;
end;
end;
{
s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'FX');;
xmldoc.LoadFromXML(s_web);
// xmldoc.SaveToFile('c:\¼¯×°ÏäÐÅÏ¢.xml');
XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\âùÖ®º½³¡Õ¾\·ÅÐÐ.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
}
finally
// dewebservice;
t_op_ctn.EnableControls;
end;
end;
procedure Tfrm_op_seae_edi_data.GetdyczInfo_yzh(s_caragt,s_key,s_billno,bsno:String);
var
b:Boolean;
s_web: WideString;
xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_ctnno,s_ctnType:string;
begin
try
t_op_ctn.DisableControls;
getwebservice_yzh;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
// s_billno:='HLCUTA1130371756'; //QDJY000476
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'YT');
// ShowMessage(s_web);
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\¼¯×°ÏäÐÅÏ¢.xml');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\âùÖ®º½³¡Õ¾\¼¯×°ÏäÐÅÏ¢.xtr';
// XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\âùÖ®º½³¡Õ¾\¼¯×°ÏäÐÅÏ¢.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('ÏäºÅ').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('Ǧ·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('×ܼþÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:='';
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('×ܳßÂë').AsFloat;
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('³ß´ç').AsString);
s_ctnType:=Trim(FieldByName('ÏäÐÍ').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=FieldByName('ÏäºÅ').AsString;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('Ǧ·âºÅ').AsString;
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('×ܼþÊý').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:='';
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('×ܳßÂë').AsFloat;
t_op_ctn.Post;
end;
Next;
end;
end;
{
s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'FX');;
xmldoc.LoadFromXML(s_web);
// xmldoc.SaveToFile('c:\¼¯×°ÏäÐÅÏ¢.xml');
XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\âùÖ®º½³¡Õ¾\·ÅÐÐ.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
}
finally
// dewebservice;
t_op_ctn.EnableControls;
end;
end;
procedure Tfrm_op_seae_edi_data.GetdyczInfo_lhcz(s_caragt,s_key,s_billno,bsno:String);
var
testService:myServicePortType;
strmsg:string;
s_web: WideString;
xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_ctnno,s_ctnType:string;
begin
testService:=GetmyServicePortType(false,'http://221.215.96.158:8190/WebServiceTest/services/myService?wsdl',nil);
try
t_op_ctn.DisableControls;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
s_web:=testService.CntrMess(s_billno) ;
// ShowMessage(s_web);
xmldoc.LoadFromXML(s_web);
xmldoc.SaveToFile('c:\¼¯×°ÏäÐÅÏ¢.xml');
//ShowMessage('1');
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\½º£³¡Õ¾\¼¯×°ÏäÐÅÏ¢.xtr';
//ShowMessage('\\'+dbserver+'\½º£³¡Õ¾\ÖØÏä·µ³¡.xtr');
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
// ShowMessage('3');
cds.Data:=XMLTransformProvider1.Data;
// ShowMessage('4');
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
if t_op_ctn.Locate('ÏäºÅ',Trim(FieldByName('CTNNO').AsString),[]) then
begin
t_op_ctn.Edit;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
if FieldByName('PKGS').Value<>'null' then
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('PKGS').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=FieldByName('PKTP').AsString;
if FieldByName('ALKWGT').Value<>'null' then
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ALKWGT').AsFloat;
if FieldByName('ALCUBAGE').Value<>'null' then
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('ALCUBAGE').AsFloat;
t_op_ctn.Post;
end
else
begin
t_op_ctn.append;
s_ctnno:=Trim(FieldByName('CTNSZ').AsString);
s_ctnType:=Trim(FieldByName('CTNTP').AsString);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then
begin
t_op_ctn.FieldByName('´úÂë').AsString:=frm_data_share.t_code_ctn.FieldByName('´úÂë').AsString;
end;
t_op_ctn.FieldByName('ÏäºÅ').AsString:=Trim(FieldByName('CTNNO').AsString);
t_op_ctn.FieldByName('·âºÅ').AsString:=FieldByName('SEALNO').AsString;
if FieldByName('PKGS').Value<>'null' then
t_op_ctn.FieldByName('¼þÊý').AsInteger:=FieldByName('PKGS').AsInteger;
t_op_ctn.FieldByName('°ü×°').AsString:=FieldByName('PKTP').AsString;
if FieldByName('ALKWGT').Value<>'null' then
t_op_ctn.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ALKWGT').AsFloat;
if FieldByName('ALCUBAGE').Value<>'null' then
t_op_ctn.FieldByName('³ßÂë').AsFloat:=FieldByName('ALCUBAGE').AsFloat;
t_op_ctn.Post;
end;
Next;
end;
end;
finally
t_op_ctn.EnableControls;
end;
end;
procedure Tfrm_op_seae_edi_data.setconcolor;
procedure consetcolor(fielname:String);
var
i:integer;
scolor:string;
begin
scolor:=get_parameters_value(144,'clInfoBk');
with bsSkinGroupBox1 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox2 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox3 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox4 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox5 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox7 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox8 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinGroupBox9 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with Panel1 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
with bsSkinPanel1 do begin
for i:=0 to ControlCount-1 do begin
if Controls[i] is TwwDBComboBox then
begin
if TwwDBComboBox(Controls[i]).DataField=fielname then
begin
TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBLookupCombo then begin
if TwwDBLookupCombo(Controls[i]).DataField=fielname then
begin
TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBEdit then begin
if TDBEdit(Controls[i]).DataField=fielname then
begin
TDBEdit(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TwwDBDateTimePicker then begin
if TwwDBDateTimePicker(Controls[i]).DataField=fielname then
begin
TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBMemo then begin
if TDBMemo(Controls[i]).DataField=fielname then
begin
TDBMemo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TRxDBLookupCombo then begin
if TRxDBLookupCombo(Controls[i]).DataField=fielname then
begin
TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end else if Controls[i] is TDBComboBoxEh then begin
if TDBComboBoxEh(Controls[i]).DataField=fielname then
begin
TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor);
exit;
end;
end;
end;
end;
end;
begin
//±ØÌîÏîÄ¿²»Í¬ÑÕÉ«ÏÔʾ
frm_data_share.t_code_empty.Filtered:=false;
frm_data_share.t_code_empty.Filter:='±í=''t_op_seae_edi''';
frm_data_share.t_code_empty.Filtered:=true;
frm_data_share.t_code_empty.First;
while not frm_data_share.t_code_empty.Eof do
begin
consetcolor(frm_data_share.t_code_empty.fieldbyname('×Ö¶ÎÃû³Æ').asstring);
frm_data_share.t_code_empty.next;
end;
end;
procedure Tfrm_op_seae_edi_data.UpdateInfor;
var
aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('Update t_code_vessel set ´¬²°ºôºÅ=:´¬²°ºôºÅ');
sql.add('where Ó¢ÎÄ´¬Ãû=:Ó¢ÎÄ´¬Ãû');
Parameters.ParamByName('Ó¢ÎÄ´¬Ãû').Value:=t_op_seae.fieldbyname('´¬Ãû').asstring;
Parameters.ParamByName('´¬²°ºôºÅ').Value:=t_op_seae.fieldbyname('´¬²°IMO').asstring;
ExecSQL;
finally
Free;
end;
end;
function Tfrm_op_seae_edi_data.GetStrChar_1(str:String):string;
var
i:integer;
begin
result:='';
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9','.']
then
else
result:=result+str[i];
end;
end;
function Tfrm_op_seae_edi_data.GetStrChar(str:String):string;
var
i:integer;
begin
result:='';
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
then
else
result:=result+str[i];
end;
end;
function Tfrm_op_seae_edi_data.IsZhongwen(Str: String): Boolean;
var
i:Integer;
begin
Result:=false;
if Str='' then Exit;
for i:=1 to Length(Str) do begin
// if Str[i]>Chr(127) then begin
if bytetype(Str[i],1)<>mbsinglebyte then begin
Result:=True;
Exit;
end;
end;
end;
function Tfrm_op_seae_edi_data.GetCtnCode(ctnkind,ctnsize:String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select º£¹ØEDI´úÂë EDI´úÂë from t_code_ctn where ÏäÐÍ='''+ctnkind+''' and ³ß´ç='''+ctnsize+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI´úÂë').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.GetpkgsEdi(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi´úÂë from t_code_package where ´úÂë='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.GetwypkgsEdi(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select ÍâÔË´úÂë from t_code_package where ´úÂë='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('ÍâÔË´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.isEditrue(DataSet:TDataSet): boolean;
var
error:String;
i,c : Integer;
begin
result:=true;
if trim(get_parameters_value(301,''))='' then
begin
result:=false;
if trim(error)='' then
error:='Óû§´úÂë'
else error:=error+#13#10+'Óû§´úÂë';
end;
if trim(get_parameters_value(302,''))='' then
begin
result:=false;
if trim(error)='' then
error:='Óû§´úÂë'
else error:=error+#13#10+'·¢ËÍ·½´úÂë';
end;
if trim(get_parameters_value(303,''))='' then
begin
result:=false;
if trim(error)='' then
error:='Óû§´úÂë'
else error:=error+#13#10+'½ÓÊÜ·½´úÂë';
end;
c:=0;
if bsSkinComboBox1.ItemIndex=3 then
begin
for i:=0 to cxDBCheckListBox1.Count-1 do
begin
if cxDBCheckListBox1.Items[i].Checked then
begin
c:=c+1;
end;
end;
if c<=0 then
begin
if trim(error)='' then
error:='ÐÞ¸ÄÔ­Òò'
else error:=error+#13#10+'ÐÞ¸ÄÔ­Òò';
end
else
if c>4 then
begin
if trim(error)='' then
error:='×î¶àÖ»ÄÜÑ¡Ôñ3¸öÔ­Òò'
else error:=error+#13#10+'×î¶àÖ»ÄÜÑ¡Ôñ3¸öÔ­Òò';
result:=false;
end;
end;
if GetStrChar(DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)<>'' then
begin
result:=false;
if trim(error)='' then
error:='Ö÷Ìáµ¥ºÅÖдæÔÚ·Ç·¨×Ö·û'
else error:=error+#13#10+'Ö÷Ìáµ¥ºÅÖдæÔÚ·Ç·¨×Ö·û';
end;
if GetStrChar(DataSet.fieldbyname('·ÖÌáµ¥ºÅ').asstring)<>'' then
begin
result:=false;
if trim(error)='' then
error:='·ÖÌáµ¥ºÅÖдæÔÚ·Ç·¨×Ö·û'
else error:=error+#13#10+'·ÖÌáµ¥ºÅÖдæÔÚ·Ç·¨×Ö·û';
end;
if GetStrChar_1(DataSet.fieldbyname('ÔËÊ䷽ʽ').asstring)<>'' then
begin
result:=false;
if trim(error)='' then
error:='HS CODE ÖдæÔÚ·Ç·¨×Ö·û'
else error:=error+#13#10+'HS CODE ÖдæÔÚ·Ç·¨×Ö·û';
end;
if DataSet.fieldbyname('´¬²°IMO').AsString='' then
begin
result:=false;
if trim(error)='' then
error:='´¬²°IMO'
else error:=error+#13#10+'´¬²°IMO';
end;
if DataSet.fieldbyname('´¬¹«Ë¾´úÂë').AsString='' then
begin
result:=false;
if trim(error)='' then
error:='´¬¹«Ë¾º£¹Ø´úÂë'
else error:=error+#13#10+'´¬¹«Ë¾º£¹Ø´úÂë';
end;
if trim(DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='Ö÷Ìáµ¥ºÅ'
else error:=error+#13#10+'Ö÷Ìáµ¥ºÅ';
end;
if trim(DataSet.fieldbyname('·¢»õÈËÃû³Æ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='·¢»õÈËÃû³Æ'
else error:=error+#13#10+'·¢»õÈËÃû³Æ';
end;
if trim(DataSet.fieldbyname('·¢»õÈ˵ØÖ·1').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='·¢»õÈ˵ØÖ·1'
else error:=error+#13#10+'·¢»õÈ˵ØÖ·1';
end;
if trim(DataSet.fieldbyname('ÊÕ»õÈËÃû³Æ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='ÊÕ»õÈËÃû³Æ'
else error:=error+#13#10+'ÊÕ»õÈËÃû³Æ';
end;
if trim(DataSet.fieldbyname('ÊÕ»õÈ˵ØÖ·1').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='ÊÕ»õÈ˵ØÖ·1'
else error:=error+#13#10+'ÊÕ»õÈ˵ØÖ·1';
end;
if trim(DataSet.fieldbyname('֪ͨÈËÃû³Æ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='֪ͨÈËÃû³Æ'
else error:=error+#13#10+'֪ͨÈËÃû³Æ';
end;
if trim(DataSet.fieldbyname('֪ͨÈ˵ØÖ·1').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='֪ͨÈ˵ØÖ·1'
else error:=error+#13#10+'֪ͨÈ˵ØÖ·1';
end;
if trim(DataSet.fieldbyname('¸¶·Ñ·½Ê½').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='¸¶·Ñ·½Ê½'
else error:=error+#13#10+'¸¶·Ñ·½Ê½';
end;
if pos(' ', trim(DataSet.fieldbyname('´¬Ãû').asstring))>0 then begin
result:=false;
if trim(error)='' then
error:='´¬Ãû´æÔÚÁ½¸ö¿Õ¸ñ'
else error:=error+#13#10+'´¬Ãû´æÔÚÁ½¸ö¿Õ¸ñ';
end;
if trim(DataSet.fieldbyname('´¬Ãû').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='´¬Ãû'
else error:=error+#13#10+'´¬Ãû';
end;
if trim(DataSet.fieldbyname('º½´Î').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='º½´Î'
else error:=error+#13#10+'º½´Î';
end;
if Length(trim(DataSet.fieldbyname('´¬²°IMO').asstring))<7 then begin
result:=false;
if trim(error)='' then
error:='´¬²°ºôºÅ²»ÄÜСÓÚ7λ'
else error:=error+#13#10+'´¬²°ºôºÅ²»ÄÜСÓÚ7λ';
end;
if trim(DataSet.fieldbyname('×°¸Û´úÂë').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='×°¸Û´úÂë'
else error:=error+#13#10+'×°¸Û´úÂë';
end;
if trim(DataSet.fieldbyname('×°»õ¸Û').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='×°»õ¸Û'
else error:=error+#13#10+'×°»õ¸Û';
end;
if pos('/',trim(DataSet.fieldbyname('×°¸Û´úÂë').asstring))<=0 then begin
result:=false;
if trim(error)='' then
error:='×°¸Û´úÂë´úÂëÖбØÐëÓÐ "/" '
else error:=error+#13#10+'×°¸Û´úÂë´úÂëÖбØÐëÓÐ "/" ';
end;
if trim(DataSet.fieldbyname('¿ª´¬ÈÕÆÚ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='¿ª´¬ÈÕÆÚ'
else error:=error+#13#10+'¿ª´¬ÈÕÆÚ';
end;
if trim(DataSet.fieldbyname('Ô¤µÖÈÕÆÚ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='Ô¤µÖÈÕÆÚ'
else error:=error+#13#10+'Ô¤µÖÈÕÆÚ';
end;
if trim(DataSet.fieldbyname('ж»õ´úÂë').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='ж»õ´úÂë'
else error:=error+#13#10+'ж»õ´úÂë';
end;
if trim(DataSet.fieldbyname('Ä¿µÄ´úÂë').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='Ä¿µÄ´úÂë'
else error:=error+#13#10+'Ä¿µÄ´úÂë';
end;
if trim(DataSet.fieldbyname('Ä¿µÄµØ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='Ä¿µÄµØ'
else error:=error+#13#10+'Ä¿µÄµØ';
end;
if trim(DataSet.fieldbyname('Ç©µ¥µØµã').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='Ç©µ¥µØµã'
else error:=error+#13#10+'Ç©µ¥µØµã';
end;
if trim(GetpkgsEdi(DataSet.fieldbyname('°ü×°').asstring))='' then begin
result:=false;
if trim(error)='' then
error:='°ü×°´úÂë'
else error:=error+#13#10+'°ü×°´úÂë';
end;
if Length(trim(GetpkgsEdi(DataSet.fieldbyname('°ü×°').asstring)))<>2 then begin
result:=false;
if trim(error)='' then
error:='°ü×°´úÂëÖ»ÄÜÊÇÁ½Î»´úÂë'
else error:=error+#13#10+'°ü×°´úÂëÖ»ÄÜÊÇÁ½Î»´úÂë';
end;
if trim(DataSet.fieldbyname('»õÎïÃèÊö').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='»õÎïÃèÊö'
else error:=error+#13#10+'»õÎïÃèÊö';
end;
if trim(DataSet.fieldbyname('ßéÍ·').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='ßéÍ·'
else error:=error+#13#10+'ßéÍ·';
end;
if DataSet.fieldbyname('¼þÊý').asinteger=0 then begin
result:=false;
if trim(error)='' then
error:='¼þÊý'
else error:=error+#13#10+'¼þÊý';
end;
if DataSet.fieldbyname('ÖØÁ¿').asFloat=0 then begin
result:=false;
if trim(error)='' then
error:='ÖØÁ¿'
else error:=error+#13#10+'ÖØÁ¿';
end;
if DataSet.fieldbyname('³ßÂë').asFloat=0 then begin
result:=false;
if trim(error)='' then
error:='³ßÂë'
else error:=error+#13#10+'³ßÂë';
end;
if trim(DataSet.fieldbyname('»õÎï±êʶ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='»õÎï±êʶ'
else error:=error+#13#10+'»õÎï±êʶ';
end;
if trim(DataSet.FieldByName('»õÎï±êʶ').asstring)='D' then
begin
if Trim(DataSet.fieldbyname('ΣÏÕÆ··ÖÀà').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='ΣÏÕÆ··ÖÀà'
else error:=error+#13#10+'ΣÏÕÆ··ÖÀà';
end;
if Trim(DataSet.fieldbyname('ΣÏÕÆ·±àºÅ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='ΣÏÕÆ·±àºÅ'
else error:=error+#13#10+'ΣÏÕÆ·±àºÅ';
end;
if GetStrNum(Trim(DataSet.fieldbyname('ΣÏÕÆ·±àºÅ').asstring))<>4 then begin
result:=false;
MessageDlg('ΣÏÕÆ·±àºÅ±ØÐëÊÇ4λÊý×Ö',mtWarning,[mbOk],0);
if trim(error)='' then
error:='ΣÏÕÆ·±àºÅ±ØÐëÊÇ4λÊý×Ö'
else error:=error+#13#10+'ΣÏÕÆ·±àºÅ±ØÐëÊÇ4λÊý×Ö';
end;
end;
if trim(DataSet.FieldByName('»õÎï±êʶ').asstring)='R' then
begin
if Trim(DataSet.fieldbyname('ÉèÖÃζÈ').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='ÉèÖÃζÈ'
else error:=error+#13#10+'ÉèÖÃζÈ';
end;
end;
t_op_ctn.close;
t_op_ctn.Parameters.ParamByName('񅧏').Value:=DataSet.fieldbyname('񅧏').asstring;
t_op_ctn.open;
if t_op_ctn.IsEmpty then begin
result:=false;
MessageDlg('¼¯×°Ïä²»ÄÜΪ¿Õ',mtWarning,[mbOk],0);
end;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if Trim(t_op_ctn.fieldbyname('ÏäºÅ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='ÏäºÅ'
else error:=error+#13#10+'ÏäºÅ';
end;
if Trim(t_op_ctn.fieldbyname('·âºÅ').asstring)='' then begin
result:=false;
if trim(error)='' then
error:='·âºÅ'
else error:=error+#13#10+'·âºÅ';
end;
if trim(GetpkgsEdi(t_op_ctn.fieldbyname('°ü×°').asstring))='' then begin
result:=false;
if trim(error)='' then
error:='°ü×°´úÂë'
else error:=error+#13#10+'°ü×°´úÂë';
end;
if Length(trim(GetpkgsEdi(t_op_ctn.fieldbyname('°ü×°').asstring)))<>2 then
begin
result:=false;
if trim(error)='' then
error:='°ü×°´úÂëÖ»ÄÜÊÇÁ½Î»´úÂë'
else error:=error+#13#10+'°ü×°´úÂëÖ»ÄÜÊÇÁ½Î»´úÂë';
end;
if t_op_ctn.fieldbyname('¼þÊý').asinteger=0 then begin
result:=false;
if trim(error)='' then
error:='¼þÊý'
else error:=error+#13#10+'¼þÊý';
end;
if t_op_ctn.fieldbyname('ÖØÁ¿').asFloat=0 then begin
result:=false;
if trim(error)='' then
error:='ÖØÁ¿'
else error:=error+#13#10+'ÖØÁ¿';
end;
if t_op_ctn.fieldbyname('³ßÂë').asFloat=0 then begin
result:=false;
if trim(error)='' then
error:='³ßÂë'
else error:=error+#13#10+'³ßÂë';
end;
if GetCtnCode(t_op_ctn.fieldbyname('ÏäÐÍ').asstring,t_op_ctn.fieldbyname('³ß´ç').asstring)='' then
begin
result:=false;
if trim(error)='' then
error:='¼¯×°ÏäEdi´úÂë'
else error:=error+#13#10+'¼¯×°ÏäEdi´úÂë';
end;
t_op_ctn.Next;
end;
if iszhongwen(dataset.fieldbyname('ßéÍ·').AsString) then begin
result:=false;
MessageDlg('ßéÍ·²»ÄÜÓÐÖÐÎÄ×Ö·û£¡',mtWarning,[mbOk],0);
end;
if iszhongwen(dataset.fieldbyname('»õÎïÃèÊö').AsString) then begin
result:=false;
MessageDlg('»õÎïÃèÊö²»ÄÜÓÐÖÐÎÄ×Ö·û£¡',mtWarning,[mbOk],0);
end;
if trim(error)<>'' then
ShowMessage(error+#13#10+'²»ÄÜΪ¿Õ');
end;
function Tfrm_op_seae_edi_data.CreateSIEdiFile_XML:TStrings;
var
str:Tstringlist;
i,j,k,l,Count:integer;
strsql,strRmain:string;
rs:Tadoquery;
wide_str:widestring;
inifile1:Tinifile;
strType,XType,TransType:string;
strDatetime,IMO:string;
SenderCode,ReciverCode:string;
alist,alisttemp:TStringList;
begin
if not isEditrue(frm_op_seae_edi_data.t_op_seae) then
begin
Exit;
end;
SenderCode:=trim(get_parameters_value(302,'')) ;
ReciverCode:=trim(get_parameters_value(303,'')) ;
if bsSkinComboBox1.ItemIndex=0 then
strType:='9'
else if bsSkinComboBox1.ItemIndex=1 then
strType:='2'
else if bsSkinComboBox1.ItemIndex=2 then
strType:='3'
else if bsSkinComboBox1.ItemIndex=3 then
strType:='5'
else if bsSkinComboBox1.ItemIndex=4 then
strType:='0'
else if bsSkinComboBox1.ItemIndex=5 then
strType:='11'
else strType:='9';
if bsSkinComboBox1.ItemIndex<>2 then
begin
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('<?xml version="1.0" encoding="UTF-8" standalone="no"?>');
// str.Add('<?xml version="1.0" encoding="utf-8" ?>');
str.Add('<Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT2101:1">');
str.Add('<Head>');
//<!--±¨ÎıàºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<MessageID>'+SenderCode+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)+GetDatetime(datetimetostr(now),3)+IntToStr(GetTickCount)+'</MessageID>');
//<!--±¨ÎŦÄÜ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<FunctionCode>'+strType+'</FunctionCode>');
//<!--±¨ÎÄÀàÐÍ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<MessageType>MT2101</MessageType>');
// <!--·¢ËÍ·½´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<SenderID>'+SenderCode+'</SenderID>');
//<!--½ÓÊÜ·½´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ReceiverID>'+ReciverCode+'</ReceiverID>');
//<!--·¢ËÍʱ¼ä£¨Ñ­»·´ÎÊý£º1£©²ÉÓþ«È·µ½ºÁÃëµÄʱ¼ä¸ñʽ£¬¸ñʽΪCCYYMMDDHHmmssfff-->
str.Add('<SendTime>'+GetDatetime(datetimetostr(now),4)+'</SendTime>');
//<!--±¨ÎÄ°æ±¾ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Version>1.0</Version>');
str.Add('</Head>');
// <!--±¨ÎÄÌ壨ѭ»·´ÎÊý£º1£©-->
str.Add('<Declaration>');
// <!--²Õµ¥´«ÊäÈËÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<RepresentativePerson>');
// <!--256 Representative person name ²Õµ¥´«ÊäÈËÃû³Æ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Name>'+SenderCode+'</Name>');
str.Add('</RepresentativePerson>');
// <!--ÔËÊ乤¾ßÀë¾³µØº£¹ØÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ExitCustomsOffice>');
// <!--ÔËÊ乤¾ßÀë¾³µØº£¹Ø´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)+'</ID>');
str.Add('</ExitCustomsOffice>');
// <!--ÔËÊ乤¾ß´úÀíÆóÒµÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Agent>');
// <!--ÔËÊ乤¾ß´úÀíÆóÒµ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ID>'+SenderCode+'</ID>');
str.Add('</Agent>');
// <!--³ÐÔËÈËÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Carrier>');
// <!--³ÐÔËÈË´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ID>'+frm_op_seae_edi_data.t_op_seae.fieldbyname('´¬¹«Ë¾´úÂë').AsString+'</ID>');
str.Add('</Carrier>');
// <!--ÔËÊ乤¾ßÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<BorderTransportMeans>');
// <!--º½´Îº½°à±àºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<JourneyID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('º½´Î').asstring)+'</JourneyID>');
// <!--ÔËÊ䷽ʽ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<TypeCode>1</TypeCode>');
// <!--ÔËÊ乤¾ß´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('´¬²°IMO').asstring)+'</ID>');
// <!--ÔËÊ乤¾ßÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Name>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('´¬Ãû').AsString)+'</Name>');
// <!--ÔËÊ乤¾ßµÖ´ï¹Ø¾³ÄÚµÚÒ»¸öÄ¿µÄ¸Û´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<FirstArrivalLocationID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж»õ´úÂë').asstring)+'</FirstArrivalLocationID>');
// <!--ÔËÊ乤¾ßµÖ´ï¹Ø¾³ÄÚµÚÒ»¸öÄ¿µÄ¸ÛµÄÈÕÆÚºÍʱ¼ä£¨CCYYMMDDhhmmss£©£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<ArrivalDateTime>'+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').asstring,1)+'086'+'</ArrivalDateTime>');
//<!--ÔËÊ乤¾ßÆôÔËÈÕÆÚºÍʱ¼ä£¨CCYYMMDDhhmmss£©£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<DepartureDateTime>'+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ô¤µÖÈÕÆÚ').asstring,1)+'086'+'</DepartureDateTime>');
str.Add('</BorderTransportMeans>');
//<!--ÌᣨÔË£©µ¥Êý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1-9999£©-->
str.Add('<Consignment>');
// <!--ÔËÊäºÏͬÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<TransportContractDocument>');
//<!--×ÜÌᣨÔË£©µ¥ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)+'</ID>');
// <!--¸ü¸ÄÔ­Òò´úÂ루ѭ»·´ÎÊý£º0-3£©-->
if bsSkinComboBox1.ItemIndex=3 then
begin
for i:=0 to cxDBCheckListBox1.Count-1 do
begin
if cxDBCheckListBox1.Items[i].Checked then
begin
str.Add('<ChangeReasonCode>'+COPY(cxDBCheckListBox1.Items[i].Text,1,Pos(':',cxDBCheckListBox1.Items[i].Text)-1)+'</ChangeReasonCode>');
end;
end;
end;
if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)) >0 then
xtype := 'PP'
else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('¸¶·Ñ·½Ê½').asstring)) >0 then
xtype := 'CC'
else xtype := 'PP';
if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='CY-CY' then
TransType:='10'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-DOOR' then
TransType:='27'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='DOOR-PIER' then
TransType:='28'
else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊäÌõ¿î').asstring)='PIER-DOOR' then
TransType:='29'
else TransType:='10'; // PIER TO PIER
// <!--ÔËÊäÌõ¿î´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ConditionCode>'+TransType+'</ConditionCode>');
//<!--Æ´ÏäÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
{
str.Add('<Consolidator>');
// <!--Æ´ÏäÈË´úÂ루ѭ»·´ÎÊý£º1)-->
str.Add('<ID></ID>');
str.Add('</Consolidator>');
}
str.Add('</TransportContractDocument>');
// <!--ÔËÊäºÏͬ¸½¼ÓÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
{
if trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring)<>'' then
begin
str.Add('<AssociatedTransportDocument>');
//<!--·ÖÌᣨÔË£©µ¥ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring)+'</ID>');
str.Add('</AssociatedTransportDocument>');
end
else
begin
end;
}
//<!--»õÎïÌå»ý£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<GrossVolumeMeasure>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('³ßÂë').asstring)+'</GrossVolumeMeasure>');
// <!--CurrencyTypeCodeµÄÖµÊǽð¶îÀàÐÍ´úÂ룬 ValueAmountµÄÖµÊÇ»õÎï¼ÛÖµ £¨Ñ­»·´ÎÊý£º0-1£©-->
// str.Add('<ValueAmount CurrencyTypeCode="CNY"></ValueAmount>');
// <!--×°»õµØÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<LoadingLocation>');
//<!--×°»õµØ´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('×°¸Û´úÂë').asstring)+'</ID>');
// <!--»õÎï×°ÔØÔËÊ乤¾ßʱ¼ä£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<LoadingDate>'+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').asstring,1)+'086'+'</LoadingDate>');
str.Add('</LoadingLocation>');
// <!--ж»õµØÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<UnloadingLocation>');
// <!--ж»õµØ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ж»õ´úÂë').asstring)+'</ID>');
// <!--µ½´ïж»õµØÈÕÆÚ(CCYYMMDD)£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<ArrivalDate>'+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ô¤µÖÈÕÆÚ').asstring,0)+'</ArrivalDate>');
str.Add('</UnloadingLocation>');
// <!--ÊÕ»õµØÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<GoodsReceiptPlace>');
// <!--ÊÕ»õµØµã´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ä¿µÄ´úÂë').asstring)+'</ID>');
// <!--ÊÕ»õµØµãÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Name>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ä¿µÄµØ').asstring)+'</Name>');
str.Add('</GoodsReceiptPlace>');
{
// <!--ÖÐתµØÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<TranshipmentLocation>');
// <!--ÖÐתµØµã´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ID></ID>);
str.Add('</TranshipmentLocation>')
<!--ÖÐתĿµÄµØÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<TransitDestination>
<!--ÖÐתĿµÄµØ´úÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
</TransitDestination>
<!--;¾­¹ú¼Ò´úÂ루ѭ»·´ÎÊý£º0-99£©-->
<RoutingCountryCode></RoutingCountryCode>
<!--»õÎïÍÐÔ˵ØÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<GoodsConsignedPlace>
<!--»õÎïÍÐÔ˵ĵصã»òÕß¹ú¼Ò´úÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
</GoodsConsignedPlace>
<!--»õÎﺣ¹Ø״̬´úÂ루ѭ»·´ÎÊý£º0-99£©-->
<CustomsStatusCode></CustomsStatusCode>
<!--³ÐÔËÈË»õÎï·ÖÅúµ½/·¢»õ±êʶ£¨Ñ­»·´ÎÊý£º0-1£©-->
<TransportSplitIndicator></TransportSplitIndicator>
}
// <!--ÔË·ÑÖ§¸¶ÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<FreightPayment>');
//<!--ÔË·ÑÖ§¸¶·½·¨´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<MethodCode>'+xtype+'</MethodCode>');
str.Add('</FreightPayment>');
//<!--»õÎï×ܼþÊý/°ü×°ÖÖÀà´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ConsignmentPackaging>');
// <!--»õÎï×ܼþÊý£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<QuantityQuantity>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('¼þÊý').asstring)+'</QuantityQuantity>');
// <!--°ü×°ÖÖÀà´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<TypeCode>'+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('°ü×°').asstring))+'</TypeCode>');
str.Add('</ConsignmentPackaging>');
// <!--»õÎï×ÜëÖØ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<TotalGrossMassMeasure>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÖØÁ¿').asstring)+'</TotalGrossMassMeasure>');
{
<!--Ç°Ò»º£¹Øµ¥Ö¤ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<PreviousCustomsDocument>
<!--Ç°Ò»º£¹Øµ¥Ö¤ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
<ID></ID>
<!--Ç°Ò»º£¹Øµ¥Ö¤ÀàÐÍ´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeCode></TypeCode>
</PreviousCustomsDocument>
<!--»õÎï½»¸¶ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<DeliveryDestination>
<!--»õÎï½»¸¶Ä¿µÄµØµØÖ·£¨½ÖµÀ,ÓÊÏ䣩£¨Ñ­»·´ÎÊý£º1£©-->
<Line></Line>
<!--³ÇÊÐÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CityName></CityName>
<!--Ê¡·Ý´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountrySubEntityID></CountrySubEntityID>
<!--Ê¡·ÝÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CountrySubEntityName></CountrySubEntityName>
<!--ÓÊÕþ±àÂ루ѭ»·´ÎÊý£º0-1£©-->
<PostcodeID></PostcodeID>
<!--¹ú¼Ò´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountryCode></CountryCode>
</DeliveryDestination>
<!--ÂëÍ·×÷ÒµÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<Handling>
<!--ÂëÍ·×÷ÒµÖ¸Áî´úÂ루ѭ»·´ÎÊý£º1£©-->
<InstructionsCodeCode></InstructionsCodeCode>
</Handling>
<!--Öмä³ÐÔËÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<IntermediateCarrier>
<!--Öмä³ÐÔËÈ˱êʶ£¨Ñ­»·´ÎÊý£º0-1£©-->
<ID></ID>
<!--Öмä³ÐÔËÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
<Communication>
<!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
<!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeID></TypeID>
</Communication>
</IntermediateCarrier>
}
//<!--ÊÕ»õÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Consignee>');
//<!--ÊÕ»õÈË´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈËÆóÒµ´úÂë').AsString))+'</ID>');
//<!--ÊÕ»õÈËÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Name>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString))+'</Name>');
//<!--ÊÕ»õÈ˵ØÖ·ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Address>');
//<!--ÏêϸµØÖ·£¨½ÖµÀ,ÓÊÏ䣩£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Line>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString))+'</Line>');
{
<!--³ÇÊÐÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CityName></CityName>
<!--Ê¡·Ý´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountrySubEntityID></CountrySubEntityID>
<!--Ê¡·ÝÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CountrySubEntityName></CountrySubEntityName>
<!--ÓÊÕþ±àÂ루ѭ»·´ÎÊý£º0-1£©-->
<PostcodeID></PostcodeID>
}
str.Add('<CountryCode>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString))+'</CountryCode>');
str.Add('</Address>');
if (frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString<>'') or (frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈËÓÊÏä').AsString<>'') then begin
// <!--Öмä³ÐÔËÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
str.Add('<Communication>');
// <!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
if (frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString<>'') then begin
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString))+'</ID>');
// <!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<TypeID>TE</TypeID>');
end else begin
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÊÕ»õÈËÓÊÏä').AsString))+'</ID>');
// <!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<TypeID>FX</TypeID>');
end;
str.Add('</Communication>');
end;
{
<!--ÊÕ»õ¾ßÌåÁªÏµÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<Contact>
<!--¾ßÌåÁªÏµÈËÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<Name></Name>
<Communication>
<!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
<!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeID></TypeID>
</Communication>
</Contact>
}
str.Add('</Consignee>');
// <!--·¢»õÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Consignor>');
//<!--·¢»õÈË´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈËÆóÒµ´úÂë').AsString))+'</ID>');
//<!--·¢»õÈËÃû³Æ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Name>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈËÃû³Æ').AsString))+'</Name>');
//<!--·¢»õÈ˵ØÖ·ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Address>');
//<!--ÏêϸµØÖ·£¨½ÖµÀ,ÓÊÏ䣩£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Line>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·1').AsString)+'</Line>');
{
<!--³ÇÊÐÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CityName></CityName>
<!--Ê¡·Ý´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountrySubEntityID></CountrySubEntityID>
<!--Ê¡·ÝÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CountrySubEntityName></CountrySubEntityName>
<!--ÓÊÕþ±àÂ루ѭ»·´ÎÊý£º0-1£©-->
<PostcodeID></PostcodeID>
<!--¹ú¼Ò´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountryCode></CountryCode>
}
str.Add('</Address>');
{
<!--·¢»õÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
<Communication>
<!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
<!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeID></TypeID>
</Communication>
}
if (frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString<>'') or (frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈËÓÊÏä').AsString<>'') then begin
// <!--Öмä³ÐÔËÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
str.Add('<Communication>');
// <!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
if (frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString<>'') then begin
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString))+'</ID>');
// <!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<TypeID>TE</TypeID>');
end else begin
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('·¢»õÈËÓÊÏä').AsString))+'</ID>');
// <!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<TypeID>FX</TypeID>');
end;
str.Add('</Communication>');
end;
str.Add('</Consignor>');
//<!--֪ͨÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<NotifyParty>');
//<!--֪ͨÈË´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨÈËÆóÒµ´úÂë').AsString))+'</ID>');
//<!--֪ͨÈËÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Name>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString))+'</Name>');
//<!--֪ͨÈ˵ØÖ·ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<Address>');
// <!--ÏêϸµØÖ·£¨½ÖµÀ,ÓÊÏ䣩£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Line>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString))+'</Line>');
{
<!--³ÇÊÐÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CityName></CityName>
<!--Ê¡·Ý´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountrySubEntityID></CountrySubEntityID>
<!--Ê¡·ÝÃû³Æ£¨Ñ­»·´ÎÊý£º0-1£©-->
<CountrySubEntityName></CountrySubEntityName>
<!--ÓÊÕþ±àÂ루ѭ»·´ÎÊý£º0-1£©-->
<PostcodeID></PostcodeID>
<!--¹ú¼Ò´úÂ루ѭ»·´ÎÊý£º0-1£©-->
<CountryCode></CountryCode>
}
str.Add('<CountryCode>'+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString))+'</CountryCode>');
str.Add('</Address>');
{
<!--֪ͨÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
<Communication>
<!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
<!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeID></TypeID>
</Communication>
}
str.Add('</NotifyParty>');
{
<!--ΣÏÕÆ·ÁªÏµÈËÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
<UNDGContact>
<!--ΣÏÕÆ·ÁªÏµÈËÐÕÃû£¨Ñ­»·´ÎÊý£º0£©-->
<Name></Name>
<!--ΣÏÕÆ·ÁªÏµÈËͨѶ·½Ê½ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-3£©-->
<Communication>
<!--ͨѶ·½Ê½ºÅÂ루ѭ»·´ÎÊý£º1£©-->
<ID></ID>
<!--ͨѶ·½Ê½Àà±ð´úÂ루ѭ»·´ÎÊý£º1£©-->
<TypeID></TypeID>
</Communication>
</UNDGContact>
}
strsql:='select * from t_op_ctn_edi '
+'WHERE 񅧏='
+#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('񅧏').asstring+#39;
try
rs:=CreateAdoQuery;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
if not rs.IsEmpty then begin
rs.First;
while not rs.Eof do
begin
// <!--¼¯×°Ï䣨Æ÷£©ÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-9999£©-->
str.Add('<TransportEquipment>');
// <!--¼¯×°Ï䣨Æ÷£©±àºÅÐÅÏ¢£¨Ñ­»·´ÎÊý£º1)-->
str.Add('<EquipmentIdentification>');
// <!-- ¼¯×°Ï䣨Æ÷£©±àºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID>'+rs.fieldbyname('ÏäºÅ').asstring+'</ID>');
str.Add('</EquipmentIdentification>');
// <!--¼¯×°Ï䣨Æ÷£©³ß´çºÍÀàÐÍ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<CharacteristicCode>'+GetCtnCode(rs.fieldbyname('ÏäÐÍ').asstring,rs.fieldbyname('³ß´ç').asstring)+'</CharacteristicCode>');
//<!--¼¯×°Ï䣨Æ÷£©À´Ô´´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<SupplierPartyTypeCode>2</SupplierPartyTypeCode>');
//<!--ÖØÏä»òÕß¿ÕÏä±êʶ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<FullnessCode>5</FullnessCode>');
// <!--SealIDµÄÖµÊÇ·âÖ¾ÀàÐÍ/ºÅÂë,AgencyCodeµÄÖµÊÇÊ©¼Ó·âÖ¾ÈËÀàÐÍ£¨Ñ­»·´ÎÊý£º0-9£©-->
str.Add('<SealID AgencyCode="CA">M/'+trim(rs.fieldbyname('·âºÅ').asstring)+'</SealID>');
str.Add('</TransportEquipment>');
rs.Next;
end;
end;
rs.Close;
rs.Destroy;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
k:=1;
alist:=TStringList.Create;
alisttemp:=TStringList.Create;
strsql:='select * from t_op_ctn_edi '
+'WHERE 񅧏='
+#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('񅧏').asstring+#39;
try
rs:=CreateAdoQuery;
rs.sql.clear;
rs.sql.add(strsql);
rs.Open;
rs.First;
if not rs.IsEmpty then begin
rs.First;
while not rs.Eof do
begin
//<!--ÉÌÆ·ÏîÐÅÏ¢£¨Ñ­»·´ÎÊý£º1-999£©-->
str.Add('<ConsignmentItem>');
//<!--ÉÌÆ·ÏîÐòºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<SequenceNumeric>'+inttostr(k)+'</SequenceNumeric>');
//<!--ÉÌÆ·Ïî°ü×°ÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ConsignmentItemPackaging>');
// <!--ÉÌÆ·Ïî»õÎï¼þÊý£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<QuantityQuantity>'+trim(IntToStr(rs.fieldbyname('¼þÊý').AsInteger))+'</QuantityQuantity>');
// <!--°ü×°ÖÖÀà´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<TypeCode>'+trim(GetpkgsEdi(rs.fieldbyname('°ü×°').asstring)) +'</TypeCode>');
alist.text:='';
if trim(rs.fieldbyname('ßéÍ·').asstring)<>'' then
alist.text:=trim(rs.fieldbyname('ßéÍ·').asstring)
else alist.text:=trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ßéÍ·').asstring);
alisttemp.Clear;
for l:=0 to alist.Count-1 do
begin
alisttemp.Add(formatAfrstr(alist[l]));
end;
// <!--ßéÍ·£¨Ñ­»·´ÎÊý£º0-1£©-->
str.Add('<MarksNumbers>'+alisttemp.text+'</MarksNumbers>');
str.Add('</ConsignmentItemPackaging>');
alist.text:='';
if trim(rs.fieldbyname('»õÃè').asstring)<>'' then
alist.text:=trim(rs.fieldbyname('»õÃè').asstring)
else alist.text:=trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('»õÎïÃèÊö').asstring);
alisttemp.Clear;
for l:=0 to alist.Count-1 do
begin
alisttemp.Add(formatAfrstr(alist[l]));
end;
//<!--ÉÌÆ·Ïî¼òÒªÃèÊö£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Commodity>');
//<!--ÉÌÆ·Ïî¼òÒªÃèÊö£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<CargoDescription>'+alisttemp.text+'</CargoDescription>');
//<!--ΣÏÕÆ·±àºÅ£¨Ñ­»·´ÎÊý£º0-1£©-->
if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('»õÎï±êʶ').asstring)='D' then
begin
str.Add('<UNDGCode>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring)+'</UNDGCode>');
end;
//<!--º£¹ØË°Ôò±àºÅ£¨Ñ­»·´ÎÊý£º0-1£©-->
if trim(rs.fieldbyname('HTSºÅ').asstring)<>'' then
str.Add('<TariffClassificationCode>'+rs.fieldbyname('HTSºÅ').asstring+'</TariffClassificationCode>')
else
begin
if trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊ䷽ʽ').asstring)<>'' then
str.Add('<TariffClassificationCode>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('ÔËÊ䷽ʽ').asstring)+'</TariffClassificationCode>');
end;
str.Add('</Commodity>');
//<!--ÉÌÆ·Ïî²¹³äÃèÊö£¨Ñ­»·´ÎÊý£º0-1£©-->
{
str.Add('<AdditionalInformation>');
// <!--±¸×¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Content></Content>');
str.Add('</AdditionalInformation>');
}
//<!--ÉÌÆ·Ïî»õÎïëÖØ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<GoodsMeasure>');
// <!--ÉÌÆ·Ïî»õÎïëÖØ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<GrossMassMeasure>'+trim(FloatToStr(rs.fieldbyname('ÖØÁ¿').AsFloat))+'</GrossMassMeasure>');
str.Add('</GoodsMeasure>');
// <!--¼¯×°Ï䣨Æ÷£©±àºÅÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-9999£©-->
str.Add('<EquipmentIdentification>');
// <!--¼¯×°Ï䣨Æ÷£©±àºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(rs.fieldbyname('ÏäºÅ').asstring)+'</ID>');
str.Add('</EquipmentIdentification>');
// <!--º£¹ØÊÖÐøÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
{
str.Add('<CustomsProcedure>');
// <!--º£¹ØÊÖÐø´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<CurrentCode></CurrentCode>');
str.Add('</CustomsProcedure>');
}
{
//<!--ΨһÍÐÔ˱àºÅ£¨Ñ­»·´ÎÊý£º0-99£©-->
str.Add('<UCR>');
//<!--ΨһÍÐÔ˱àºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID></ID>');
str.Add('</UCR>');
}
//<!--Ô­²ú¹úÐÅÏ¢£¨Ñ­»·´ÎÊý£º0-1£©-->
{
str.Add('<Origin>');
//<!--Ô­²ú¹ú´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<OriginCountryCode></OriginCountryCode>');
str.Add('</Origin>');
}
str.Add('</ConsignmentItem>');
k:=k+1;
rs.Next;
end;
end;
rs.Close;
rs.Destroy;
alist.Free;
alisttemp.Free;
except
on e:exception do
begin
rs.Close;
rs.Destroy;
exit;
end;
end;
str.Add('</Consignment>');
//<!--±¸×¢£¨Ñ­»·´ÎÊý£º0-1£©-->
{
str.Add('<AdditionalInformation>');
//<!--±¸×¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Content></Content>');
str.Add('</AdditionalInformation>');
}
str.Add('</Declaration>');
str.Add('</Manifest>');
frm_op_seae_edi_data.t_op_seae.Edit;
frm_op_seae_edi_data.t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
frm_op_seae_edi_data.t_op_seae.Post;
end
end
else
begin
if frm_op_seae_edi_data.dxdbgrid1.SelectedCount<=1 then
begin
str:=Tstringlist.Create;
str.Clear;
str.Add('<?xml version="1.0" encoding="UTF-8" standalone="no"?>');
// str.Add('<?xml version="1.0" encoding="utf-8" ?>');
str.Add('<Manifest xmlns="urn:Declaration:datamodel:standard:CN:MT2101:1">');
str.Add('<Head>');
//<!--±¨ÎıàºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<MessageID>'+SenderCode+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)+GetDatetime(datetimetostr(now),3)+IntToStr(GetTickCount)+'</MessageID>');
//<!--±¨ÎŦÄÜ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<FunctionCode>'+strType+'</FunctionCode>');
//<!--±¨ÎÄÀàÐÍ´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<MessageType>MT2101</MessageType>');
// <!--·¢ËÍ·½´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<SenderID>'+SenderCode+'</SenderID>');
//<!--½ÓÊÜ·½´úÂ루ѭ»·´ÎÊý£º1£©-->
str.Add('<ReceiverID>'+ReciverCode+'</ReceiverID>');
//<!--·¢ËÍʱ¼ä£¨Ñ­»·´ÎÊý£º1£©²ÉÓþ«È·µ½ºÁÃëµÄʱ¼ä¸ñʽ£¬¸ñʽΪCCYYMMDDHHmmssfff-->
str.Add('<SendTime>'+GetDatetime(datetimetostr(now),4)+'</SendTime>');
//<!--±¨ÎÄ°æ±¾ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Version>1.0</Version>');
str.Add('</Head>');
// <!--±¨ÎÄÌ壨ѭ»·´ÎÊý£º1£©-->
str.Add('<Declaration>');
// <!--²Õµ¥´«ÊäÈËÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<RepresentativePerson>');
// <!--256 Representative person name ²Õµ¥´«ÊäÈËÃû³Æ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<Name>'+SenderCode+'</Name>');
str.Add('</RepresentativePerson>');
// <!--ÔËÊ乤¾ßÊý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<BorderTransportMeans>');
// <!--º½´Îº½°à±àºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<JourneyID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('º½´Î').asstring)+'</JourneyID>');
// <!--ÔËÊ乤¾ß´úÂ루ѭ»·´ÎÊý£º0-1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('´¬²°IMO').asstring)+'</ID>');
str.Add('</BorderTransportMeans>');
//<!--ÌᣨÔË£©µ¥Êý¾Ý¶Î£¨Ñ­»·´ÎÊý£º1-9999£©-->
str.Add('<Consignment>');
// <!--ÔËÊäºÏͬÐÅÏ¢£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<TransportContractDocument>');
//<!--×ÜÌᣨÔË£©µ¥ºÅ£¨Ñ­»·´ÎÊý£º1£©-->
str.Add('<ID>'+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring)+'</ID>');
// <!--¸ü¸ÄÔ­Òò´úÂ루ѭ»·´ÎÊý£º0-3£©-->
if (bsSkinComboBox1.ItemIndex=2) then
begin
for i:=0 to cxDBCheckListBox1.Count-1 do
begin
if cxDBCheckListBox1.Items[i].Checked then
begin
str.Add('<ChangeReasonCode>'+COPY(cxDBCheckListBox1.Items[i].Text,1,Pos(':',cxDBCheckListBox1.Items[i].Text)-1)+'</ChangeReasonCode>');
end;
end;
end;
str.Add('</TransportContractDocument>');
str.Add('</Consignment>');
str.Add('</Declaration>');
str.Add('</Manifest>');
frm_op_seae_edi_data.t_op_seae.Edit;
frm_op_seae_edi_data.t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
frm_op_seae_edi_data.t_op_seae.Post;
end;
end;
Result:=str;
end;
procedure Tfrm_op_seae_edi_data.getwebservice_ds;
begin
try
mHttpRIO_ds:=THTTPRIO.Create(nil);
mHttpRIO_ds.WSDLLocation:='http://122.4.79.84:8090/webservice/DsWebService.asmx?WSDL';
mHttpRIO_ds.URL:='http://122.4.79.84:8090/webservice/DsWebService.asmx';
mHttpRIO_ds.Port:='DsWebServiceSoap';
mHttpRIO_ds.Service:='DsWebService';
mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
{ mHttpRIO_ds:=THTTPRIO.Create(nil);
mHttpRIO_ds.WSDLLocation:='http://221.3.83.5:8090/webservice/DsWebService.asmx?WSDL';
mHttpRIO_ds.URL:='http://221.3.83.5:8090/webservice/DsWebService.asmx';
mHttpRIO_ds.Port:='DsWebServiceSoap';
mHttpRIO_ds.Service:='DsWebService';
mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true;
mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap;
InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
}
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.UpdateCTN(BSNO:STRING);
var
aAdoQuery:TAdoQuery;
p:Integer;
w,c:Double;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select sum(¼þÊý) ¼þÊý, sum(ÖØÁ¿) ÖØÁ¿,sum(³ßÂë) ³ßÂë from t_op_ctn_edi');
sql.add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=BSNO;
open;First;
if not IsEmpty then
begin
t_op_seae.Edit;
p:=FieldByName('¼þÊý').AsInteger;
w:=FieldByName('ÖØÁ¿').AsFloat;
c:=FieldByName('³ßÂë').AsFloat;
t_op_seae.Post;
close; sql.clear;
sql.add('Update t_op_seae_edi set ¼þÊý=:¼þÊý, ÖØÁ¿=:ÖØÁ¿,³ßÂë=:³ßÂë');
sql.add('where 񅧏=:񅧏');
Parameters.ParamByName('¼þÊý').Value:=p;
Parameters.ParamByName('ÖØÁ¿').Value:=w;
Parameters.ParamByName('³ßÂë').Value:=c;
Parameters.ParamByName('񅧏').Value:=BSNO;
ExecSQL;
end;
finally
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_edi_data.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
if hThread>0 then TerminateThread(hThread,0);
frm_op_seae_edi_data.Hide;
frm_op_seae_edi_data.ManualFloat(frm_op_seae_edi_data.BoundsRect );
frm_main.freeTabs('frm_op_seae_edi_data');
action:=cafree;
frm_op_seae_edi_data:=nil;
end;
procedure Tfrm_op_seae_edi_data.Panel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(Panel2.Width/16);
bsSkinButton7.Width:=i;
bsSkinButton6.Width:=i;
bsSkinButton11.Width:=i;
bsSkinButton14.Width:=i;
bsSkinButton2.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton3.Width:=i;
bsSkinButton38.Width:=i;
bsSkinButton22.Width:=i;
bsSkinButton25.Width:=i;
bsSkinButton27.Width:=i;
bsSkinButton29.Width:=i;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton7Click(Sender: TObject);
begin
table_Prior(t_op_seae);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton6Click(Sender: TObject);
begin
table_next(t_op_seae);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton2Click(Sender: TObject);
begin
t_op_seae.fieldbyname('Ô¤µÖÈÕÆÚ').AsDateTime:=t_op_seae.fieldbyname('¿ª´¬ÈÕÆÚ').AsDateTime+3;
table_post(t_op_seae);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton11Click(Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='±à¼­ÐÞ¸Ä' then
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='·µ»ØÁбí';
// GetDuiBiStr;
//DBEdit3.OnChange(Sender);
end
else
begin
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then
BEGIN
answer:=messagedlg( 'Êý¾ÝÒѾ­Ð޸ģ¬ÊÇ·ñ±£´æ£¿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_op_seae.post;
end;
if answer=mrNo then
begin
t_op_seae.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
Notebook1.PageIndex:=0;
bsSkinButton11.Caption:='±à¼­ÐÞ¸Ä';
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton4Click(Sender: TObject);
var
i,j:Integer;
strno:string;
aQuery:TADOQuery;
begin
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then begin
showmessage('ÒÑ·¢ËͲ»ÄÜÐÞ¸Ä,ɾ³ý£¡');
Exit;
end;
j:=dxDBGrid1.SelectedCount;
strno:=' where 1=2 ';
for i:=0 to j-1 do
begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
strno:=strno+' or 񅧏='''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
if MessageDlg('È·¶¨ÒªÉ¾³ýÑ¡ÖеÄ'+inttostr(j)+'ƱҵÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)=mryes then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add(' delete from t_op_ctn_detail_edi where ctn_id in (select ctn_id from t_op_ctn_edi '+strno+')');
ExecSQL;
Close;SQL.Clear;
SQL.Add(' delete from t_op_ctn_edi '+strno);
ExecSQL;
Close;SQL.Clear;
SQL.Add(' delete from t_op_seae_edi '+strno);
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
t_op_seae.Refresh;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_op_seae);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton38Click(Sender: TObject);
var
book1:Tbookmark;
begin
book1:=t_op_seae.GetBookmark;
t_op_seae.Refresh;
t_op_seae.GotoBookmark(book1);
end;
procedure Tfrm_op_seae_edi_data.FormShow(Sender: TObject);
var
inifile1:Tinifile;
s:string;
FromFileName,ToFileName:string;
begin
Notebook1.PageIndex:=0;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
s:=inifile1.ReadString('database','Data Source','');
if Pos('\',s)>0 then
begin
dbserver:=Copy(s,1,Pos('\',s)-1);
end
else
if Pos(';',s)>0 then
begin
dbserver:=Copy(s,1,Pos(';',s)-1);
end
else
dbserver:=s;
FromFileName:='\\'+dbserver+'\Çൺº£¹Ø\midas.dll';
ToFileName:=ExtractFilePath(application.ExeName)+'midas.dll';
if not FileExists(ExtractFilePath(application.ExeName)+'midas.dll') then
CopyFile(pChar(FromFileName),pChar(ToFileName),False);
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='¼ÓÔØÊý¾ÝÇëµÈºò¡£¡£¡£';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=28;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
//ίÍбàºÅ´¦Àí
t_op_seae.Close;
t_op_seae.SQL.clear;
t_op_seae.SQL.Add('select top 100 * from t_op_seae_edi where EDIÀàÐÍ=''CN'' AND '
+'(¼ÈëÈË='+''''+employee+''''+') order by ¼ÈëÈÕÆÚ desc ');
t_op_seae.open;
t_op_ctn.Open;
t_op_ctn_detail.Open;
t_op_state.Open;
t_code_cangdan.Open;
t_code_cdstatus.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
loadreggrid(dxdbgrid1,false,caption);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
{with t_code_shiper do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_code_edicode where ·¢»õÈË=1 and ²Ù×÷Ô±='+QuotedStr(employee)+' order by ´úÂë');
Open;
end; }
t_code_shiper.Open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
{with t_code_consignee do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_code_edicode where ÊÕ»õÈË=1 and ²Ù×÷Ô±='+QuotedStr(employee)+' order by ´úÂë');
Open;
end;}
t_code_goods_not.Open;
t_code_consignee.Open;
code_e_carrier.Open;
code_cdkehuchuand.Open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
{with t_code_notifyparty do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_code_edicode where ֪ͨÈË=1 and ²Ù×÷Ô±='+QuotedStr(employee)+' order by ´úÂë');
Open;
end;}
t_code_notifyparty.Open;
t_code_carrier.Open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.close;
frm_sys_progress:=nil;
if if_reg(20301) then //Íâ´ú
begin
NWD2101.Visible:=True;
// NWD1101.Visible:=True;
end
else
begin
NWD2101.Visible:=False;
// NWD1101.Visible:=False;
end;
if if_reg(20302) then //ÍâÔË
begin
NWY.Visible:=True;
end
else
begin
NWY.Visible:=False;
end;
if if_reg(20303) then //Áª´ú
begin
NLD.Visible:=True;
end
else
begin
NLD.Visible:=False;
end;
if if_reg(20304) then //»ª¸Û
begin
// NHG.Visible:=True;
end
else
begin
// NHG.Visible:=False;
end;
if if_reg(20305) then //Ô¶´ó
begin
NYD.Visible:=True;
end
else
begin
NYD.Visible:=False;
end;
if if_reg(20306) then //ÖÐÔ¶
begin
// NZY.Visible:=True;
end
else
begin
// NZY.Visible:=False;
end;
if if_reg(20307) then //ÖÐͨ
begin
// NZT.Visible:=True;
end
else
begin
// NZT.Visible:=False;
end;
if if_reg(20309) then //º£·á
begin
NHF.Visible:=True;
end
else
begin
NHF.Visible:=False;
end;
if if_reg(20310) then //͖Ȼ
begin
NZH.Visible:=True;
// ShowMessage('ok');
end
else
begin
NZH.Visible:=False;
end;
if if_reg(20311) then //º£¹ØÒ»µãͨ
begin
NHGYDT.Visible:=True;
end
else
begin
NHGYDT.Visible:=False;
end;
end;
procedure Tfrm_op_seae_edi_data.N10Click(Sender: TObject);
begin
update_grid_view_no(dxdbgrid1);
end;
procedure Tfrm_op_seae_edi_data.N14Click(Sender: TObject);
begin
update_grid_view_all(dxdbgrid1);
end;
procedure Tfrm_op_seae_edi_data.N12Click(Sender: TObject);
begin
update_grid(dxdbgrid1,213);
end;
procedure Tfrm_op_seae_edi_data.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton8Click(Sender: TObject);
VAR
str:widestring;
adate:TDate;
begin
str:='where EDIÀàÐÍ=''CN'' AND '+open_data('0001','¼ÈëÈË','no','no','no','no');
if (not CheckBox1.Checked) then begin
adate:=IncMonth(Now,-3);
str:=str+' and ¼ÈëÈÕÆÚ>='+''''+formatdatetime('yyyy-mm-dd',adate)+'''';
adate:=IncMonth(Now,1);
str:=str+' and ¼ÈëÈÕÆÚ<='+''''+formatdatetime('yyyy-mm-dd',adate)+'''';
end;
if Edit3.text<>''then
str:=str+' and Ö÷Ìáµ¥ºÅ like '+''''+'%'+Edit3.text+'%'+'''';
if Edit1.text<>''then
str:=str+' and ·ÖÌáµ¥ºÅ like '+''''+'%'+Edit1.text+'%'+'''';
if wwDBComboBoxType.text<>''then
str:=str+' and EDIÀàÐÍ like '+''''+wwDBComboBoxType.text+'''';
if wwDBComboBox2.text<>''then
str:=str+' and EDI״̬ like '+''''+wwDBComboBox2.text+'''';
if wwDBDateTimePicker9.text<>''then
str:=str+' and ¼ÈëÈÕÆÚ>='+''''+wwDBDateTimePicker9.text+'''';
if wwDBDateTimePicker12.text<>''then
str:=str+' and ¼ÈëÈÕÆÚ<='+''''+wwDBDateTimePicker12.text+' 23:59:59''';
if wwDBDateTimePicker11.text<>''then
str:=str+' and ¿ª´¬ÈÕÆÚ>='+''''+wwDBDateTimePicker11.text+'''';
if wwDBDateTimePicker13.text<>''then
str:=str+' and ¿ª´¬ÈÕÆÚ<='+''''+wwDBDateTimePicker13.text+'''';
if wwDBComboBoxOP.text<>''then
str:=str+' and ¼ÈëÈË='+''''+wwDBComboBoxOP.text+'''';
if wwDBComboBox5.text<>''then
str:=str+' and ת·¢ÀàÐÍ='+''''+wwDBComboBox5.text+'''';
str:=query_tiaojian(1,str,'´¬Ãû','Ä£ºý',wwDBLookupCombo26.text);
str:=query_tiaojian(1,str,'º½´Î','Ä£ºý',Edit8.text);
str:=query_tiaojian(1,str,'´¬¹«Ë¾','Ä£ºý',Edit9.text);
str:=query_tiaojian(1,str,'´¬´ú','Ä£ºý',Edit10.text);
str:=query_tiaojian(1,str,'ж»õ¸Û','Ä£ºý',Edit11.text);
str:=query_tiaojian(1,str,'ίÍз¢ËÍ·½','Ä£ºý',Edit12.text);
if Edit2.text<>''then
str:=str+' and ±àºÅ in ( select ±àºÅ from t_op_ctn_edi where ÏäºÅ like '+''''+'%'+Edit2.text+'%'+''')';
t_op_ctn.close;
t_op_ctn_detail.close;
t_op_state.close;
t_op_seae.close;
t_op_seae.sql.clear;
t_op_seae.sql.add('select * from t_op_seae_edi '+str+' order by Ö÷Ìáµ¥ºÅ');
t_op_seae.open;
t_op_ctn.open;
t_op_ctn_detail.open;
t_op_state.open;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton12Click(Sender: TObject);
begin
Edit3.text:='';
Edit8.text:='';
Edit2.text:='';
Edit1.text:='';
Edit11.text:='';
Edit12.text:='';
wwDBDateTimePicker9.text:='';
wwDBDateTimePicker12.text:='';
wwDBDateTimePicker11.text:='';
wwDBDateTimePicker13.text:='';
wwDBComboBoxType.Text:='';
wwDBComboBox2.Text:='';
wwDBLookupCombo26.Clear;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton14Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton14.ClientToScreen(Point(0,bsSkinButton14.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton1Click(Sender: TObject);
begin
if bsSkinGroupBox5.Visible then begin
bsSkinGroupBox5.Visible:=false;
bsSkinGroupBox2.Visible:=true;
end else begin
bsSkinGroupBox5.left:=bsSkinGroupBox2.Left;
bsSkinGroupBox5.Top:=bsSkinGroupBox2.Top;
bsSkinGroupBox5.Height:=bsSkinGroupBox2.Height;
bsSkinGroupBox5.Width:=bsSkinGroupBox2.Width;
bsSkinGroupBox2.Visible:=False;
bsSkinGroupBox5.Visible:=True;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton2Click(Sender: TObject);
begin
if bsSkinGroupBox7.Visible then begin
bsSkinGroupBox7.Visible:=false;
bsSkinGroupBox3.Visible:=true;
end else begin
bsSkinGroupBox7.left:=bsSkinGroupBox3.Left;
bsSkinGroupBox7.Top:=bsSkinGroupBox3.Top;
bsSkinGroupBox7.Height:=bsSkinGroupBox3.Height;
bsSkinGroupBox7.Width:=bsSkinGroupBox3.Width;
bsSkinGroupBox3.Visible:=False;
bsSkinGroupBox7.Visible:=True;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton3Click(Sender: TObject);
begin
if bsSkinGroupBox8.Visible then begin
bsSkinGroupBox8.Visible:=false;
bsSkinGroupBox2.Visible:=true;
end else begin
bsSkinGroupBox8.left:=bsSkinGroupBox2.Left;
bsSkinGroupBox8.Top:=bsSkinGroupBox2.Top;
bsSkinGroupBox8.Height:=bsSkinGroupBox2.Height;
bsSkinGroupBox8.Width:=bsSkinGroupBox2.Width;
bsSkinGroupBox2.Visible:=False;
bsSkinGroupBox8.Visible:=True;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton56Click(Sender: TObject);
begin
t_op_ctn.insert;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton57Click(Sender: TObject);
begin
table_post(t_op_ctn);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton58Click(Sender: TObject);
begin
table_delete(t_op_ctn);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton59Click(Sender: TObject);
begin
table_cancel(t_op_ctn);
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupComboctnChange(Sender: TObject);
begin
if (t_op_ctn.State=dsedit)or(t_op_ctn.State=dsinsert) then
begin
if frm_data_share.t_code_ctn.Locate('´úÂë',wwDBLookupComboctn.text,[]) then
begin
t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
t_op_ctn['ÏäÐÍ']:=frm_data_share.t_code_ctn['ÏäÐÍ'];
t_op_ctn['³ß´ç']:=frm_data_share.t_code_ctn['³ß´ç'];
end
else
begin
t_op_ctn['±íÏÖÐÎʽ']:='';
t_op_ctn['ÏäÐÍ']:='';
t_op_ctn['³ß´ç']:='';
end;
end;
end;
procedure Tfrm_op_seae_edi_data.btnMarksClick(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn1,'ßéÍ·');
end;
procedure Tfrm_op_seae_edi_data.btnDescClick(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn1,'»õÃè');
end;
procedure Tfrm_op_seae_edi_data.t_op_ctnAfterInsert(DataSet: TDataSet);
begin
t_op_ctn['񅧏']:=t_op_seae1.DataSet['񅧏'];
t_op_ctn['ÊýÁ¿']:=1;
t_op_ctn['TEU']:=0;
end;
procedure Tfrm_op_seae_edi_data.wwDBGrid1ColEnter(Sender: TObject);
begin
if (wwDBGrid1.GetActiveField.FieldName='ßéÍ·') then begin
// bsSkinPanel4.Visible:=true;
// Label62.Visible:=True;
// Label61.Visible:=false;
// DBMemo5.Visible:=true;
// DBMemo4.Visible:=false;
end else if (wwDBGrid1.GetActiveField.FieldName='»õÃè') then begin
// bsSkinPanel4.Visible:=true;
// Label62.Visible:=false;
// Label61.Visible:=True;
// DBMemo5.Visible:=false;
// DBMemo4.Visible:=true;
end else begin
// bsSkinPanel4.Visible:=False;
end;
end;
function Tfrm_op_seae_edi_data.getCtnAfr(code: string): string;
var
aQuery:TADOQuery;
begin
result:='';
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;
SQL.Text:='select AFR´úÂë from t_code_ctn where ´úÂë='''+code+'''';
Open;
Result:=aQuery.fieldbyname('AFR´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.getPkgAfr(code: string): string;
var
aQuery:TADOQuery;
begin
result:='';
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;
SQL.Text:='select AFR´úÂë from t_code_package where ´úÂë='''+code+'''';
Open;
if not IsEmpty then
Result:=aQuery.fieldbyname('AFR´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.formatAfrstr(str: string): string;
begin
Result:=Trim(str);
Result:=StringReplace(Result,'&','&amp;',[rfReplaceAll]);
Result:=StringReplace(Result,'<','&lt;',[rfReplaceAll]);
Result:=StringReplace(Result,'"','&quot;',[rfReplaceAll]);
Result:=StringReplace(Result,'>','&gt;',[rfReplaceAll]);
Result:=StringReplace(Result,'''','&apos;',[rfReplaceAll]);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton1Click(Sender: TObject);
begin
t_op_ctn_detail.insert;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton9Click(Sender: TObject);
begin
table_post(t_op_ctn_detail);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton10Click(Sender: TObject);
begin
table_delete(t_op_ctn_detail);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton13Click(Sender: TObject);
begin
table_cancel(t_op_ctn_detail);
end;
procedure Tfrm_op_seae_edi_data.t_op_ctn_detailAfterInsert(DataSet: TDataSet);
begin
t_op_ctn_detail['ctn_id']:=t_op_ctn['ctn_id'];
end;
procedure Tfrm_op_seae_edi_data.t_op_ctn_detailBeforePost(DataSet: TDataSet);
begin
t_op_ctn_detail['ctn_id']:=t_op_ctn['ctn_id'];
end;
procedure Tfrm_op_seae_edi_data.t_op_ctn_detailBeforeInsert(DataSet: TDataSet);
begin
if t_op_ctn.State in [dsedit,dsinsert] then t_op_ctn.Post;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton17Click(Sender: TObject);
begin
try
if IdFTP1.Connected then begin
IdFTP1.Abort;
IdFTP1.Quit;
end;
finally
bsSkinGroupBox11.Visible:=false;
bsSkinButton16.Enabled:=True;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton19Click(Sender: TObject);
begin
frm_code_edicode:=Tfrm_code_edicode.Create(self);
try
frm_code_edicode.t_code_edicode.Open;
if not frm_code_edicode.t_code_edicode.Locate('¼ò³Æ',RxDBLookupCombo16.DisplayValue,[]) then begin
frm_code_edicode.t_code_edicode.Insert;
frm_code_edicode.t_code_edicode.FieldByName('¿Í»§¼ò³Æ').AsString:=t_op_seae.fieldbyname('·¢»õÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('·¢»õÈË').AsBoolean:=true;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('·¢»õÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('·¢»õÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('·¢»õÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('·¢»õÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('·¢»õÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('·¢»õÈËÖÝ').AsString;
end else begin
frm_code_edicode.t_code_edicode.Edit;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('·¢»õÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('·¢»õÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('·¢»õÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('·¢»õÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('·¢»õÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('·¢»õÈËÖÝ').AsString;
end;
frm_code_edicode.ShowModal;
finally
t_code_shiper.Requery();
FreeAndNil(frm_code_edicode);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton20Click(Sender: TObject);
begin
frm_code_edicode:=Tfrm_code_edicode.Create(self);
try
frm_code_edicode.t_code_edicode.Open;
if not frm_code_edicode.t_code_edicode.Locate('¼ò³Æ',RxDBLookupCombo1.DisplayValue,[]) then begin
frm_code_edicode.t_code_edicode.Insert;
frm_code_edicode.t_code_edicode.FieldByName('¿Í»§¼ò³Æ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÊÕ»õÈË').AsBoolean:=true;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÖÝ').AsString;
end else begin
frm_code_edicode.t_code_edicode.Edit;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÖÝ').AsString;
end;
frm_code_edicode.ShowModal;
finally
t_code_consignee.Requery();
FreeAndNil(frm_code_edicode);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton21Click(Sender: TObject);
begin
frm_code_edicode:=Tfrm_code_edicode.Create(self);
try
frm_code_edicode.t_code_edicode.Open;
if not frm_code_edicode.t_code_edicode.Locate('¼ò³Æ',RxDBLookupCombo2.DisplayValue,[]) then begin
frm_code_edicode.t_code_edicode.Insert;
frm_code_edicode.t_code_edicode.FieldByName('¿Í»§¼ò³Æ').AsString:=t_op_seae.fieldbyname('֪ͨÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('֪ͨÈË').AsBoolean:=true;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('֪ͨÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('֪ͨÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('֪ͨÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÖÝ').AsString;
end else begin
frm_code_edicode.t_code_edicode.Edit;
frm_code_edicode.t_code_edicode.FieldByName('Ãû³Æ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·1').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·2').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·2').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µØÖ·3').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·3').AsString;
frm_code_edicode.t_code_edicode.FieldByName('³ÇÊÐ').AsString:=t_op_seae.fieldbyname('֪ͨÈ˳ÇÊÐ').AsString;
frm_code_edicode.t_code_edicode.FieldByName('Óʱà').AsString:=t_op_seae.fieldbyname('֪ͨÈËÓʱà').AsString;
frm_code_edicode.t_code_edicode.FieldByName('¹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÁªÏµÈË').AsString:=t_op_seae.fieldbyname('֪ͨÈËÁªÏµÈË').AsString;
frm_code_edicode.t_code_edicode.FieldByName('µç»°').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵绰').AsString;
frm_code_edicode.t_code_edicode.FieldByName('ÖÝ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÖÝ').AsString;
end;
frm_code_edicode.ShowModal;
finally
t_code_notifyparty.Requery();
FreeAndNil(frm_code_edicode);
end;
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Enter(Sender: TObject);
begin
RxDBLookupCombo16.LookupDisplay:='´úÂë;¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Exit(Sender: TObject);
begin
RxDBLookupCombo16.LookupDisplay:='¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Enter(Sender: TObject);
begin
RxDBLookupCombo1.LookupDisplay:='´úÂë;¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Exit(Sender: TObject);
begin
RxDBLookupCombo1.LookupDisplay:='¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Enter(Sender: TObject);
begin
RxDBLookupCombo2.LookupDisplay:='´úÂë;¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Exit(Sender: TObject);
begin
RxDBLookupCombo2.LookupDisplay:='¿Í»§¼ò³Æ';
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Change(Sender: TObject);
begin
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then
begin
if RxDBLookupCombo16.DisplayValue<>'' then begin
t_op_seae.fieldbyname('·¢»õÈËÃû³Æ').AsString:=t_code_shiper.FieldByName('Ãû³Æ').AsString;
t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·1').AsString:=t_code_shiper.FieldByName('µØÖ·1').AsString;
t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·2').AsString:=t_code_shiper.FieldByName('µØÖ·2').AsString;
t_op_seae.fieldbyname('·¢»õÈ˵ØÖ·3').AsString:=t_code_shiper.FieldByName('µØÖ·3').AsString;
t_op_seae.fieldbyname('·¢»õÈ˳ÇÊÐ').AsString:=t_code_shiper.FieldByName('³ÇÊÐ').AsString;
t_op_seae.fieldbyname('·¢»õÈËÓʱà').AsString:=t_code_shiper.FieldByName('Óʱà').AsString;
t_op_seae.fieldbyname('·¢»õÈ˹ú¼Ò´úÂë').AsString:=t_code_shiper.FieldByName('¹ú¼Ò´úÂë').AsString;
t_op_seae.fieldbyname('·¢»õÈËÁªÏµÈË').AsString:=t_code_shiper.FieldByName('ÁªÏµÈË').AsString;
t_op_seae.fieldbyname('·¢»õÈ˵绰').AsString:=t_code_shiper.FieldByName('µç»°').AsString;
t_op_seae.fieldbyname('·¢»õÈËÖÝ').AsString:=t_code_shiper.FieldByName('ÖÝ').AsString;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Change(Sender: TObject);
begin
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then
begin
if RxDBLookupCombo1.DisplayValue<>'' then begin
t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString:=t_code_consignee.FieldByName('Ãû³Æ').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString:=t_code_consignee.FieldByName('µØÖ·1').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·2').AsString:=t_code_consignee.FieldByName('µØÖ·2').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·3').AsString:=t_code_consignee.FieldByName('µØÖ·3').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˳ÇÊÐ').AsString:=t_code_consignee.FieldByName('³ÇÊÐ').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÓʱà').AsString:=t_code_consignee.FieldByName('Óʱà').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString:=t_code_consignee.FieldByName('¹ú¼Ò´úÂë').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÁªÏµÈË').AsString:=t_code_consignee.FieldByName('ÁªÏµÈË').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString:=t_code_consignee.FieldByName('µç»°').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÖÝ').AsString:=t_code_consignee.FieldByName('ÖÝ').AsString;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Change(Sender: TObject);
begin
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then
begin
if RxDBLookupCombo2.DisplayValue<>'' then begin
t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString:=t_code_notifyparty.FieldByName('Ãû³Æ').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString:=t_code_notifyparty.FieldByName('µØÖ·1').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·2').AsString:=t_code_notifyparty.FieldByName('µØÖ·2').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·3').AsString:=t_code_notifyparty.FieldByName('µØÖ·3').AsString;
t_op_seae.fieldbyname('֪ͨÈ˳ÇÊÐ').AsString:=t_code_notifyparty.FieldByName('³ÇÊÐ').AsString;
t_op_seae.fieldbyname('֪ͨÈËÓʱà').AsString:=t_code_notifyparty.FieldByName('Óʱà').AsString;
t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString:=t_code_notifyparty.FieldByName('¹ú¼Ò´úÂë').AsString;
t_op_seae.fieldbyname('֪ͨÈËÁªÏµÈË').AsString:=t_code_notifyparty.FieldByName('ÁªÏµÈË').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵绰').AsString:=t_code_notifyparty.FieldByName('µç»°').AsString;
t_op_seae.fieldbyname('֪ͨÈËÖÝ').AsString:=t_code_notifyparty.FieldByName('ÖÝ').AsString;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.PutToDebugLog(Operation, S1: String);
Var
S: String;
begin
while Length(S1) > 0 do begin
if Pos(#13, S1) > 0 then begin
S := Copy(S1, 1, Pos(#13, S1) - 1);
Delete(S1, 1, Pos(#13, S1));
if S1[1] = #10 then Delete(S1, 1, 1);
end
else
S := S1;
DebugListBox.ItemIndex := DebugListBox.Items.Add(Operation + S);
end;
end;
procedure Tfrm_op_seae_edi_data.IdFTP1Status(ASender: TObject;
const AStatus: TIdStatus; const AStatusText: String);
begin
DebugListBox.ItemIndex := DebugListBox.Items.Add(AStatusText);
end;
procedure Tfrm_op_seae_edi_data.IdFTP1Work(Sender: TObject;
AWorkMode: TWorkMode; const AWorkCount: Integer);
Var
S: String;
TotalTime: TDateTime;
H, M, Sec, MS: Word;
DLTime: Double;
begin
TotalTime := Now - STime;
DecodeTime(TotalTime, H, M, Sec, MS);
Sec := Sec + M * 60 + H * 3600;
DLTime := Sec + MS / 1000;
if DLTime > 0 then
AverageSpeed := {(AverageSpeed + }(AWorkCount / 1024) / DLTime{) / 2};
if AverageSpeed > 0 then begin
Sec := Trunc(((ProgressBar1.Max - AWorkCount) / 1024) / AverageSpeed);
S := Format('%2d:%2d:%2d', [Sec div 3600, (Sec div 60) mod 60, Sec mod 60]);
S := 'Ê£Óàʱ¼ä ' + S;
end
else S := '';
S := FormatFloat('0.00 KB/s', AverageSpeed) + '; ' + S;
case AWorkMode of
wmRead: StatusBar1.Panels[1].Text := 'ÏÂÔØËÙ¶È ' + S;
wmWrite: StatusBar1.Panels[1].Text := 'ÉÏ´«ËÙ¶È ' + S;
end;
if AbortTransfer then IdFTP1.Abort;
ProgressBar1.Position := AWorkCount;
AbortTransfer := false;
end;
procedure Tfrm_op_seae_edi_data.IdFTP1WorkBegin(Sender: TObject;
AWorkMode: TWorkMode; const AWorkCountMax: Integer);
begin
TransferrignData := true;
AbortTransfer := false;
STime := Now;
if AWorkCountMax > 0 then ProgressBar1.Max := AWorkCountMax
else ProgressBar1.Max := BytesToTransfer;
AverageSpeed := 0;
end;
procedure Tfrm_op_seae_edi_data.IdFTP1WorkEnd(Sender: TObject;
AWorkMode: TWorkMode);
begin
StatusBar1.Panels[1].Text := '´«ÊäÍê±Ï.';
BytesToTransfer := 0;
TransferrignData := false;
ProgressBar1.Position := 0;
AverageSpeed := 0;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton22Click(Sender: TObject);
var
Pnt:Tpoint;
aAdoQuery,aAdoQuery2:TAdoQuery;
s:string;
LengthQ, PosQ,i:Integer;
iscon:Boolean;
begin
if wwDBDateTimePicker1.Date<Date then
begin
ShowMessage('¿ª´¬ÈÕÆÚСÓÚ½ñÌì²»ÄÜ·¢ËÍ');
Exit;
end;
if not (t_op_seae1.DataSet.State in [dsedit,dsinsert]) then
t_op_seae1.DataSet.Edit;
t_op_seae1.DataSet['·¢»õÈ˵绰']:=formattel(t_op_seae1.DataSet.fieldbyname('·¢»õÈ˵绰').AsString);
t_op_seae1.DataSet['ÊÕ»õÈ˵绰']:=formattel(t_op_seae1.DataSet.fieldbyname('ÊÕ»õÈ˵绰').AsString);
t_op_seae1.DataSet['֪ͨÈ˵绰']:=formattel(t_op_seae1.DataSet.fieldbyname('֪ͨÈ˵绰').AsString);
t_op_seae1.DataSet.Post;
if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then
t_op_seae1.DataSet.post;
table_before_post(t_op_seae, 'Ö÷Ìáµ¥ºÅ');
table_before_post(t_op_seae, '´¬Ãû');
table_before_post(t_op_seae, 'º½´Î');
table_before_post(t_op_seae, '·¢»õÈËÃû³Æ');
table_before_post(t_op_seae, '·¢»õÈ˵ØÖ·1');
table_before_post(t_op_seae, '·¢»õÈ˵绰');
table_before_post(t_op_seae, '·¢»õÈ˹ú¼Ò´úÂë');
table_before_post(t_op_seae, 'ÊÕ»õÈËÃû³Æ');
table_before_post(t_op_seae, 'ÊÕ»õÈ˵ØÖ·1');
table_before_post(t_op_seae, 'ÊÕ»õÈ˵绰');
table_before_post(t_op_seae, 'ÊÕ»õÈ˹ú¼Ò´úÂë');
table_before_post(t_op_seae, '֪ͨÈËÃû³Æ');
table_before_post(t_op_seae, '֪ͨÈ˵ØÖ·1');
table_before_post(t_op_seae, '֪ͨÈ˵绰');
table_before_post(t_op_seae, '֪ͨÈ˹ú¼Ò´úÂë');
table_before_post(t_op_seae, '×°»õ¸Û');
table_before_post(t_op_seae, '×°¸Û´úÂë');
table_before_post(t_op_seae, 'ж»õ¸Û');
table_before_post(t_op_seae, 'ж»õ´úÂë');
table_before_post(t_op_seae, 'Ä¿µÄµØ');
table_before_post(t_op_seae, 'Ä¿µÄ´úÂë');
table_before_post(t_op_seae, '¼þÊý');
table_before_post(t_op_seae, '°ü×°');
table_before_post(t_op_seae, 'ÖØÁ¿');
table_before_post(t_op_seae, '³ßÂë');
table_before_post(t_op_seae, 'ßéÍ·');
table_before_post(t_op_seae, '»õÎïÃèÊö');
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if (t_op_ctn.FieldByName('±íÏÖÐÎʽ').AsString='') then begin
ShowMessage('¼¯×°Ïä±íÏÖÐÎʽ²»ÄÜΪ¿Õ£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('ÏäºÅ').AsString='') then begin
ShowMessage('¼¯×°ÏäÏäºÅ²»ÄÜΪ¿Õ£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('·âºÅ').AsString='') then begin
ShowMessage('¼¯×°Ïä·âºÅ²»ÄÜΪ¿Õ£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('°ü×°').AsString='') then begin
ShowMessage('¼¯×°Ïä°ü×°²»ÄÜΪ¿Õ£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('¼þÊý').AsInteger=0) then begin
ShowMessage('¼¯×°Ïä¼þÊý²»ÄÜΪ0£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('ÖØÁ¿').AsFloat=0) then begin
ShowMessage('¼¯×°ÏäÖØÁ¿²»ÄÜΪ0£¬Çë¼ì²é');
exit;
end;
if (t_op_ctn.FieldByName('³ßÂë').AsFloat=0) then begin
ShowMessage('¼¯×°Ïä³ßÂë²»ÄÜΪ0£¬Çë¼ì²é');
exit;
end;
t_op_ctn.Next;
end;
if (t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString='D') then begin
if MessageDlg('´ËƱ»õΪΣÏÕÆ·,ȷʵҪ·¢ËÍÂð?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
if (Length(Trim(t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString))>900) then begin
if MessageDlg('´ËƱ»õ»õÎïÃèÊö³¬³¤,ȷʵҪ·¢ËÍÂð?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
if (t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString='O') then begin
if MessageDlg('´ËƱΪ³¬ÏÞÏ䣬ÊÇ·ñ¼ÌÐø²Ù×÷?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
s:='';
aAdoQuery:=createAdoQuery;
aAdoQuery2:=createAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('select isnull(object_id(''CANGDAN_CUSTOMER''),''0'') as tbl');
Open;
if (FieldByName('tbl').AsString<>'0') then begin
Close;sql.Clear;
sql.Add('select COUNT(*) CT FROM CANGDAN_CUSTOMER WHERE CUSTOMERNAME='''+t_op_seae.fieldbyname('ίÍз¢ËÍ·½').asstring+'''');
Open;
if (FieldByName('CT').AsInteger=0) then begin
MessageDlg('²»ÄÜ·¢Ë͸ÿͻ§ÉÐδ¿ªÍ¨²Õµ¥É걨ҵÎñ£¬ÇëÓë¶ÔÓ¦ÒµÎñͬÊÂÁªÏµ£¡',mtError,[mbOk],0);
Exit;
end;
end;
if (t_op_seae.FieldByName('·ÖÌáµ¥ºÅ').AsString='') then begin
Close;sql.Clear;
sql.Add('select distinct b.Ö÷Ìáµ¥ºÅ,c.ÏäºÅ from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' ');
sql.Add(' and b.¼ÈëÈÕÆÚ>=GETDATE()-20 ');
sql.Add(' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' and b.Ö÷Ìáµ¥ºÅ<>'''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' ');
sql.Add(' and c.ÏäºÅ in (select ÏäºÅ from t_op_ctn_edi where ±àºÅ='''+t_op_seae.fieldbyname('±àºÅ').AsString+''') ');
Open;First;
while not Eof do
begin
if s='' then s:='¸Ãº½´Î'+FieldByName('Ö÷Ìáµ¥ºÅ').AsString+'Ï´æÔÚÏàͬÏäºÅ'+FieldByName('ÏäºÅ').AsString+''
else s:=s+#13#10+FieldByName('ÏäºÅ').AsString;
Next;
end;
Close;sql.Clear;
sql.Add('select c.ÏäºÅ,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY C.ÏäºÅ ');
Open;
if (not IsEmpty) then begin
First;
while not eof do begin
if t_op_ctn.Locate('ÏäºÅ',fieldbyname('ÏäºÅ').AsString,[]) then begin
if t_op_ctn.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+' ¼þÊý:'+FieldByName('¼þÊý').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'¼þÊý:'+FieldByName('¼þÊý').AsString;
if t_op_ctn.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
if t_op_ctn.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString;
end else begin
if s='' then s:='Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
Next;
end;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if aAdoQuery.Locate('ÏäºÅ',t_op_ctn.fieldbyname('ÏäºÅ').AsString,[]) then begin
end else begin
if s='' then s:='·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
t_op_ctn.Next;
end;
end;
end else begin
aAdoQuery2.Close;
aAdoQuery2.SQL.Clear;
aAdoQuery2.SQL.add('SELECT * from t_op_ctn_edi where ±àºÅ in (select top 1 ±àºÅ from t_op_seae_edi where ISNULL(·ÖÌáµ¥ºÅ,'''')='''' and Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' ');
aAdoQuery2.SQL.add(' and ´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' )');
aAdoQuery2.Open;
Close;sql.Clear;
sql.Add('select c.ÏäºÅ,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY C.ÏäºÅ ');
Open;
if (not IsEmpty) then begin
First;
while not eof do begin
if aAdoQuery2.Locate('ÏäºÅ',fieldbyname('ÏäºÅ').AsString,[]) then begin
if aAdoQuery2.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+' ¼þÊý:'+FieldByName('¼þÊý').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'¼þÊý:'+FieldByName('¼þÊý').AsString;
if aAdoQuery2.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
if aAdoQuery2.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString;
end else begin
if s='' then s:='Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
Next;
end;
end;
aAdoQuery2.First;
while not aAdoQuery2.Eof do begin
if aAdoQuery.Locate('ÏäºÅ',aAdoQuery2.fieldbyname('ÏäºÅ').AsString,[]) then begin
end else begin
if s='' then s:='·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
aAdoQuery2.Next;
end;
Close;sql.Clear;
sql.Add('select b.·ÖÌáµ¥ºÅ,b.¼þÊý ×ܼþÊý,b.ÖØÁ¿ ×ÜÖØÁ¿,b.³ßÂë ×ܳßÂë,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY b.·ÖÌáµ¥ºÅ,b.¼þÊý,b.ÖØÁ¿,b.³ßÂë ');
Open;
First;
while not eof do begin
if (FieldByName('×ܼþÊý').AsInteger<>FieldByName('¼þÊý').AsInteger) then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܼþÊýºÍ¼¯×°ÏäÃ÷ϸ¼þÊýºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܼþÊýºÍ¼¯×°ÏäÃ÷ϸ¼þÊýºÏ¼Æ²»Ò»Ö£¡'
end;
if (FieldByName('×ÜÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat)
then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ÜÖØÁ¿ºÍ¼¯×°ÏäÃ÷ϸÖØÁ¿ºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ÜÖØÁ¿ºÍ¼¯×°ÏäÃ÷ϸÖØÁ¿ºÏ¼Æ²»Ò»Ö£¡'
end;
if (FieldByName('×ܳßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat) then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܳßÂëºÍ¼¯×°ÏäÃ÷ϸ³ßÂëºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܳßÂëºÍ¼¯×°ÏäÃ÷ϸ³ßÂëºÏ¼Æ²»Ò»Ö£¡'
end;
Next;
end;
end;
iscon:=true;
if (s<>'') then begin
iscon:=False;
try
frm_sys_messagedlg:=tfrm_sys_messagedlg.Create (application);
frm_sys_messagedlg.msg:=s;
iscon:=frm_sys_messagedlg.ShowModal=mrOk;
finally
frm_sys_messagedlg.Free;
frm_sys_messagedlg:=nil;
end;
// if MessageDlg(s+',ÊÇ·ñ¼ÌÐø£¿',mtWarning,mbOKCancel,0)<>mrok then exit;
end;
if (not iscon) then exit;
s:='';
Close;sql.Clear;
sql.Add('select ÏäºÅ,count(*)');
sql.Add('from t_op_ctn_edi');
sql.Add('where 񅧏=:񅧏');
sql.Add('group by ÏäºÅ');
sql.Add('having count(*)>1');
Parameters.ParamByName('񅧏').Value:=t_op_seae.FieldByName('񅧏').AsString;
Open;First;
while not Eof do
begin
if s='' then s:=FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+FieldByName('ÏäºÅ').AsString;
Next;
end;
if s<>'' then
begin
ShowMessage('Öظ´µÄÏäºÅÈçÏÂ:'+#13#10+s);
Exit;
end;
s:='';
Close;sql.Clear;
sql.Add('select sum(¼þÊý) ¼þÊý,sum(ÖØÁ¿) ÖØÁ¿,sum(³ßÂë) ³ßÂë');
sql.Add('from t_op_ctn_edi');
sql.Add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=t_op_seae.FieldByName('񅧏').AsString;
Open;First;
if t_op_seae.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
if s='' then s:='¼þÊý:'+FieldByName('¼þÊý').AsString else s:=s+#13#10+'¼þÊý:'+FieldByName('¼þÊý').AsString;
if t_op_seae.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
if s='' then s:='ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString else s:=s+#13#10+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
if t_op_seae.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
if s='' then s:='³ßÂë:'+FieldByName('³ßÂë').AsString else s:=s+#13#10+'³ßÂë:'+FieldByName('³ßÂë').AsString;
if s<>'' then
begin
ShowMessage('´æÔÚ²îÒì'+#13#10+s);
end;
{
if (t_op_seae.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString='CN') then begin
if not ((pos('USCI+',t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)>0) or (pos('OC+',t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)>0)) then begin
ShowMessage('·¢»õÈËÆóÒµ´úÂë²»·ûºÏ¹æ·¶£¬Çë¼ì²é');
exit;
end;
if (pos('USCI+',t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)>0) then begin
if (Length(t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)<>23) then begin
ShowMessage('·¢»õÈËÆóÒµ´úÂë²»·ûºÏ¹æ·¶£¬Çë¼ì²é');
exit;
end;
end;
if (pos('OC+',t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)>0) then begin
if (Length(t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)<>12) then begin
ShowMessage('·¢»õÈËÆóÒµ´úÂë²»·ûºÏ¹æ·¶£¬Çë¼ì²é');
exit;
end;
end;
LengthQ := Length(t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString);
PosQ := Pos('+',t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString);
s := Copy(t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString, PosQ + 1, LengthQ - PosQ + 1);
for i := 1 to Length(s) do
begin
if not (s[i] in ['0'..'9', 'A'..'Z','-',#32]) then
begin
ShowMessage('ÆóÒµ´úÂë±ØÐëΪÊý×ֺʹóд×Öĸ');
Exit;
end;
end;
end;
}
if (Trim(t_op_seae.FieldByName('´¬Ãû').AsString)<>t_op_seae.FieldByName('´¬Ãû').AsString) then begin
ShowMessage('´¬ÃûÇ°ºóÓпոñ,Çë¼ì²é£¡');
Exit;
end;
if (Trim(t_op_seae.FieldByName('º½´Î').AsString)<>t_op_seae.FieldByName('º½´Î').AsString) then begin
ShowMessage('º½´ÎÇ°ºóÓпոñ,Çë¼ì²é£¡');
Exit;
end;
if (Pos('DESCRIPTION',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[DESCRIPTION],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐø·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
if (Pos('LIST',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[LIST],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐø·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
if (Pos('N/M',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[N/M],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐø·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
t_code_goods_not.First;
while not t_code_goods_not.Eof do begin
if (Pos(t_code_goods_not.fieldbyname('»õÎïÃû³Æ').AsString,t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê'+t_code_goods_not.fieldbyname('»õÎïÃû³Æ').AsString+',ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐø·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
t_code_goods_not.Next;
end;
{
if IsZhongwen(Trim(t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString)) then begin
ShowMessage('·¢»õÈËÆóÒµ´úÂëÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
}
if IsZhongwen(Trim(t_op_seae.FieldByName('·¢»õÈËÃû³Æ').AsString)) then begin
ShowMessage('·¢»õÈËÃû³ÆÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('·¢»õÈ˵ØÖ·1').AsString)) then begin
ShowMessage('·¢»õÈ˵ØÖ·1ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('·¢»õÈ˵绰').AsString)) then begin
ShowMessage('·¢»õÈ˵绰ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('ÊÕ»õÈËÃû³Æ').AsString)) then begin
ShowMessage('ÊÕ»õÈËÃû³ÆÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString)) then begin
ShowMessage('ÊÕ»õÈ˵ØÖ·1ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('ÊÕ»õÈ˵绰').AsString)) then begin
ShowMessage('ÊÕ»õÈ˵绰ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
{
if IsZhongwen(Trim(t_op_seae.FieldByName('ÊÕ»õÈËÆóÒµ´úÂë').AsString)) then begin
ShowMessage('ÊÕ»õÈËÆóÒµ´úÂëÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
}
if IsZhongwen(Trim(t_op_seae.FieldByName('֪ͨÈËÃû³Æ').AsString)) then begin
ShowMessage('֪ͨÈËÃû³ÆÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('֪ͨÈ˵ØÖ·1').AsString)) then begin
ShowMessage('֪ͨÈ˵ØÖ·1ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('֪ͨÈ˵绰').AsString)) then begin
ShowMessage('֪ͨÈ˵绰ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
{
if IsZhongwen(Trim(t_op_seae.FieldByName('֪ͨÈËÆóÒµ´úÂë').AsString)) then begin
ShowMessage('֪ͨÈËÆóÒµ´úÂëÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
}
if IsZhongwen(Trim(t_op_seae.FieldByName('×°»õ¸Û').AsString)) then begin
ShowMessage('×°»õ¸ÛÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('ж»õ¸Û').AsString)) then begin
ShowMessage('ж»õ¸ÛÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('Ä¿µÄµØ').AsString)) then begin
ShowMessage('Ä¿µÄµØÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('ßéÍ·').AsString)) then begin
ShowMessage('ßéÍ·ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(t_op_seae.FieldByName('»õÎïÃèÊö').AsString)) then begin
ShowMessage('»õÎïÃèÊöÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
Close;sql.Clear;
sql.Add('select * ');
sql.Add('from t_op_ctn_edi');
sql.Add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=t_op_seae.FieldByName('񅧏').AsString;
Open;First;
while not Eof do
begin
if (Trim(FieldByName('ÏäºÅ').AsString)<>FieldByName('ÏäºÅ').AsString) then begin
ShowMessage('ÏäºÅ'+FieldByName('ÏäºÅ').AsString+'Ç°ºóÓпոñ,Çë¼ì²é£¡');
Exit;
end;
if (Trim(FieldByName('·âºÅ').AsString)<>FieldByName('·âºÅ').AsString) then begin
ShowMessage('·âºÅ'+FieldByName('·âºÅ').AsString+'Ç°ºóÓпոñ,Çë¼ì²é£¡');
Exit;
end;
if (FieldByName('ÏäºÅ').AsString=FieldByName('·âºÅ').AsString) then begin
ShowMessage('ÏäºÅ·âºÅÏàͬ,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(FieldByName('ÏäºÅ').AsString)) then begin
ShowMessage('ÏäºÅ'+FieldByName('ÏäºÅ').AsString+'ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if IsZhongwen(Trim(FieldByName('·âºÅ').AsString)) then begin
ShowMessage('·âºÅ'+FieldByName('·âºÅ').AsString+'ÓÐÌØÊâ×Ö·û,Çë¼ì²é£¡');
Exit;
end;
if (not frm_data_share.t_code_ctn.Locate('±íÏÖÐÎʽ',FieldByName('±íÏÖÐÎʽ').AsString,[])) then begin
ShowMessage('ÏäºÅ'+FieldByName('ÏäºÅ').AsString+',ÏäÐÍÔÚϵͳÖв»´æÔÚ,Çë¼ì²é£¡');
Exit;
end;
Next;
end;
finally
FreeAndNil(aAdoQuery);
FreeAndNil(aAdoQuery2);
end;
Pnt:=bsSkinButton22.ClientToScreen(Point(0,bsSkinButton22.Height));
PopupMenu4.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_seae_edi_data.NZYClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_cosco) then
frm_op_seae_edi_custom_cosco:=tfrm_op_seae_edi_custom_cosco.Create(application);
frm_op_seae_edi_custom_cosco.ShowModal;
finally
frm_op_seae_edi_custom_cosco.free;
frm_op_seae_edi_custom_cosco:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton23Click(Sender: TObject);
begin
t_op_seae.Edit;
t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString;;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·2').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·2').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·3').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·3').AsString;
t_op_seae.fieldbyname('֪ͨÈ˳ÇÊÐ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˳ÇÊÐ').AsString;
t_op_seae.fieldbyname('֪ͨÈËÓʱà').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÓʱà').AsString;
t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
t_op_seae.fieldbyname('֪ͨÈËÁªÏµÈË').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÁªÏµÈË').AsString;
t_op_seae.fieldbyname('֪ͨÈ˵绰').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString;
t_op_seae.fieldbyname('֪ͨÈËÖÝ').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÖÝ').AsString;
t_op_seae.fieldbyname('֪ͨÈËÆóÒµ´úÂë').AsString:=t_op_seae.fieldbyname('ÊÕ»õÈËÆóÒµ´úÂë').AsString;
t_op_seae.Post;
end;
procedure Tfrm_op_seae_edi_data.NZTClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_custom_edi_zt) then
frm_op_seae_custom_edi_zt:=tfrm_op_seae_custom_edi_zt.Create(application);
frm_op_seae_custom_edi_zt.ShowModal;
finally
frm_op_seae_custom_edi_zt.free;
frm_op_seae_custom_edi_zt:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.updatelr;
var
aQuery:TADOQuery;
i:Integer;
str:WideString;
begin
aQuery:=CreateAdoQuery;
if dxDBGrid1.SelectedCount=0 then
begin
ShowMessage('ûÓÐÊý¾Ý£¡²»ÄÜͬ²½Â¼ÈëÈË£¡');
Exit;
end;
str:='';
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
end;
str:=str+')';
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add('update t_op_seae_edi set ¼ÈëÈË='+QuotedStr(employee)+' where ±àºÅ in '+ str);
ExecSQL;
end;
FreeAndNil(aQuery);
end;
procedure Tfrm_op_seae_edi_data.NWD2101Click(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_waidai) then
frm_op_seae_edi_custom_waidai:=tfrm_op_seae_edi_custom_waidai.Create(application);
frm_op_seae_edi_custom_waidai.ShowModal;
finally
frm_op_seae_edi_custom_waidai.free;
frm_op_seae_edi_custom_waidai:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.t_op_ctnBeforePost(DataSet: TDataSet);
begin
if length(t_op_ctn.FieldByName('ßéÍ·').AsString)>180 then begin
MessageDlg('ßéÍ·³¤¶È²»Äܳ¬¹ý180¸ö×Ö·û',mtWarning,[mbOk],0);
Abort;
end;
if length(t_op_ctn.FieldByName('»õÃè').AsString)>180 then begin
MessageDlg('»õÃ賤¶È²»Äܳ¬¹ý180¸ö×Ö·û',mtWarning,[mbOk],0);
Abort;
end;
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn.fieldbyname('´úÂë').asstring,[]) then
begin
t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
t_op_ctn['ÏäÐÍ']:=frm_data_share.t_code_ctn['ÏäÐÍ'];
t_op_ctn['³ß´ç']:=frm_data_share.t_code_ctn['³ß´ç'];
end
else
begin
t_op_ctn['´úÂë']:='';
t_op_ctn['±íÏÖÐÎʽ']:='';
t_op_ctn['ÏäÐÍ']:='';
t_op_ctn['³ß´ç']:='';
end;
end;
procedure Tfrm_op_seae_edi_data.NWD1101Click(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_waidai_1101) then
frm_op_seae_edi_custom_waidai_1101:=tfrm_op_seae_edi_custom_waidai_1101.Create(application);
frm_op_seae_edi_custom_waidai_1101.ShowModal;
finally
frm_op_seae_edi_custom_waidai_1101.free;
frm_op_seae_edi_custom_waidai_1101:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.NYDClick(Sender: TObject);
var
i:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
begin
if t_op_seae.IsEmpty then
exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
updatelr;
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
sys_print('Ô¶´ó²Õµ¥',2,aDataSource,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
finally
aDataSource.Free;
Free;
end;
end;
{
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
try
if not assigned(frm_op_seae_edi_custom_yd) then
frm_op_seae_edi_custom_yd:=tfrm_op_seae_edi_custom_yd.Create(application);
frm_op_seae_edi_custom_yd.ShowModal;
finally
frm_op_seae_edi_custom_yd.free;
frm_op_seae_edi_custom_yd:=nil;
end;
}
procedure Tfrm_op_seae_edi_data.NLDClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÍе¥ÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_ld) then
frm_op_seae_edi_custom_ld:=tfrm_op_seae_edi_custom_ld.Create(application);
frm_op_seae_edi_custom_ld.ShowModal;
finally
frm_op_seae_edi_custom_ld.free;
frm_op_seae_edi_custom_ld:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.NWYClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_wy) then
frm_op_seae_edi_custom_wy:=tfrm_op_seae_edi_custom_wy.Create(application);
frm_op_seae_edi_custom_wy.ShowModal;
finally
frm_op_seae_edi_custom_wy.free;
frm_op_seae_edi_custom_wy:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.NHGClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_hg) then
frm_op_seae_edi_custom_hg:=tfrm_op_seae_edi_custom_hg.Create(application);
frm_op_seae_edi_custom_hg.ShowModal;
finally
frm_op_seae_edi_custom_hg.free;
frm_op_seae_edi_custom_hg:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.btnSealClick(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn1,'·âºÅ');
end;
procedure Tfrm_op_seae_edi_data.NHFClick(Sender: TObject);
var
i:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
begin
if t_op_seae.IsEmpty then
exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
updatelr;
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
sys_print('º£·á²Õµ¥',2,aDataSource,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBComboBoxOPDropDown(Sender: TObject);
var AdoQuery1:TAdoQuery;
begin
wwDBComboBoxOP.items.clear;
AdoQuery1:=CreateAdoQuery;
with AdoQuery1 do
try
Close;sql.Clear;
SQL.Add('select * from t_sys_employee where ״̬=''ÔÚÖ°''');
SQL.Add('Order by ÐÕÃû');
Open;first;
while not Eof do
begin
wwDBComboBoxOP.Items.Add(AdoQuery1.fieldbyname('ÐÕÃû').AsString);
Next;
end;
finally
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.NZHClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_zh) then
frm_op_seae_edi_custom_zh:=tfrm_op_seae_edi_custom_zh.Create(application);
frm_op_seae_edi_custom_zh.ShowModal;
finally
frm_op_seae_edi_custom_zh.free;
frm_op_seae_edi_custom_zh:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton15Click(Sender: TObject);
var
aAdoQuery:TAdoQuery;
begin
if (t_op_ctn.State=dsinsert)or(t_op_ctn.State=dsedit) then
t_op_ctn.post;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select sum(¼þÊý) ¼þÊý, sum(ÖØÁ¿) ÖØÁ¿,sum(³ßÂë) ³ßÂë from t_op_ctn_edi');
sql.add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=t_op_seae.fieldbyname('񅧏').asstring;
open;First;
if not IsEmpty then
begin
if t_op_seae=nil then
exit;
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then
t_op_seae.post;
t_op_seae.Edit;
t_op_seae.FieldByName('¼þÊý').AsInteger:=FieldByName('¼þÊý').AsInteger;
t_op_seae.FieldByName('ÖØÁ¿').AsFloat:=FieldByName('ÖØÁ¿').AsFloat;
t_op_seae.FieldByName('³ßÂë').AsFloat:=FieldByName('³ßÂë').AsFloat;
t_op_seae.Post;
end;
finally
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton47Click(Sender: TObject);
begin
frm_main.view_momo(t_op_seae1,'ßéÍ·');
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton24Click(Sender: TObject);
begin
frm_main.view_momo(t_op_seae1,'»õÎïÃèÊö');
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton25Click(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then
t_op_seae1.DataSet.post;
sys_print('²Õµ¥É걨',2,t_op_seae1,t_op_ctn1,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton26Click(Sender: TObject);
begin
frm_main.view_momo(t_op_seae1,'ÏäºÅ·âºÅ');
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo3Change(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_loaport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo3.text,[]) then
begin
t_op_seae1.DataSet['×°¸Û´úÂë']:=frm_data_share.t_code_loaport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo3Exit(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_loaport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo3.text,[]) then
begin
t_op_seae1.DataSet['×°¸Û´úÂë']:=frm_data_share.t_code_loaport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo52Change(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo52.text,[]) then
begin
t_op_seae1.DataSet['ж»õ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo52Exit(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo52.text,[]) then
begin
t_op_seae1.DataSet['ж»õ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo17Change(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo17.text,[]) then
begin
t_op_seae1.DataSet['Ä¿µÄ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBLookupCombo17Exit(Sender: TObject);
begin
if t_op_seae1.DataSet=nil then
exit;
if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then
begin
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',wwDBLookupCombo17.text,[]) then
begin
t_op_seae1.DataSet['Ä¿µÄ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end;
end;
end;
procedure Tfrm_op_seae_edi_data.N1Click(Sender: TObject);
var
Ext,adate,bsno,corp,vslvoy,mblno,id,cntNo,ctnName,s:String;
ExcelTemplet:Variant;
i,j,k:integer;
M,D,Y:Word;
imp,seae_apply_add_total:boolean;
aAdoQuery,t_op_ctn_edi:TAdoQuery;
alist:TStringList;
function getcustedi(cust:string):string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
result:='';
try
aQuery.Close;
aQuery.SQL.Text:='select EDI´úÂë from t_crm_client where ¿Í»§¼ò³Æ='''+cust+'''';
aQuery.Open;
if not aQuery.IsEmpty then
result:=aQuery.fieldbyname('EDI´úÂë').AsString;
finally
FreeAndNil(aQuery);
end;
end;
function GetvesselEdi(avessel: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select ´¬²°ºôºÅ from t_code_vessel where Ó¢ÎÄ´¬Ãû='''+avessel+'''');
Open;
if IsEmpty then
Result:='a'
else
Result:=FieldByName('´¬²°ºôºÅ').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function getETD(VSL,VOY:string):string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
result:='';
try
aQuery.Close;
aQuery.SQL.Text:='select * from v_vessel_voyage where Ó¢ÎÄ´¬Ãû='''+VSL+''' and º½´Î='''+VOY+'''';
aQuery.Open;
if not aQuery.IsEmpty then
result:=aQuery.fieldbyname('¿ª´¬ÈÕÆÚ').AsString;
finally
FreeAndNil(aQuery);
end;
end;
begin
// id:=get_id;
j:=1;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
close;SQL.Clear;
SQL.Add('select * from t_op_seae_edi');
SQL.Add('where Ö÷Ìáµ¥ºÅ=:Ö÷Ìáµ¥ºÅ');
Parameters.ParamByName('Ö÷Ìáµ¥ºÅ').Value:='';
end;
alist:=TStringList.Create;
t_op_ctn_edi:=CreateAdoQuery;
t_op_ctn_edi.close;
t_op_ctn_edi.sql.Text:='select * from t_op_ctn_edi where 񅧏=:񅧏';
if OpenDialog1.Execute then begin
Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName));
if Ext='.xls' then begin
ExcelTemplet:= CreateOleObject('Excel.Application');
ExcelTemplet.Workbooks.Open(OpenDialog1.FileName);
try
frm_main.db.BeginTrans;
t_op_seae.DisableControls;
t_op_ctn.DisableControls;
I:=2;
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value)<>'' do
begin
mblno:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value);
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('Ö÷Ìáµ¥ºÅ').Value:=mblno;
aAdoQuery.Open;
if aAdoQuery.IsEmpty then
begin
j:=j+1;
id:=get_edi_id;
t_op_seae.Insert;
t_op_seae['񅧏']:=id;
t_op_seae['ÒµÎñ±àºÅ']:=mblno;
t_op_seae['Ö÷±àºÅ']:='';
t_op_seae['EDIÀàÐÍ']:='CN';
t_op_seae['EDI״̬']:='δ·¢ËÍ';
t_op_seae['¼ÈëÈË']:=employee;
t_op_seae['¼ÈëÈÕÆÚ']:=now;
t_op_seae['Ö÷Ìáµ¥ºÅ']:=mblno;
t_op_seae['¸¶·Ñ·½Ê½']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,5].Value);
t_op_seae['Ç©µ¥µØµã']:='QINGDAO,CHINA';
t_op_seae['·¢»õÈË´úÂë']:='';
// t_op_seae['´¬¹«Ë¾']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,4].Value);
t_op_seae['´¬¹«Ë¾´úÂë']:=getcustedi(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,4].Value));
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,13].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['·¢»õÈËÃû³Æ']:=Trim(s);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,14].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['·¢»õÈ˵ØÖ·1']:=Trim(s);
t_op_seae['·¢»õÈ˵ØÖ·2']:='';
t_op_seae['·¢»õÈ˵ØÖ·3']:='';
t_op_seae['·¢»õÈË']:='';
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,15].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['ÊÕ»õÈËÃû³Æ']:=Trim(s);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,16].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['ÊÕ»õÈ˵ØÖ·1']:=Trim(s);
t_op_seae['ÊÕ»õÈ˵ØÖ·2']:='';
t_op_seae['ÊÕ»õÈ˵ØÖ·3']:='';
t_op_seae['ÊÕ»õÈË´úÂë']:='';
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,17].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['֪ͨÈËÃû³Æ']:=Trim(s);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,18].Value;
s:='';
for k:=0 to alist.Count-1 do
begin
s:=Trim(alist[k])+s;
end;
t_op_seae['֪ͨÈ˵ØÖ·1']:=Trim(s);
t_op_seae['֪ͨÈ˵ØÖ·2']:='';
t_op_seae['֪ͨÈ˵ØÖ·3']:='';
t_op_seae['´¬Ãû']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,1].Value);
t_op_seae['º½´Î']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value);
t_op_seae['´¬²°IMO']:=GetvesselEdi(t_op_seae['´¬Ãû']);
if getETD(t_op_seae['´¬Ãû'],t_op_seae['º½´Î'])<>'' then
begin
t_op_seae['¿ª´¬ÈÕÆÚ']:=getETD(t_op_seae['´¬Ãû'],t_op_seae['º½´Î']);
t_op_seae.FieldByName('Ô¤µÖÈÕÆÚ').AsDateTime:=t_op_seae.FieldByName('¿ª´¬ÈÕÆÚ').AsDateTime+3;
end;
t_op_seae['×°»õ¸Û']:='QINGDAO,CHINA';//VartoStr(ExcelTemplet.ActiveSheet.Cells[I,7].Value);
t_op_seae['×°¸Û´úÂë']:='CNTAO';
{if frm_data_share.t_code_loaport.Locate('Ó¢ÎÄÃû',t_op_seae['×°»õ¸Û'],[]) then
begin
t_op_seae['×°¸Û´úÂë']:=frm_data_share.t_code_loaport['EDI´úÂë'];
end
else t_op_seae['×°¸Û´úÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,8].Value);
}
t_op_seae['ж»õ¸Û']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,9].Value);
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',t_op_seae['ж»õ¸Û'],[]) then
begin
t_op_seae['ж»õ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end else t_op_seae['ж»õ´úÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value);
t_op_seae['Ä¿µÄµØ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,11].Value);
if frm_data_share.t_code_disport.Locate('Ó¢ÎÄÃû',t_op_seae['ж»õ¸Û'],[]) then
begin
t_op_seae['Ä¿µÄ´úÂë']:=frm_data_share.t_code_disport['EDI´úÂë'];
end else t_op_seae['Ä¿µÄ´úÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,12].Value);
t_op_seae['ÔËÊäÌõ¿î']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,6].Value);
t_op_seae['ÔËÊ䷽ʽ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,28].Value);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value;
t_op_seae['ßéÍ·']:=alist.Text;
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value;
t_op_seae['»õÎïÃèÊö']:=alist.Text;
t_op_seae['¼þÊý']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value);
t_op_seae['°ü×°']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value);
t_op_seae['ÖØÁ¿']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value);
t_op_seae['³ßÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value);
t_op_seae['ΣÏÕÆ··ÖÀà']:='';
t_op_seae['ΣÏÕÆ·±àºÅ']:='';
t_op_seae['Àä²Øͨ·çÁ¿']:='';
t_op_seae['ζȵ¥Î»']:='';
t_op_seae['ÉèÖÃζÈ']:='';
t_op_seae['×îµÍζÈ']:='';
t_op_seae['×î¸ßζÈ']:='';
t_op_seae['»õÎï±êʶ']:='';
t_op_seae['ÔË·ÑЭÒéºÅ']:='';
t_op_seae['ʪ¶È']:='';
t_op_seae['¶©²ÕºÅÂë']:='';
t_op_seae['ÔËÊ䷽ʽ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,28].Value);
if pos('¶³',VartoStr(ExcelTemplet.ActiveSheet.Cells[I,29].Value))>0 then
begin
t_op_seae['»õÎï±êʶ']:='R';
t_op_seae['ζȵ¥Î»']:='C';
t_op_seae['ÉèÖÃζÈ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value);
t_op_seae['×îµÍζÈ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value);
t_op_seae['×î¸ßζÈ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value);
end
else
if pos('Σ',VartoStr(ExcelTemplet.ActiveSheet.Cells[I,29].Value))>0 then
begin
t_op_seae['»õÎï±êʶ']:='D';
t_op_seae['ΣÏÕÆ··ÖÀà']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,31].Value);
t_op_seae['ΣÏÕÆ·±àºÅ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,32].Value);
end
else t_op_seae['»õÎï±êʶ']:='S';
t_op_seae['ÎļþÀàÐÍ']:='Master';
t_op_seae.Post;
t_op_ctn_edi.Close;
t_op_ctn_edi.Parameters.ParamByName('񅧏').Value:=id;
t_op_ctn_edi.Open;
t_op_ctn_edi.Insert;
t_op_ctn_edi['񅧏']:=id;
cntNo:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),1,2);
ctnName:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),3,2);
// showmessage(mblno+' '+cntNo+'--'+ctnName);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([cntNo,ctnName]),[]) then
begin
t_op_ctn_edi['´úÂë']:=frm_data_share.t_code_ctn.fieldbyname('´úÂë').asstring;
end
else
begin
t_op_ctn_edi['´úÂë']:='ÎÞ';
end;
t_op_ctn_edi['³ß´ç']:=cntNo;
t_op_ctn_edi['ÏäÐÍ']:=ctnName;
t_op_ctn_edi['ÊýÁ¿']:=1;
t_op_ctn_edi['±íÏÖÐÎʽ']:=cntNo+''''+ctnName;
t_op_ctn_edi['ÏäºÅ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value);
t_op_ctn_edi['·âºÅ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value);
t_op_ctn_edi['¼þÊý']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value);
t_op_ctn_edi['°ü×°']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value);
t_op_ctn_edi['ÖØÁ¿']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value);
t_op_ctn_edi['³ßÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value;
t_op_ctn_edi['ßéÍ·']:=alist.Text;
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value;
t_op_ctn_edi['»õÃè']:=alist.Text;
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn_edi.fieldbyname('´úÂë').asstring,[]) then
begin
if frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='20'then
t_op_ctn_edi['TEU']:=1;
if (frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='40')OR
(frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='45')then
t_op_ctn_edi['TEU']:=2;
end;
t_op_ctn_edi.Post;
end
else
begin
t_op_ctn_edi.Close;
t_op_ctn_edi.Parameters.ParamByName('񅧏').Value:=aAdoQuery.fieldbyname('񅧏').asstring;
t_op_ctn_edi.Open;
if not t_op_ctn_edi.Locate('ÏäºÅ;·âºÅ',VarArrayOf([VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value),VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value)]),[]) then
begin
t_op_ctn_edi.Insert;
t_op_ctn_edi['񅧏']:=aAdoQuery.fieldbyname('񅧏').asstring;
cntNo:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),1,2);
ctnName:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),3,2);
if frm_data_share.t_code_ctn.Locate('³ß´ç;ÏäÐÍ',VarArrayOf([cntNo,ctnName]),[]) then
begin
t_op_ctn_edi['´úÂë']:=frm_data_share.t_code_ctn.fieldbyname('´úÂë').asstring;
end
else
begin
t_op_ctn_edi['´úÂë']:='ÎÞ';
end;
t_op_ctn_edi['³ß´ç']:=cntNo;
t_op_ctn_edi['ÏäÐÍ']:=ctnName;
t_op_ctn_edi['ÊýÁ¿']:=1;
t_op_ctn_edi['±íÏÖÐÎʽ']:=cntNo+''''+ctnName;
t_op_ctn_edi['ÏäºÅ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value);
t_op_ctn_edi['·âºÅ']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value);
t_op_ctn_edi['¼þÊý']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value);
t_op_ctn_edi['°ü×°']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value);
t_op_ctn_edi['ÖØÁ¿']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value);
t_op_ctn_edi['³ßÂë']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value);
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value;
t_op_ctn_edi['ßéÍ·']:=alist.Text;
alist.Text:='';
alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value;
t_op_ctn_edi['»õÃè']:=alist.Text;
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn_edi.fieldbyname('´úÂë').asstring,[]) then
begin
if frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='20'then
t_op_ctn_edi['TEU']:=1;
if (frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='40')OR
(frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='45')then
t_op_ctn_edi['TEU']:=2;
end;
t_op_ctn_edi.Post;
end;
UpdateCTN(aAdoQuery.fieldbyname('񅧏').asstring);
end;
i:=i+1;
end;
frm_main.db.CommitTrans;
finally
t_op_seae.EnableControls;
t_op_ctn.EnableControls;
ExcelTemplet.DisplayAlerts := false;//ÊÇ·ñÌáʾ´æÅÌ
ExcelTemplet.Quit;//Èç¹û³ö´íÔòÍ˳ö
MessageDlg('µ¼Èë:'+IntTostr(i-2)+'ÐÐ '+'ƱÊý:'+IntTostr(j-1)+'Ʊ ', mtConfirmation, [mbYes],0);
if frm_main.db.InTransaction then
begin
ShowMessage('µ¼Èëʱ³ö´í£¬ÇëË¢ÐÂÖØÊÔ£¡');
frm_main.db.RollbackTrans;
end;
end;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton28Click(Sender: TObject);
var i :Integer;
begin
with t_op_ctn do
begin
First;
while not eof do
begin
Edit;
FieldByName('³ßÂë').AsFloat:=s_w(0,FieldByName('³ßÂë').AsFloat);
post;
Next;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.NHGYDTClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
updatelr;
try
if not assigned(frm_op_seae_edi_custom_hgYDT) then
frm_op_seae_edi_custom_hgYDT:=tfrm_op_seae_edi_custom_hgYDT.Create(application);
frm_op_seae_edi_custom_hgYDT.ShowModal;
finally
frm_op_seae_edi_custom_hgYDT.free;
frm_op_seae_edi_custom_hgYDT:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton29Click(Sender: TObject);
{
var xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_web: WideString;
i :Integer;
aAdoQuery,bAdoQuery:TAdoQuery;
AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond:Word;
STATUS:string;
}
begin
{
getwebservice_ds;
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
Close;Sql.Clear;
SQL.Add('Insert Into t_op_state (±àºÅ ,ÒµÎñ״̬ ,ÊÇ·ñÍê³É,Íê³Éʱ¼ä,Íê³ÉÈË,¼ÈëÈË ,¼ÈëÈÕÆÚ,ϵͳ¼ÓÈë,±¸×¢)');
SQL.Add('values (:±àºÅ,:ÒµÎñ״̬ ,:ÊÇ·ñÍê³É,:Íê³Éʱ¼ä,:Íê³ÉÈË,:¼ÈëÈË,:¼ÈëÈÕÆÚ,:ϵͳ¼ÓÈë,:±¸×¢)');
Close;
end;
bAdoQuery:=CreateAdoQuery;
with bAdoQuery do
begin
Close;Sql.Clear;
SQL.Add('select ÒµÎñ״̬,Íê³Éʱ¼ä from t_op_state');
SQL.Add('where 񅧏=:񅧏');
SQL.Add('order by Íê³Éʱ¼ä desc');
end;
try
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
xmldoc.Options:=[doNamespaceDecl];
s_web:=mServiceSoap_Ds.LoadCustomMainfastStatus(t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
xmldoc.LoadFromXML(s_web);
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\Çൺº£¹Ø\dscustom.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
if cds.RecordCount<=0 then
begin
ShowMessage('º£¹ØûÓзµ»ØÊý¾Ý');
exit;
end;
with cds do
begin
First;
while not Eof do
begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('±àºÅ').Value:=t_op_seae.FieldByName('Ö÷±àºÅ').AsString;
if Copy(FieldByName('STATUS').AsString,1,5)='11104' then
STATUS:='²Õµ¥ÔËÊ乤¾ßÎÞÔ¤±¨¶¯Ì¬'
else
if Copy(FieldByName('STATUS').AsString,1,5)='11124' then
STATUS:='µ¥ÒÑ·ÅÐв»ÄÜÔÙÆ´Ïä'
else
if Copy(FieldByName('STATUS').AsString,1,5)='15302' then
STATUS:='Àí»õ±¨¸æ´«Êä³É¹¦Àí»õÒì³£'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21102' then
STATUS:='²Õµ¥ÔËÊ乤¾ßδ±¸°¸'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21106' then
STATUS:='ÌᣨÔË£©µ¥ºÅÖظ´'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21107' then
STATUS:='×ÜÌᣨÔË£©µ¥Î´Ïòº£¹Ø´«Êä'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21301' then
STATUS:='Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦'
else
if Copy(FieldByName('STATUS').AsString,1,5)='22103' then
STATUS:=' δÕÒµ½¶ÔÓ¦ÌᣨÔË£©µ¥'
else
if Copy(FieldByName('STATUS').AsString,1,5)='22201' then
STATUS:='Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='23105' then
STATUS:='¸ÃÌᣨÔË£©µ¥ÒѺË×¢'
else
if Copy(FieldByName('STATUS').AsString,1,5)='23301' then
STATUS:='Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='24103' then
STATUS:='ÉêÇëɾ³ýµÄÌᣨÔË£©µ¥²»´æÔÚ'
else
if Copy(FieldByName('STATUS').AsString,1,5)='24301' then
STATUS:='Ô¤Åä²Õµ¥É¾³ýÉêÇëÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='25201' then
STATUS:='º£ÔËÔ˵ֱ¨¸æ´«Êä³É¹¦'
else
if Copy(FieldByName('STATUS').AsString,1,5)='99001' then
STATUS:=' ±¨ÎIJ»·ûºÏÌîÖƹ淶'
else STATUS:=FieldByName('STATUS').AsString;
aAdoQuery.Parameters.ParamByName('ÒµÎñ״̬').Value:=STATUS;
aAdoQuery.Parameters.ParamByName('ÊÇ·ñÍê³É').Value:=true;
aAdoQuery.Parameters.ParamByName('Íê³ÉÈË').Value:=employee;
AYear:=StrToInt(Copy(FieldByName('DATESTR').AsString,1,4));
AMonth:=StrToInt(Copy(FieldByName('DATESTR').AsString,5,2));
ADay:=StrToInt(Copy(FieldByName('DATESTR').AsString,7,2));
AHour:=StrToInt(Copy(FieldByName('DATESTR').AsString,9,2));
AMinute:=StrToInt(Copy(FieldByName('DATESTR').AsString,11,2));
aAdoQuery.Parameters.ParamByName('Íê³Éʱ¼ä').Value:=EncodeDatetime(AYear,AMonth,ADay,AHour,AMinute,ASecond, AMilliSecond); //DATASTR
aAdoQuery.Parameters.ParamByName('¼ÈëÈË').Value:=employee;
aAdoQuery.Parameters.ParamByName('¼ÈëÈÕÆÚ').Value:=FormatDateTime('YYYY-MM-DD',Now);
aAdoQuery.Parameters.ParamByName('ϵͳ¼ÓÈë').Value:=True;
aAdoQuery.Parameters.ParamByName('±¸×¢').Value:=FieldByName('STATUS').AsString;
aAdoQuery.ExecSQL;
Next;
end;
end;
finally
bAdoQuery.Close;
bAdoQuery.Parameters.ParamByName('±àºÅ').Value:=t_op_seae.FieldByName('Ö÷±àºÅ').AsString;
bAdoQuery.Open;
bAdoQuery.First;
modify_all:=True;
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString<>'' then
begin
t_op_seae.Edit;
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='Ö÷ÒªÊý¾Ý´«Êä³É¹¦'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÆäËûÊý¾ÝÉóºËͨ¹ý'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô˵ֱȶԽá¹ûΪ£ºÔ˵ÖÕý³£' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÒÑÔ˵Ö'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='ÌáÔ˵¥·ÅÐÐ' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÒÑ·ÅÐÐ'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÐÞ¸Äͨ¹ý';
t_op_seae.Post;
end;
modify_all:=False;
aAdoQuery.Free;
bAdoQuery.Free;
cds.Free;
t_op_state.Requery();
DBEdit3.OnChange(Sender);
end;
}
end;
procedure Tfrm_op_seae_edi_data.SelectReciveData(bsno,mblno:string);
var xmldoc:IXMLDocument;
cds:TClientDataSet;
XMLTransformProvider1:TXMLTransformProvider;
s_web: WideString;
i :Integer;
aAdoQuery,bAdoQuery:TAdoQuery;
AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond:Word;
STATUS:string;
begin
cds:=TClientDataSet.Create(nil);
XMLTransformProvider1:=TXMLTransformProvider.Create(NIL);
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
Close;Sql.Clear;
SQL.Add('Insert Into t_op_state (±àºÅ ,ÒµÎñ״̬ ,ÊÇ·ñÍê³É,Íê³Éʱ¼ä,Íê³ÉÈË,¼ÈëÈË ,¼ÈëÈÕÆÚ,ϵͳ¼ÓÈë,±¸×¢)');
SQL.Add('values (:±àºÅ,:ÒµÎñ״̬ ,:ÊÇ·ñÍê³É,:Íê³Éʱ¼ä,:Íê³ÉÈË,:¼ÈëÈË,:¼ÈëÈÕÆÚ,:ϵͳ¼ÓÈë,:±¸×¢)');
Close;
end;
bAdoQuery:=CreateAdoQuery;
with bAdoQuery do
begin
Close;Sql.Clear;
SQL.Add('select ÒµÎñ״̬,Íê³Éʱ¼ä from t_op_state');
SQL.Add('where 񅧏=:񅧏');
SQL.Add('order by Íê³Éʱ¼ä desc');
end;
try
cds.Active:=false;
xmldoc:=NewXMLDocument;
xmldoc.Encoding:='UTF-8';
xmldoc.Options:=[doNamespaceDecl];
s_web:=mServiceSoap_Ds.LoadCustomMainfastStatus(mblno);
xmldoc.LoadFromXML(s_web);
XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\Çൺº£¹Ø\dscustom.xtr';
XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument;
cds.Data:=XMLTransformProvider1.Data;
cds.Active:=true;
with cds do
begin
First;
while not Eof do
begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('񅧏').Value:=bsno;
if Copy(FieldByName('STATUS').AsString,1,5)='11104' then
STATUS:='²Õµ¥ÔËÊ乤¾ßÎÞÔ¤±¨¶¯Ì¬'
else
if Copy(FieldByName('STATUS').AsString,1,5)='11124' then
STATUS:='µ¥ÒÑ·ÅÐв»ÄÜÔÙÆ´Ïä'
else
if Copy(FieldByName('STATUS').AsString,1,5)='15302' then
STATUS:='Àí»õ±¨¸æ´«Êä³É¹¦Àí»õÒì³£'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21102' then
STATUS:='²Õµ¥ÔËÊ乤¾ßδ±¸°¸'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21106' then
STATUS:='ÌᣨÔË£©µ¥ºÅÖظ´'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21107' then
STATUS:='×ÜÌᣨÔË£©µ¥Î´Ïòº£¹Ø´«Êä'
else
if Copy(FieldByName('STATUS').AsString,1,5)='21301' then
STATUS:='Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦'
else
if Copy(FieldByName('STATUS').AsString,1,5)='22103' then
STATUS:=' δÕÒµ½¶ÔÓ¦ÌᣨÔË£©µ¥'
else
if Copy(FieldByName('STATUS').AsString,1,5)='22201' then
STATUS:='Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='23105' then
STATUS:='¸ÃÌᣨÔË£©µ¥ÒѺË×¢'
else
if Copy(FieldByName('STATUS').AsString,1,5)='23301' then
STATUS:='Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='24103' then
STATUS:='ÉêÇëɾ³ýµÄÌᣨÔË£©µ¥²»´æÔÚ'
else
if Copy(FieldByName('STATUS').AsString,1,5)='24301' then
STATUS:='Ô¤Åä²Õµ¥É¾³ýÉêÇëÉóºËͨ¹ý'
else
if Copy(FieldByName('STATUS').AsString,1,5)='25201' then
STATUS:='º£ÔËÔ˵ֱ¨¸æ´«Êä³É¹¦'
else
if Copy(FieldByName('STATUS').AsString,1,5)='99001' then
STATUS:=' ±¨ÎIJ»·ûºÏÌîÖƹ淶'
else STATUS:=FieldByName('STATUS').AsString;
aAdoQuery.Parameters.ParamByName('ÒµÎñ״̬').Value:=STATUS;
aAdoQuery.Parameters.ParamByName('ÊÇ·ñÍê³É').Value:=true;
aAdoQuery.Parameters.ParamByName('Íê³ÉÈË').Value:=employee;
AYear:=StrToInt(Copy(FieldByName('DATESTR').AsString,1,4));
AMonth:=StrToInt(Copy(FieldByName('DATESTR').AsString,5,2));
ADay:=StrToInt(Copy(FieldByName('DATESTR').AsString,7,2));
AHour:=StrToInt(Copy(FieldByName('DATESTR').AsString,9,2));
AMinute:=StrToInt(Copy(FieldByName('DATESTR').AsString,11,2));
aAdoQuery.Parameters.ParamByName('Íê³Éʱ¼ä').Value:=EncodeDatetime(AYear,AMonth,ADay,AHour,AMinute,ASecond, AMilliSecond); //DATASTR
aAdoQuery.Parameters.ParamByName('¼ÈëÈË').Value:=employee;
aAdoQuery.Parameters.ParamByName('¼ÈëÈÕÆÚ').Value:=FormatDateTime('YYYY-MM-DD',Now);
aAdoQuery.Parameters.ParamByName('ϵͳ¼ÓÈë').Value:=True;
aAdoQuery.Parameters.ParamByName('±¸×¢').Value:=FieldByName('STATUS').AsString;
aAdoQuery.ExecSQL;
Next;
end;
end;
finally
bAdoQuery.Close;
bAdoQuery.Parameters.ParamByName('񅧏').Value:=bsno;
bAdoQuery.Open;
bAdoQuery.First;
modify_all:=True;
t_op_seae.Edit;
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString<>'' then
begin
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='Ö÷ÒªÊý¾Ý´«Êä³É¹¦'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÆäËûÊý¾ÝÉóºËͨ¹ý'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô˵ֱȶԽá¹ûΪ£ºÔ˵ÖÕý³£' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÒÑÔ˵Ö'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='ÌáÔ˵¥·ÅÐÐ' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÒÑ·ÅÐÐ'
else
if bAdoQuery.FieldByName('ÒµÎñ״̬').AsString='Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý' then
t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString:='ÐÞ¸Äͨ¹ý'
end;
t_op_seae.Post;
aAdoQuery.Free;
XMLTransformProvider1.Free;
cds.Free;
bAdoQuery.Free;
modify_all:=False;
end;
end;
procedure Tfrm_op_seae_edi_data.t_op_seaeBeforeEdit(DataSet: TDataSet);
begin
if not modify_all then begin
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then begin
showmessage('ÒÑ·¢ËͲ»ÄÜÐÞ¸Ä,ɾ³ý£¡');
abort;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.t_op_ctnBeforeEdit(DataSet: TDataSet);
begin
if not modify_all then begin
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then begin
showmessage('ÒÑ·¢ËͲ»ÄÜÐ޸ģ¡');
abort;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.N20Click(Sender: TObject);
begin
if t_op_seae.fieldbyname('¼ÈëÈË').AsString<>employee then begin
if (not if_open('422')) then begin
ShowMessage('ÄãûÓÐȨÏÞÐÞ¸ÄËûÃǼÈëµÄÒµÎñ£¡');
exit;
end;
end;
try
modify_all:=true;
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='δ·¢ËÍ';
t_op_seae.Post;
finally
modify_all:=false;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton30Click(Sender: TObject);
var
Str:string;
i:integer;
numunzipped:integer;
fileType,SenderHandphone,SenderEmail,SenderFax:string;
s0,s5:string;
aQuery:TADOQuery;
begin
if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then
t_op_seae1.DataSet.post;
if (wwDBLookupCombo2.Text='') then begin
showmessage('״̬²»ÄÜΪ¿Õ£¡');
abort;
end;
if t_op_seae.IsEmpty then Exit;
aQuery:=CreateAdoQuery;
try
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aQuery.SQL.Text:='update t_op_seae_edi set Òì³£ÒµÎñ״̬='''+wwDBLookupCombo2.Text+''',״̬¸üÐÂÈË='''+employee+''',״̬¸üÐÂʱ¼ä=GETDATE() WHERE ±àºÅ in '+str;
aQuery.ExecSQL;
t_op_seae.Requery();
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
adopingtai.Close;
adopingtai.SQL.Clear;
adopingtai.SQL.Add('insert into op_seae_edi_status(gid,mfno,mblno,statustext,statustime,createtime,ShenBaoXiangShu) ');
adopingtai.SQL.Add(' select top 1 newid(),MFNO,MBLNO,'''+wwDBLookupCombo2.Text+''',GETDATE(),GETDATE(),''0'' from op_seae_edi WHERE ');
if (t_op_seae.FieldByName('·ÖÌáµ¥ºÅ').AsString<>'') then
adopingtai.SQL.Add(' HBLNO='''+t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring+''' ')
else adopingtai.SQL.Add(' ISNULL(HBLNO,'''')='''' AND MBLNO='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+''' ');
adopingtai.ExecSQL;
end;
end else begin
adopingtai.Close;
adopingtai.SQL.Clear;
adopingtai.SQL.Add('insert into op_seae_edi_status(gid,mfno,mblno,statustext,statustime,createtime,ShenBaoXiangShu) ');
adopingtai.SQL.Add(' select top 1 newid(),MFNO,MBLNO,'''+wwDBLookupCombo2.Text+''',GETDATE(),GETDATE(),''0'' from op_seae_edi WHERE ');
if (t_op_seae.FieldByName('·ÖÌáµ¥ºÅ').AsString<>'') then
adopingtai.SQL.Add(' HBLNO='''+t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring+''' ')
else adopingtai.SQL.Add(' ISNULL(HBLNO,'''')='''' AND MBLNO='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+''' ');
adopingtai.ExecSQL;
end;
ShowMessage('ÒѸüУ¡');
finally
FreeAndNil(aQuery);
end;
{
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then begin
showmessage('ÒÑ·¢ËͲ»ÄÜ·¢ËÍ,ÇëÐÞ¸ÄΪδ·¢ËÍ£¡');
abort;
end;
if MessageDlg('È·¶¨Òª·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)=mrNo then
Exit;
bsSkinButton28Click(Sender);
bsSkinButton15Click(Sender);
s0:='';
s5:='';
str:=Tstringlist.Create;
try
modify_all:=True;
if bsSkinComboBox1.ItemIndex=0 then
begin
Str:=CreateSIEdiFile_xml;
s0:=Str.Text;
for i:=0 to Str.Count-1 do begin
if IsZhongwen(Str[i]) then
begin
ShowMessage('´ËƱҵÎñ¿ÉÄܺ¬ÓÐÖÐÎÄ×Ö·û»òÆäËû²»¹æ·¶×Ö·û'+Str[i]);
exit;
end;
end;
s5:='1';
end
else
begin
Str:=CreateSIEdiFile_xml;
s0:=Str.Text;
for i:=0 to Str.Count-1 do
begin
if IsZhongwen(Str[i]) then
begin
ShowMessage('´ËƱҵÎñ¿ÉÄܺ¬ÓÐÖÐÎÄ×Ö·û»òÆäËû²»¹æ·¶×Ö·û'+Str[i]);
exit;
end;
end;
end;
finally
modify_all:=False;
FreeAndNil(Str)
end;
try
modify_all:=True;
getwebservice_ds;
if frm_data_share.t_sys_employee.locate('ÐÕÃû',employee,[]) then
begin
SenderHandphone:=frm_data_share.t_sys_employee.fieldbyname('Òƶ¯µç»°').asstring;
SenderEmail:=frm_data_share.t_sys_employee.fieldbyname('ÓÊÏä').asstring;
SenderFax:=frm_data_share.t_sys_employee.fieldbyname('´«Õæ').asstring;
end;
mServiceSoap_Ds.UpdateCustomMainfast(s0,s5,trim(get_parameters_value(301,'')),employee,SenderHandphone,SenderEmail,SenderFax,frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring);
frm_op_seae_edi_data.t_op_seae.Edit;
frm_op_seae_edi_data.t_op_seae.FieldByName('·¢ËÍʱ¼ä').Value:=Now;
frm_op_seae_edi_data.t_op_seae.FieldByName('µ±Ç°×´Ì¬').Value:='ÒÑ·¢ËÍ';
frm_op_seae_edi_data.t_op_seae.Post;
showmessage('·¢Ëͳɹ¦£¡');
modify_all:=False;
except
showmessage('·¢ËÍ´íÎó£¡');
end;
}
end;
procedure Tfrm_op_seae_edi_data.bsSkinComboBox1Change(Sender: TObject);
begin
if (bsSkinComboBox1.ItemIndex=3) or (bsSkinComboBox1.ItemIndex=2) then
begin
cxDBCheckListBox1.Visible:=true;
end
else
begin
cxDBCheckListBox1.Visible:=False;
end;
end;
{
procedure Tfrm_op_seae_edi_data.bsSkinButton31Click(Sender: TObject);
var
Str:TStrings;
i:integer;
fileType:string;
begin
if bsSkinComboBox1.ItemIndex=0 then
fileType:='-9'
else if bsSkinComboBox1.ItemIndex=1 then
fileType:='-2'
else if bsSkinComboBox1.ItemIndex=2 then
fileType:='-3'
else if bsSkinComboBox1.ItemIndex=3 then
fileType:='-5'
else if bsSkinComboBox1.ItemIndex=4 then
fileType:='-0'
else if bsSkinComboBox1.ItemIndex=5 then
fileType:='-11'
else fileType:='-9';
str:=Tstringlist.Create;
try
Str:=CreateSIEdiFile_xml;
for i:=0 to Str.Count-1 do begin
if IsZhongwen(Str[i]) then begin
if MessageDlg('´ËƱҵÎñ¿ÉÄܺ¬ÓÐÖÐÎÄ×Ö·û»òÆäËû²»¹æ·¶×Ö·û,ȷʵҪ¼ÌÐøÉÏ´«Âð£¡',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
end;
SaveDialog1.FileName:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
SaveDialog1.Filter:='*.xml|*.xml';
if SaveDialog1.Execute then
begin
str.SaveToFile(SaveDialog1.FileName+fileType+'.xml');
showmessage('ÎļþÉú³É³É¹¦£¡');
end
else
begin
showmessage('ÎļþÉú³Éʧ°Ü£¡');
exit;
end;
finally
FreeAndNil(Str)
end;
end;
}
procedure Tfrm_op_seae_edi_data.N2Click(Sender: TObject);
var
afield,afieldfee : variant;
aOR_ID:integer;
aQuery:TAdoQuery;
i:integer;
bsno,id:string;
Boolean_Ctn:Boolean;
begin
if t_op_seae.IsEmpty then
begin
exit;
MessageDlg('ûÓи´ÖƵÄÐÅÏ¢£¬²»Äܸ´ÖÆÌí¼Ó£¡',mtWarning,[mbok],0);
end;
afield := vararraycreate([0,t_op_seae.fieldcount-1],varvariant);
for i := 0 to (t_op_seae.fieldcount-1) do
begin
afield[i] :=t_op_seae.fields[i].value ;
end;
bsno:=t_op_seae.fieldbyname('񅧏').AsString;
t_op_seae.append;
for i := 0 to (t_op_seae.fieldcount-1) do
begin
if t_op_seae.fields[i].FieldName<>'񅧏' then
t_op_seae.fields[i].value := afield[i] ;
end;
id:=get_edi_id;
t_op_seae.fieldbyname('¼ÈëÈË').Value:=employee;
t_op_seae.fieldbyname('¼ÈëÈÕÆÚ').Value:=date;
t_op_seae.fieldbyname('EDI״̬').Value:='δ·¢ËÍ';
t_op_seae.fieldbyname('µ±Ç°×´Ì¬').Value:='δ·¢ËÍ';
t_op_seae.fieldbyname('񅧏').Value:=id;
t_op_seae.fieldbyname('Ö÷±àºÅ').Value:=id;
t_op_seae.fieldbyname('ÐÞ¸ÄÔ­Òò').Value:='';
t_op_seae.Post;
aQuery:=CreateAdoQuery;
try
with aQuery do
begin
close;sql.clear;
sql.Add('select * from t_op_ctn_edi where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=bsno;
open;
if not t_op_ctn.active then
t_op_ctn.Open;
first;
while not eof do
begin
t_op_ctn.Insert;
t_op_ctn['񅧏']:=id;
t_op_ctn['´úÂë']:=aQuery['´úÂë'];
t_op_ctn['³ß´ç']:=aQuery['³ß´ç'];
t_op_ctn['ÏäÐÍ']:=aQuery['ÏäÐÍ'];
t_op_ctn['ÊýÁ¿']:=1;
t_op_ctn['±íÏÖÐÎʽ']:=aQuery['±íÏÖÐÎʽ'];
t_op_ctn['ÏäºÅ']:=aQuery['ÏäºÅ'];
t_op_ctn['·âºÅ']:=aQuery['·âºÅ'];
t_op_ctn['¼þÊý']:=aQuery['¼þÊý'];
t_op_ctn['°ü×°']:=aQuery['°ü×°'];
t_op_ctn['ÖØÁ¿']:=aQuery['ÖØÁ¿'];
t_op_ctn['³ßÂë']:=aQuery['³ßÂë'];
t_op_ctn['»õÃè']:=aQuery['»õÃè'];
t_op_ctn['ßéÍ·']:=aQuery['ßéÍ·'];
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn.fieldbyname('´úÂë').asstring,[]) then
begin
if frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='20'then
t_op_ctn['TEU']:=1;
if (frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='40')OR
(frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='45')
then
t_op_ctn['TEU']:=2;
end;
t_op_ctn.Post;
next;
end;
end;
finally
freeandnil(aQuery);
showmessage('¸´ÖÆÍê³É');
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton32Click(Sender: TObject);
begin
UpdateInfor;
end;
procedure Tfrm_op_seae_edi_data.t_op_seaeBeforeDelete(DataSet: TDataSet);
begin
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then begin
showmessage('ÒÑ·¢ËͲ»ÄÜÐÞ¸Ä,ɾ³ý£¡');
abort;
end;
end;
procedure Tfrm_op_seae_edi_data.DBEdit3Change(Sender: TObject);
begin
if t_op_seae.FieldByName('EDI״̬').AsString='ÒÑ·¢ËÍ' then
begin
bsSkinLabel1.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel1.DefaultFont.Color:=clRed;
end;
if not t_op_state.Active then
t_op_state.OPEN;
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦',[]) then
begin
bsSkinLabel2.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel2.DefaultFont.Color:=clRed;
end;
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý',[]) then
begin
bsSkinLabel3.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel3.DefaultFont.Color:=clRed;
end;
if t_op_state.Locate('ÒµÎñ״̬','Ô˵ֱȶԽá¹ûΪ£ºÔ˵ÖÕý³£',[]) then
begin
bsSkinLabel4.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel4.DefaultFont.Color:=clRed;
end;
if t_op_state.Locate('ÒµÎñ״̬','ÌáÔ˵¥·ÅÐÐ',[]) then
begin
bsSkinLabel5.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel5.DefaultFont.Color:=clRed;
end;
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý',[]) then
begin
bsSkinLabel6.DefaultFont.Color:=clGreen;
end
else
begin
bsSkinLabel6.DefaultFont.Color:=clRed;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinLabel1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
exit;
Pnt:=bsSkinLabel1.ClientToScreen(Point(0,bsSkinLabel1.Height));
if not t_op_seae.FieldByName('·¢ËÍʱ¼ä').IsNull then
begin
ABC1.Caption:=t_op_seae.FieldByName('·¢ËÍʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinLabel2MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
exit;
Pnt:=bsSkinLabel2.ClientToScreen(Point(0,bsSkinLabel2.Height));
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥Ö÷ÒªÊý¾Ý´«Êä³É¹¦',[]) then
begin
ABC1.Caption:=t_op_state.FieldByName('Íê³Éʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinLabel3MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
exit;
Pnt:=bsSkinLabel3.ClientToScreen(Point(0,bsSkinLabel3.Height));
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥ÆäËûÊý¾ÝÉ걨ÉóºËͨ¹ý',[]) then
begin
ABC1.Caption:=t_op_state.FieldByName('Íê³Éʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinLabel4MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
exit;
Pnt:=bsSkinLabel4.ClientToScreen(Point(0,bsSkinLabel4.Height));
if t_op_state.Locate('ÒµÎñ״̬','Ô˵ֱȶԽá¹ûΪ£ºÔ˵ÖÕý³£',[]) then
begin
ABC1.Caption:=t_op_state.FieldByName('Íê³Éʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinLabel5MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
exit;
Pnt:=bsSkinLabel5.ClientToScreen(Point(0,bsSkinLabel5.Height));
if t_op_state.Locate('ÒµÎñ״̬','ÌáÔ˵¥·ÅÐÐ',[]) then
begin
ABC1.Caption:=t_op_state.FieldByName('Íê³Éʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton27Click(Sender: TObject);
var Param:TStringList;
response,MBLNO,s,s_val:string;
RStream:TStringStream;
SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ:string;
str_memo:Tmemo;
Str:TStrings;
SenderHandphone,SenderEmail, SenderFax:string;
basecnt,i,beginpos,endpos,baseid:Integer;
alist:TStringList;
QYT,WEIGHT,ctncount:Double;
aAdoQuery:TAdoQuery;
k:integer;
begin
if dxDBGrid1.SelectedCount>=1 then
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='ÕýÔÚÌáÈ¡ÇëÉԺ󡣡£¡£';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for k:=0 to dxDBGrid1.SelectedCount-1 do
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_op_seae.GotoBookmark(Pointer(dxDBGrid1.selectedrows[k]));
baseid:=-1;
if t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring<>'' then //´ò¿ªµÇ¼ҳÃæ
MBLNO:=t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').asstring
else MBLNO:=t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring;
if Trim(MBLNO)='' then
begin
ShowMessage('Ö÷Ìáµ¥ºÅ²»ÄÜΪ¿Õ');
exit;
end;
Param:=TStringList.Create;
// response:=DoPost('http://cdp.qdcdc.com/CDP/MftQuery/BillExportQuery.aspx','',Param) ;
response:=DoPost('http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx','',Param) ;
// showmessage('6');
SetState(response);
/////////////////////
Param.Clear;
Param.Add('__VIEWSTATE='+state );
Param.Add('__EVENTVALIDATION=' + EVENT);
Param.Add('txtIMO=' );
Param.Add('txtTransportName=' );
Param.Add('txtVoyageNo=' );
Param.Add('txtBillNo='+MBLNO );
Param.Add('LinkButtonQuery=%E6%9F%A5%E8%AF%A2' );
Param.Add('hdSelectRow=' );
Param.Add('hdData=' );
Param.Add('hdCols=%E5%BA%8F%E5%8F%B7%2C%E5%87%BA%E5%8F%A3%E6%8F%90%E5%8D%95%E5%8F%B7%2C%E9%A2%84%E9%85%8D%E8%88%B1%E5%8D%95%2C%E5%87%BA%E5%8F%A3%E8%BF%90%E6%8A%B5%E6%8A');
Param[Param.Count-1]:=Param[Param.Count-1]+'%A5%E5%91%8A%2C%E5%87%BA%E5%8F%A3%E8%A3%85%E8%BD%BD%2C%E5%87%BA%E5%8F%A3%E7%90%86%E8%B4%A7%2C%E5%87%BA%E5%8F%A3%E6%8A%A5%E5%85%B3%E7%8A%B6%E6%80%81%2C%E7%A9%BA%E7%AE%B1%E9%AA%8C%E6%94%BE%2C%E6%8F%90%E5%8D%95%E6%94%BE%E8%A1%8C';
Param.Add('hdChildHide=' );
Param.Add('hdColsHide=' );
Param.Add('hdColSpan=%E6%8F%90%E5%8D%95%E5%8F%B7' );
Param.Add('hdMutiQuery=' );
Param.Add('hdReturnResult=' );
Param.Add('hdLoadMarkText=' );
Param.Add('hdArrivalMarkText=' );
Param.Add('hdEmptyResult=' );
Param.Add('hdTalMarkText=' );
//showmessage('7');
// response:=DoPost('http://cdp.qdcdc.com/CDP/MftQuery/BillExportQuery.aspx'
// ,'http://cdp.qdcdc.com/CDP/MftQuery/BillExportQuery.aspx',Param);
response:=DoPost('http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx'
,'http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx',Param);
idhttp1.Disconnect;
_s:=response;
//´¦Àí²éѯ½á¹û
//ShowMessage(GetPosition(edt1.Text,Memo1.Text,8).ToString());
if (Pos('ûÓв鵽½á¹û',_s)>0) then
begin
// ShowMessage('ûÓв鵽½á¹û');
end
else
begin
//1 ÉóºËʱ¼ä
basecnt:=10;
beginpos:=Pos('<tr class="selectRow TableInputTr ExportRow" value=',_s);
endpos:=Pos('<td colspan="20" align="center">',_s);
_s:=Copy(_s,beginpos,endpos-beginpos);
// showmessage('8');
alist:=TStringList.Create;
for i:=0 to 25 do
begin
if _s<>'' then
begin
beginpos:=Pos('<td>',_s);
endpos:=Pos('</td>',_s);
s:=Copy(_s,beginpos+4,endpos-beginpos-4);
_s:=Trim(Copy(_s,endpos+5,Length(_s)));
alist.Add(StringReplace(Trim(s), #13#10, '', [rfReplaceAll]));
end;
end;
SHSJ:=alist[11+baseid]; //Ô¤Åä²Õµ¥ ʱ¼ä
SHHZ:=alist[12+baseid]; //
YDSJ:=alist[13+baseid]; // Ô˵Ö״̬ ʱ¼ä
YDHZ:=alist[14+baseid];
if alist[15+baseid]<>'-' then
BGZT:=alist[15+baseid]; //µ¥Ö¤·ÅÐÐ
TDFX:=alist[17+baseid]; //×°´¬·ÅÐÐ
TDSJ:=alist[16+baseid];
CKZZ:=alist[20+baseid]; //×°ÔØ
ZZSJ:=alist[19+baseid];
IF Trim(alist[9+baseid])<>'' THEN
QYT:=strtofloat(alist[9+baseid]);
IF Trim(alist[10+baseid])<>'' THEN
WEIGHT:=strtofloat(alist[10+baseid]);
IF Trim(alist[8+baseid])<>'' THEN
ctncount:=strtofloat(alist[8+baseid]);
cxTreeView1.Items.Clear;
cxTreeView1.Items.Add(nil,'Ô¤ÅäÉ걨:'+alist[12+baseid]+' '+alist[11+baseid]);
cxTreeView1.Items.Add(nil,'³ö¿ÚÔ˵Ö:'+alist[14+baseid]+' '+alist[13+baseid]);
cxTreeView1.Items.Add(nil,'³ö¿Ú±¨¹Ø״̬:'+alist[15+baseid]);
cxTreeView1.Items.Add(nil,'Ìáµ¥·ÅÐÐ:'+alist[17+baseid]+' '+alist[16+baseid]);
cxTreeView1.Items.Add(nil,'³ö¿Ú×°ÔØ :'+alist[20+baseid]+' '+alist[19+baseid]);
try
modify_all:=true;
t_op_seae.Edit;
t_op_seae.FieldByName('É걨״̬').AsString:=alist[12+baseid];
t_op_seae.FieldByName('״̬ÈÕÆÚ').AsString:=StringReplace(alist[11+baseid],'/','-',[rfReplaceAll]) ;
t_op_seae.Post;
finally
modify_all:=false;
end;
aAdoQuery:=createAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('select sum(ÊýÁ¿) ÊýÁ¿');
sql.Add('from t_op_ctn_edi');
sql.Add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=t_op_seae.FieldByName('񅧏').AsString;
Open;First;
if ctncount<>FieldByName('ÊýÁ¿').AsFloat then
s_val:=' ÏäÁ¿ ';
finally
free;
end;
if QYT<>t_op_seae1.DataSet.FieldByName('¼þÊý').AsFloat then
s_val:=s_val+' ¼þÊý';
if WEIGHT<>t_op_seae1.DataSet.FieldByName('ÖØÁ¿').AsFloat then
s_val:=s_val+' ÖØÁ¿';
if s_val<>'' then
showmessage('É걨ÏäÁ¿Îª:'+alist[8+baseid]+' É걨¼þÊýΪ:'+alist[9+baseid]+' É걨ÖØÁ¿Îª:'+alist[10+baseid]+#13#10+ '¶Ô±È½á¹û:'+s_val+'²»ÏàµÈ');
end;
sleep(6000);
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
finally
frm_sys_progress.Close;
frm_sys_progress.Free;
frm_sys_progress:=nil;
end;
end;
end;
{
procedure Tfrm_op_seae_edi_data.bsSkinButton27Click(Sender: TObject);
var i:integer;
begin
if dxDBGrid1.SelectedCount>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='ÕýÔÚÉú³Éƾ֤ÇëÉԺ󡣡£¡£';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
getwebservice_ds;
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(Pointer(dxDBGrid1.selectedrows[I]));
SelectReciveData(t_op_seae.FieldByName('Ö÷±àºÅ').AsString,t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
finally
freeAndNil(frm_sys_progress);
end;
end
else
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='ÕýÔÚÉú³Éƾ֤ÇëÉԺ󡣡£¡£';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=t_op_seae.RecordCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
getwebservice_ds;
with t_op_seae do
begin
First;
while not eof do
begin
if t_op_seae.FieldByName('µ±Ç°×´Ì¬').AsString<>'ÒÑ·ÅÐÐ' then
SelectReciveData(t_op_seae.FieldByName('Ö÷±àºÅ').AsString,t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
Next;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
finally
freeAndNil(frm_sys_progress);
t_op_seae.First;
end;
end;
end;
}
procedure Tfrm_op_seae_edi_data.bsSkinLabel6MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinLabel6.ClientToScreen(Point(0,bsSkinLabel6.Height));
if t_op_state.Locate('ÒµÎñ״̬','Ô¤Åä²Õµ¥ÐÞ¸ÄÉêÇëÉóºËͨ¹ý',[]) then
begin
ABC1.Caption:=t_op_state.FieldByName('Íê³Éʱ¼ä').Asstring;
PopupMenu5.Popup(Pnt.x,Pnt.y);
end
else
begin
ABC1.Caption:='ÎÞ';
PopupMenu5.Popup(Pnt.x,Pnt.y);
end;
end;
procedure Tfrm_op_seae_edi_data.t_op_seaeAfterInsert(DataSet: TDataSet);
begin
t_op_seae.FieldByName('µ±Ç°×´Ì¬').Asstring:='δ·¢ËÍ';
t_op_seae.FieldByName('Ç©µ¥µØµã').Asstring:='QINGDAO,CHINA';
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton33Click(Sender: TObject);
var strtmp:string;
begin
strtmp:='';
t_op_ctn.First;
while not t_op_ctn.eof do begin
strtmp:=strtmp+t_op_ctn.fieldbyname('ÏäºÅ').AsString+' '+t_op_ctn.fieldbyname('·âºÅ').AsString+' '
+StringReplace(t_op_ctn.fieldbyname('±íÏÖÐÎʽ').AsString,'''','',[])+' '+t_op_ctn.fieldbyname('¼þÊý').AsString+' '
+t_op_ctn.fieldbyname('ÖØÁ¿').AsString+' '+t_op_ctn.fieldbyname('³ßÂë').AsString+#13#10;
t_op_ctn.Next;
end;
Clipboard.AsText :=strtmp;
{
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)='' then
begin
showmessage('³¡Õ¾²»ÄÜΪ¿Õ');
exit;
end;
try
s_user:=get_parameters_value(2101,'false');
s_key:=get_parameters_value(2102,'false');
s_czmc:=get_parameters_value(2103,'false');
s_yzhuser:=get_parameters_value(2104,'false');
s_yzhkey:=get_parameters_value(2105,'false');
s_yzh:=get_parameters_value(2106,'false');
s_lh:=get_parameters_value(2109,'false');
s_zc:=get_parameters_value(2113,'false');
s_zckey:=get_parameters_value(2112,'false');
s_sscz:=get_parameters_value(2114,'false');
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)=s_czmc then
GetdyczInfo_dy(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('±àºÅ').AsString)
else
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)=s_yzh then
GetdyczInfo_yzh(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('±àºÅ').AsString)
else
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)=s_lh then
GetdyczInfo_lhcz(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('±àºÅ').AsString)
else
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)=s_zc then
begin
GetdyczInfo_zc(s_user,s_zckey,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('±àºÅ').AsString)
end
else
if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)=s_sscz then
begin
getssczinfor(Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString))
end
else
if pos('½Ý',t_op_ctn.DataSource.DataSet.fieldbyname('³¡Õ¾').AsString)>0 then
begin
GetdyczInfo_jfcz('','',Trim(t_op_ctn.DataSource.DataSet.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString),'')
end
else
begin
showmessage('ÇëÖ¸¶¨³¡Õ¾');
end;
finally
t_op_ctn.Requery;
end;
}
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9Enter(Sender: TObject);
begin
RxLookupComboEnter(RxDBLookupCombo9);
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9KeyPress(Sender: TObject;
var Key: Char);
begin
RxLookupComboExit(RxDBLookupCombo9);
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9Exit(Sender: TObject);
begin
RxLookupComboExit(RxDBLookupCombo9);
end;
procedure Tfrm_op_seae_edi_data.t_op_ctnNewRecord(DataSet: TDataSet);
begin
t_op_ctn['°ü×°']:=t_op_seae.FieldByName('°ü×°').AsString;
end;
procedure Tfrm_op_seae_edi_data.CLClick(Sender: TObject);
var
EdiStrings:TStrings;
FileNames,repeatCtnNo,ctntype:String;
ctncount,i:integer;
S,ctns,dddd,Heads,oldHeads,VslID,Vessel,VoyNo,eta,etd,Carrier,s2,CarrierAgent,cz,CarrierName,shipper,tmp,bsno:String;
tempStr:TStrings;
aQuery,aQuery2,aQueryCount,aQueryUpdate,aQuery3,aQuerytmp:TAdoQuery;
isstr:Boolean;
SendOp,SendTel:string;
L:Integer;
RL:TStringList;
filename:string;
function GetPosString(S1:string;m:integer):String;
var
z:integer;
begin
Result:='';
if pos(':',S1)=0 then exit;
s1:=StringReplace(s1,'??','?',[rfReplaceAll]);
s1:=StringReplace(s1,'?:','¤·',[rfReplaceAll]);
s1:=StringReplace(s1,'?''','''',[rfReplaceAll]);
s1:=StringReplace(s1,'?+','+',[rfReplaceAll]);
for z:=1 to m-1 do begin
if Pos(':',S1)=0 then exit;
if Pos(':',S1)=1 then
S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1)))
else
S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1)));
end;
if pos(':',S1)=1 then exit;
if Pos(':',S1)=0 then begin
if (Pos('''',S1)=0) then
Result:=Copy(S1,1,length(S1))
else
Result:=Copy(S1,1,length(S1)-1);
end else Result:=Copy(S1,1,Pos(':',S1)-1);
Result:=StringReplace(Result,'¤·',':',[rfReplaceAll]);
end;
function GetPosString2(S1:string):String;
var
z:integer;
begin
Result:='';
// if pos(':',S1)=0 then exit;
s1:=StringReplace(s1,'??','?',[rfReplaceAll]);
s1:=StringReplace(s1,'?:','¤·',[rfReplaceAll]);
s1:=StringReplace(s1,'?''','''',[rfReplaceAll]);
s1:=StringReplace(s1,'?+','+',[rfReplaceAll]);
if Pos('''',S1)<>0 then
Result:=Copy(S1,1,length(S1)-1)
else Result:=S1;
Result:=StringReplace(Result,'¤·',':',[rfReplaceAll]);
end;
function FormatDateStr(ADate:String):String;
begin
Result:='';
if length(ADate)<>8 then exit;
Result:=Copy(ADate,1,4)+'-'+Copy(ADate,5,2)+'-'+Copy(ADate,7,2);
end;
function FormatNumStr(ANum:String):String;
var
i:integer;
begin
Result:='0';
if length(ANum)=0 then exit;
for i:=1 to length(ANum) do begin
if Copy(ANum,1,1)='0' then
system.Delete(ANum,1,1)
else
Break;
end;
Result:=ANum;
end;
function CheckctnNoRepeat(ctnNo:string):string;
var
aQuery:TAdoQuery;
begin
Result:='';
if trim(ctnNo)='' then exit;
aQuery:=CreateAdoQuery;
with aQuery do
try
close;sql.Clear;
sql.Add('select Ö÷Ìáµ¥ºÅ from t_op_ctn_edi');
sql.Add('left join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏');
sql.Add('where ÏäºÅ=:ÏäºÅ');
sql.Add(' and ¿ª´¬ÈÕÆÚ>=GetDate()-30 and ¿ª´¬ÈÕÆÚ<=GetDate()+30');
Parameters.ParamByName('ÏäºÅ').Value:=ctnNo;
open;First;
while not eof do
begin
if result='' then result:=FieldByName('Ö÷Ìáµ¥ºÅ').AsString
else result:=result+#13#10+FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
Next;
end;
finally
free;
end;
end;
begin
repeatCtnNo:='';
aQueryCount:=CreateAdoQuery;
with aQueryCount do
begin
Close;sql.Clear;
SQL.Add('select Count(*) C from t_op_seae_edi');
SQL.Add('where Ö÷Ìáµ¥ºÅ=:Ö÷Ìáµ¥ºÅ and ·ÖÌáµ¥ºÅ=:·ÖÌáµ¥ºÅ and EDIÀàÐÍ=''CN''') ;
end;
aQueryUpdate:=CreateAdoQuery;
with aQueryUpdate do
begin
Close;sql.Clear;
SQL.Add('update t_op_seae_edi set Êý¾ÝÖظ´=1');
SQL.Add('where Ö÷Ìáµ¥ºÅ=:Ö÷Ìáµ¥ºÅ and ·ÖÌáµ¥ºÅ=:·ÖÌáµ¥ºÅ and EDIÀàÐÍ=''CN''') ;
end;
EdiStrings:=TStringList.Create;
try
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='µ¼ÈëÊý¾ÝÇëµÈºò¡£¡£¡£';
edi_addseai:=true;
OpenDialog1.Execute;
RL := TStringList.Create;
RL := TStringList(OpenDialog1.Files);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=RL.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for L := 0 to RL.Count - 1 do
begin
FileNames:=RL.Strings[L];
if FileNames<>'' then begin
EdiStrings.LoadFromFile(FileNames);
end;
if EdiStrings.Count=0 then exit;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_main.db.BeginTrans;
try
for i:=0 to EdiStrings.Count-1 do
begin
S:=EdiStrings.Strings[i];
OldHeads:=Heads;
tmp:=Copy(S,3,1);
if tmp=':' then begin
Heads:=Copy(S,1,2);
isstr:=False;
end else begin
Heads:=oldHeads;
isstr:=true;
end;
//showmessage(Heads);
if Heads='00' then
begin
CarrierAgent:=GetPosString(S,3);
// showmessage(CarrierAgent);
shipper:=GetPosString(S,5);
SendOp:=GetPosString(S,9);
SendTel:=GetPosString(S,10);
end;
if Heads='10' then
begin
VslID:=GetPosString(S,2);
Vessel:=GetPosString(S,3);
CarrierName:=GetPosString(S,4);
VoyNo:=GetPosString(S,5);
//eta:=GetPosString(S,8);
//etd:=GetPosString(S,9);
end;
if Heads='11' then
begin
Carrier:=GetPosString(S,4);
cz:=GetPosString(S,5);
end;
if Heads='12' then
begin
if t_op_seae1.DataSet.State in [dsinsert,dsEdit] then
t_op_seae1.DataSet.Post;
frm_main.t_sum_ctn.close;
frm_main.t_sum_ctn.open;
bsno:=get_edi_id;
aQuerytmp:=CreateAdoQuery;
try
with aQuerytmp do
begin
Close;sql.Clear;
SQL.Add(' delete from t_op_ctn where 񅧏='''+bsno+'''');
ExecSQL;
end;
finally
FreeAndNil(aQuerytmp);
end;
t_op_seae1.DataSet.Insert;
t_op_seae.fieldbyname('񅧏').Value:=bsno;
t_op_seae.fieldbyname('Ö÷±àºÅ').Value:=get_edi_id;
t_op_seae.fieldbyname('ÒµÎñ±àºÅ').Value:=get_edi_id;
t_op_seae.fieldbyname('×°ÔËÀàÐÍ').Value:='FCL';
t_op_seae.fieldbyname('´¬´ú').Value:=CarrierAgent;
t_op_seae.fieldbyname('³¡Õ¾').Value:=cz;
t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString:='S';
t_op_seae.fieldbyname('ίÍз¢ËÍ·½').Value:=shipper;
t_op_seae.fieldbyname('·¢ËÍ·½ÈËÔ±').Value:=SendOp;
t_op_seae.fieldbyname('·¢ËÍ·½µç»°').Value:=SendTel;
{
aQuery3:=CreateAdoQuery;
try
with aQuery3 do begin
close;SQL.Clear;
SQL.Add('select a.* from code_price_edi a inner join code_emf_type b on a.²Õµ¥·¢ËÍÀàÐÍ=b.²Õµ¥·¢ËÍÀàÐÍ '
+' where a.EDIÀàÐÍ=''²Õµ¥'' and ¿Í»§¼ò³Æ='''+shipper+'''');
Open;
if not IsEmpty then begin
t_op_seae.fieldbyname('À¿»õÈË').Value:=fieldbyname('À¿»õÈË').AsString;
t_op_seae.fieldbyname('µ¥¼Û').Value:=fieldbyname('µ¥¼Û').AsString;
t_op_seae.fieldbyname('±¸×¢').Value:=fieldbyname('²Õµ¥·¢ËÍÀàÐÍ').AsString;
end;
end;
finally
FreeAndNil(aQuery3);
end;
}
t_op_seae['EDIÀàÐÍ']:='CN';
t_op_seae['EDI״̬']:='δ·¢ËÍ';
t_op_seae['µ±Ç°×´Ì¬']:='δ·¢ËÍ';
t_op_seae['¼ÈëÈË']:=employee;
t_op_seae['¼ÈëÈÕÆÚ']:=now;
t_op_seae1.DataSet['ж»õ¸Û']:='';
t_op_seae1.DataSet['¸¶·Ñ·½Ê½']:='';
t_op_seae1.DataSet['»õÎïÃèÊö']:='';
t_op_seae1.DataSet.FieldByName('´¬Ãû').AsString:=Vessel;
t_op_seae1.DataSet.FieldByName('º½´Î').AsString:=VoyNo;
t_op_seae1.DataSet.FieldByName('Ö÷Ìáµ¥ºÅ').AsString:=GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('·ÖÌáµ¥ºÅ').AsString:=GetPosString(S,17);
aQueryCount.Close;
aQueryCount.Parameters.ParamByName('Ö÷Ìáµ¥ºÅ').Value:=GetPosString(S,2);
aQueryCount.Parameters.ParamByName('·ÖÌáµ¥ºÅ').Value:=GetPosString(S,17);
aQueryCount.Open;
IF aQueryCount.FieldByName('c').AsInteger>=1 then
begin
t_op_seae1.DataSet.FieldByName('Êý¾ÝÖظ´').AsBoolean:=True;
aQueryUpdate.Close;
aQueryUpdate.Parameters.ParamByName('Ö÷Ìáµ¥ºÅ').Value:=GetPosString(S,2);
aQueryUpdate.Parameters.ParamByName('·ÖÌáµ¥ºÅ').Value:=GetPosString(S,17);
aQueryUpdate.ExecSQL;
showmessage(GetPosString(S,2)+'Êý¾ÝÖظ´');
end
else t_op_seae1.DataSet.FieldByName('Êý¾ÝÖظ´').AsBoolean:=false;
t_op_seae1.DataSet.FieldByName('´¬¹«Ë¾').AsString:=CarrierName;
{t_op_seae1.DataSet.FieldByName('×°¸Û´úÂë').AsString:=GetPosString(S,8);
t_op_seae1.DataSet.FieldByName('×°»õ¸Û').AsString:=GetPosString(S,9); }
t_op_seae1.DataSet.FieldByName('×°¸Û´úÂë').AsString:='CNTAO';
t_op_seae1.DataSet.FieldByName('×°»õ¸Û').AsString:='QINGDAO,CHINA';
t_op_seae1.DataSet.FieldByName('ÔËÊäÌõ¿î').AsString:=GetPosString(S,10);
t_op_seae1.DataSet.FieldByName('¸¶·Ñ·½Ê½').AsString:=GetPosString(S,11);
s2:=copy(GetPosString(S,12),1,8);
if trim(s2)<>'' then
begin
t_op_seae1.DataSet.FieldByName('¿ª´¬ÈÕÆÚ').AsDateTime:=StrToDate(FormatDateStr(s2));
t_op_seae1.DataSet.FieldByName('Ô¤µÖÈÕÆÚ').AsDateTime:=StrToDate(FormatDateStr(s2))+3;
end;
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:='';
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:='';
end;
if Heads='13' then
begin
t_op_seae1.DataSet.FieldByName('ж»õ´úÂë').AsString:=GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('ж»õ¸Û').AsString:=GetPosString(S,3);
t_op_seae1.DataSet.FieldByName('Ä¿µÄ´úÂë').AsString:=GetPosString(S,4);
t_op_seae1.DataSet.FieldByName('Ä¿µÄµØ').AsString:=GetPosString(S,5);
end;
if Heads='14' then
begin
end;
if Heads='15' then
begin
end;
if Heads='16' then
begin
t_op_seae1.DataSet.FieldByName('·¢»õÈËÃû³Æ').AsString:=GetPosString(S,3);
t_op_seae1.DataSet.FieldByName('·¢»õÈ˵ØÖ·1').AsString:=GetPosString(S,4);
//20180526 ËïС»ªÌí¼Ó
t_op_seae1.DataSet.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString:= GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString:= GetPosString(S,9);
t_op_seae1.DataSet.FieldByName('·¢»õÈ˵绰').AsString:= GetPosString(S,11);
t_op_seae1.DataSet.FieldByName('·¢»õÈËÓÊÏä').AsString:= GetPosString(S,12);
end;
if Heads='17' then
begin
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈËÃû³Æ').AsString:=GetPosString(S,3);
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString:=GetPosString(S,4);
//20180526 ËïС»ªÌí¼Ó
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈËÆóÒµ´úÂë').AsString:= GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString:= GetPosString(S,9);
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈ˵绰').AsString:= GetPosString(S,11);
t_op_seae1.DataSet.FieldByName('ÊÕ»õÈËÓÊÏä').AsString:= GetPosString(S,12);
end;
if Heads='18' then
begin
t_op_seae1.DataSet.FieldByName('֪ͨÈËÃû³Æ').AsString:=GetPosString(S,3);
t_op_seae1.DataSet.FieldByName('֪ͨÈ˵ØÖ·1').AsString:=GetPosString(S,4);
//20180526 ËïС»ªÌí¼Ó
t_op_seae1.DataSet.FieldByName('֪ͨÈËÆóÒµ´úÂë').AsString:= GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString:= GetPosString(S,9);
t_op_seae1.DataSet.FieldByName('֪ͨÈ˵绰').AsString:= GetPosString(S,11);
t_op_seae1.DataSet.FieldByName('֪ͨÈËÓÊÏä').AsString:= GetPosString(S,12);
end;
if Heads='19' then
begin
end;
if Heads='20' then
begin
end;
if Heads='41' then
begin
t_op_seae1.DataSet.FieldByName('¼þÊý').AsString:=FormatNumStr(GetPosString(S,4));
t_op_seae1.DataSet.FieldByName('°ü×°').AsString:=GetPosString(S,6);
t_op_seae1.DataSet.FieldByName('ÖØÁ¿').AsString:=FormatNumStr(GetPosString(S,7));
t_op_seae1.DataSet.FieldByName('³ßÂë').AsString:=FormatNumStr(GetPosString(S,9));
end;
if Heads='43' then
begin
t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString:='S';
IF Trim(GetPosString(S,11))<>'' then
begin
t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString:='R';
t_op_seae1.DataSet.FieldByName('ÉèÖÃζÈ').AsString:=GetPosString(S,11);
end
else
IF Trim(GetPosString(S,2))<>'' then
begin
t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString:='D';
t_op_seae1.DataSet.FieldByName('ΣÏÕÆ··ÖÀà').AsString:=GetPosString(S,2);
t_op_seae1.DataSet.FieldByName('ΣÏÕÆ·±àºÅ').AsString:=GetPosString(S,4);
end;
end;
if Heads='44' then
begin
if (isstr) then begin
if t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString2(S)
else
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=GetPosString2(S);
end else begin
if t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,2)
else
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=GetPosString(S,2);
if GetPosString(S,3)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,3);
if GetPosString(S,4)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,4);
if GetPosString(S,5)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,5);
if GetPosString(S,6)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,6);
if GetPosString(S,7)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,7);
if GetPosString(S,8)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,8);
if GetPosString(S,9)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,9);
if GetPosString(S,10)<>'' then
t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString:=t_op_seae1.DataSet.FieldByName('ßéÍ·').AsString+#13#10+GetPosString(S,10);
end;
end;
if Heads='47' then
begin
if (isstr) then begin
if (t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString<>'') then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString2(S)
else
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=GetPosString2(S);
end else begin
if (t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString<>'') then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString(S,2)
else
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=GetPosString(S,2);
if GetPosString(S,3)<>'' then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString(S,3);
if GetPosString(S,4)<>'' then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString(S,4);
if GetPosString(S,5)<>'' then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString(S,5);
if GetPosString(S,6)<>'' then
t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString:=t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString+#13#10+GetPosString(S,6);
end;
end;
if Heads='51' then
begin
repeatctnno:=CheckctnNoRepeat(GetPosString(S,3));
if repeatctnno<>'' then
begin
showmessage(repeatctnno+#13#10+'ÒÔÉÏÌáµ¥ºÅ´æÔÚ¸ÃÏäºÅ:'+GetPosString(S,3));
end;
if (not t_op_seae1.DataSet.FieldByName('񅧏').IsNull) and (t_op_seae1.DataSet.FieldByName('񅧏').AsString<>'') then
begin
aQuery:=createAdoQuery;
aQuery2:=createAdoQuery;
try
with aQuery do
begin
Close;sql.clear;
sql.Add('select * from t_op_ctn_edi where 񅧏=:񅧏');
DataSource:=t_op_seae1;
open;
aQuery2.close;aQuery2.sql.Clear;
aQuery2.SQL.Add('select * from t_code_ctn where ³ß´ç+ÏäÐÍ='''+GetPosString(S,5)+'''');
aQuery2.Open;
if not aQuery2.IsEmpty then
begin
ctntype:= aQuery2.fieldbyname('±íÏÖÐÎʽ').AsString;
Insert;
FieldByName('´úÂë').AsString:=aQuery2.fieldbyname('´úÂë').AsString;
FieldByName('ÏäÐÍ').AsString:=aQuery2.fieldbyname('ÏäÐÍ').AsString;
FieldByName('³ß´ç').AsString:=aQuery2.fieldbyname('³ß´ç').AsString;
FieldByName('±íÏÖÐÎʽ').AsString:=aQuery2.fieldbyname('±íÏÖÐÎʽ').AsString;
FieldByName('ÊýÁ¿').AsInteger:=1;
if aQuery2.fieldbyname('³ß´ç').AsString='20'then
FieldByName('TEU').AsInteger:=1;
if (aQuery2.fieldbyname('³ß´ç').AsString='40') OR (aQuery2.fieldbyname('³ß´ç').AsString='45') then
FieldByName('TEU').AsInteger:=2;
//FieldByName('°ü×°').AsString:=GetPosString(S,3);
FieldByName('ÏäºÅ').AsString:=GetPosString(S,3);
FieldByName('·âºÅ').AsString:=GetPosString(S,4);
FieldByName('¼þÊý').AsString:=FormatNumStr(GetPosString(S,7));
FieldByName('ÖØÁ¿').AsString:=FormatNumStr(GetPosString(S,8));
FieldByName('³ßÂë').AsString:=FormatNumStr(GetPosString(S,10));
FieldByName('°ü×°').AsString:=FormatNumStr(GetPosString(S,11));
Post;
end
else
begin
ctntype:=GetPosString(S,5);
Insert;
FieldByName('´úÂë').AsString:='XX';
// showmessage(GetPosString(S,5)+Copy(GetPosString(S,5),1,2)+Copy(GetPosString(S,5),3,2));
FieldByName('ÏäÐÍ').AsString:=Copy(GetPosString(S,5),1,2);
FieldByName('³ß´ç').AsString:=Copy(GetPosString(S,5),3,2);
FieldByName('±íÏÖÐÎʽ').AsString:=GetPosString(S,5);
FieldByName('ÊýÁ¿').AsInteger:=1;
if Copy(GetPosString(S,5),1,2)='20'then
FieldByName('TEU').AsInteger:=1;
if (Copy(GetPosString(S,5),1,2)='40') OR (Copy(GetPosString(S,5),1,2)='45') then
FieldByName('TEU').AsInteger:=2
else FieldByName('TEU').AsInteger:=0;
// FieldByName('°ü×°').AsString:=GetPosString(S,3);
FieldByName('ÏäºÅ').AsString:=GetPosString(S,3);
FieldByName('·âºÅ').AsString:=GetPosString(S,4);
FieldByName('¼þÊý').AsString:=FormatNumStr(GetPosString(S,7));
FieldByName('ÖØÁ¿').AsString:=FormatNumStr(GetPosString(S,8));
FieldByName('³ßÂë').AsString:=FormatNumStr(GetPosString(S,10));
FieldByName('°ü×°').AsString:=FormatNumStr(GetPosString(S,11));
Post;
end;
end;
finally
FreeAndNil(aQuery);
FreeAndNil(aQuery2);
end;
end;
end;
if Heads='99' then
begin
if t_op_seae1.DataSet.State in [dsinsert,dsEdit] then
t_op_seae1.DataSet.Post;
t_op_ctn.Close;
t_op_ctn.Open;
update_edictn(t_op_ctn);
end;
END;
frm_main.db.CommitTrans;
except
on e:Exception do
begin
showmessage('µ¼ÈëÊý¾Ýʱ·¢Éú´íÎó,ûÓÐÕý³£µ¼È룡'+e.Message+FileNames);
frm_main.db.RollbackTrans;
aQuery:=createAdoQuery;
try
with aQuery do
begin
Close;sql.clear;
sql.Add('delete from t_op_ctn_edi where 񅧏='''+bsno+'''');
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
end;
end;
END;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
edi_addseai:=true;
FreeAndNil(EdiStrings);
end;
notebook1.pageindex:=1;
end;
procedure Tfrm_op_seae_edi_data.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 uppercase(ANode.Strings[dxDBGrid1Column28.Index])='TRUE' then begin
AColor:=clRed;
exit;
end;
end;
function Tfrm_op_seae_edi_data.IgzEdi(EdiStrings:TStrings):Boolean;
var
i:integer;
MblNo,HblNo,CtnNo,S,Heads,ctnStatusNo,ctnStatus,adate:string;
function GetPosString(S1:string;m:integer):String;
var
z:integer;
begin
Result:='';
if pos(':',S1)=0 then exit;
s1:=StringReplace(s1,'??','?',[rfReplaceAll]);
s1:=StringReplace(s1,'?:','¤·',[rfReplaceAll]);
s1:=StringReplace(s1,'?''','''',[rfReplaceAll]);
s1:=StringReplace(s1,'?+','+',[rfReplaceAll]);
for z:=1 to m-1 do begin
if Pos(':',S1)=0 then exit;
if Pos(':',S1)=1 then
S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1)))
else
S1:=Copy(S1,Pos(':',S1)+1,(length(s1)-Pos(':',S1)));
end;
if pos(':',S1)=1 then exit;
if Pos(':',S1)=0 then
Result:=Copy(S1,1,length(S1)-1)
else Result:=Copy(S1,1,Pos(':',S1)-1);
Result:=StringReplace(Result,'¤·',':',[rfReplaceAll]);
end;
function FormatDateStr(ADate:String):String;
begin
Result:='';
if length(ADate)<>8 then exit;
Result:=Copy(ADate,1,4)+'-'+Copy(ADate,5,2)+'-'+Copy(ADate,7,2);
end;
function FormatNumStr(ANum:String):String;
var
i:integer;
begin
Result:='0';
if length(ANum)=0 then exit;
for i:=1 to length(ANum) do begin
if Copy(ANum,1,1)='0' then
system.Delete(ANum,1,1)
else
Break;
end;
Result:=ANum;
end;
begin
Memo1.Clear;
Memo1.Lines.Clear;
try
for i:=0 to EdiStrings.Count-1 do
begin
S:=EdiStrings.Strings[i];
if Pos('RFF+BN:',S)>0 then
begin
HblNo:=Copy(s,Pos(':',S)+1,length(S)-Pos(':',S)-1);
Memo1.Lines.Add('·ÖÌáµ¥ºÅ:'+HblNo);
end;
if Pos('RFF+BM:',S)>0 then
begin
MblNo:=Copy(s,Pos(':',S)+1,length(S)-Pos(':',S)-1);
Memo1.Lines.Add('Ö÷Ìáµ¥ºÅ:'+MblNo);
end;
if Pos('STS+1+',S)>0 then
begin
ctnStatusNo:=Copy(s,7,Pos('::',S)-7);
if ctnStatusNo='EE' then
ctnStatus:='¿ÕÏä³ö³¡'
else if ctnStatusNo='I' then
ctnStatus:='ÖØÏä»Ø³¡'
else if ctnStatusNo='TR' then
ctnStatus:='Ô˵ֱ¨¸æ'
else if ctnStatusNo='CT' then
ctnStatus:='º£¹Ø·ÅÐÐ'
else if ctnStatusNo='AE' then
ctnStatus:='×°´¬'
else if ctnStatusNo='AF' then
ctnStatus:='ʼ·¢¸ÛÀë¸Û'
else if ctnStatusNo='UV' then
ctnStatus:='ж´¬'
else if ctnStatusNo='VA' then
ctnStatus:='µ½¸Û'
else if ctnStatusNo='VD' then
ctnStatus:='Àë¸Û'
else if ctnStatusNo='OA' then
ctnStatus:='ÖØÏä³ö³¡'
else if ctnStatusNo='MT' then
ctnStatus:='¿ÕÏä»Ø³¡'
else if ctnStatusNo='RD' then
ctnStatus:='Return Container'
else ctnStatus:='δʶ±ðΪ±ê×¼´úÂëµÄ״̬';
Memo1.Lines.Add('״̬:'+ctnStatus);
end;
adate:='';
if Pos('DTM+334:',S)>0 then
begin
adate:=Copy(s,Pos(':',S)+1,12);
Memo1.Lines.Add('·¢ÉúÈÕÆÚ:'+adate);
end;
adate:='';
if Pos('DTM+132:',S)>0 then
begin
adate:=Copy(s,Pos(':',S)+1,12);
Memo1.Lines.Add('µ½¸ÛÈÕÆÚ:'+adate);
end;
if Pos('EQD+CN+',S)>0 then
begin
CtnNo:=Copy(s,8,11);
Memo1.Lines.Add('ÏäºÅ:'+CtnNo);
end;
end;
finally
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton35Click(Sender: TObject);
var
EdiString:TStrings;
FileNames:string;
begin
EdiString:=TStringList.Create;
try
OpenDialog1.Execute;
FileNames:=OpenDialog1.FileName;
if FileNames<>'' then
begin
EdiString.LoadFromFile(FileNames);
IgzEdi(EdiString);
end;
finally
FreeAndNil(EdiString);
end;
end;
procedure Tfrm_op_seae_edi_data.DBEdit1Change(Sender: TObject);
begin
cxTreeView1.Items.Clear;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton31Click(Sender: TObject);
var
Str:TStrings;
begin
str:=Tstringlist.Create;
try
Str:=CreateIgengzongxml('SO');
SaveDialog1.FileName:='YT_'+FormatDateTime('YYYYMMDD',Date)+'_N';
SaveDialog1.Filter:='*.xml|*.xml';
if SaveDialog1.Execute then
begin
str.SaveToFile(SaveDialog1.FileName+'.xml');
showmessage('ÎļþÉú³É³É¹¦£¡');
end
else
begin
showmessage('ÎļþÉú³Éʧ°Ü£¡');
exit;
end;
finally
FreeAndNil(Str)
end;
end;
function Tfrm_op_seae_edi_data.CreateIgengzongxml(SOI:string):TStringlist;
var
str,alist:Tstringlist;
StlType:string;
s:widestring;
aAdoQuery:TAdoQuery;
i:integer;
begin
i:=1;
str:=Tstringlist.Create;
alist:=Tstringlist.Create;
str.Clear;
str.Add('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');
str.Add('<Message>');
str.Add('<Header>');
str.Add('<MessageType MessageVersion="2.0">QueryCondition');
str.Add('</MessageType>');
str.Add('<DateTime DateType="Document">'+FormatDateTime('YYYYMMDD',Date)+'000000');
str.Add('</DateTime>');
str.Add('</Header>');
str.Add('<MessageBody>');
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(Pointer(dxDBGrid1.selectedrows[I]));
SelectReciveData(t_op_seae.FieldByName('Ö÷±àºÅ').AsString,t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
str.Add('<Trace Type="BLNo"> CarrierCode="'+t_op_seae.FieldByName('´¬¹«Ë¾').AsString+'" PortCode="'+t_op_seae.FieldByName('×°¸Û´úÂë').AsString+'" DockCode="" EndDate="">');
str.Add('<Index Count="'+IntTostr(i)+'">'+t_op_seae.FieldByName('Ö÷Ìáµ¥ºÅ').AsString+'</Index>');
str.Add('</Trace>');
end;
str.Add('</MessageBody>');
str.Add('</Message>');
Result:=str;
end;
procedure Tfrm_op_seae_edi_data.t_op_ctnAfterPost(DataSet: TDataSet);
begin
// update_edictn(t_op_ctn);
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton36Click(Sender: TObject);
begin
{
try
if not assigned(frmget56Cookie) then
frmget56Cookie:=tfrmget56Cookie.Create(application);
frmget56Cookie.ShowModal;
finally
frmget56Cookie.free;
frmget56Cookie:=nil;
end;
}
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton37Click(Sender: TObject);
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('update t_op_ctn_edi set °ü×°='''+t_op_seae.fieldbyname('°ü×°').AsString+''' where ±àºÅ='''+t_op_seae.fieldbyname('±àºÅ').AsString+'''');
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
t_op_ctn.Requery;
end;
procedure Tfrm_op_seae_edi_data.RxDBLookupCombo3Change(Sender: TObject);
var
aQuery:TADOQuery;
kftype,kffieldname:string;
begin
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then
begin
if RxDBLookupCombo3.DisplayValue<>'' then begin
kftype:=t_code_cangdan.FieldByName('¿Û·ÑÀàÐÍ').AsString;
if (kftype='') then exit;
if (kftype='ÐÂÔö') then kftype:='·¢ËÍ';
if trim(t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').AsString)='' then begin
kffieldname:='Ö÷µ¥'+kftype;
end else begin
kffieldname:='·Öµ¥'+kftype;
end;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQL.Clear;
SQL.Add('SELECT D.'+kffieldname+' FROM code_price_edi_detail D');
SQL.Add(' LEFT JOIN code_price_edi P ON D.LINKGID=P.ÐòºÅ');
SQL.Add(' WHERE P.¿Í»§¼ò³Æ='''+t_op_seae.fieldbyname('ίÍз¢ËÍ·½').AsString+''' and D.´¬´ú='''+t_op_seae.fieldbyname('´¬´ú').AsString+'''');
open;
if not IsEmpty then begin
t_op_seae.fieldbyname('µ¥¼Û').AsString:=FieldByName(kffieldname).AsString;
t_op_seae.fieldbyname('Ó¦ÊÕ').AsString:=FieldByName(kffieldname).AsString;
end else begin
close;SQL.Clear;
SQL.Add('SELECT P.'+kffieldname+' ');
SQL.Add(' FROM code_price_edi P ');
SQL.Add(' WHERE P.¿Í»§¼ò³Æ='''+t_op_seae.fieldbyname('ίÍз¢ËÍ·½').AsString+''' ');
open;
if not IsEmpty then begin
t_op_seae.fieldbyname('µ¥¼Û').AsString:=FieldByName(kffieldname).AsString;
t_op_seae.fieldbyname('Ó¦ÊÕ').AsString:=FieldByName(kffieldname).AsString;
end
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
end;
end;
procedure Tfrm_op_seae_edi_data.DBEdit11Change(Sender: TObject);
begin
{
t_code_cangdan.Close;
t_code_cangdan.Parameters.ParamByName('ίÍз¢ËÍ·½').Value:=DBEdit11.Text;
// t_code_cangdan.Parameters.ParamByName('´¬´ú').Value:=DBEdit4.Text;
if (Trim(DBEdit10.Text)='') then
t_code_cangdan.Parameters.ParamByName('Ö÷·Öµ¥ÀàÐÍ').Value:='Ö÷µ¥'
else t_code_cangdan.Parameters.ParamByName('Ö÷·Öµ¥ÀàÐÍ').Value:='·Öµ¥';
t_code_cangdan.Open;
}
end;
procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton4Click(Sender: TObject);
var
aQuery,bQuery,cQuery,dQuery:TADOQuery;
SQLStr,CTNSQLStr:string;
i:Integer;
ResentBookMark:TBookmark;
begin
if messagedlg('ÄúÈ·¶¨ÒªÍ¬²½Ö÷Ìáµ¥ºÅΪ:'+DBEdit9.Text+' µÄ·ÖÌáµ¥ºÅÂð£¿',mtWarning,mbYesNoCancel,0)=MrYES then
begin
ResentBookMark:=t_op_seae.GetBookmark;
aQuery:=CreateAdoQuery;
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_seae_edi where Ö÷Ìáµ¥ºÅ='+QuotedStr(DBEdit9.Text)+' and (·ÖÌáµ¥ºÅ<>'''' and ·ÖÌáµ¥ºÅ is not null) '
+' and ´¬Ãû='+QuotedStr(DBEdit38.Text) ) ;
Open;
end;
if aQuery.IsEmpty then
begin
ShowMessage('ûÓÐÕÒµ½Ö÷Ìáµ¥ºÅΪ: '+DBEdit9.Text+',´¬ÃûΪ: '+QuotedStr(DBEdit38.Text)+', µÄ·ÖÌáµ¥ºÅ! ²»ÄÜͬ²½!');
FreeAndNil(aQuery);
Exit;
end;
cQuery:=CreateAdoQuery;
with cQuery do
begin
Close;
SQL.Clear;
SQL.Add('select top 1 * from t_op_ctn_edi where 񅧏='+QuotedStr(DBEdit33.Text) );
Open;
end;
if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.ProgressText:='ÕýÔÚͬ²½Êý¾Ý ÇëµÈºò¡£¡£¡£';
frm_sys_progress.bsSkinGauge1.MaxValue:=aQuery.RecordCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
bQuery:=CreateAdoQuery;
dQuery:=CreateAdoQuery;
aQuery.First;
while not aQuery.Eof do
begin
SQLStr:='update t_op_seae_edi set º½´Î=:p1,¿ª´¬ÈÕÆÚ=:p2,´¬²°IMO=:p3,´¬¹«Ë¾´úÂë=:p4,·¢»õÈË=:p5,·¢»õÈËÃû³Æ=:p6,·¢»õÈ˵ØÖ·1=:p7,'
+'·¢»õÈ˵ØÖ·2=:p8,·¢»õÈËÓÊÏä=:p9,·¢»õÈ˵绰=:p10,·¢»õÈ˹ú¼Ò´úÂë=:p11,·¢»õÈËÆóÒµ´úÂë=:p12,ÊÕ»õÈË=:p13,ÊÕ»õÈËÃû³Æ=:p14,'
+'ÊÕ»õÈ˵ØÖ·1=:p15,ÊÕ»õÈ˵ØÖ·2=:p16,ÊÕ»õÈËÓÊÏä=:p17,ÊÕ»õÈ˵绰=:p18,ÊÕ»õÈ˹ú¼Ò´úÂë=:p19,ÊÕ»õÈËÆóÒµ´úÂë=:p20,֪ͨÈË=:p21,'
+'֪ͨÈËÃû³Æ=:p22,֪ͨÈ˵ØÖ·1=:p23,֪ͨÈ˵ØÖ·2=:p24,֪ͨÈËÓÊÏä=:p25,֪ͨÈ˵绰=:p26,֪ͨÈ˹ú¼Ò´úÂë=:p27,֪ͨÈËÆóÒµ´úÂë=:p28,'
+'ÔËÊäÌõ¿î=:p29,×°»õ¸Û=:p30,×°¸Û´úÂë=:p31,Ç©µ¥µØµã=:p32,ж»õ¸Û=:p34,ж»õ´úÂë=:p35,Ä¿µÄµØ=:p36,Ä¿µÄ´úÂë=:p37,'
+'Ô¤µÖÈÕÆÚ=:p38,¸¶·Ñ·½Ê½=:p39,°ü×°=:p40,´¬´ú=:p41,ίÍз¢ËÍ·½=:p42,±¸×¢=:p43,À¿»õÈË=:p44,ΣÏÕÆ·ÁªÏµÈË=:p45,ΣÏÕÆ·µç»°=:p46,'
+'ΣÏÕÆ··ÖÀà=:p47,ΣÏÕÆ·±àºÅ=:p48 where ±àºÅ='
+QuotedStr(aQuery.fieldbyname('񅧏').AsString);
CTNSQLStr:='update t_op_ctn_edi set °ü×°=:p1 where ±àºÅ='+QuotedStr(aQuery.fieldbyname('±àºÅ').AsString);
with bQuery do
begin
Close;
SQL.Clear;
SQL.Add(CTNSQLStr);
Parameters.ParamByName('p1').Value:=t_op_seae.FieldByName('°ü×°').AsString;
ExecSQL;
Close;
SQL.Clear;
SQL.Add(SQLStr);
Parameters.ParamByName('p1').Value:=t_op_seae.FieldByName('º½´Î').AsString;
Parameters.ParamByName('p2').Value:=t_op_seae.FieldByName('¿ª´¬ÈÕÆÚ').AsDateTime;
Parameters.ParamByName('p3').Value:=t_op_seae.FieldByName('´¬²°IMO').AsString;
Parameters.ParamByName('p4').Value:=t_op_seae.FieldByName('´¬¹«Ë¾´úÂë').AsString;
Parameters.ParamByName('p5').Value:=t_op_seae.FieldByName('·¢»õÈË').AsString;
Parameters.ParamByName('p6').Value:=t_op_seae.FieldByName('·¢»õÈËÃû³Æ').AsString;
Parameters.ParamByName('p7').Value:=t_op_seae.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
Parameters.ParamByName('p8').Value:=t_op_seae.FieldByName('·¢»õÈ˵ØÖ·2').AsString;
Parameters.ParamByName('p9').Value:=t_op_seae.FieldByName('·¢»õÈËÓÊÏä').AsString;
Parameters.ParamByName('p10').Value:=t_op_seae.FieldByName('·¢»õÈ˵绰').AsString;
Parameters.ParamByName('p11').Value:=t_op_seae.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
Parameters.ParamByName('p12').Value:=t_op_seae.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString;
Parameters.ParamByName('p13').Value:=t_op_seae.FieldByName('ÊÕ»õÈË').AsString;
Parameters.ParamByName('p14').Value:=t_op_seae.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
Parameters.ParamByName('p15').Value:=t_op_seae.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
Parameters.ParamByName('p16').Value:=t_op_seae.FieldByName('ÊÕ»õÈ˵ØÖ·2').AsString;
Parameters.ParamByName('p17').Value:=t_op_seae.FieldByName('ÊÕ»õÈËÓÊÏä').AsString;
Parameters.ParamByName('p18').Value:=t_op_seae.FieldByName('ÊÕ»õÈ˵绰').AsString;
Parameters.ParamByName('p19').Value:=t_op_seae.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
Parameters.ParamByName('p20').Value:=t_op_seae.FieldByName('ÊÕ»õÈËÆóÒµ´úÂë').AsString;
Parameters.ParamByName('p21').Value:=t_op_seae.FieldByName('֪ͨÈË').AsString;
Parameters.ParamByName('p22').Value:=t_op_seae.FieldByName('֪ͨÈËÃû³Æ').AsString;
Parameters.ParamByName('p23').Value:=t_op_seae.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
Parameters.ParamByName('p24').Value:=t_op_seae.FieldByName('֪ͨÈ˵ØÖ·2').AsString;
Parameters.ParamByName('p25').Value:=t_op_seae.FieldByName('֪ͨÈËÓÊÏä').AsString;
Parameters.ParamByName('p26').Value:=t_op_seae.FieldByName('֪ͨÈ˵绰').AsString;
Parameters.ParamByName('p27').Value:=t_op_seae.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
Parameters.ParamByName('p28').Value:=t_op_seae.FieldByName('֪ͨÈËÆóÒµ´úÂë').AsString;
Parameters.ParamByName('p29').Value:=t_op_seae.FieldByName('ÔËÊäÌõ¿î').AsString;
Parameters.ParamByName('p30').Value:=t_op_seae.FieldByName('×°»õ¸Û').AsString;
Parameters.ParamByName('p31').Value:=t_op_seae.FieldByName('×°¸Û´úÂë').AsString;
{ Parameters.ParamByName('p30').Value:='QINGDAO,CHINA';
Parameters.ParamByName('p31').Value:='CNTAO'; }
Parameters.ParamByName('p32').Value:=t_op_seae.FieldByName('Ç©µ¥µØµã').AsString;
Parameters.ParamByName('p34').Value:=t_op_seae.FieldByName('ж»õ¸Û').AsString;
Parameters.ParamByName('p35').Value:=t_op_seae.FieldByName('ж»õ´úÂë').AsString;
Parameters.ParamByName('p36').Value:=t_op_seae.FieldByName('Ä¿µÄµØ').AsString;
Parameters.ParamByName('p37').Value:=t_op_seae.FieldByName('Ä¿µÄ´úÂë').AsString;
Parameters.ParamByName('p38').Value:=t_op_seae.FieldByName('Ô¤µÖÈÕÆÚ').AsDateTime;
Parameters.ParamByName('p39').Value:=t_op_seae.FieldByName('¸¶·Ñ·½Ê½').AsString;
Parameters.ParamByName('p40').Value:=t_op_seae.FieldByName('°ü×°').AsString;
Parameters.ParamByName('p41').Value:=t_op_seae.FieldByName('´¬´ú').AsString;
Parameters.ParamByName('p42').Value:=t_op_seae.FieldByName('ίÍз¢ËÍ·½').AsString;
Parameters.ParamByName('p43').Value:=t_op_seae.FieldByName('±¸×¢').AsString;
Parameters.ParamByName('p44').Value:=t_op_seae.FieldByName('À¿»õÈË').AsString;
Parameters.ParamByName('p45').Value:=t_op_seae.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString;
Parameters.ParamByName('p46').Value:=t_op_seae.FieldByName('ΣÏÕÆ·µç»°').AsString;
Parameters.ParamByName('p47').Value:=t_op_seae.FieldByName('ΣÏÕÆ··ÖÀà').AsString;
Parameters.ParamByName('p48').Value:=t_op_seae.FieldByName('ΣÏÕÆ·±àºÅ').AsString;
ExecSQL;
end;
//,ÖØÏäÕûÏä±êÖ¾=:p45,Ê©·âÈË=:p46
if not cQuery.IsEmpty then
begin
with dQuery do
begin
Close;
SQL.Clear;
SQL.Add('update t_op_ctn_edi set ÖØÏäÕûÏä±êÖ¾=:p1,Ê©·âÈË=:p2 where ±àºÅ='+QuotedStr(aQuery.fieldbyname('±àºÅ').AsString) );
Parameters.ParamByName('p1').Value:=cQuery.FieldByName('ÖØÏäÕûÏä±êÖ¾').AsString;
Parameters.ParamByName('p2').Value:=cQuery.FieldByName('Ê©·âÈË').AsString;
ExecSQL;
end;
end;
aQuery.Next;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
FreeAndNil(aQuery);
FreeAndNil(bQuery);
FreeAndNil(cQuery);
FreeAndNil(dQuery);
t_op_seae.Requery();
t_op_seae.GotoBookmark(ResentBookMark);
frm_sys_progress.close;
frm_sys_progress:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton39Click(Sender: TObject);
begin
t_op_seae.Edit;
t_op_seae.fieldbyname('ÊÕ»õÈËÃû³Æ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÃû³Æ').AsString;;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·1').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·1').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·2').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·2').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵ØÖ·3').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵ØÖ·3').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˳ÇÊÐ').AsString:=t_op_seae.fieldbyname('֪ͨÈ˳ÇÊÐ').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÓʱà').AsString:=t_op_seae.fieldbyname('֪ͨÈËÓʱà').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString:=t_op_seae.fieldbyname('֪ͨÈ˹ú¼Ò´úÂë').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÁªÏµÈË').AsString:=t_op_seae.fieldbyname('֪ͨÈËÁªÏµÈË').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈ˵绰').AsString:=t_op_seae.fieldbyname('֪ͨÈ˵绰').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÖÝ').AsString:=t_op_seae.fieldbyname('֪ͨÈËÖÝ').AsString;
t_op_seae.fieldbyname('ÊÕ»õÈËÆóÒµ´úÂë').AsString:=t_op_seae.fieldbyname('֪ͨÈËÆóÒµ´úÂë').AsString;
t_op_seae.Post;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton40Click(Sender: TObject);
var
ctntype,ctnsize,ctncode:string;
mybookmark:TBookmark;
begin
mybookmark:=t_op_ctn.GetBookmark;
ctncode:=t_op_ctn.fieldbyname('´úÂë').AsString;
ctntype:=t_op_ctn.fieldbyname('ÏäÐÍ').AsString;
ctnsize:=t_op_ctn.fieldbyname('³ß´ç').AsString;
with t_op_ctn do
begin
First;
while not eof do
begin
Edit;
FieldByName('´úÂë').AsString:=ctncode;
FieldByName('ÏäÐÍ').AsString:=ctntype;
FieldByName('³ß´ç').AsString:=ctnsize;
FieldByName('±íÏÖÐÎʽ').AsString:=ctnsize+'"'+ctntype;
post;
Next;
end;
end;
t_op_ctn.Requery();
t_op_ctn.GotoBookmark(mybookmark);
end;
procedure Tfrm_op_seae_edi_data.Notebook1PageChanged(Sender: TObject);
begin
setconcolor;
if (Notebook1.PageIndex=1) then begin
if (t_op_seae.FieldByName('´¬´ú').AsString='ÖÐÔ¶') or (t_op_seae.FieldByName('´¬´ú').AsString='ÖÐÔ¶º£ÔË') then
begin
t_code_zy_client.Close;
t_code_zy_client.SQL.Text:='select top 1 ¿Í»§¼ò³Æ from t_code_zy_client where ËùÊô¹«Ë¾='''+t_op_seae.FieldByName('ίÍз¢ËÍ·½').AsString+'''';
t_code_zy_client.Open;
end else t_code_zy_client.Close;
end else begin
t_code_zy_client.Close;
end;
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton41Click(Sender: TObject);
var
ctnsfr:string;
mybookmark:TBookmark;
begin
mybookmark:=t_op_ctn.GetBookmark;
ctnsfr:=t_op_ctn.fieldbyname('Ê©·âÈË').AsString;
with t_op_ctn do
begin
First;
while not eof do
begin
Edit;
FieldByName('Ê©·âÈË').AsString:=ctnsfr;
post;
Next;
end;
end;
t_op_ctn.Requery();
t_op_ctn.GotoBookmark(mybookmark);
end;
procedure Tfrm_op_seae_edi_data.DBEdit11Exit(Sender: TObject);
begin
{
t_code_cangdan.Close;
t_code_cangdan.Parameters.ParamByName('ίÍз¢ËÍ·½').Value:=DBEdit11.Text;
t_code_cangdan.Open;
}
end;
procedure Tfrm_op_seae_edi_data.t_op_seaeAfterScroll(DataSet: TDataSet);
begin
{
t_code_cangdan.Close;
t_code_cangdan.Parameters.ParamByName('ίÍз¢ËÍ·½').Value:=t_op_seae.fieldbyname('ίÍз¢ËÍ·½').AsString;
t_code_cangdan.Open;
}
{
t_code_cangdan.Close;
t_code_cangdan.Parameters.ParamByName('ίÍз¢ËÍ·½').Value:=t_op_seae.fieldbyname('ίÍз¢ËÍ·½').AsString;
if (Trim(t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').AsString)='') then
t_code_cangdan.Parameters.ParamByName('Ö÷·Öµ¥ÀàÐÍ').Value:='Ö÷µ¥'
else t_code_cangdan.Parameters.ParamByName('Ö÷·Öµ¥ÀàÐÍ').Value:='·Öµ¥';
t_code_cangdan.Open;
}
if (Notebook1.PageIndex=1) then begin
if (t_op_seae.FieldByName('´¬´ú').AsString='ÖÐÔ¶') or (t_op_seae.FieldByName('´¬´ú').AsString='ÖÐÔ¶º£ÔË') then
begin
t_code_zy_client.Close;
t_code_zy_client.SQL.Text:='select top 1 ¿Í»§¼ò³Æ from t_code_zy_client where ËùÊô¹«Ë¾='''+t_op_seae.FieldByName('ίÍз¢ËÍ·½').AsString+'''';
t_code_zy_client.Open;
end else t_code_zy_client.Close;
end else begin
t_code_zy_client.Close;
end;
// GetDuiBiStr;
end;
procedure Tfrm_op_seae_edi_data.EXCEL1Click(Sender: TObject);
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,zhusername,zhpassword,ScriptPath,str_file:string;
inifile1:TIniFile;
senddgdata:TSendDGData;
begin
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=6;
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(Application.ExeName)+'ZHENHUA.xls'+'"'+')]');
excel2.putstr(2,1,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
First;
while not eof do begin
excel2.putstr(j,1,aAdoQuery.FieldByName('´¬Ãû').AsString);
excel2.putstr(j,2,aAdoQuery.FieldByName('º½´Î').AsString);
excel2.putstr(j,3,aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString);
excel2.putstr(j,4,'');
excel2.putstr(j,5,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
excel2.putstr(j,6,aAdoQuery.FieldByName('ÏäºÅ').AsString);
excel2.putstr(j,7,aAdoQuery.FieldByName('·âºÅ').AsString);
poststr:=aAdoQuery.FieldByName('×°»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
excel2.putstr(j,8,poststr);
poststr:=aAdoQuery.FieldByName('ж»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
excel2.putstr(j,10,poststr);
poststr:=aAdoQuery.FieldByName('Ä¿µÄµØ').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
excel2.putstr(j,11,poststr);
excel2.putstr(j,12,aAdoQuery.FieldByName('¼þÊý').AsString);
excel2.putstr(j,13,aAdoQuery.FieldByName('°ü×°').AsString);
excel2.putstr(j,14,aAdoQuery.FieldByName('ÖØÁ¿').AsString);
excel2.putstr(j,15,aAdoQuery.FieldByName('³ßÂë').AsString);
excel2.putstr(j,16,aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString);
excel2.putstr(j,17,aAdoQuery.FieldByName('»õÎïÃèÊö').AsString);
excel2.putstr(j,18,aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString);
excel2.putstr(j,19,aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString);
excel2.putstr(j,20,aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString);
if Pos('COLLECT',aAdoQuery.FieldByName('¸¶·Ñ·½Ê½').AsString)>0 THEN
excel2.putstr(j,21,'COLLECT')
else excel2.putstr(j,21,'PREPAID');
excel2.putstr(j,22,aAdoQuery.FieldByName('ßéÍ·_1').AsString);
excel2.putstr(j,24,aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString);
excel2.putstr(j,25,'');
excel2.putstr(j,26,aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,27,'TE');
excel2.putstr(j,28,aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString);
excel2.putstr(j,30,aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString);
excel2.putstr(j,31,'');
excel2.putstr(j,32,aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,33,'TE');
excel2.putstr(j,34,aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString);
excel2.putstr(j,36,aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString);
excel2.putstr(j,37,'');
excel2.putstr(j,38,aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,39,'TE');
excel2.putstr(j,40,aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString);
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
excel2.putstr(j,42,'ÊÇ')
else excel2.putstr(j,42,'·ñ');
excel2.putstr(j,43,aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString);
excel2.putstr(j,44,aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString);
excel2.putstr(j,45,aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString);
excel2.putstr(j,46,aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsString);
j:=j+1;
Next;
end;
SaveDialog.Filter := '(*.xls)|*.xls';
SaveDialog.FileName := aAdoQuery.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'.xls';
if SaveDialog.Execute then
begin
excel2.Exec('[SAVE.AS("'+SaveDialog.FileName+'";1;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
end;
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
//function PlateThreadZHFun(p: Pointer): Integer; stdcall;
//procedure TMyThread.Execute;
procedure Tfrm_op_seae_edi_data.N29Click(Sender: TObject);
var
i,j:integer;
str,ScriptPath,str_file:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr:string;
MultiPartFormDataStream: TIdMultiPartFormDataStream;
IdHTTP1:TIdHTTP;
inifile1: Tinifile;
zhusername,zhpassword,mblno:string;
ExcelEXP: TExcel;
isfile:Boolean;
xlstest, thesheet:Variant;
begin
if MessageDlg('È·¶¨Òª<<Öк£Ö±·¢>>Ñ¡ÖеÄ'+inttostr(j)+'ƱҵÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then begin
Exit;
end;
// FreeOnTerminate := True;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
zhusername:= inifile1.ReadString('customZH', 'EDIUSERNAME', '');
zhpassword:= inifile1.ReadString('customZH', 'EDIPASSOWRD', '');
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if frm_op_seae_edi_data.t_op_seae.IsEmpty then Exit;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
CoInitialize(Nil);
if frm_op_seae_edi_data.dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to frm_op_seae_edi_data.dxDBGrid1.SelectedCount-1 do begin
frm_op_seae_edi_data.t_op_seae.GotoBookmark(pointer(frm_op_seae_edi_data.dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+frm_op_seae_edi_data.t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+frm_op_seae_edi_data.t_op_seae.fieldbyname('񅧏').asstring+'''';
frm_op_seae_edi_data.t_op_seae.Edit;
frm_op_seae_edi_data.t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
frm_op_seae_edi_data.t_op_seae.Post;
end;
end else begin
str:='('+''''+frm_op_seae_edi_data.t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
mblno:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'(Öк£)';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
ExcelEXP:=TExcel.Create(nil);
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=2;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHONGHAI.xls');
thesheet:= xlstest.Workbooks[1].Worksheets['sheet1'];
First;
while not eof do begin
thesheet.cells.item[j,1]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,2]:='';
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('´¬Ãû').AsString;
thesheet.cells.item[j,4]:=aAdoQuery.FieldByName('º½´Î').AsString;
thesheet.cells.item[j,5]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,6]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,7]:=aAdoQuery.FieldByName('·¢»õÈËÆóÒµ´úÂë').AsString;
thesheet.cells.item[j,8]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,9]:='TE';
thesheet.cells.item[j,10]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,14]:=aAdoQuery.FieldByName('ÊÕ»õÈËÆóÒµ´úÂë').AsString;
thesheet.cells.item[j,15]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,16]:='TE';
thesheet.cells.item[j,17]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,19]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
thesheet.cells.item[j,20]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,21]:=aAdoQuery.FieldByName('֪ͨÈËÆóÒµ´úÂë').AsString;
thesheet.cells.item[j,22]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,23]:='TE';
thesheet.cells.item[j,24]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
thesheet.cells.item[j,26]:=aAdoQuery.FieldByName('×°¸Û´úÂë').AsString;
thesheet.cells.item[j,27]:=aAdoQuery.FieldByName('ж»õ´úÂë').AsString;
thesheet.cells.item[j,28]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,29]:=aAdoQuery.FieldByName('·âºÅ').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString;
poststr:=aAdoQuery.FieldByName('ÖØÏäÕûÏä±êÖ¾').AsString;
if (poststr='¿ÕÏä') then
thesheet.cells.item[j,31]:='E'
else thesheet.cells.item[j,31]:='F';
thesheet.cells.item[j,32]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsString;
thesheet.cells.item[j,33]:=aAdoQuery.FieldByName('ßéÍ·_1').AsString;
thesheet.cells.item[j,34]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,35]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,36]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,37]:=frm_op_seae_edi_data.GetpkgsEdi(aAdoQuery.FieldByName('°ü×°').AsString);
thesheet.cells.item[j,38]:=aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString;
j:=j+1;
Next;
end;
str_file:=ScriptPath
+frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+FormatDateTime('ss',now)+'.xls';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHONGHAI.xls');
// xlstest.Disconnect;
xlstest.Quit;
xlstest:=UnAssigned;
frm_op_seae_edi_data.updatelr;
// Delay(10000);
// ShowMessage(mblno+str_file);
TMyThread.create(str_file,'',zhusername,zhpassword,mblno,'zh');
finally
FreeAndNil(ExcelEXP);
aDataSource.Free;
Free;
CoUninitialize;
end;
end;
procedure Tfrm_op_seae_edi_data.Delay(dwMilliseconds:DWORD);//Longint
var
iStart,iStop:DWORD;
begin
iStart := GetTickCount;
repeat
iStop := GetTickCount;
Application.ProcessMessages;
until (iStop - iStart) >= dwMilliseconds;
end;
///procedure Tfrm_op_seae_edi_data.N29Click(Sender: TObject);
// var
// ID: DWORD;
//begin
// TMyThread.Create(False);
{
if hThread>0 then begin
showmessage('Óнø³ÌÕýÔÚ·¢ËÍ,²»ÄÜ·¢ËÍ£¡');
Exit;
end;
try
hThread := CreateThread(nil, 0, @PlateThreadZHFun, nil, CREATE_SUSPENDED, ID);
ResumeThread(hThread);
except
if hThread>0 then TerminateThread(hThread,0);
end;
}
//end;
{ TMyThread }
constructor TMyThread.create(mfilename, mfiletype, mediname, medipassword,
mmblno: string;meditype:string);
begin
inherited Create(True);
filename:=mfilename;
filetype:=mfiletype;
ediname:=mediname;
edipassword:=medipassword;
mblno:=mmblno;
editype:=meditype;
FreeOnTerminate:=True;
Resume;
end;
destructor TMyThread.destroy;
begin
inherited;
end;
procedure TMyThread.Execute;
var
MultiPartFormDataStream: TIdMultiPartFormDataStream;
IdHTTP1:TIdHTTP;
strmsg:string;
begin
inherited;
CoInitialize(Nil);
try
// if editype='zh' then Sleep(10000);
// ShowMessage(filename);
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
IdHTTP1:=TIdHTTP.Create(Application);
try
IdHttp1.Request.Accept := '*/*';
IdHttp1.Request.AcceptLanguage:='zh-CN';
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
MultiPartFormDataStream.AddFormField('username',ediname);
MultiPartFormDataStream.AddFormField('password',edipassword);
MultiPartFormDataStream.AddFormField('action',editype);
MultiPartFormDataStream.AddFormField('encode','1');
if (filetype='') then
MultiPartFormDataStream.AddFile('filename',filename,GetMIMETypeFromFile(filename))
else MultiPartFormDataStream.AddFile('filename',filename,filetype);
MultiPartFormDataStream.Position := 0;
strmsg:=mblno+'---'+trim(UnicodeToChinese(IdHTTP1.Post('http://47.104.73.97:8111/cdpost.ashx', MultiPartFormDataStream)));
Application.MessageBox(pchar(strmsg),'Ìáʾ:',mrOk);
// ShowMessage(filename);
finally
MultiPartFormDataStream.Free;
FreeAndNil(IdHTTP1);
end;
finally
CoUninitialize;
end;
end;
procedure Tfrm_op_seae_edi_data.DBMemo38Change(Sender: TObject);
begin
lblmarklength.Caption:='×Ö·ûÊý:'+inttostr(Length (DBMemo38.Text));
end;
procedure Tfrm_op_seae_edi_data.DBMemo39Change(Sender: TObject);
begin
Label43.Caption:='×Ö·ûÊý:'+inttostr(Length(DBMemo39.Text));
if (Pos('£¿',DBMemo39.Text)>0) or (Pos('?',DBMemo39.Text)>0) then
lblTSGOOD.Caption:='×¢Òâ:»õÃè´æÔÚ£¿'
else lblTSGOOD.Caption:='';
end;
procedure Tfrm_op_seae_edi_data.bsSkinButton291Click(Sender: TObject);
var
ctnsfr:string;
mybookmark:TBookmark;
begin
mybookmark:=t_op_ctn.GetBookmark;
ctnsfr:=t_op_ctn.fieldbyname('ÖØÏäÕûÏä±êÖ¾').AsString;
with t_op_ctn do
begin
First;
while not eof do
begin
Edit;
FieldByName('ÖØÏäÕûÏä±êÖ¾').AsString:=ctnsfr;
post;
Next;
end;
end;
t_op_ctn.Requery();
t_op_ctn.GotoBookmark(mybookmark);
end;
function Tfrm_op_seae_edi_data.formattel(str: string): string;
begin
Result := Trim(str);
Result := StringReplace(Result, '+', '', [rfReplaceAll]);
Result := StringReplace(Result, '-', '', [rfReplaceAll]);
end;
procedure Tfrm_op_seae_edi_data.N31Click(Sender: TObject);
begin
try
if not assigned(frm_op_seae_edi_custom_qgzf) then
frm_op_seae_edi_custom_qgzf:=tfrm_op_seae_edi_custom_qgzf.Create(application);
frm_op_seae_edi_custom_qgzf.ShowModal;
finally
frm_op_seae_edi_custom_qgzf.free;
frm_op_seae_edi_custom_qgzf:=nil;
end;
end;
{ TDsThread }
constructor TDsThread.create(mfilename, mcarrierid,mScriptPath,mwebusername,mwebpassword: string;msenddgdata:TSendDGData;mwebcustname:string='');
begin
inherited Create(True);
filename:=mfilename;
carrierid:=mcarrierid;
ScriptPath:=mScriptPath;
webusername:=mwebusername;
webpassword:=mwebpassword;
webcustname:=mwebcustname;
senddgdata:=msenddgdata;
FreeOnTerminate:=True;
Resume;
end;
destructor TDsThread.destroy;
begin
inherited;
end;
procedure TDsThread.Execute;
var
MultiPartFormDataStream: TIdMultiPartFormDataStream;
IdHTTP1:TIdHTTP;
strmsg,strfile,Url,ResponseStr:string;
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
jo:ISuperobject;
begin
inherited;
CoInitialize(Nil);
try
// if editype='zh' then Sleep(10000);
// ShowMessage(filename);
strfile:=ScriptPath+filename;
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
IdHTTP1:=TIdHTTP.Create(Application);
ResponseStream := TStringStream.Create('');
try
IdHttp1.Request.Accept := '*/*';
IdHttp1.Request.AcceptLanguage:='zh-CN';
IdHttp1.Request.ContentType := MultiPartFormDataStream.RequestContentType;
{
IdHttp1.Request.CustomHeaders.AddValue('custname','qdds');
IdHttp1.Request.CustomHeaders.AddValue('custpsw','ds20040201');
IdHttp1.Request.CustomHeaders.AddValue('yardid',carrierid);
}
MultiPartFormDataStream.AddFormField('custname','qdds');
MultiPartFormDataStream.AddFormField('custpsw','ds20040201');
MultiPartFormDataStream.AddFormField('yardid',carrierid);
MultiPartFormDataStream.AddFormField('webusername',webusername);
MultiPartFormDataStream.AddFormField('webpassword',webpassword);
if (webcustname<>'') then
MultiPartFormDataStream.AddFormField('webcustname',webcustname);
if (senddgdata.dgConPerson<>'') then
MultiPartFormDataStream.AddFormField('dgConPerson',senddgdata.dgConPerson);
if (senddgdata.dgTel<>'') then
MultiPartFormDataStream.AddFormField('dgTel',senddgdata.dgTel);
if (senddgdata.dgClass<>'') then
MultiPartFormDataStream.AddFormField('dgClass',senddgdata.dgClass);
if (senddgdata.temperature<>'') then
MultiPartFormDataStream.AddFormField('temperature',senddgdata.temperature);
if (senddgdata.temUnit<>'') then
MultiPartFormDataStream.AddFormField('temUnit',senddgdata.temUnit);
if (senddgdata.humidity<>'') then
MultiPartFormDataStream.AddFormField('humidity',senddgdata.humidity);
if (senddgdata.vent<>'') then
MultiPartFormDataStream.AddFormField('vent',senddgdata.vent);
if (senddgdata.dgNo<>'') then
MultiPartFormDataStream.AddFormField('dgNo',senddgdata.dgNo);
// MultiPartFormDataStream.AddFormField('data','1');
// if (filetype='') then
MultiPartFormDataStream.AddFile('file',strfile,GetMIMETypeFromFile(strfile));
// else MultiPartFormDataStream.AddFile('filename',filename,filetype);
MultiPartFormDataStream.Position := 0;
// Url:='http://47.104.90.170:8000/sub?custname=qdds&custpsw=ds20040201&yardid='+carrierid;
Url:='http://47.104.90.170:8000/customer/sub';
try
IdHttp1.post(Url,MultiPartFormDataStream,ResponseStream);
except
on e : Exception do
begin
end;
end;
ResponseStr := ResponseStream.DataString; //»ñÈ¡ÍøÒ³·µ»ØµÄÐÅÏ¢
ResponseStr := UTF8Decode(ResponseStr); //ÍøÒ³ÖеĴæÔÚÖÐÎÄʱ£¬ÐèÒª½øÐÐUTF8½âÂë
jo:=so(ResponseStr);
strmsg:=jo.O['message'].AsString;
if (jo.O['status'].AsString='0') then begin
Application.MessageBox(pchar('ÉÏ´«Ê§°Ü,'+strmsg),'¾¯¸æ:',mrOk);
end else begin
Application.MessageBox(pchar('ÉÏ´«³É¹¦,'+strmsg),'Ìáʾ:',mrOk);
end;
finally
MultiPartFormDataStream.Free;
FreeAndNil(IdHTTP1);
FreeAndNil(ResponseStream);
end;
finally
CoUninitialize;
end;
end;
function Tfrm_op_seae_edi_data.GetpkgsMscEdi(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select MSC´úÂë from t_code_package where °ü×°Ãû³Æ='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('MSC´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.GetCtnMSCCode(ctn: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctn:=StringReplace(ctn,'''','''''',[rfReplaceAll]);
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select MSCÏäÐÍ EDI´úÂë from t_code_ctn where ±íÏÖÐÎʽ='''+ctn+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI´úÂë').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.GetpkgsEdi2(pkgs: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select Edi´úÂë from t_code_package where °ü×°Ãû³Æ='''+pkgs+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('Edi´úÂë').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_edi_data.GetCtnMSCCodeCode(ctn: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctn:=StringReplace(ctn,'''','''''',[rfReplaceAll]);
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select MSC´úÂë EDI´úÂë from t_code_ctn where ±íÏÖÐÎʽ='''+ctn+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI´úÂë').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_edi_data.wwDBGrid1CalcCellColors(Sender: TObject;
Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont;
ABrush: TBrush);
begin
if (Field.FieldName='·âºÅ') and (Pos('0',VarToStr(Field.Value))=1 ) then begin
ABrush.Color:=clRed;
end;
end;
procedure Tfrm_op_seae_edi_data.DBEdit4Change(Sender: TObject);
begin
t_code_carrier.Close;
if Trim(DBEdit4.Text)='' then
t_code_carrier.SQL.Text:='select * from code_cangdan_carrier '
else
t_code_carrier.SQL.Text:='select * from code_cangdan_carrier where FORWARDER='''+DBEdit4.Text+'''';
t_code_carrier.Open;
end;
function Tfrm_op_seae_edi_data.createzhjson(UserName,userpsw:string): string;
var
TempStr:TStringlist;
str,codestr,strsql,poststr:string;
aAdoQuery:TADOQuery;
i:Integer;
isfirst:Boolean;
begin
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
strsql:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
strsql:=strsql+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
end else begin
strsql:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
strsql:=strsql+')';
aAdoQuery:=CreateAdoQuery;
TempStr:=TStringList.Create;
try
with aAdoQuery do begin
close;SQL.Clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+strsql
+' order by t_op_ctn_edi.񅧏');
open;
end;
str:=str+'{';
str:=str+'"username":"'+ UserName+'"';
str:=str+',"password":"'+ userpsw+'"';
str:=str+',"filename":"'+ aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString+'"';
str:=str+',data:[';
isfirst:=true;
while not aAdoQuery.Eof do begin
if (isfirst) then str:=str+'{' else str:=str+',{';
str:=str+'"vessel":"'+ aAdoQuery.FieldByName('´¬Ãû').AsString+'"';
str:=str+',"voyage":"'+aAdoQuery.FieldByName('º½´Î').AsString+'"';
str:=str+',"company":"'+ aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString+'"';
str:=str+',"subbillno":""';
str:=str+',"masterbillno":"'+aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString+'"';
str:=str+',"boxno":"'+aAdoQuery.FieldByName('ÏäºÅ').AsString+'"';
str:=str+',"sealno":"'+aAdoQuery.FieldByName('·âºÅ').asstring+'"';
poststr:=aAdoQuery.FieldByName('×°»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
str:=str+',"loadingport":"'+poststr+'"';
str:=str+',"transport":""';
poststr:=aAdoQuery.FieldByName('ж»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
str:=str+',"dischargingport":"'+poststr+'"';
poststr:=aAdoQuery.FieldByName('Ä¿µÄµØ').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
str:=str+',"destinationport":"'+poststr+'"';
str:=str+',"unitsno":"'+aAdoQuery.FieldByName('¼þÊý').AsString+'"';
str:=str+',"pdesc":"'+aAdoQuery.FieldByName('°ü×°').AsString+'"';
str:=str+',"roughweight":"'+aAdoQuery.FieldByName('ÖØÁ¿').AsString+'"';
str:=str+',"volume":"'+aAdoQuery.FieldByName('³ßÂë').AsString+'"';
str:=str+',"boxtype":"'+aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString+'"';
str:=str+',"cargoname":"'+StringReplace(StringReplace(aAdoQuery.FieldByName('»õÎïÃèÊö').AsString,'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"';
str:=str+',"shipper":"'+aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString+'"';
str:=str+',"consignee":"'+aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString+'"';
str:=str+',"notify":"'+aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString+'"';
if Pos('COLLECT',aAdoQuery.FieldByName('¸¶·Ñ·½Ê½').AsString)>0 THEN
str:=str+',"paidcoll":"COLLECT"'
else str:=str+',"paidcoll":"PREPAID"';
str:=str+',"mark":"'+StringReplace(StringReplace(aAdoQuery.FieldByName('ßéÍ·_1').AsString,'&','%26',[rfReplaceAll]),'"','\"',[rfReplaceAll])+'"';
str:=str+',"emptyweight":""';
str:=str+',"shipperaddress":"'+aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString+'"';
str:=str+',"shippercode":""';
str:=str+',"shippercountry":"'+aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString+'"';
str:=str+',"shippercontact":"TE"';
str:=str+',"shippernumber":"'+aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString+'"';
str:=str+',"shipperAEO":""';
str:=str+',"consigneeaddress":"'+aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString+'"';
str:=str+',"consigneecode":""';
str:=str+',"consigneecountry":"'+aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString+'"';
str:=str+',"consigneecontact":"TE"';
str:=str+',"consigneenumber":"'+aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString+'"';
str:=str+',"consigneeAEO":""';
str:=str+',"notifyaddress":"'+aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString+'"';
str:=str+',"notifycode":""';
str:=str+',"notifycountry":"'+aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString+'"';
str:=str+',"notifycontact":"TE"';
str:=str+',"notifynumber":"'+aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString+'"';
str:=str+',"notifyAEO":""';
str:=str+',"UNno":"'+aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString+'"';
str:=str+',"Dclass":"'+aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString+'"';
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') THEN begin
str:=str+',"ISDG":"1"';
end ELSE begin
str:=str+',"ISDG":"0"';
end;
str:=str+',"Emergcontact":"'+aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString+'"';
str:=str+',"Emergnumber":"'+aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsString+'"';
str:=str+'}';
isfirst:=false;
aAdoQuery.Next;
end;
str:=str+']';
str:=str+'}';
finally
FreeAndNil(aAdoQuery);
FreeAndNil(TempStr);
end;
Result:=str;
end;
procedure Tfrm_op_seae_edi_data.N3Click(Sender: TObject);
var
IdHttp : TIdHTTP;
Url,StrL,JSONSTR,errmsg,UserName,userpsw : string;//ÇëÇóµØÖ·
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
ResponseStr: string;
RequestStr : string; //ÇëÇóÐÅÏ¢
RequestStream : TStringStream;
jo: ISuperObject;
inifile1:TIniFile;
i,k:Integer;
begin
if t_op_seae.IsEmpty then Exit;
if not assigned(frm_op_seae_zhedi) then
frm_op_seae_zhedi:=tfrm_op_seae_zhedi.Create (self);
try
IdHttp := TIdHTTP.Create(nil);
IdHTTP.HTTPOptions := IdHTTP.HTTPOptions + [hoKeepOrigProtocol]; //±ØÐëÓÐÕâÐвÅʹÉèÖÃЭÒé°æ±¾ÉúЧ
IdHTTP.ProtocolVersion := pv1_1;
IdHttp.Request.UserAgent:='Mozilla/3.0 (compatible; Indy Library)';
idhttp.Request.ContentType:='application/json;charset=UTF-8';
ResponseStream := TStringStream.Create('');
RequestStream := TStringStream.Create('');
if frm_op_seae_zhedi.ShowModal = mrOK then
begin
UserName:=frm_op_seae_zhedi.edit2.Text;
userpsw:=frm_op_seae_zhedi.edit3.Text;
StrL:=createzhjson(UserName,userpsw);
jo := SO(StrL);
if (UserName<>'') and (userpsw<>'') then
try
Url:='http://47.104.90.170:9000/cloudship/upload';
try
RequestStr:=jo.AsJSon(True); //ËïС»ª
RequestStream.WriteString(RequestStr);
IdHttp.post(Url,RequestStream,ResponseStream);
except
on e : Exception do
begin
errmsg:=e.Message;
end;
end;
ResponseStr := ResponseStream.DataString;
ResponseStr := UTF8Decode(ResponseStr);
if Pos('"status":"0"',ResponseStr)>0 then begin
i:= Pos('"Message":' ,ResponseStr);
errmsg :=Copy(ResponseStr ,i+11,Length(ResponseStr)-i-11);
MessageDlg('δÉÏ´«³É¹¦,'+errmsg,mtWarning,[mbOk],0);
end else
begin
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
ShowMessage('ÒÑÉÏ´«£¡')
end;
finally
IdHttp.Free;
RequestStream.Free;
ResponseStream.Free;
end;
end;
updatelr;
finally
FreeAndNil(frm_op_seae_zhedi);
end;
end;
procedure Tfrm_op_seae_edi_data.opClick(Sender: TObject);
begin
if MessageDlg('È·¶¨Òª·¢ËÍ'+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+'ÏîÏ·ֵ¥Âð£¡',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
adopingtai.Close;
adopingtai.SQL.Text:='update WLXX_MBLNO_DELAY set NEEDREAD=1,READTIME=DATEADD(n,-30,GETDATE()),ENDTIME=DATEADD(n,20,GETDATE()) where MBLNO='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+'''';
adopingtai.ExecSQL;
ShowMessage('ÒÑÉèÖ÷ֵ¥×Ô¶¯·¢ËÍ£¡');
end;
procedure Tfrm_op_seae_edi_data.N7Click(Sender: TObject);
var
i,j,NO:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr:string;
begin
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=2;
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(Application.ExeName)+'OOLU.xlsx'+'"'+')]');
First;
while not eof do begin
excel2.putstr(j,1,inttostr(j-1));
excel2.putstr(j,2,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
excel2.putstr(j,3,'');
excel2.putstr(j,4,'');
excel2.putstr(j,5,aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString);
excel2.putstr(j,6,'');
excel2.putstr(j,7,aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString);
excel2.putstr(j,8,'qingdao');
excel2.putstr(j,9,aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,10,aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString);
excel2.putstr(j,11,aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString);
excel2.putstr(j,12,aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString);
excel2.putstr(j,13,'');
excel2.putstr(j,14,aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,15,aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString);
excel2.putstr(j,16,aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString);
excel2.putstr(j,17,aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString);
excel2.putstr(j,18,'');
excel2.putstr(j,19,aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(j,20,aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString);
excel2.putstr(j,21,aAdoQuery.FieldByName('ÏäºÅ').AsString);
excel2.putstr(j,22,aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString);
excel2.putstr(j,23,aAdoQuery.FieldByName('·âºÅ').AsString);
excel2.putstr(j,24,aAdoQuery.FieldByName('¼þÊý').AsString);
excel2.putstr(j,25,GetwypkgsEdi(aAdoQuery.FieldByName('°ü×°').AsString));
excel2.putstr(j,26,aAdoQuery.FieldByName('ÖØÁ¿').AsString);
excel2.putstr(j,27,aAdoQuery.FieldByName('³ßÂë').AsString);
excel2.putstr(j,28,aAdoQuery.FieldByName('ßéÍ·_1').AsString);
excel2.putstr(j,29,aAdoQuery.FieldByName('»õÎïÃèÊö').AsString);
excel2.putstr(j,30,aAdoQuery.FieldByName('×°¸Û´úÂë').AsString);
excel2.putstr(j,31,aAdoQuery.FieldByName('ж»õ´úÂë').AsString);
excel2.putstr(j,32,'');
excel2.putstr(j,33,aAdoQuery.FieldByName('Ä¿µÄ´úÂë').AsString);
excel2.putstr(j,34,'');
excel2.putstr(j,35,'PP - Ô¤¸¶');
excel2.putstr(j,36,'HH - (House to House)');
excel2.putstr(j,37,aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString);
excel2.putstr(j,38,aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString);
excel2.putstr(j,39,'');
excel2.putstr(j,40,'');
excel2.putstr(j,41,aAdoQuery.FieldByName('ÉèÖÃζÈ').AsString);
excel2.putstr(j,42,aAdoQuery.FieldByName('Àä²Øͨ·çÁ¿').AsString);
j:=j+1;
Next;
end;
SaveDialog.Filter := '(*.xlsx)|*.xlsx';
SaveDialog.FileName := aAdoQuery.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'.xlsx';
if SaveDialog.Execute then
begin
excel2.Exec('[SAVE.AS("'+SaveDialog.FileName+'";1;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
// excel2.Exec('[open("'+SaveDialog.FileName+'")]');
// excel2.Exec('[APP.maxIMIZE()]'); //×î´ó»¯excel
end;
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
function Tfrm_op_seae_edi_data.GetCtnWYCode(ctnkind,
ctnsize: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]);
try
with aQuery do
begin
Close;SQL.Clear;
SQL.Add('Select ÍâÔËEDI´úÂë EDI´úÂë from t_code_ctn where ÏäÐÍ='''+ctnkind+''' and ³ß´ç='''+ctnsize+'''');
Open;
if not IsEmpty then
Result:=Trim(FieldByName('EDI´úÂë').asstring)
else
Result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_edi_data.Sendzyzf;
var
i,j:integer;
str,pkgcode:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,ScriptPath,str_file,strall,zhusername,zhpassword:string;
stringStream: TStringStream;
memory:TMemoryStream;
myStream:TFileStream;
buffer:PChar;
ExcelEXP: TExcel;
xlstest, thesheet:Variant;
IdHTTP1:TIdHTTP;
strmsg:string;
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
ResponseStr,Url: string;
RequestStr : string; //ÇëÇóÐÅÏ¢
RequestStream : TStringStream;
jo:ISuperobject;
inifile1:Tinifile;
senddgdata:TSendDGData;
begin
if MessageDlg('È·¶¨Òª<<ÖÐÔ¶Ö±·¢>>Ñ¡ÖеÄÒµÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then begin
Exit;
end;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
zhusername:= inifile1.ReadString('customZYHY', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customZYHY', 'WEBPASSOWRD', '');
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=4;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'COSCO.xls');
thesheet:= xlstest.Workbooks[1].Worksheets['sheet1'];
First;
while not eof do begin
thesheet.cells.item[j,1]:=Copy(aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString,5,Length(aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString)-4);
thesheet.cells.item[j,2]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,4]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,7]:='µç»°';
thesheet.cells.item[j,8]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,10]:='N';
thesheet.cells.item[j,11]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,16]:='µç»°';
thesheet.cells.item[j,17]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,19]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
thesheet.cells.item[j,20]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,21]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,24]:='µç»°';
thesheet.cells.item[j,25]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
if (aAdoQuery.FieldByName('¸¶·Ñ·½Ê½').AsString='FREIGHT PREPAID') then
thesheet.cells.item[j,26]:='P-Ô¤¸¶'
else thesheet.cells.item[j,26]:='C-µ½¸¶';
thesheet.cells.item[j,27]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,29]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('·âºÅ').AsString;
thesheet.cells.item[j,31]:=GetCtnMSCCode(aAdoQuery.FieldByName('±íÏÖÐÎʽ').AsString);
thesheet.cells.item[j,32]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,33]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,34]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,35]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsString;
if (aAdoQuery.FieldByName('ÊÇ·ñ¶³´ú¸É').AsBoolean) then begin
thesheet.cells.item[j,36]:='GC-General'
end else begin
if ((aAdoQuery.FieldByName('ÏäÐÍ').AsString='RH') OR (aAdoQuery.FieldByName('ÏäÐÍ').AsString='RF') OR (aAdoQuery.FieldByName('ÏäÐÍ').AsString='RQ')) then begin
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
thesheet.cells.item[j,36]:='RD-Reefer Dangerous'
else thesheet.cells.item[j,36]:='RF-Reefer';
end else begin
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
thesheet.cells.item[j,36]:='DG-Dangerous'
else thesheet.cells.item[j,36]:='GC-General';
end;
end;
pkgcode:=GetpkgsMscEdi(aAdoQuery.FieldByName('°ü×°').AsString);
if (pkgcode='Bag') then pkgcode:='BAG(Bag)' else pkgcode:='('+pkgcode+')';
thesheet.cells.item[j,37]:=pkgcode;
thesheet.cells.item[j,38]:=aAdoQuery.FieldByName('ÔËÊ䷽ʽ').AsString;
j:=j+1;
Next;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+'.xls';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(ScriptPath+str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'COSCO.xls');
xlstest.Quit;
xlstest:=UnAssigned;
Sleep(1000);
senddgdata.dgConPerson:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·ÁªÏµÈË').asstring;
senddgdata.dgTel:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·µç»°').asstring;
senddgdata.dgClass:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring;
senddgdata.temperature:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring;
senddgdata.temUnit:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ζȵ¥Î»').asstring;
senddgdata.humidity:='';
senddgdata.vent:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring;
senddgdata.dgNo:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring;
TDsThread.create(str_file,'ZYHY',ScriptPath,zhusername,zhpassword,senddgdata);
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.N30Click(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
try
if not assigned(frm_op_seae_edi_custom_zyzf) then
frm_op_seae_edi_custom_zyzf:=tfrm_op_seae_edi_custom_zyzf.Create(application);
frm_op_seae_edi_custom_zyzf.ShowModal;
finally
frm_op_seae_edi_custom_zyzf.free;
frm_op_seae_edi_custom_zyzf:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.Sendqgzf(lhcd:string);
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,ScriptPath,str_file,strall,fileallname,zhusername,zhpassword:string;
ExcelEXP: TExcel;
xlstest, thesheet:Variant;
IdHTTP1:TIdHTTP;
strmsg:string;
ResponseStream : TStringStream; //·µ»ØÐÅÏ¢
ResponseStr,Url: string;
RequestStr : string; //ÇëÇóÐÅÏ¢
RequestStream : TStringStream;
jo:ISuperobject;
myStream:TFileStream;
buffer:PChar;
inifile1:TIniFile;
senddgdata:TSendDGData;
begin
if (lhcd='LHCD') then begin
if MessageDlg('È·¶¨Òª<<ÁªºÏ´¬´úÖ±·¢>>Ñ¡ÖеÄÒµÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then begin
Exit;
end;
end else begin
if MessageDlg('È·¶¨Òª<<Çà¸ÛÖ±·¢>>Ñ¡ÖеÄÒµÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then begin
Exit;
end;
end;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
if (lhcd='LHCD') then begin
zhusername:= inifile1.ReadString('customLHCD', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customLHCD', 'WEBPASSOWRD', '');
end else begin
zhusername:= inifile1.ReadString('customQGZF', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customQGZF', 'WEBPASSOWRD', '');
end;
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=2;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'QINGGANG.xls');
thesheet:= xlstest.Workbooks[1].Worksheets['sheet1'];
First;
while not eof do begin
thesheet.cells.item[j,1]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,2]:=aAdoQuery.FieldByName('·ÖÌáµ¥ºÅ').AsString;
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('´¬Ãû').AsString;
thesheet.cells.item[j,4]:=aAdoQuery.FieldByName('º½´Î').AsString;
thesheet.cells.item[j,5]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,6]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,7]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,8]:='TE';
thesheet.cells.item[j,9]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,10]:='';
thesheet.cells.item[j,11]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,14]:='TE';
thesheet.cells.item[j,15]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,16]:='';
thesheet.cells.item[j,17]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
thesheet.cells.item[j,18]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
// thesheet.cells.item[j,21]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,19]:='TE';
thesheet.cells.item[j,20]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
thesheet.cells.item[j,21]:='';
thesheet.cells.item[j,22]:=aAdoQuery.FieldByName('×°¸Û´úÂë').AsString;
thesheet.cells.item[j,23]:=aAdoQuery.FieldByName('ж»õ´úÂë').AsString;
thesheet.cells.item[j,24]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,25]:=aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString;
thesheet.cells.item[j,26]:=''''+aAdoQuery.FieldByName('·âºÅ').AsString;
thesheet.cells.item[j,27]:=GetCtnMSCCodeCode(aAdoQuery.FieldByName('±íÏÖÐÎʽ').AsString);
poststr:=aAdoQuery.FieldByName('ÖØÏäÕûÏä±êÖ¾').AsString;
if (poststr='¿ÕÏä') then
thesheet.cells.item[j,28]:='E'
else thesheet.cells.item[j,28]:='F';
thesheet.cells.item[j,29]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('ßéÍ·_1').AsString;
thesheet.cells.item[j,31]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,32]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,33]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,34]:=GetpkgsEdi2(aAdoQuery.FieldByName('°ü×°').AsString);
thesheet.cells.item[j,35]:=aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString;
thesheet.cells.item[j,36]:='CN';
j:=j+1;
Next;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+'.xls';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(ScriptPath+str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'QINGGANG.xls');
xlstest.Quit;
xlstest:=UnAssigned;
Sleep(1000);
senddgdata.dgConPerson:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·ÁªÏµÈË').asstring;
senddgdata.dgTel:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·µç»°').asstring;
senddgdata.dgClass:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring;
senddgdata.temperature:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring;
senddgdata.temUnit:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ζȵ¥Î»').asstring;
senddgdata.humidity:='';
senddgdata.vent:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring;
senddgdata.dgNo:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring;
if (lhcd='LHCD') then begin
TDsThread.create(str_file,'LHCD',ScriptPath,zhusername,zhpassword,senddgdata);
end else begin
TDsThread.create(str_file,'CDCS',ScriptPath,zhusername,zhpassword,senddgdata);
end;
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.widClick(Sender: TObject);
var
i:Integer;
aAdoQuery,aAdoQuery2:TAdoQuery;
s:string;
LengthQ, PosQ:Integer;
iscon:Boolean;
begin
if (t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString='D') then begin
if MessageDlg('´ËƱ»õΪΣÏÕÆ·,ȷʵҪ·¢ËÍÂð?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
if (Length(Trim(t_op_seae1.DataSet.FieldByName('»õÎïÃèÊö').AsString))>900) then begin
if MessageDlg('´ËƱ»õ»õÎïÃèÊö³¬³¤,ȷʵҪ·¢ËÍÂð?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
if (t_op_seae1.DataSet.FieldByName('»õÎï±êʶ').AsString='O') then begin
if MessageDlg('´ËƱΪ³¬ÏÞÏ䣬ÊÇ·ñ¼ÌÐø²Ù×÷?',mtWarning,[mbYes,mbNo],0)=mrNo then
exit;
end;
s:='';
aAdoQuery:=createAdoQuery;
aAdoQuery2:=createAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('select isnull(object_id(''CANGDAN_CUSTOMER''),''0'') as tbl');
Open;
if (FieldByName('tbl').AsString<>'0') then begin
Close;sql.Clear;
sql.Add('select COUNT(*) CT FROM CANGDAN_CUSTOMER WHERE CUSTOMERNAME='''+t_op_seae.fieldbyname('ίÍз¢ËÍ·½').asstring+'''');
Open;
if (FieldByName('CT').AsInteger=0) then begin
MessageDlg('²»ÄÜ·¢Ë͸ÿͻ§ÉÐδ¿ªÍ¨²Õµ¥É걨ҵÎñ£¬ÇëÓë¶ÔÓ¦ÒµÎñͬÊÂÁªÏµ£¡',mtError,[mbOk],0);
Exit;
end;
end;
if (t_op_seae.FieldByName('·ÖÌáµ¥ºÅ').AsString='') then begin
Close;sql.Clear;
sql.Add('select distinct b.Ö÷Ìáµ¥ºÅ,c.ÏäºÅ from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' ');
sql.Add(' and b.¼ÈëÈÕÆÚ>=GETDATE()-20 ');
sql.Add(' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' and b.Ö÷Ìáµ¥ºÅ<>'''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' ');
sql.Add(' and c.ÏäºÅ in (select ÏäºÅ from t_op_ctn_edi where ±àºÅ='''+t_op_seae.fieldbyname('±àºÅ').AsString+''') ');
Open;First;
while not Eof do
begin
if s='' then s:='¸Ãº½´Î'+FieldByName('Ö÷Ìáµ¥ºÅ').AsString+'Ï´æÔÚÏàͬÏäºÅ'+FieldByName('ÏäºÅ').AsString+''
else s:=s+#13#10+FieldByName('ÏäºÅ').AsString;
Next;
end;
Close;sql.Clear;
sql.Add('select c.ÏäºÅ,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY C.ÏäºÅ ');
Open;
if (not IsEmpty) then begin
First;
while not eof do begin
if t_op_ctn.Locate('ÏäºÅ',fieldbyname('ÏäºÅ').AsString,[]) then begin
if t_op_ctn.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+' ¼þÊý:'+FieldByName('¼þÊý').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'¼þÊý:'+FieldByName('¼þÊý').AsString;
if t_op_ctn.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
if t_op_ctn.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString;
end else begin
if s='' then s:='Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
Next;
end;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
if aAdoQuery.Locate('ÏäºÅ',t_op_ctn.fieldbyname('ÏäºÅ').AsString,[]) then begin
end else begin
if s='' then s:='·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
t_op_ctn.Next;
end;
end;
end else begin
aAdoQuery2.Close;
aAdoQuery2.SQL.Clear;
aAdoQuery2.SQL.add('SELECT * from t_op_ctn_edi where ±àºÅ in (select top 1 ±àºÅ from t_op_seae_edi where ISNULL(·ÖÌáµ¥ºÅ,'''')='''' and Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' ');
aAdoQuery2.SQL.add(' and ´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' )');
aAdoQuery2.Open;
Close;sql.Clear;
sql.Add('select c.ÏäºÅ,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY C.ÏäºÅ ');
Open;
if (not IsEmpty) then begin
First;
while not eof do begin
if aAdoQuery2.Locate('ÏäºÅ',fieldbyname('ÏäºÅ').AsString,[]) then begin
if aAdoQuery2.FieldByName('¼þÊý').AsInteger<>FieldByName('¼þÊý').AsInteger then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+' ¼þÊý:'+FieldByName('¼þÊý').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'¼þÊý:'+FieldByName('¼þÊý').AsString;
if aAdoQuery2.FieldByName('ÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'ÖØÁ¿:'+FieldByName('ÖØÁ¿').AsString;
if aAdoQuery2.FieldByName('³ßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat then
if s='' then s:='Ö÷·Öµ¥²»Ò»ÖÂÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString else s:=s+#13#10+'Ö÷·Öµ¥ÏäºÅ:'+fieldbyname('ÏäºÅ').AsString+'³ßÂë:'+FieldByName('³ßÂë').AsString;
end else begin
if s='' then s:='Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'Ö÷µ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
Next;
end;
end;
aAdoQuery2.First;
while not aAdoQuery2.Eof do begin
if aAdoQuery.Locate('ÏäºÅ',aAdoQuery2.fieldbyname('ÏäºÅ').AsString,[]) then begin
end else begin
if s='' then s:='·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString
else s:=s+#13#10+'·Öµ¥²»´æÔÚÏäºÅ:'+FieldByName('ÏäºÅ').AsString;
end;
aAdoQuery2.Next;
end;
Close;sql.Clear;
sql.Add('select b.·ÖÌáµ¥ºÅ,b.¼þÊý ×ܼþÊý,b.ÖØÁ¿ ×ÜÖØÁ¿,b.³ßÂë ×ܳßÂë,sum(c.¼þÊý) ¼þÊý,sum(c.ÖØÁ¿) ÖØÁ¿,sum(c.³ßÂë) ³ßÂë from t_op_seae_edi b left join t_op_ctn_edi c on (c.±àºÅ=b.±àºÅ) where ISNULL(b.·ÖÌáµ¥ºÅ,'''')<>'''' ');
sql.Add(' AND b.Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' and b.´¬Ãû='''+t_op_seae.fieldbyname('´¬Ãû').AsString+''' and b.º½´Î='''+t_op_seae.fieldbyname('º½´Î').AsString+''' ');
sql.Add(' GROUP BY b.·ÖÌáµ¥ºÅ,b.¼þÊý,b.ÖØÁ¿,b.³ßÂë ');
Open;
First;
while not eof do begin
if (FieldByName('×ܼþÊý').AsInteger<>FieldByName('¼þÊý').AsInteger) then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܼþÊýºÍ¼¯×°ÏäÃ÷ϸ¼þÊýºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܼþÊýºÍ¼¯×°ÏäÃ÷ϸ¼þÊýºÏ¼Æ²»Ò»Ö£¡'
end;
if (FieldByName('×ÜÖØÁ¿').AsFloat<>FieldByName('ÖØÁ¿').AsFloat)
then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ÜÖØÁ¿ºÍ¼¯×°ÏäÃ÷ϸÖØÁ¿ºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ÜÖØÁ¿ºÍ¼¯×°ÏäÃ÷ϸÖØÁ¿ºÏ¼Æ²»Ò»Ö£¡'
end;
if (FieldByName('×ܳßÂë').AsFloat<>FieldByName('³ßÂë').AsFloat) then begin
if s='' then s:='·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܳßÂëºÍ¼¯×°ÏäÃ÷ϸ³ßÂëºÏ¼Æ²»Ò»Ö£¡'
else s:=s+#13#10+'·Öµ¥:'+FieldByName('·ÖÌáµ¥ºÅ').AsString+' ×ܳßÂëºÍ¼¯×°ÏäÃ÷ϸ³ßÂëºÏ¼Æ²»Ò»Ö£¡'
end;
Next;
end;
end;
Close;sql.Clear;
sql.Add('select * ');
sql.Add('from t_op_ctn_edi');
sql.Add('where 񅧏=:񅧏');
Parameters.ParamByName('񅧏').Value:=t_op_seae.FieldByName('񅧏').AsString;
Open;First;
while not Eof do
begin
if (not frm_data_share.t_code_ctn.Locate('±íÏÖÐÎʽ',FieldByName('±íÏÖÐÎʽ').AsString,[])) then begin
if s='' then s:='ÏäºÅ'+FieldByName('ÏäºÅ').AsString+',ÏäÐÍÔÚϵͳÖв»´æÔÚ,Çë¼ì²é£¡'
else s:=s+#13#10+'ÏäºÅ'+FieldByName('ÏäºÅ').AsString+',ÏäÐÍÔÚϵͳÖв»´æÔÚ,Çë¼ì²é£¡';
end;
Next;
end;
finally
FreeAndNil(aAdoQuery);
FreeAndNil(aAdoQuery2);
end;
iscon:=true;
if (s<>'') then begin
iscon:=False;
try
frm_sys_messagedlg:=tfrm_sys_messagedlg.Create (application);
frm_sys_messagedlg.msg:=s;
iscon:=frm_sys_messagedlg.ShowModal=mrOk;
finally
frm_sys_messagedlg.Free;
frm_sys_messagedlg:=nil;
end;
// if MessageDlg(s+',ÊÇ·ñ¼ÌÐø£¿',mtWarning,mbOKCancel,0)<>mrok then exit;
end;
if (not iscon) then exit;
if t_op_seae.IsEmpty then
exit;
if (Pos('DESCRIPTION',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[DESCRIPTION],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐøÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
if (Pos('LIST',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[LIST],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐøÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
if (Pos('N/M',t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê[N/M],ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐøÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
t_code_goods_not.First;
while not t_code_goods_not.Eof do begin
if (Pos(t_code_goods_not.fieldbyname('»õÎïÃû³Æ').AsString,t_op_seae.FieldByName('»õÎïÃèÊö').AsString)>0) then begin
if MessageDlg('»õÎïÃèÊöÖаüº¬ÌØÊâµ¥´Ê'+t_code_goods_not.fieldbyname('»õÎïÃû³Æ').AsString+',ÇëÓë¿Í»§È·ÈÏÆ·ÃûÊÇ·ñÕýÈ·,ȷʵ¼ÌÐø·¢ËÍÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then exit;
end;
t_code_goods_not.Next;
end;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
updatelr;
end;
procedure Tfrm_op_seae_edi_data.N8Click(Sender: TObject);
begin
try
if not assigned(frm_op_seae_edi_custom_lhcd) then
frm_op_seae_edi_custom_lhcd:=tfrm_op_seae_edi_custom_lhcd.Create(application);
frm_op_seae_edi_custom_lhcd.ShowModal;
finally
frm_op_seae_edi_custom_lhcd.free;
frm_op_seae_edi_custom_lhcd:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.GetDuiBiStr;
var
aQuery,aQuery2:TADOQuery;
cntrstr:string;
begin
Memo2.Lines.Clear;
if (Notebook1.PageIndex=0) then Exit;
aQuery:=CreateAdoQuery;
aQuery2:=CreateAdoQuery;
try
With aQuery do begin
close;sql.Clear;
SQL.Add('select * from t_op_seae_edi where Ö÷Ìáµ¥ºÅ='''+t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').AsString+''' ');
if (t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').AsString='') then
SQL.Add(' and (·ÖÌáµ¥ºÅ='''' or ·ÖÌáµ¥ºÅ is null) ')
else
SQL.Add(' and ·ÖÌáµ¥ºÅ='''+t_op_seae.fieldbyname('·ÖÌáµ¥ºÅ').AsString+'''');
SQL.Add(' and ±àºÅ<>'''+t_op_seae.fieldbyname('±àºÅ').AsString+''' and ¼ÈëÈÕÆÚ<='''+t_op_seae.fieldbyname('¼ÈëÈÕÆÚ').AsString+''' order by ¼ÈëÈÕÆÚ desc');
Open;
if (not IsEmpty) then begin
if FieldByName('´¬Ãû').AsString<>t_op_seae.FieldByName('´¬Ãû').AsString then
Memo2.Lines.Add('´¬Ãû');
if FieldByName('º½´Î').AsString<>t_op_seae.FieldByName('º½´Î').AsString then
Memo2.Lines.Add('º½´Î');
if FieldByName('·¢»õÈËÃû³Æ').AsString<>t_op_seae.FieldByName('·¢»õÈËÃû³Æ').AsString then
Memo2.Lines.Add('·¢»õÈËÃû³Æ');
if FieldByName('·¢»õÈ˵ØÖ·1').AsString<>t_op_seae.FieldByName('·¢»õÈ˵ØÖ·1').AsString then
Memo2.Lines.Add('·¢»õÈ˵ØÖ·');
if FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString<>t_op_seae.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString then
Memo2.Lines.Add('·¢»õÈ˹ú¼Ò´úÂë');
if FieldByName('·¢»õÈ˵绰').AsString<>t_op_seae.FieldByName('·¢»õÈ˵绰').AsString then
Memo2.Lines.Add('·¢»õÈ˵绰');
if FieldByName('ÊÕ»õÈËÃû³Æ').AsString<>t_op_seae.FieldByName('ÊÕ»õÈËÃû³Æ').AsString then
Memo2.Lines.Add('ÊÕ»õÈËÃû³Æ');
if FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString<>t_op_seae.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString then
Memo2.Lines.Add('ÊÕ»õÈ˵ØÖ·');
if FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString<>t_op_seae.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString then
Memo2.Lines.Add('ÊÕ»õÈ˹ú¼Ò´úÂë');
if FieldByName('֪ͨÈËÃû³Æ').AsString<>t_op_seae.FieldByName('֪ͨÈËÃû³Æ').AsString then
Memo2.Lines.Add('֪ͨÈËÃû³Æ');
if FieldByName('֪ͨÈ˵绰').AsString<>t_op_seae.FieldByName('֪ͨÈ˵绰').AsString then
Memo2.Lines.Add('֪ͨÈ˵绰');
if FieldByName('֪ͨÈ˵ØÖ·1').AsString<>t_op_seae.FieldByName('֪ͨÈ˵ØÖ·1').AsString then
Memo2.Lines.Add('֪ͨÈ˵ØÖ·');
if FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString<>t_op_seae.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString then
Memo2.Lines.Add('֪ͨÈ˹ú¼Ò´úÂë');
if FieldByName('ж»õ¸Û').AsString<>t_op_seae.FieldByName('ж»õ¸Û').AsString then
Memo2.Lines.Add('ж»õ¸Û');
if FieldByName('Ä¿µÄµØ').AsString<>t_op_seae.FieldByName('Ä¿µÄµØ').AsString then
Memo2.Lines.Add('Ä¿µÄµØ');
if FieldByName('°ü×°').AsString<>t_op_seae.FieldByName('°ü×°').AsString then
Memo2.Lines.Add('°ü×°');
if FieldByName('ßéÍ·').AsString<>t_op_seae.FieldByName('ßéÍ·').AsString then
Memo2.Lines.Add('ßéÍ·');
if FieldByName('»õÎïÃèÊö').AsString<>t_op_seae.FieldByName('»õÎïÃèÊö').AsString then
Memo2.Lines.Add('»õÎïÃèÊö');
if FieldByName('¿ª´¬ÈÕÆÚ').AsString<>t_op_seae.FieldByName('¿ª´¬ÈÕÆÚ').AsString then
Memo2.Lines.Add('¿ª´¬ÈÕÆÚ');
if FieldByName('¼¯×°Ïä').AsString<>t_op_seae.FieldByName('¼¯×°Ïä').AsString then
Memo2.Lines.Add('¼¯×°Ïä');
aQuery2.Close;aQuery2.SQL.Clear;
aQuery2.SQL.Add('select * from t_op_ctn_edi where ±àºÅ='''+aQuery.fieldbyname('±àºÅ').AsString+''' order by ´úÂë');
aQuery2.Open;
t_op_ctn.First;
while not t_op_ctn.Eof do begin
cntrstr:='';
if not (aQuery2.Locate('ÏäºÅ',t_op_ctn.fieldbyname('ÏäºÅ').AsString,[])) then
cntrstr:='ÏäºÅ:'+t_op_ctn.fieldbyname('ÏäºÅ').AsString
else begin
if aQuery2.FieldByName('·âºÅ').AsString<>t_op_ctn.fieldbyname('·âºÅ').AsString then
cntrstr:=cntrstr+',·âºÅ';
if aQuery2.FieldByName('ÏäÐÍ').AsString<>t_op_ctn.fieldbyname('ÏäÐÍ').AsString then
cntrstr:=cntrstr+',ÏäÐÍ';
if aQuery2.FieldByName('¼þÊý').AsString<>t_op_ctn.fieldbyname('¼þÊý').AsString then
cntrstr:=cntrstr+',¼þÊý';
if aQuery2.FieldByName('ÖØÁ¿').AsString<>t_op_ctn.fieldbyname('ÖØÁ¿').AsString then
cntrstr:=cntrstr+',ÖØÁ¿';
if aQuery2.FieldByName('³ßÂë').AsString<>t_op_ctn.fieldbyname('³ßÂë').AsString then
cntrstr:=cntrstr+',³ßÂë';
end;
if (cntrstr<>'') then Memo2.Lines.Add('ÏäºÅ:'+t_op_ctn.fieldbyname('ÏäºÅ').AsString+cntrstr);
t_op_ctn.Next;
end;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_seae_edi_data.t_op_seaeAfterPost(DataSet: TDataSet);
begin
// GetDuiBiStr;
end;
procedure Tfrm_op_seae_edi_data.Button1Click(Sender: TObject);
begin
GetDuiBiStr;
end;
function Tfrm_op_seae_edi_data.get_edi_id: string;
var
code:string;
begin
frm_data_share.p_edi_id.ExecProc;
result:=frm_data_share.p_edi_id.Parameters.ParamByName('str').value;
end;
procedure Tfrm_op_seae_edi_data.e1Click(Sender: TObject);
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr:string;
begin
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(Application.ExeName)+'eº½ÎÞÓÇ.xlsx'+'"'+')]');
excel2.putstr(3,2,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
if (code_e_carrier.Locate('´¬¹«Ë¾',aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString,[])) then
excel2.putstr(3,4,code_e_carrier.FieldByName('Eº½´¬¹«Ë¾').AsString);
excel2.putstr(3,6,aAdoQuery.FieldByName('´¬Ãû').AsString);
excel2.putstr(4,2,aAdoQuery.FieldByName('º½´Î').AsString);
excel2.putstr(4,4,aAdoQuery.FieldByName('´¬´ú').AsString);
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
excel2.putstr(4,6,'ΣÏÕÆ·')
else if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='R') then
excel2.putstr(4,6,'À䶳Ʒ')
else excel2.putstr(4,6,'ÆÕͨ»õÎï');
excel2.putstr(5,6,aAdoQuery.FieldByName('×°»õ¸Û').AsString);
excel2.putstr(5,8,aAdoQuery.FieldByName('×°¸Û´úÂë').AsString);
excel2.putstr(6,2,aAdoQuery.FieldByName('Ä¿µÄµØ').AsString);
excel2.putstr(6,4,aAdoQuery.FieldByName('Ä¿µÄ´úÂë').AsString);
excel2.putstr(6,6,aAdoQuery.FieldByName('ж»õ¸Û').AsString);
excel2.putstr(6,8,aAdoQuery.FieldByName('ж»õ´úÂë').AsString);
excel2.putstr(3,11,aAdoQuery.FieldByName('ÉèÖÃζÈ').AsString);
excel2.putstr(5,11,aAdoQuery.FieldByName('Àä²Øͨ·çÁ¿').AsString);
excel2.putstr(8,2,aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString);
excel2.putstr(9,2,aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString);
excel2.putstr(12,2,aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString);
excel2.putstr(8,6,aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString);
excel2.putstr(9,6,aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString);
excel2.putstr(10,6,aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(11,6,aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString);
excel2.putstr(8,11,aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString);
excel2.putstr(9,11,aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString);
excel2.putstr(10,11,aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString);
excel2.putstr(11,11,aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString);
j:=15;
First;
while not eof do begin
excel2.putstr(j,1,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
excel2.putstr(j,2,aAdoQuery.FieldByName('ÏäºÅ').AsString);
excel2.putstr(j,3,aAdoQuery.FieldByName('·âºÅ').AsString);
excel2.putstr(j,4,aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString);
excel2.putstr(j,5,aAdoQuery.FieldByName('»õÎïÃèÊö').AsString);
excel2.putstr(j,8,aAdoQuery.FieldByName('ÔËÊ䷽ʽ').AsString);
excel2.putstr(j,9,aAdoQuery.FieldByName('¼þÊý').AsString);
excel2.putstr(j,10,aAdoQuery.FieldByName('°ü×°').AsString);
excel2.putstr(j,11,aAdoQuery.FieldByName('ÖØÁ¿').AsString);
excel2.putstr(j,12,aAdoQuery.FieldByName('³ßÂë').AsString);
excel2.putstr(j,13,aAdoQuery.FieldByName('ßéÍ·_1').AsString);
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then begin
excel2.putstr(j,14,aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString);
excel2.putstr(j,15,aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString);
excel2.putstr(j,16,aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString);
excel2.putstr(j,17,aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsString);
end;
j:=j+1;
Next;
end;
SaveDialog.Filter := '(*.xlsx)|*.xlsx';
SaveDialog.FileName := aAdoQuery.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'.xlsx';
if SaveDialog.Execute then
begin
excel2.Exec('[SAVE.AS("'+SaveDialog.FileName+'";1;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
// excel2.Exec('[open("'+SaveDialog.FileName+'")]');
// excel2.Exec('[APP.maxIMIZE()]'); //×î´ó»¯excel
end;
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.N32Click(Sender: TObject);
begin
try
frm_code_zy_cust:=Tfrm_code_zy_cust.Create (self);
frm_code_zy_cust.ShowModal;
finally
frm_code_zy_cust.Free;
end;
end;
procedure Tfrm_op_seae_edi_data.N39Click(Sender: TObject);
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,ScriptPath,str_file,strall,fileallname,zhusername,zhpassword,zhcorpcode:string;
ExcelEXP: TExcel;
xlstest, thesheet:Variant;
inifile1:TIniFile;
senddgdata:TSendDGData;
begin
if MessageDlg('È·¶¨Òª<<ÖкÍ˳µÂ>>Ñ¡ÖеÄÒµÎñÊý¾ÝÂð£¿',mtWarning,[mbyes,mbno],0)<>mryes then begin
Exit;
end;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
zhusername:= inifile1.ReadString('customZHSD', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customZHSD', 'WEBPASSOWRD', '');
zhcorpcode:= inifile1.ReadString('customZHSD', 'WEBCUSTNAME', '');
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if t_op_seae.IsEmpty then Exit;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if (t_op_seae.FieldByName('´¬¹«Ë¾´úÂë').AsString='') then begin
ShowMessage('´¬¹«Ë¾´úÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
end;
end else begin
if (t_op_seae.FieldByName('´¬¹«Ë¾´úÂë').AsString='') then begin
ShowMessage('´¬¹«Ë¾´úÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
end;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=2;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHSD.xlsx');
thesheet:= xlstest.Workbooks[1].Worksheets['sheet1'];
First;
while not eof do begin
thesheet.cells.item[j,1]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,2]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,4]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,5]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,6]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,7]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,8]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,9]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
thesheet.cells.item[j,10]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,11]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,14]:=aAdoQuery.FieldByName('·ÖÌáµ¥ºÅ').AsString;
thesheet.cells.item[j,15]:=aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString;
thesheet.cells.item[j,16]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,17]:=''''+aAdoQuery.FieldByName('·âºÅ').AsString;
thesheet.cells.item[j,18]:=GetCtnMSCCodeCode(aAdoQuery.FieldByName('±íÏÖÐÎʽ').AsString);
thesheet.cells.item[j,19]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,20]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,21]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,22]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsString;
thesheet.cells.item[j,23]:=aAdoQuery.FieldByName('ßéÍ·_1').AsString;
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
thesheet.cells.item[j,24]:='ΣÏÕÆ·'
else if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='R') then
thesheet.cells.item[j,24]:='¶³¹ñ'
else thesheet.cells.item[j,24]:='ÆÕͨ»õ';
thesheet.cells.item[j,25]:=aAdoQuery.FieldByName('°ü×°').AsString;
thesheet.cells.item[j,26]:=aAdoQuery.FieldByName('´¬Ãû').AsString;
thesheet.cells.item[j,27]:=aAdoQuery.FieldByName('º½´Î').AsString;
thesheet.cells.item[j,28]:=aAdoQuery.FieldByName('ж»õ´úÂë').AsString;
thesheet.cells.item[j,29]:=aAdoQuery.FieldByName('Ä¿µÄ´úÂë').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('ÉèÖÃζÈ').AsString;
thesheet.cells.item[j,31]:=aAdoQuery.FieldByName('Àä²Øͨ·çÁ¿').AsString;
thesheet.cells.item[j,32]:=aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString;
thesheet.cells.item[j,33]:=aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString;
thesheet.cells.item[j,34]:=aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString;
thesheet.cells.item[j,35]:=aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsString;
j:=j+1;
Next;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+'.xlsx';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(ScriptPath+str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHSD.xlsx');
xlstest.Quit;
xlstest:=UnAssigned;
Sleep(1000);
senddgdata.dgConPerson:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·ÁªÏµÈË').asstring;
senddgdata.dgTel:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·µç»°').asstring;
senddgdata.dgClass:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring;
senddgdata.temperature:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring;
senddgdata.temUnit:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ζȵ¥Î»').asstring;
senddgdata.humidity:='';
senddgdata.vent:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring;
senddgdata.dgNo:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring;
TDsThread.create(str_file,'ZGL',ScriptPath,zhusername,zhpassword,senddgdata,zhcorpcode);
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.NZHZFClick(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
try
if not assigned(frm_op_seae_edi_custom_zHzf) then
frm_op_seae_edi_custom_zHzf:=tfrm_op_seae_edi_custom_zHzf.Create(application);
frm_op_seae_edi_custom_zHzf.ShowModal;
finally
frm_op_seae_edi_custom_zHzf.free;
frm_op_seae_edi_custom_zHzf:=nil;
end;
end;
procedure Tfrm_op_seae_edi_data.Sendzhzf;
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,zhusername,zhpassword,ScriptPath,str_file:string;
inifile1:TIniFile;
senddgdata:TSendDGData;
xlstest, thesheet:Variant;
begin
if t_op_seae.IsEmpty then Exit;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
zhusername:= inifile1.ReadString('customZHZF', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customZHZF', 'WEBPASSOWRD', '');
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=6;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHENHUA.xls');
thesheet:= xlstest.Workbooks[1].Worksheets['ZHENHUA MANIFEST'];
thesheet.cells.item[2,1]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
{
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(Application.ExeName)+'ZHENHUA.xls'+'"'+')]');
excel2.putstr(2,1,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
}
First;
while not eof do begin
thesheet.cells.item[j,1]:=aAdoQuery.FieldByName('´¬Ãû').AsString;
thesheet.cells.item[j,2]:=aAdoQuery.FieldByName('º½´Î').AsString;
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString;
thesheet.cells.item[j,4]:='';
thesheet.cells.item[j,5]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,6]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,7]:=aAdoQuery.FieldByName('·âºÅ').AsString;
poststr:=aAdoQuery.FieldByName('×°»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
thesheet.cells.item[j,8]:=poststr;
poststr:=aAdoQuery.FieldByName('ж»õ¸Û').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
thesheet.cells.item[j,10]:=poststr;
poststr:=aAdoQuery.FieldByName('Ä¿µÄµØ').AsString;
if Pos(',',poststr)>0 then poststr:=Copy(poststr,1,Pos(',',poststr)-1);
thesheet.cells.item[j,11]:=poststr;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('°ü×°').AsString;
thesheet.cells.item[j,14]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,15]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,16]:=aAdoQuery.FieldByName('³ß´ç').AsString+aAdoQuery.FieldByName('ÏäÐÍ').AsString;
thesheet.cells.item[j,17]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsStrinG;
thesheet.cells.item[j,18]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,19]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,20]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
if Pos('COLLECT',aAdoQuery.FieldByName('¸¶·Ñ·½Ê½').AsString)>0 THEN
thesheet.cells.item[j,21]:='COLLECT'
else thesheet.cells.item[j,21]:='PREPAID';
thesheet.cells.item[j,22]:=aAdoQuery.FieldByName('ßéÍ·_1').AsString;
thesheet.cells.item[j,24]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,25]:='';
thesheet.cells.item[j,26]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,27]:='TE';
thesheet.cells.item[j,28]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,31]:='';
thesheet.cells.item[j,32]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,33]:='TE';
thesheet.cells.item[j,34]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,36]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,37]:='';
thesheet.cells.item[j,38]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,39]:='TE';
thesheet.cells.item[j,40]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
if (aAdoQuery.FieldByName('»õÎï±êʶ').AsString='D') then
thesheet.cells.item[j,42]:='ÊÇ'
else thesheet.cells.item[j,42]:='·ñ';
thesheet.cells.item[j,43]:=aAdoQuery.FieldByName('ΣÏÕÆ·±àºÅ').AsString;
thesheet.cells.item[j,44]:=aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsString;
thesheet.cells.item[j,45]:=aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsString;
thesheet.cells.item[j,46]:=aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsString;
j:=j+1;
Next;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+'.xls';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(ScriptPath+str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHENHUA.xls');
xlstest.Quit;
xlstest:=UnAssigned;
Sleep(1000);
senddgdata.dgConPerson:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·ÁªÏµÈË').asstring;
senddgdata.dgTel:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·µç»°').asstring;
senddgdata.dgClass:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring;
senddgdata.temperature:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring;
senddgdata.temUnit:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ζȵ¥Î»').asstring;
senddgdata.humidity:='';
senddgdata.vent:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring;
senddgdata.dgNo:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring;
TDsThread.create(str_file,'ylw',ScriptPath,zhusername,zhpassword,senddgdata);
{
SaveDialog.Filter := '(*.xls)|*.xls';
SaveDialog.FileName := aAdoQuery.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring+'.xls';
if SaveDialog.Execute then
begin
excel2.Exec('[SAVE.AS("'+SaveDialog.FileName+'";1;"";false;"";false)]');
excel2.Exec('[CLOSE(false)]');
end;
}
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.Sendzczf;
var
i,j:integer;
str:widestring;
aAdoQuery:TAdoQuery;
aDataSource:TDataSource;
poststr,zhusername,zhpassword,ScriptPath,str_file:string;
inifile1:TIniFile;
senddgdata:TSendDGData;
xlstest, thesheet:Variant;
begin
if t_op_seae.IsEmpty then Exit;
inifile1 := Tinifile.Create(ExtractFilePath(application.ExeName) + 'main.ini');
zhusername:= inifile1.ReadString('customZCZF', 'WEBUSERNAME', '');
zhpassword:= inifile1.ReadString('customZCZF', 'WEBPASSOWRD', '');
if zhusername='' then begin
ShowMessage('·¢ËÍÓû§ÃûºÍÃÜÂë²»ÄÜΪ¿Õ£¡');
Exit;
end;
if dxDBGrid1.SelectedCount>0 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if i=0 then
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
t_op_seae.Edit;
t_op_seae.FieldByName('EDI״̬').AsString:='ÒÑ·¢ËÍ';
t_op_seae.Post;
end;
end else begin
str:='('+''''+t_op_seae.fieldbyname('񅧏').asstring+'''';
end;
str:=str+')';
aDataSource:=TDataSource.Create(nil);
aAdoQuery:=CreateAdoQuery;
aDataSource.DataSet:=aAdoQuery;
with aAdoQuery do
try
close;
sql.clear;
sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.񅧏=t_op_seae_edi.񅧏 '
+' where t_op_ctn_edi.񅧏 in '+str
+' order by t_op_ctn_edi.񅧏');
open;
j:=2;
try
xlstest:=CreateOleObject('Excel.Application');
except
Try //¶àÓÃÒ»¸öTry..FinallyÊÇ·ÀÖ¹ÔÚ¶Áдµ¥Ôª¸ñ¹ý³ÌÖгö´í£¬Í˳öʱ¿ÉÄÜûÓÐÊÍ·ÅExcel£¬Ôì³ÉÄڴ橶´
xlstest.ActiveWorkBook.Saved := True;
xlstest.Quit;
Finally
xlstest:=UnAssigned;
End;
Exit;
end;
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHONGCHUANG.xls');
thesheet:= xlstest.Workbooks[1].Worksheets['Sheet1'];
{
excel2.Connect;
Excel2.Exec('[open('+'"'+ExtractFilePath(Application.ExeName)+'ZHENHUA.xls'+'"'+')]');
excel2.putstr(2,1,aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString);
}
First;
while not eof do begin
thesheet.cells.item[j,2]:=aAdoQuery.FieldByName('Ö÷Ìáµ¥ºÅ').AsString;
thesheet.cells.item[j,3]:=aAdoQuery.FieldByName('ÏäºÅ').AsString;
thesheet.cells.item[j,4]:=aAdoQuery.FieldByName('·âºÅ').AsString;
thesheet.cells.item[j,5]:=aAdoQuery.FieldByName('³ß´ç').AsString;
thesheet.cells.item[j,6]:=aAdoQuery.FieldByName('ÏäÐÍ').AsString;
thesheet.cells.item[j,7]:=aAdoQuery.FieldByName('´¬¹«Ë¾´úÂë').AsString;
thesheet.cells.item[j,8]:='F';
thesheet.cells.item[j,10]:=aAdoQuery.FieldByName('¼þÊý').AsString;
thesheet.cells.item[j,11]:=aAdoQuery.FieldByName('°ü×°').AsString;
thesheet.cells.item[j,12]:=aAdoQuery.FieldByName('ÖØÁ¿').AsString;
thesheet.cells.item[j,13]:=aAdoQuery.FieldByName('³ßÂë').AsString;
thesheet.cells.item[j,14]:=aAdoQuery.FieldByName('·¢»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,15]:=aAdoQuery.FieldByName('·¢»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,16]:=aAdoQuery.FieldByName('·¢»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,18]:='TE';
thesheet.cells.item[j,19]:=aAdoQuery.FieldByName('·¢»õÈ˵绰').AsString;
thesheet.cells.item[j,21]:=aAdoQuery.FieldByName('ÊÕ»õÈËÃû³Æ').AsString;
thesheet.cells.item[j,22]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,23]:=aAdoQuery.FieldByName('ÊÕ»õÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,24]:='';
thesheet.cells.item[j,25]:='TE';
thesheet.cells.item[j,26]:=aAdoQuery.FieldByName('ÊÕ»õÈ˵绰').AsString;
thesheet.cells.item[j,27]:='';
thesheet.cells.item[j,28]:=aAdoQuery.FieldByName('֪ͨÈËÃû³Æ').AsString;
thesheet.cells.item[j,29]:=aAdoQuery.FieldByName('֪ͨÈ˵ØÖ·1').AsString;
thesheet.cells.item[j,30]:=aAdoQuery.FieldByName('֪ͨÈ˹ú¼Ò´úÂë').AsString;
thesheet.cells.item[j,31]:='';
thesheet.cells.item[j,32]:='TE';
thesheet.cells.item[j,33]:=aAdoQuery.FieldByName('֪ͨÈ˵绰').AsString;
thesheet.cells.item[j,34]:=aAdoQuery.FieldByName('×°¸Û´úÂë').AsString;
thesheet.cells.item[j,35]:='';
thesheet.cells.item[j,36]:=aAdoQuery.FieldByName('ж»õ´úÂë').AsString;
thesheet.cells.item[j,37]:=aAdoQuery.FieldByName('Ä¿µÄ´úÂë').AsString;
thesheet.cells.item[j,38]:=aAdoQuery.FieldByName('¸¶·Ñ·½Ê½').AsString;
thesheet.cells.item[j,39]:=aAdoQuery.FieldByName('ÔËÊäÌõ¿î').AsString;
thesheet.cells.item[j,40]:=aAdoQuery.FieldByName('ßéÍ·_1').AsString;
thesheet.cells.item[j,41]:=aAdoQuery.FieldByName('»õÎïÃèÊö').AsStrinG;
thesheet.cells.item[j,42]:=aAdoQuery.FieldByName('ΣÏÕÆ·ÁªÏµÈË').AsStrinG;
thesheet.cells.item[j,43]:=aAdoQuery.FieldByName('ΣÏÕÆ·µç»°').AsStrinG;
thesheet.cells.item[j,44]:=aAdoQuery.FieldByName('ΣÏÕÆ··ÖÀà').AsStrinG;
thesheet.cells.item[j,45]:=aAdoQuery.FieldByName('ÔËÊ䷽ʽ').AsStrinG;
thesheet.cells.item[j,46]:=aAdoQuery.FieldByName('´¬Ãû').AsString;
thesheet.cells.item[j,47]:=aAdoQuery.FieldByName('º½´Î').AsString;
j:=j+1;
Next;
end;
ScriptPath:=ExtractFilePath(ParamStr(0))+'TMPEXCEL\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
str_file:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Ö÷Ìáµ¥ºÅ').asstring
+'.xls';
xlstest.DisplayAlerts:=false;
xlstest.ActiveWorkBook.SaveAs(ScriptPath+str_file);
xlstest.WorkBooks.Open(ExtractFilePath(Paramstr(0))+'ZHONGCHUANG.xls');
xlstest.Quit;
xlstest:=UnAssigned;
Sleep(1000);
senddgdata.dgConPerson:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·ÁªÏµÈË').asstring;
senddgdata.dgTel:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·µç»°').asstring;
senddgdata.dgClass:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ··ÖÀà').asstring;
senddgdata.temperature:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ÉèÖÃζÈ').asstring;
senddgdata.temUnit:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ζȵ¥Î»').asstring;
senddgdata.humidity:='';
senddgdata.vent:=frm_op_seae_edi_data.t_op_seae.fieldbyname('Àä²Øͨ·çÁ¿').asstring;
senddgdata.dgNo:=frm_op_seae_edi_data.t_op_seae.fieldbyname('ΣÏÕÆ·±àºÅ').asstring;
TDsThread.create(str_file,'ZC',ScriptPath,zhusername,zhpassword,senddgdata);
updatelr;
finally
aDataSource.Free;
Free;
end;
end;
procedure Tfrm_op_seae_edi_data.N40Click(Sender: TObject);
begin
if t_op_seae.isempty then
begin
showmessage('¶Ô²»Æð£¬Ã»ÓÐÊý¾ÝÐÅÏ¢£¬²»ÄÜÉú³ÉEDIÎļþ£¡');
exit;
end;
try
if not assigned(frm_op_seae_edi_custom_zczf) then
frm_op_seae_edi_custom_zczf:=tfrm_op_seae_edi_custom_zczf.Create(application);
frm_op_seae_edi_custom_zczf.ShowModal;
finally
frm_op_seae_edi_custom_zczf.free;
frm_op_seae_edi_custom_zczf:=nil;
end;
end;
end.