From 116dbc469185acb50515910cc453a0d3a83242fa Mon Sep 17 00:00:00 2001 From: hanxuntao Date: Tue, 19 Nov 2024 11:09:58 +0800 Subject: [PATCH] 1 --- .../Controllers/MsOpSeaeEdiController.cs | 5 + .../DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs | 10 +- .../MsOpSeaeEdiTemplateDAL.cs | 12 + .../MsOpSeaeEdiTemplateModel.cs | 3 + .../Views/MsOpSeaeEdi/ENSEdit.aspx | 60 + .../Viewsjs/MsOpSeaeEdi/ENSEdit.js | 22 + .../Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js | 2934 +++++++++++++++++ .../Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiIndex.js | 2 +- .../Controllers/PcHeadEdit_WFSDController.cs | 30 + .../TruckMng/Viewsjs/MsWlBs/MsPcHYRDEdit.js | 21 +- .../TruckMng/Viewsjs/MsWlBs/MsWlPcEdit.js | 4 +- DSWeb/DSWeb.csproj | 3 + JobSendAgentMail/JobSendAgentMail.csproj | 1 + JobSendAgentMail/JobSendArrivalNotice.cs | 195 ++ 14 files changed, 3284 insertions(+), 18 deletions(-) create mode 100644 DSWeb/Areas/MvcShipping/Views/MsOpSeaeEdi/ENSEdit.aspx create mode 100644 DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/ENSEdit.js create mode 100644 DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js create mode 100644 JobSendAgentMail/JobSendArrivalNotice.cs diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs index 19be4e87..8691b188 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs @@ -45,6 +45,11 @@ namespace DSWeb.MvcShipping.Controllers return View(); } + public ActionResult ENSEdit() + { + return View(); + } + public ActionResult CustomIndex() { return View(); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs index 41d1b3a5..0648c137 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs @@ -20386,15 +20386,15 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL { if (bill.HSCODE == null || bill.HSCODE == "") { error = error + "
HSCODE不能为空"; } - if (!string.IsNullOrEmpty(bill.MBLNO)) { - if (bill.MBLNO.Length > 10) { + //if (!string.IsNullOrEmpty(bill.MBLNO)) { + // if (bill.MBLNO.Length > 10) { - error = error + "
主提单号不允许超过10位"; + // error = error + "
主提单号不允许超过10位"; - } + // } - } + //} T_ALL_DA T_ALL_DA = new T_ALL_DA(); DataSet dsUserOp = T_ALL_DA.GetAllSQL("select top 1 * from [user] as u INNER JOIN user_baseinfo as b on u.GID=b.USERID where u.GID='" + userid + "'"); var sendno = dsUserOp.Tables[0].Rows[0]["EMAIL1"].ToString().Trim(); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateDAL.cs index c7a147dd..d7f2b5d8 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateDAL.cs @@ -84,6 +84,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate data.CODE = reader["CODE"].ToString(); data.TEL = reader["TEL"].ToString(); data.POSTCODE = reader["POSTCODE"].ToString(); + data.HOUSENO = reader["HOUSENO"].ToString(); + data.EORI = reader["EORI"].ToString(); + data.CORPTYPE = reader["CORPTYPE"].ToString(); data.ATTN = reader["ATTN"].ToString(); data.CreateTime = reader["CreateTime"].ToString(); data.DisplayName = data.TEMPLATENAME + "-" + data.NAME; @@ -162,6 +165,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate sbIns.Append("PROVINCE,"); sbIns.Append("CODETYPE,"); sbIns.Append("CODE,"); + sbIns.Append("HOUSENO,"); + sbIns.Append("EORI,"); + sbIns.Append("CORPTYPE,"); sbIns.Append("POSTCODE,"); sbIns.Append("ATTN,"); sbIns.Append("TEL"); @@ -181,6 +187,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate sbIns.Append("'" + et.PROVINCE + "',"); sbIns.Append("'" + et.CODETYPE + "',"); sbIns.Append("'" + et.CODE + "',"); + sbIns.Append("'" + et.HOUSENO + "',"); + sbIns.Append("'" + et.EORI + "',"); + sbIns.Append("'" + et.CORPTYPE + "',"); sbIns.Append("'" + et.POSTCODE + "',"); sbIns.Append("'" + et.ATTN + "',"); sbIns.Append("'" + et.TEL + "'"); @@ -221,6 +230,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate sbUpd.Append("PROVINCE='" + et.PROVINCE + "',"); sbUpd.Append("CODETYPE= '" + et.CODETYPE + "',"); sbUpd.Append("CODE= '" + et.CODE + "',"); + sbUpd.Append("HOUSENO='" + et.HOUSENO + "',"); + sbUpd.Append("EORI='" + et.EORI + "',"); + sbUpd.Append("CORPTYPE='" + et.CORPTYPE + "',"); sbUpd.Append("POSTCODE='" + et.POSTCODE + "',"); sbUpd.Append("ATTN='" + et.ATTN + "',"); sbUpd.Append("TEL= '" + et.TEL + "'"); diff --git a/DSWeb/Areas/MvcShipping/Models/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateModel.cs b/DSWeb/Areas/MvcShipping/Models/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateModel.cs index 4ec07c10..d457d396 100644 --- a/DSWeb/Areas/MvcShipping/Models/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateModel.cs +++ b/DSWeb/Areas/MvcShipping/Models/MsOpSeaeEdiTemplate/MsOpSeaeEdiTemplateModel.cs @@ -37,6 +37,9 @@ namespace DSWeb.Areas.MvcShipping.Models.MsOpSeaeEdiTemplate public string TEL { get; set; } public string POSTCODE { get; set; } + public string HOUSENO { get; set; } + public string EORI { get; set; } + public string CORPTYPE { get; set; } public string ATTN { get; set; } public string CreateTime { get; set; } public string DisplayName { get; set; } diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpSeaeEdi/ENSEdit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpSeaeEdi/ENSEdit.aspx new file mode 100644 index 00000000..9e68ad7d --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Views/MsOpSeaeEdi/ENSEdit.aspx @@ -0,0 +1,60 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/MvcShipping/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + + + + +<%-- +--%> + + + + + + + + + + + + + + + + + + + +
+
diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/ENSEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/ENSEdit.js new file mode 100644 index 00000000..0a741a47 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/ENSEdit.js @@ -0,0 +1,22 @@ + +Ext.BLANK_IMAGE_URL = '../../TruckMng/Content/Images/s.gif'; +var panelEdit = null; +Ext.onReady(function () { + Ext.QuickTips.init(); + Ext.form.Field.prototype.msgTarget = 'side'; + + panelEdit = Ext.create('Shipping.MsOpSeaeENSEdit', { + id:'OpSeaeEdiEdit', + layout: 'border', + region: 'center' }); + + + var view = new Ext.Viewport({ + layout: 'border', + renderTo: 'viewport', + border: false, + items: [ + panelEdit + ] + }); +}); \ No newline at end of file diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js new file mode 100644 index 00000000..adf29f58 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js @@ -0,0 +1,2934 @@ +Ext.namespace('Shipping'); + +Shipping.MsOpSeaeENSEdit = function (config) { + Ext.applyIf(this, config); + this.initUIComponents(); + window.Shipping.MsOpSeaeENSEdit.superclass.constructor.call(this); +}; +var _TempType = ''; +Ext.extend(Shipping.MsOpSeaeENSEdit, Ext.Panel, { + ParentWin: null, + OpStatus: 'add', + StoreList: null, + EditRecord: null, + Editdata: null, + isAudit: null, + accdate: null, + seaeop: "", + seaecustservice: "", + reason: "", + BillType: null, + OrType: null, + + initUIComponents: function () { + this.serialNo = 0; + //this.bodyDel = []; + this.itemindex = 1; + + + this.StoreCargoid = Ext.create('Ext.data.Store', { + fields: ['ID', 'NAME'] + }); + this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" }); + this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" }); + this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" }); + this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" }); + + + this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreCargoid, + fieldLabel: '货物标示', + forceSelection: true, + name: 'CARGOID', + valueField: 'ID', + displayField: 'NAME', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + if (combo.value == 'R') { + this.panelBodyDr.setVisible(false); + this.panelBodyRf.setVisible(true); + } else if (combo.value == 'D') { + this.panelBodyDr.setVisible(true); + this.panelBodyRf.setVisible(false); + } else { + this.panelBodyDr.setVisible(false); + this.panelBodyRf.setVisible(false); + } + + } + } + } + }); + + //键值维护表_装运方式 + + + + + //件数包装 + this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CodePackageModel', + proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } + }); + this.storeCodePackage.load(); + this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', { + store: this.storeCodePackage, + forceSelection: true, + name: 'KINDPKGS', + valueField: 'PKGS', + displayField: 'PKGS' + }); + + + + //件数包装_集装箱列表中的下拉框加载 + this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', { + //fieldLabel: '件数包装', + store: this.storeCodePackage, + forceSelection: true, + name: 'KINDPKGS', + valueField: 'PKGS', + displayField: 'PKGS' + }); + + + //箱型_集装箱列表中的下拉框加载 + this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CodeCtnModel', + proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } + }); + this.storeCodeCtn.load(); + this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', { + //fieldLabel: '箱型', + store: this.storeCodeCtn, + forceSelection: true, + name: 'CTNALL', + valueField: 'CTN', + displayField: 'CTN' + }); + + + + this.StoreEdiType = Ext.create('Ext.data.Store', { + fields: ['TYPE'] + }); + this.StoreEdiType.add({ "TYPE": "AFR" }); + this.StoreEdiType.add({ "TYPE": "AMR" }); + this.StoreEdiType.add({ "TYPE": "AMS" }); + this.StoreEdiType.add({ "TYPE": "ACI" }); + this.StoreEdiType.add({ "TYPE": "EMANIFEST" }); + this.StoreEdiType.add({ "TYPE": "ISF" }); + this.StoreEdiType.add({ "TYPE": "AMS,ISF" }); + this.StoreEdiType.add({ "TYPE": "AMS,ISF,ACI" }); + this.StoreEdiType.add({ "TYPE": "AMS,ACI" }); + + + + this.comboxEdiType = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreEdiType, + fieldLabel: 'EDI类型', + forceSelection: true, + name: 'EDITYPE', + valueField: 'TYPE', + displayField: 'TYPE' + }); + + this.StoreStatus = Ext.create('Ext.data.Store', { + fields: ['STATUS'] + }); + this.StoreStatus.add({ "STATUS": "未发送" }); + this.StoreStatus.add({ "STATUS": "已保存文件" }); + this.StoreStatus.add({ "STATUS": "已发送" }); + + + + this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreStatus, + fieldLabel: 'EDI状态', + forceSelection: true, + name: 'EDISTATUS', + valueField: 'STATUS', + displayField: 'STATUS' + }); + + this.StoreFileType = Ext.create('Ext.data.Store', { + fields: ['TYPE', 'NAME'] + }); + this.StoreFileType.add({ "TYPE": "Master", "NAME": "主单" }); + this.StoreFileType.add({ "TYPE": "House", "NAME": "分单" }); + //this.StoreFileType.add({ "TYPE": "Regular" }); + //this.StoreFileType.add({ "TYPE": "Empty" }); + //this.StoreFileType.add({ "TYPE": "FCR" }); + + + this.comboxFileType = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreFileType, + fieldLabel: '文件类型', + forceSelection: true, + name: 'FILETYPE', + valueField: 'TYPE', + displayField: 'NAME' + }); + + + + this.StorePKType = Ext.create('Ext.data.Store', { + fields: ['TYPE'] + }); + this.StorePKType.add({ "TYPE": "FCL" }); + this.StorePKType.add({ "TYPE": "LCL" }); + this.StorePKType.add({ "TYPE": "MASTER" }); + + this.comboxPKType = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StorePKType, + fieldLabel: '装运方式', + forceSelection: true, + name: 'PACKINGTYPE', + valueField: 'TYPE', + displayField: 'TYPE' + }); + + + + + + //#endregion + + + //#region 编辑formHead 基本信息 + this.formHead = Ext.widget('form', { + region: 'north', + frame: true, + bodyPadding: 5, + //collapsed: false, + //collapsible: true, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 90, + msgTarget: 'qtip' + }, + + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '业务编号', //'业务编号', + name: 'BSNO', hidden: true + }, { + fieldLabel: 'AMSNO', //'AMSNO', + name: 'AMSNO', hidden: true + }, { + xtype: 'checkboxfield', + boxLabel: '是否有货代单', + name: 'ISHAVEHBL', + inputValue: true, + checked: true + }, { + fieldLabel: '补充申报人EORI', //'AMS代码', + labelWidth: 120, + name: 'APPLICATIONEORI' + }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }] + } + + ]//end items(fieldset 1) + + }); //end this.formEdit + //#endregion + + + //#region 集装箱-数据集 + + + + + + + this.StoreCTNOWNER = Ext.create('Ext.data.Store', { + fields: ['TYPE'] + }); + this.StoreCTNOWNER.add({ "TYPE": "Shipper" }); + this.StoreCTNOWNER.add({ "TYPE": "Carrier" }); + this.StoreCTNOWNER.add({ "TYPE": "Consolidator" }); + this.StoreCTNOWNER.add({ "TYPE": "Deconsolidator" }); + this.StoreCTNOWNER.add({ "TYPE": "ThirdParty" }); + + + this.comboxCTNOWNER = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreCTNOWNER, + forceSelection: true, + name: 'CTNOWNER', + valueField: 'TYPE', + displayField: 'TYPE' + }); + + + this.storeBodyList = Ext.create('Ext.data.Store', { + model: 'MsSeaeEdiCtn', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsOpSeaeEdi/GetBodyList', + reader: { + id: 'MFNO,CTN_ID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //明细表表格 + this.gridListCtnCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + this.gridListCtn = new Ext.grid.GridPanel({ + store: this.storeBodyList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + plugins: [this.gridListCtnCellEditing], + selType: 'cellmodel', + + tbar: [{ + text: '增加明细', + tooltip: '增加明细', + id: "btnaddctndetail", + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddDetailClick(button, event); + }, + scope: this + }, '-', { + text: '删除明细', + tooltip: '删除明细', + id: "btndelctndetail", + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDelDetailClick(button, event); + }, + scope: this + }], + + columns: [{ + sortable: true, + dataIndex: 'CTN_ID', + header: '编号', + hidden: true, + width: 0 + }, { + sortable: true, + dataIndex: 'MFNO', + header: '业务编号', + hidden: true, + width: 0 + }, { + sortable: true, + dataIndex: 'CTNCODE', + header: '序号', + width: 30 + }, { + dataIndex: 'CTNALL', + header: '箱型', + width: 70, + editor: this.comboxCTNALL + }, { + dataIndex: 'CTNOWNER', + header: '箱所有者', + width: 100, + editor: this.comboxCTNOWNER + }, { + dataIndex: 'CNTRNO', + header: '箱号', + width: 120, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'SEALNO', + header: '封号', + width: 100, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'MARKS', + header: '唛头', + width: 150, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'DESCRIPTION', + header: '货物描述', + width: 150, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }] + }); + + this.gridListCtn.addListener('itemclick', function (dataview, record, item, index, e, b) { + this.formDescriptionEdit.getForm().findField('DESCRIPTION').setValue(record.data.DESCRIPTION); + _this.formDescriptionEdit.getForm().findField('CTN_ID').setDisabled(false); + this.formDescriptionEdit.getForm().findField('CTN_ID').setValue(record.data.CTN_ID); + _this.formDescriptionEdit.getForm().findField('CTN_ID').setDisabled(true); + }, this); + _this = this; + this.formDescriptionEdit = Ext.widget('form', { + title: '货物描述', + region: 'east', + width:220, + frame: true, + border: false, + trackResetOnLoad: true, + items: [{ + fieldLabel: 'GID', + name: 'GID', hidden: true + },{ + fieldLabel: 'CTN_ID', + xtype: 'textfield', + name: 'CTN_ID', hidden: true + }, { + xtype: 'textareafield', + grow: true, //字段是否自动伸展和收缩,默认为false + labelSeparator: '', //标签分隔字符 + name: 'DESCRIPTION', + height: 170, + anchor: '100%', + enableKeyEvents: true, //激活键盘事件 + listeners: { + scope: this, + 'blur': function blur(combo, eOpts, obj) { + _this.formDescriptionEdit.getForm().findField('CTN_ID').setDisabled(false); + var CTN_ID = _this.formDescriptionEdit.getForm().findField('CTN_ID').getValue(); + _this.formDescriptionEdit.getForm().findField('CTN_ID').setDisabled(true); + //var selections = this.gridList.getSelectionModel().getSelection(); + //if (selections.length > 0) { + // selections[0].set('DESCRIPTION', combo.value); + //} + for (i = 0; i < _this.storeBodyList.getCount(); i += 1) { + var memberyf = _this.storeBodyList.getAt(i); + if (memberyf.data.CTN_ID == CTN_ID) { + memberyf.data.DESCRIPTION = combo.value; + } + }; + + _this.formDescriptionEdit.getForm().findField('DESCRIPTION') + .setValue(combo.value.toUpperCase()); + } + // + } + }] + }); + + + //#endregion + + + this.panelBodyCtn = new Ext.Panel({ + title: '集装箱信息', + layout: "border", + // anchor:'50% 100%', + region: 'center', + frame: true, + items: [this.gridListCtn, this.formDescriptionEdit] + }); + + + //件数包装 + this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CodePackageModel', + proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } + }); + this.storeCodePackage.load(); + this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', { + store: this.storeCodePackage, + padding: '0 0 0 10', + forceSelection: true, + name: 'KINDPKGS', + valueField: 'PKGS', + displayField: 'PKGS' + }); + + + + this.comboxCTNID = Ext.create('DsExt.ux.RefTableCombox', { + //fieldLabel: '箱型', + store: this.storeBodyList, + forceSelection: true, + name: 'CTN_ID', + valueField: 'CTN_ID', + displayField: 'CNTRNO' + }); + + this.storeCargoList = Ext.create('Ext.data.Store', { + model: 'MsSeaeEdiCtnDetail', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsOpSeaeEdi/GetCargoList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //明细表表格 + this.gridListCargoCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + this.gridListCargo = new Ext.grid.GridPanel({ + store: this.storeCargoList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + plugins: [this.gridListCargoCellEditing], + selType: 'cellmodel', + + tbar: [{ + text: '增加明细', + tooltip: '增加明细', + id: "btnadddetail", + iconCls: "btnadddetail", + handler: function (button, event) { + this.addDetailCargo(); + }, + scope: this + }, '-', { + text: '删除明细', + tooltip: '删除明细', + id: "btndeldetail", + iconCls: "btndeletedetail", + handler: function (button, event) { + this.deleteDetailCargo(); + }, + scope: this + }], + + columns: [{ + sortable: true, + dataIndex: 'GID', + header: '编号', + hidden: true, + width: 0 + }, { + sortable: true, + dataIndex: 'MFNO', + header: '业务编号', + hidden: true, + width: 0 + }, { + dataIndex: 'CTN_ID', + header: '箱号', + width: 120, + renderer: function (value, p, record) { + return record.data.CNTRNO; + }, + editor: this.comboxCTNID + }, { + sortable: true, + dataIndex: 'PKGS', + header: '件数', + width: 60, + editor: { + xtype: 'numberfield', + allowBlank: false, + selectOnFocus: true + } + }, { + dataIndex: 'KINDPKGS', + header: '包装', + width: 120, + editor: this.comboxKINDPKGS + }, { + dataIndex: 'KGS', + header: '重量', + width: 60, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'CBM', + header: '尺码', + width: 60, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'HTS', + header: "HTS", + width: 60, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'DUNNO', + header: '公害行UN号', + width: 60, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }, { + dataIndex: 'GOODVALUE', + header: '货值', + width: 60, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }] + }); + //#endregion + this.gridListCargo.on('edit', function (editor, e, eOpts) { + this.gridListCargoAfterEdit(editor, e, eOpts); + }, this); + + this.panelBodyCtnDetail = new Ext.Panel({ + title: '集装箱货物', + layout: "border", + region: 'east', + flex: 1, + frame: true, + width: 320, + items: [this.gridListCargo] + }); + + // this.panelCtn = new Ext.Panel({ + // region: 'center', + // layout: "hbox", + // items: [this.panelBodyCtnDetail] + // }); + + + this.panelCtn = new Ext.Panel({ + layout: "border", + region: 'center', + animate: true, + autoScroll: true, + // containerScroll: true, + frame: false, + items: [this.panelBodyCtn, this.panelBodyCtnDetail] + }); + + this.panelBodyDr = new Ext.Panel({ + title: '危险品信息', + layout: "border", + hidden: true, + height: 60, + frame: true, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '危险品等级', + flex: 1, + labelWidth: 70, + name: 'DCLASS' + }, { + fieldLabel: '危险品编号', + flex: 1, + labelWidth: 70, + name: 'DUNNO' + }, { + fieldLabel: '危险品页号', + flex: 1, + labelWidth: 70, + name: 'DPAGE' + }, { + fieldLabel: '危险品标签', + flex: 1, + labelWidth: 70, + name: 'DLABEL' + }, { + fieldLabel: '危险品联系人', + flex: 1, + labelWidth: 90, + name: 'LINKMAN' + }] + }] + }); + + + this.StoreTemp = Ext.create('Ext.data.Store', { + fields: ['ID', 'NAME'] + }); + this.StoreTemp.add({ "ID": "C", "NAME": "C摄氏" }); + this.StoreTemp.add({ "ID": "F", "NAME": "F华氏" }); + + + this.comboxTemp = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreTemp, + fieldLabel: '温度单位', + forceSelection: true, + name: 'TEMPID', + valueField: 'ID', + displayField: 'NAME' + }); + + + this.panelBodyRf = new Ext.Panel({ + title: '冻柜信息', + layout: "border", + hidden: true, + height: 60, + //margin: '5 10', + frame: true, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '冷藏通风量', + name: 'REEFERF' + }, { + fieldLabel: '设置温度', + name: 'TEMPSET' + }, this.comboxTemp] + }] + }); + + + + + this.StoreTransType = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreTransType.add({ "ID": "PortToPort", "TYPE": "Port to Port" }); + this.StoreTransType.add({ "ID": "InlandTransit", "TYPE": "Inland Transit" }); + this.StoreTransType.add({ "ID": "InlandNonBonded", "TYPE": "Inland Non Bonded" }); + this.StoreTransType.add({ "ID": "TransitExport", "TYPE": "Transit Expor" }); + this.StoreTransType.add({ "ID": "ImmediateReexport", "TYPE": "Immediate Re-Export" }); + this.StoreTransType.add({ "ID": "StayOnBoard", "TYPE": "Stay OnBoard" }); + this.StoreTransType.add({ "ID": "Expor", "TYPE": "Expor" }); + + this.comboxTransType = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreTransType, + fieldLabel: '运输方式', + flex: 0.5, + forceSelection: true, + name: 'TRANSTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + + this.storeNameFa = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataListRm' } + }); + // this.storeNameFa.load({ params: { condition: "TYPE = 'F'" } }); + this.comboxNameFa = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel:'名称', + store: this.storeNameFa, + queryParam: 'DisplayName', + minChars: 0, + queryMode: 'remote', + flex: 0.5, + name: 'SHIPPERNAME', + valueField: 'NAME', + displayField: 'NAME', + listeners: { + beforequery: function (e) { + //var combo = e.combo; + //if (!e.forceAll) { + // var value = e.query; + // value = value.toUpperCase(); + // combo.store.filterBy(function (record, id) { + // var text = record.get(combo.displayField); + // text = text.toUpperCase(); + // return (text.indexOf(value) != -1); + // }); + // combo.expand(); + // return false; + //} + }, + select: function (combo, records, eOpts) { + if (records.length > 0) { + _this.formEdit.getForm().findField('SHIPPERNAME').setValue(records[0].data.NAME); + _this.formEdit.getForm().findField('SHIPPERADDR1').setValue(records[0].data.ADDRESS); + _this.formEdit.getForm().findField('SHIPPERADDR2').setValue(records[0].data.ADDRESS2); +/* _this.formEdit.getForm().findField('SHIPPERADDR3').setValue(records[0].data.ADDRESS3);*/ + _this.formEdit.getForm().findField('SHIPPERCITY').setValue(records[0].data.CITY); + _this.formEdit.getForm().findField('SHIPPERPOSTCODE').setValue(records[0].data.POSTCODE); + _this.formEdit.getForm().findField('SHIPPERPROVINCE').setValue(records[0].data.PROVINCE); + _this.formEdit.getForm().findField('SHIPPERATTN').setValue(records[0].data.ATTN); + _this.formEdit.getForm().findField('SHIPPERTEL').setValue(records[0].data.TEL); + _this.formEdit.getForm().findField('SHIPPERCOUNTRY').setValue(records[0].data.COUNTRY); + + } + } + } + }); + + + + this.StoreSHIPPERCORPTYPE = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreSHIPPERCORPTYPE.add({ "ID": "N", "TYPE": "Natural person-个人" }); + this.StoreSHIPPERCORPTYPE.add({ "ID": "L", "TYPE": "Legal person-法人公司" }); + this.StoreSHIPPERCORPTYPE.add({ "ID": "A", "TYPE": "Association of persons-协会" }); + + + this.comboxSHIPPERCORPTYPE = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreSHIPPERCORPTYPE, + fieldLabel: '公司类型', + forceSelection: true, + name: 'SHIPPERCORPTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + + this.panelShipper = new Ext.Panel({ + title: '发货人信息', + layout: "anchor", + height: 219, + flex: 1, + frame: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + labelWidth: 60, + msgTarget: 'qtip' + }, + items: [{ + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ xtype: 'hiddenfield'}] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [this.comboxNameFa, { + xtype: "button", + text: "保存为模板", + handler: function () { + _TempType = 'F'; + _this.winTempSaveShow.show(); + } + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址1', + flex: 1, + name: 'SHIPPERADDR1' + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址2', + flex: 1, + name: 'SHIPPERADDR2' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '城市', + flex: 1, + name: 'SHIPPERCITY' + }, { + fieldLabel: '门牌号', + flex: 1, + name: 'SHIPPERHOUSENO' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '州/省', + flex: 0.4, + name: 'SHIPPERPROVINCE' + }, { + fieldLabel: '国家', + flex: 0.30, + labelWidth: 50, + name: 'SHIPPERCOUNTRY' + }, { + fieldLabel: '邮编', + labelWidth: 50, + flex: 0.4, + name: 'SHIPPERPOSTCODE' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '联系人', + flex: 0.5, + name: 'SHIPPERATTN' + }, { + fieldLabel: '电话', + labelWidth: 50, + flex: 0.5, + name: 'SHIPPERTEL' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxSHIPPERCORPTYPE, { + fieldLabel: 'EORI', + name: 'SHIPPEREORI' + }] + } + + ] + + }); + + //#region 名称(收货人) + this.storeNameShou = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataListRm' } + }); + // this.storeNameShou.load({ params: { condition: "TYPE = 'S'" } }); + this.comboxNameShou = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '名称', + store: this.storeNameShou, + queryParam: 'DisplayName', + minChars: 0, + queryMode: 'remote', + flex: 0.5, + name: 'CONSIGNEENAME', + valueField: 'NAME', + displayField: 'NAME', + listeners: { + beforequery: function (e) { + //var combo = e.combo; + //if (!e.forceAll) { + // var value = e.query; + // value = value.toUpperCase(); + // combo.store.filterBy(function (record, id) { + // var text = record.get(combo.displayField); + // text = text.toUpperCase(); + // return (text.indexOf(value) != -1); + // }); + // combo.expand(); + // return false; + //} + }, + select: function (combo, records, eOpts) { + if (records.length > 0) { + _this.formEdit.getForm().findField('CONSIGNEENAME').setValue(records[0].data.NAME); + _this.formEdit.getForm().findField('CONSIGNEEADDR1').setValue(records[0].data.ADDRESS); + _this.formEdit.getForm().findField('CONSIGNEEADDR2').setValue(records[0].data.ADDRESS2); +/* _this.formEdit.getForm().findField('CONSIGNEEADDR3').setValue(records[0].data.ADDRESS3);*/ + _this.formEdit.getForm().findField('CONSIGNEECITY').setValue(records[0].data.CITY); + _this.formEdit.getForm().findField('CONSIGNEEPOSTCODE').setValue(records[0].data.POSTCODE); + _this.formEdit.getForm().findField('CONSIGNEEPROVINCE').setValue(records[0].data.PROVINCE); + _this.formEdit.getForm().findField('CONSIGNEEATTN').setValue(records[0].data.ATTN); + _this.formEdit.getForm().findField('CONSIGNEETEL').setValue(records[0].data.TEL); + _this.formEdit.getForm().findField('CONSIGNEECOUNTRY').setValue(records[0].data.COUNTRY); + + + } + } + } + }); + + this.StoreCONSIGNEECORPTYPE = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreCONSIGNEECORPTYPE.add({ "ID": "N", "TYPE": "Natural person-个人" }); + this.StoreCONSIGNEECORPTYPE.add({ "ID": "L", "TYPE": "Legal person-法人公司" }); + this.StoreCONSIGNEECORPTYPE.add({ "ID": "A", "TYPE": "Association of persons-协会" }); + + + this.comboxCONSIGNEECORPTYPE = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreCONSIGNEECORPTYPE, + fieldLabel: '公司类型', + forceSelection: true, + name: 'CONSIGNEECORPTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + + this.panelConsignee = new Ext.Panel({ + title: '收货人信息', + layout: "anchor", + height: 219, + flex: 1, + frame: true, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ xtype: 'hiddenfield'}] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxNameShou, { + xtype: "button", + text: "保存为模板", + handler: function () { + _TempType = 'S'; + _this.winTempSaveShow.show(); + } + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '地址1', + flex: 1, + name: 'CONSIGNEEADDR1' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '地址2', + flex: 1, + name: 'CONSIGNEEADDR2' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '城市', + flex: 1, + name: 'CONSIGNEECITY' + }, { + fieldLabel: '门牌号', + flex: 1, + name: 'CONSIGNEEHOUSENO' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '州/省', + flex: 0.4, + name: 'CONSIGNEEPROVINCE' + }, { + fieldLabel: '国家', + labelWidth: 50, + flex: 0.3, + name: 'CONSIGNEECOUNTRY' + }, { + fieldLabel: '邮编', + labelWidth: 50, + flex: 0.4, + name: 'CONSIGNEEPOSTCODE' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '联系人', + flex: 0.5, + name: 'CONSIGNEEATTN' + }, { + fieldLabel: '电话', + labelWidth: 50, + flex: 0.5, + name: 'CONSIGNEETEL' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCONSIGNEECORPTYPE, { + fieldLabel: 'EORI', + name: 'CONSIGNEEEORI' + }] + } + + ] + + }); + + //#region 名称(通知人) + this.storeNameTong = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataListRm' } + }); + // this.storeNameTong.load({ params: { condition: "TYPE = 'T'" } }); + this.comboxNameTong = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel:'名称', + store: this.storeNameTong, + queryParam: 'DisplayName', + minChars: 0, + queryMode: 'remote', + flex: 1, + name: 'NOTIFYPARTYNAME', + valueField: 'NAME', + displayField: 'NAME', + listeners: { + beforequery: function (e) { + //var combo = e.combo; + //if (!e.forceAll) { + // var value = e.query; + // value = value.toUpperCase(); + // combo.store.filterBy(function (record, id) { + // var text = record.get(combo.displayField); + // text = text.toUpperCase(); + // return (text.indexOf(value) != -1); + // }); + // combo.expand(); + // return false; + //} + }, + select: function (combo, records, eOpts) { + if (records.length > 0) { + _this.formEdit.getForm().findField('NOTIFYPARTYNAME').setValue(records[0].data.NAME); + _this.formEdit.getForm().findField('NOTIFYPARTYADDR1').setValue(records[0].data.ADDRESS); + _this.formEdit.getForm().findField('NOTIFYPARTYADDR2').setValue(records[0].data.ADDRESS2); +// _this.formEdit.getForm().findField('NOTIFYPARTYADDR3').setValue(records[0].data.ADDRESS3); + _this.formEdit.getForm().findField('NOTIFYPARTYCITY').setValue(records[0].data.CITY); + _this.formEdit.getForm().findField('NOTIFYPARTYPOSTCODE').setValue(records[0].data.POSTCODE); + _this.formEdit.getForm().findField('NOTIFYPARTYPROVINCE').setValue(records[0].data.PROVINCE); + _this.formEdit.getForm().findField('NOTIFYPARTYATTN').setValue(records[0].data.ATTN); + _this.formEdit.getForm().findField('NOTIFYPARTYTEL').setValue(records[0].data.TEL); + _this.formEdit.getForm().findField('NOTIFYPARTYCOUNTRY').setValue(records[0].data.COUNTRY); + } + } + } + }); + + this.StoreNOTIFYPARTYCORPTYPE = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreNOTIFYPARTYCORPTYPE.add({ "ID": "N", "TYPE": "Natural person-个人" }); + this.StoreNOTIFYPARTYCORPTYPE.add({ "ID": "L", "TYPE": "Legal person-法人公司" }); + this.StoreNOTIFYPARTYCORPTYPE.add({ "ID": "A", "TYPE": "Association of persons-协会" }); + + + this.comboxNOTIFYPARTYCORPTYPE = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreNOTIFYPARTYCORPTYPE, + fieldLabel: '公司类型', + forceSelection: true, + name: 'NOTIFYPARTYCORPTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + + this.panelNotifyParty = new Ext.Panel({ + title: '通知人信息', + layout: "anchor", + height: 219, + flex: 1, + frame: true, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + xtype: 'checkboxfield', + boxLabel: '同收货人', + flex: 0.5, + name: 'ISSAMECONSIGNEE', + inputValue: true, + boxLabelAlign: 'before', + checked: false + },this.comboxNameTong, { + xtype: "button", +// flex: 1, + text: "保存为模板", + handler: function () { + _TempType = 'T'; + _this.winTempSaveShow.show(); + } + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '地址1', + flex: 1, + name: 'NOTIFYPARTYADDR1' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '地址2', + flex: 1, + name: 'NOTIFYPARTYADDR2' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '城市', + flex: 1, + name: 'NOTIFYPARTYCITY' + }, { + fieldLabel: '门牌号', + flex: 1, + name: 'NOTIFYPARTYHOUSENO' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '州/省', + flex: 0.4, + name: 'NOTIFYPARTYPROVINCE' + }, { + fieldLabel: '国家', + flex: 0.3, + labelWidth: 50, + name: 'NOTIFYPARTYCOUNTRY' + }, { + fieldLabel: '邮编', + flex: 0.4, + labelWidth: 50, + name: 'NOTIFYPARTYPOSTCODE' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '联系人', + flex: 0.5, + name: 'NOTIFYPARTYATTN' + }, { + fieldLabel: '电话', + flex: 0.5, + labelWidth: 50, + name: 'NOTIFYPARTYTEL' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxNOTIFYPARTYCORPTYPE, { + fieldLabel: 'EORI', + name: 'NOTIFYPARTYEORI' + }] + } + + ] + + }); + + + + this.panelscn = new Ext.Panel({ + layout: "hbox", + height: 220, + items: [this.panelShipper, this.panelConsignee, this.panelNotifyParty] + }); + + this.storeNameSELLER = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataList' } + }); + // this.storeNameFa.load({ params: { condition: "TYPE = 'F'" } }); + this.comboxNameSELLER = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '名称', + store: this.storeNameSELLER, + queryParam: 'DisplayName', + queryMode: 'remote', + flex: 0.5, + name: 'SELLERNAME', + valueField: 'NAME', + displayField: 'NAME', + listeners: { + beforequery: function (e) { + var combo = e.combo; + if (!e.forceAll) { + var value = e.query; + value = value.toUpperCase(); + combo.store.filterBy(function (record, id) { + var text = record.get(combo.displayField); + text = text.toUpperCase(); + return (text.indexOf(value) != -1); + }); + combo.expand(); + return false; + } + }, + select: function (combo, records, eOpts) { + if (records.length > 0) { + _this.formcd.getForm().findField('SELLERNAME').setValue(records[0].data.NAME); + _this.formcd.getForm().findField('SELLERADDR1').setValue(records[0].data.ADDRESS); + _this.formcd.getForm().findField('SELLERADDR2').setValue(records[0].data.ADDRESS2); + _this.formcd.getForm().findField('SELLERCITY').setValue(records[0].data.CITY); + _this.formcd.getForm().findField('SELLERPROVINCE').setValue(records[0].data.PROVINCE); + _this.formcd.getForm().findField('SELLERCOUNTRY').setValue(records[0].data.COUNTRY); + _this.formcd.getForm().findField('SELLEREMAIL').setValue(records[0].data.POSTCODE); + + } + } + } + }); + + this.StoreSELLERCORPTYPE = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreSELLERCORPTYPE.add({ "ID": "N", "TYPE": "Natural person-个人" }); + this.StoreSELLERCORPTYPE.add({ "ID": "L", "TYPE": "Legal person-法人公司" }); + this.StoreSELLERCORPTYPE.add({ "ID": "A", "TYPE": "Association of persons-协会" }); + + + this.comboxSELLERCORPTYPE = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreSELLERCORPTYPE, + fieldLabel: '公司类型', + forceSelection: true, + name: 'SELLERCORPTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + this.panelSELLER = new Ext.Panel({ + title: '卖方信息', + layout: "anchor", + height:219, + flex: 1, + frame: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + labelWidth: 60, + msgTarget: 'qtip' + }, + items: [{ + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ xtype: 'hiddenfield' }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [this.comboxNameSELLER, { + xtype: "button", + text: "保存为模板", + handler: function () { + _TempType = 'SE'; + _this.winTempSaveShow.show(); + } + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址1', + flex: 1, + name: 'SELLERADDR1' + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址2', + flex: 2, + name: 'SELLERADDR2' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '城市', + name: 'SELLERCITY' + }, { + fieldLabel: '门牌号', + name: 'SELLERHOUSENO' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [ { + fieldLabel: '省份代码', + flex: 0.30, + //labelWidth: 50, + name: 'SELLERPROVINCE' + }, { + fieldLabel: '国家代码', + flex: 0.30, + //labelWidth: 50, + name: 'SELLERCOUNTRY' + }, { + fieldLabel: '邮编', + flex: 0.30, + //labelWidth: 50, + name: 'SELLERPOSTCODE' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '联系人', + flex: 0.5, + name: 'SELLERATTN' + }, { + fieldLabel: '电话', + flex: 0.5, + labelWidth: 50, + name: 'SELLERTEL' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxSELLERCORPTYPE, { + fieldLabel: 'EORI', + name: 'SELLEREORI' + }] + } + + ] + + }); + + this.storeNameBUYER = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataList' } + }); + // this.storeNameFa.load({ params: { condition: "TYPE = 'F'" } }); + this.comboxNameBUYER = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '名称', + store: this.storeNameBUYER, + queryParam: 'DisplayName', + queryMode: 'remote', + flex: 0.5, + name: 'BUYERNAME', + valueField: 'NAME', + displayField: 'NAME', + listeners: { + beforequery: function (e) { + var combo = e.combo; + if (!e.forceAll) { + var value = e.query; + value = value.toUpperCase(); + combo.store.filterBy(function (record, id) { + var text = record.get(combo.displayField); + text = text.toUpperCase(); + return (text.indexOf(value) != -1); + }); + combo.expand(); + return false; + } + }, + select: function (combo, records, eOpts) { + if (records.length > 0) { + _this.formcd.getForm().findField('BUYERNAME').setValue(records[0].data.NAME); + _this.formcd.getForm().findField('BUYERADDR1').setValue(records[0].data.ADDRESS); + _this.formcd.getForm().findField('BUYERADDR2').setValue(records[0].data.ADDRESS2); + _this.formcd.getForm().findField('BUYERCITY').setValue(records[0].data.CITY); + _this.formcd.getForm().findField('BUYERPROVINCE').setValue(records[0].data.PROVINCE); + _this.formcd.getForm().findField('BUYERCOUNTRY').setValue(records[0].data.COUNTRY); + _this.formcd.getForm().findField('BUYEREMAIL').setValue(records[0].data.POSTCODE); + + } + } + } + }); + this.StoreBUYERCORPTYPE = Ext.create('Ext.data.Store', { + fields: ["ID", 'TYPE'] + }); + this.StoreBUYERCORPTYPE.add({ "ID": "N", "TYPE": "Natural person-个人" }); + this.StoreBUYERCORPTYPE.add({ "ID": "L", "TYPE": "Legal person-法人公司" }); + this.StoreBUYERCORPTYPE.add({ "ID": "A", "TYPE": "Association of persons-协会" }); + + + this.comboxBUYERCORPTYPE = Ext.create('DsExt.ux.RefTableCombox', { + store: this.StoreBUYERCORPTYPE, + fieldLabel: '公司类型', + forceSelection: true, + name: 'BUYERCORPTYPE', + valueField: 'ID', + displayField: 'TYPE' + }); + + this.panelBUYER = new Ext.Panel({ + title: '买方信息', + layout: "anchor", + height: 219, + flex: 1, + frame: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + labelWidth: 60, + msgTarget: 'qtip' + }, + items: [{ + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ xtype: 'hiddenfield' }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [this.comboxNameBUYER, { + xtype: "button", + text: "保存为模板", + handler: function () { + _TempType = 'BY'; + _this.winTempSaveShow.show(); + } + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址1', + flex: 1, + name: 'BUYERADDR1' + }] + }, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [{ + fieldLabel: '地址2', + flex: 2, + name: 'BUYERADDR2' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '城市', + name: 'BUYERCITY' + }, { + fieldLabel: '门牌号', + name: 'BUYERHOUSENO' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [ { + fieldLabel: '省份代码', + flex: 0.30, + //labelWidth: 50, + name: 'BUYERPROVINCE' + }, { + fieldLabel: '国家代码', + flex: 0.30, + //labelWidth: 50, + name: 'BUYERCOUNTRY' + }, { + fieldLabel: '邮编', + name: 'BUYERPOSTCODE' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + defaults: { + anchor: '96%' + }, + items: [{ + fieldLabel: '联系人', + flex: 0.5, + name: 'BUYERATTN' + }, { + fieldLabel: '电话', + flex: 0.5, + labelWidth: 50, + name: 'BUYERTEL' + }] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxBUYERCORPTYPE, { + fieldLabel: 'EORI', + name: 'BUYEREORI' + }] + } + + ] + + }); + + + //this.storeNameSHIPTOPARTY = Ext.create('DsExt.ux.RefTableStore', { + // model: 'DsShipping.ux.MsOpSeaeEdiTemplate', + // proxy: { url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataList' } + //}); + //// this.storeNameFa.load({ params: { condition: "TYPE = 'F'" } }); + //this.comboxNameSHIPTOPARTY = Ext.create('DsExt.ux.RefTableCombox', { + // fieldLabel: '名称', + // store: this.storeNameSHIPTOPARTY, + // queryParam: 'DisplayName', + // queryMode: 'remote', + // flex: 0.5, + // name: 'SHIPTOPARTYNAME', + // valueField: 'NAME', + // displayField: 'NAME', + // listeners: { + // beforequery: function (e) { + // var combo = e.combo; + // if (!e.forceAll) { + // var value = e.query; + // value = value.toUpperCase(); + // combo.store.filterBy(function (record, id) { + // var text = record.get(combo.displayField); + // text = text.toUpperCase(); + // return (text.indexOf(value) != -1); + // }); + // combo.expand(); + // return false; + // } + // }, + // select: function (combo, records, eOpts) { + // if (records.length > 0) { + // _this.formcd.getForm().findField('SHIPTOPARTYNAME').setValue(records[0].data.NAME); + // _this.formcd.getForm().findField('SHIPTOPARTYADDR1').setValue(records[0].data.ADDRESS); + // _this.formcd.getForm().findField('SHIPTOPARTYADDR2').setValue(records[0].data.ADDRESS2); + // _this.formcd.getForm().findField('SHIPTOPARTYCITY').setValue(records[0].data.CITY); + // _this.formcd.getForm().findField('SHIPTOPARTYPROVINCE').setValue(records[0].data.PROVINCE); + // _this.formcd.getForm().findField('SHIPTOPARTYCOUNTRY').setValue(records[0].data.COUNTRY); + // _this.formcd.getForm().findField('SHIPTOPARTYEMAIL').setValue(records[0].data.POSTCODE); + + // } + // } + // } + //}); + + + //this.panelSHIPTOPARTY = new Ext.Panel({ + // title: '货物送达仓库', + // layout: "anchor", + // height: 145, + // flex: 1, + // frame: true, + // fieldDefaults: { + // margins: '2 2 2 2', + // labelAlign: 'right', + // labelWidth: 60, + // msgTarget: 'qtip' + // }, + // items: [{ + // xtype: 'container', + // defaultType: 'textfield', + // layout: 'hbox', + // items: [{ xtype: 'hiddenfield' }] + // }, { + // xtype: 'container', + // defaultType: 'textfield', + // layout: 'hbox', + // items: [this.comboxNameSHIPTOPARTY, { + // xtype: "button", + // text: "保存为模板", + // handler: function () { + // _TempType = 'ST'; + // _this.winTempSaveShow.show(); + // } + // }] + // }, { + // xtype: 'container', + // defaultType: 'textfield', + // layout: 'hbox', + // items: [{ + // fieldLabel: '地址1', + // flex: 1, + // name: 'SHIPTOPARTYADDR1' + // }] + // }, { + // xtype: 'container', + // defaultType: 'textfield', + // layout: 'hbox', + // items: [{ + // fieldLabel: '地址2', + // flex: 2, + // name: 'SHIPTOPARTYADDR2' + // }, { + // fieldLabel: '邮编', + // flex: 1, + // name: 'SHIPTOPARTYEMAIL' + // }] + // }, { + // xtype: 'container', + // layout: 'hbox', + // defaultType: 'textfield', + // items: [{ + // fieldLabel: '城市', + // flex: 0.30, + // //labelWidth: 50, + // name: 'SHIPTOPARTYCITY' + // }, { + // fieldLabel: '省份代码', + // flex: 0.30, + // //labelWidth: 50, + // name: 'SHIPTOPARTYPROVINCE' + // }, { + // fieldLabel: '国家代码', + // flex: 0.30, + // //labelWidth: 50, + // name: 'SHIPTOPARTYCOUNTRY' + // }] + // } + + // ] + + //}); + + + + //#region 编辑formEdit 基本信息 + this.formEdit = Ext.widget('form', { + region: 'north', + frame: true, + bodyPadding: 5, + layout: 'anchor', + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 70, + msgTarget: 'qtip' + }, + + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '业务编号', + name: 'MFNO', hidden: true + }, { + fieldLabel: '业务编号', + name: 'BSNO', hidden: true + }, { + fieldLabel: 'MASTERNO', + name: 'MASTERNO', hidden: true + }, { + fieldLabel: 'CARGOID', + name: 'CARGOID', hidden: true + }, { + fieldLabel: 'PLACERECEIPTID', + name: 'PLACERECEIPTID', hidden: true + }, { + fieldLabel: 'PLACERECEIPT', + name: 'PLACERECEIPT', hidden: true + }, { + fieldLabel: 'EDISTATUS', + name: 'EDISTATUS', hidden: true + }, { + fieldLabel: 'EDITYPE', + name: 'EDITYPE', hidden: true + },this.comboxFileType, { + xtype: 'checkboxfield', + boxLabel: '是否同一主票下最后一票分票', + name: 'ISLASTHBL', + inputValue: true, + checked: true + }, { + fieldLabel: '主提单号', + name: 'MBLNO' + }, { + fieldLabel: '分提单号', + name: 'HBLNO' + }, { + fieldLabel: '录入日期', + readOnly: true, + name: 'INPUTDATE' + }, { + fieldLabel: '录入人', + readOnly: true, + name: 'INPUTBY' + }] + }, this.panelscn, { + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + items: [this.panelSELLER, this.panelBUYER] + } + ] + }); //end this.formEdit + //#endregion + + + + //#region 按钮Toolbar + this.panelBtn = new Ext.Panel({ + region: "north", + tbar: [{ + id: 'btnECopyNew', + text: "复制新建", + handler: function (button, event) { + var basicForm = this.formHead.getForm(); + this.opStatus = 'add'; + basicForm.findField('BSNO').setDisabled(false); + var field = basicForm.findField('BSNO'); + var BSNO = NewGuid(); + field.setValue(BSNO); + basicForm.findField('BSNO').setDisabled(true); + field = basicForm.findField('ORDNO'); + field.setValue(''); + field = basicForm.findField('INPUTBY'); + + field.setValue(SHOWNAME); + field = basicForm.findField('ORSTATUS'); + field.setValue('9'); + field = basicForm.findField('ORSTATUSREF'); + field.setValue('录入状态'); + field = basicForm.findField('MBLNO'); + field.setValue(''); + + this.panelFee.strBSNO = BSNO; + + for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { + var memberbody = this.storeBodyList.getAt(j); + memberbody.set("ORDNO", '*'); + memberbody.commit(); + }; + + for (var j = 0; j < this.panelFee.storeDrChFee.getCount(); j += 1) { + var memberbody = this.panelFee.storeDrChFee.getAt(j); + memberbody.set("GId", NewGuid()); + memberbody.set("BsNo", '*'); + memberbody.commit(); + }; + + for (var j = 0; j < this.panelFee.storeCrChFee.getCount(); j += 1) { + var memberbody = this.panelFee.storeCrChFee.getAt(j); + memberbody.set("GId", NewGuid()); + memberbody.set("BsNo", '*'); + memberbody.commit(); + }; + + this.GetEditStatus(); + + + var children = this.tabSeaepanel.items; + if (children) { + for (var i = children.length - 1, len = 0; i >= len; i--) { + if (children.items[i].id) { + if (children.items[i].id == 'pnlmodSeaeOrderInfo') { + this.tabSeaepanel.setActiveTab(i); + } + } + } + } + this.tabSeaepanel.doLayout(); + this.panelOcr.hide(); + }, + scope: this + }, { + id: 'btnESave', + text: "保存", + iconCls: "btnsave", + handler: function (button, event) { + this.Save('0'); + }, + scope: this + }] + }); //end 按钮Toolbar + //#endregion + + //#region 框架结构 + + + this.panelpage1 = new Ext.Panel({ + layout: "border", + title: '基本信息', + region: 'center', + animate: true, + autoScroll: true, + // containerScroll: true, + frame: false, + items: [this.formEdit, this.panelCtn] + }); + + + + + + + this.panelpage = new Ext.TabPanel({ + layout: "border", + region: 'center', + animate: true, + autoScroll: true, + // containerScroll: true, + frame: false, + items: [this.panelpage1] + }); + + + this.storeList = Ext.create('Ext.data.Store', { + pageSize: this.PageSize, + model: 'MsSeaeEdiModel', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsOpSeaeEdi/GetDataList', + reader: { + id: 'MFNO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //#region List列表显示信息 + Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { + width: 30 + }); + + this.initgirdcolums = [{ + sortable: true, + id: '', + dataIndex: '', + header: '', + width: 0 + }, { + sortable: true, + dataIndex: 'BSNO', + header: '业务编号', + width: 0 + }, { + sortable: true, + dataIndex: 'MFNO', + header: '业务编号', + width: 0 + }, + { + sortable: true, + dataIndex: 'FILETYPE', + header: '文件类型', + width: 60 + }, + { + sortable: true, + dataIndex: 'MBLNO', + header: '提单号', + width: 120 + }, + { + sortable: true, + dataIndex: 'INPUTBY', + header: '录入人', + width: 80 + }, + { + sortable: true, + dataIndex: 'INPUTDATE', + header: '录入日期', + width: 80 + }]; + + this.girdcolums = this.initgirdcolums; + + this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + + //定义Grid + this.gridList = new Ext.grid.GridPanel({ + store: this.storeList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + selModel: this.GridCheckBoxModel, + listeners: { + cellclick: function (thisTab, record, item, index, e, eOpts) { + if (index == 10) {//设置按钮列 + // alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode); + + } + } + }, + columns: this.girdcolums, + // paging bar on the bottom + bbar: Ext.create('Ext.PagingToolbar', { + store: this.storeList, + displayInfo: true, + displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', + emptyMsg: "没有数据" + }) + }); + + + this.panellist = new Ext.Panel({ + // title: '提单信息', + layout: "border", + region: 'center', + animate: true, + autoScroll: true, + region: 'west', + width: 192, + // containerScroll: true, + frame: false, + items: [this.gridList] + }); + + + + this.panelSeae = new Ext.Panel({ + id: 'pnlmodSeaeEdiInfo', + layout: "border", + region: 'center', + animate: true, + autoScroll: true, + frame: false, + //closable:true, + items: [this.panellist, this.panelBtn, this.formHead, this.panelpage] + }); + + + + + Ext.apply(this, { + items: [this.panelSeae] + }); + //#endregion + + //#region 其他 + parentWin = window.parent.opener; + this.InitData(); + + + this.formTempNameShow = Ext.widget('form', { + frame: true, + region: 'center', + height: 60, + autoScroll: true, + bodyPadding: 5, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 90, + msgTarget: 'qtip' + }, + items: [ + {//fieldset 1 + xtype: 'container', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [ + { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '模板名称', + name: 'TempName', + height: 30 + } + ] + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }); + me = this; + this.winTempSaveShow = Ext.create('Ext.window.Window', { + title: "保存模板", + width: 300, + height: 120, + //plain : true, + iconCls: "addicon", + resizable: false, + // draggable:false,// 是否可以拖动 + collapsible: true, // 允许缩放条 + closeAction: 'close', + closable: true, + modal: 'true', + buttonAlign: "center", + bodyStyle: "padding:0 0 0 0", + items: [this.formTempNameShow], + buttons: [{ + text: "关闭", + minWidth: 70, + handler: function () { + me.winTempSaveShow.close(); + } + }, { + text: "保存", + minWidth: 70, + handler: function () { + me.SaveSFTTemp(); + me.winTempSaveShow.close(); + } + }] + }); + //#endregion + }, //end initUIComponents + + //#region 加载事件 + InitData: function () { + var condition = ''; + _this = this; + this.storeList.load({ + params: { condition: "BSNO='" + this.BsNo + "'" }, + callback: function (r, options, success) { + if (success) { + if (this.storeList.getCount() > 0) { + var member = this.storeList.getAt(0); + _this.editRecord = member; + _this.LoadData("edit", "MFNO='" + member.data.MFNO + "'"); + + } else { + _this.LoadData('add', ''); + } + } + }, + scope: this + }); + _this.LoadMustBe(); + + }, //end InitData + + LoadData: function (opstatus, condition) { + this.serialNo = 0; + //this.bodyDel = []; + this.opStatus = opstatus; + + Ext.Ajax.request({ + waitMsg: '正在查询主表数据...', + url: '/MvcShipping/MsOpSeaeEdi/GetData', + params: { + handle: opstatus, + condition: condition + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } + + data = result.data; + + this.formHead.getForm().reset(); + this.formHead.getForm().setValues(data); + this.formEdit.getForm().reset(); + this.formEdit.getForm().setValues(data); + + + //this.LoadInit(); + this.GetEditStatus(); + } else { + Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); + } + }, + scope: this + }); + if (this.opStatus == 'edit') { + this.storeBodyList.load({ params: { condition: condition} }); + this.storeCargoList.load({ params: { condition: condition} }); + } else { + condition = "MFNO='XX'"; + this.storeBodyList.load({ params: { condition: condition} }); + this.storeCargoList.load({ params: { condition: condition} }); + } + }, // end LoadDate + //#endregion + + //#region 保存 + Save: function (type) { + var basicForm = this.formEdit.getForm(); + var basicForm2 = this.formHead.getForm(); + if (!basicForm.isValid()) { + return; + } + if (!basicForm2.isValid()) { + return; + } + // + var bodydatas = []; + for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { + var member = this.storeBodyList.getAt(i); + + bodydatas.push(member); + } // + var jsonBody = ConvertRecordsToJsonAll(bodydatas); + + + var cargodatas = []; + for (var i = 0; i < this.storeCargoList.getCount(); i += 1) { + var member = this.storeCargoList.getAt(i); + + cargodatas.push(member); + } // + var jsonCargo = ConvertRecordsToJsonAll(cargodatas); + + this.formHead.getForm().findField('MFNO').setDisabled(false); + var data = this.formHead.getForm().getValues(false, false, false); + var data2 = this.formEdit.getForm().getValues(false, false, false); + + this.formHead.getForm().findField('MFNO').setDisabled(true); + // + Ext.Msg.wait('正在保存数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在保存数据...', + url: '/MvcShipping/MsOpSeaeEdi/Save', + scope: this, + params: { + opstatus: this.opStatus, + data: Ext.JSON.encode(data), + data2: Ext.JSON.encode(data2), + body: jsonBody, + cargobody: jsonCargo + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnData = jsonresult.Data; + this.formEdit.getForm().reset(); + this.formEdit.getForm().setValues(returnData); + this.formHead.getForm().reset(); + this.formHead.getForm().setValues(returnData); + + // + if (this.opStatus == 'add') { + var arrNewRecords = this.StoreList.add(returnData); + this.editRecord = arrNewRecords[0]; + } + else if (this.opStatus == 'edit') { + var editp = Ext.create('MsSeaeEdiModel', returnData); + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + } + if (type == '0') { + this.opStatus = 'edit'; + basicForm2.findField('MFNO').setDisabled(true); + for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { + var memberbody = this.storeBodyList.getAt(j); + memberbody.set("MFNO", this.editRecord.get('MFNO')); + memberbody.commit(); + }; + for (var j = 0; j < this.storeCargoList.getCount(); j += 1) { + var memberbody = this.storeCargoList.getAt(j); + memberbody.set("MFNO", this.editRecord.get('MFNO')); + memberbody.commit(); + }; + + } else if (type == '1') { + window.close(); + } else if (type == '2') { + this.LoadData('add', ''); + } + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + }, //end save + //#endregion + + //#region 集装箱按钮事件 + onAddDetailClick: function (button, event) { + this.addDetail(); + }, //end onAddDetailClick + + onDelDetailClick: function (button, event) { + this.deleteDetail(); + }, //onDelDetailClick + + + + addDetail: function () { + + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + var newSerialno = this.DsGetNewNo(this.storeBodyList); + this.serialNo = newSerialno; + + var record = Ext.create('MsSeaeEdiCtn', { + CTN_ID: NewGuid(), + MFNO: '*', + CTNCODE: newSerialno, + CTNALL: '', + CNTRNO: '', + SEALNO: '', + PKGS: 0, + KGS: 0, + CBM: 0, + MARKS: '', + DESCRIPTION: '' + }); + this.storeBodyList.add(record); + var n = this.storeBodyList.getCount(); + this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); + }, + + addDetailCargo: function () { + + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + var newSerialno = this.DsGetNewNo(this.storeCargoList); + this.serialNo = newSerialno; + + var record = Ext.create('MsSeaeEdiCtnDetail', { + GID: NewGuid(), + CTN_ID: '', + MFNO: '*', + KINDPKGS: '', + DUNNO: '', + HTS: '', + PKGS: 0, + KGS: 0, + CBM: 0, + CNTRNO: '', + GOODVALUE: 0 + }); + this.storeCargoList.add(record); + var n = this.storeCargoList.getCount(); + this.gridListCargoCellEditing.startEditByPosition({ row: n - 1, column: 2 }); + }, + + DsGetNewNo: function (store) { + var result = store.getCount(); + if (result == 0) { + return 1; + } + var record = store.getAt(result - 1).data.CTNCODE; + result = parseInt(record) + 1; + return result; + }, + gridListCargoAfterEdit: function (editor, e, eOpts) { + + if (e.value == e.originalValue) return; + + if (e.field == 'CTN_ID') { + var records = DsStoreQueryBy(this.storeBodyList, 'CTN_ID', e.value); + + if (records.getCount() > 0) { + var data = records.getAt(0).data; + var CNTRNO = data.CNTRNO; + e.record.set('CNTRNO', CNTRNO); + } else { + e.record.set('CNTRNO', ''); + } + + + } + + }, + + onNextKeyClick: function (type, col) { + + var rows = this.gridDrChFee.getSelectionModel().getSelection(); + var row = rows[rows.length - 1]; + var s = this.gridDrChFee.getStore(); + var number = s.indexOf(row) + 1; + if (number == this.gridDrChFee.getStore().getCount()) { + } else { + this.cellEditingDrChFee.startEditByPosition({ row: number, column: col }); + } + + + }, + + cellEditingChFeeBeforeEdit: function (editor, e) { + + var canedit = true; + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + canedit = false; + } + return canedit; + + }, + deleteDetail: function () { + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); + var selectedRecords = this.gridList.selModel.getSelection(); + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + if (rec.data.MFNO == "" || rec.data.MFNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 + { + this.storeBodyList.remove(selectedRecords[i]); + } + else { + Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在删除数据...'); + Ext.Ajax.request({ + waitMsg: '正在删除数据...', + url: '/MvcShipping/MsOpSeaeEdi/DeleteDetail', + params: { + data: Ext.JSON.encode(rec.data) + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.storeBodyList.remove(rec); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + } + //this.storeBodyList.remove(selectedRecords[i]); + } + }, + + deleteDetailCargo: function () { + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + Ext.Msg.show({ title: '警告', msg: '业务已发送,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); + var selectedRecords = this.gridList.selModel.getSelection(); + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + if (rec.data.MFNO == "" || rec.data.MFNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 + { + this.storeCargoList.remove(selectedRecords[i]); + } + else { + Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在删除数据...'); + Ext.Ajax.request({ + waitMsg: '正在删除数据...', + url: '/MvcShipping/MsOpSeaeEdi/DeleteDetailCargo', + params: { + data: Ext.JSON.encode(rec.data) + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.storeCargoList.remove(rec); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + } + //this.storeBodyList.remove(selectedRecords[i]); + } + }, + //#endregion + + + + + onFtpUpClick: function () { + + var GidStr = ''; + + this.formHead.getForm().findField('MFNO').setDisabled(false); + var data = this.formHead.getForm().getValues(false, false, false); + var data2 = this.formEdit.getForm().getValues(false, false, false); + this.formHead.getForm().findField('MFNO').setDisabled(true); + + + Object.assign(data2, data3); + Object.assign(data2, data4); + + var msg = ''; + var ORSTATUS = this.formHead.getForm().findField('EDISTATUS').getValue(); + if (ORSTATUS == '已发送') { + msg = '此票业务已发送,确实要重新发送吗?'; + } else { msg = '确实要发送吗?'; } + + var Mblno = this.formHead.getForm().findField('MBLNO').getValue(); + + _this = this; + Ext.MessageBox.confirm('提示', msg, function (btn) { + if (btn == 'yes') { + + Ext.Ajax.request({ + waitMsg: 'Changing...', + url: '/MvcShipping/MsOpSeaeEdi/AFRSendData', + params: { + data: Ext.JSON.encode(data), + data2: Ext.JSON.encode(data2), + mblno: Mblno + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } else { + + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.INFO, + buttons: Ext.Msg.OK + }); + + + + } + + } else { + Ext.MessageBox.alert('服务器响应出错,请重试', response.responseText); + } + }, + scope: this + }); + } + }, this); + + }, + //#region + + SaveSFTTemp: function () { + + var tempname = this.formTempNameShow.getForm().findField('TempName').getValue(); + if (tempname == null || tempname == '') { + Ext.Msg.show({ title: '提示', msg: '模板名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + var dataObj = new Object(); + dataObj.gid = NewGuid(); + dataObj.TEMPLATENAME = tempname; + dataObj.TYPE = _TempType; + if (_TempType == 'S') { + var name = this.formEdit.getForm().findField('CONSIGNEENAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '收货人不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('CONSIGNEENAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('CONSIGNEEADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('CONSIGNEEADDR2').getValue(); + dataObj.ADDRESS3 = this.formEdit.getForm().findField('CONSIGNEEADDR3').getValue(); + dataObj.CITY = this.formEdit.getForm().findField('CONSIGNEECITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('CONSIGNEEPOSTCODE').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('CONSIGNEEPROVINCE').getValue(); + dataObj.ATTN = this.formEdit.getForm().findField('CONSIGNEEATTN').getValue(); + dataObj.COUNTRY = this.formEdit.getForm().findField('CONSIGNEECOUNTRY').getValue(); + dataObj.TEL = this.formEdit.getForm().findField('CONSIGNEETEL').getValue(); + dataObj.HOUSENO = this.formEdit.getForm().findField('CONSIGNEEHOUSENO').getValue(); + dataObj.EORI = this.formEdit.getForm().findField('CONSIGNEEEORI').getValue(); + dataObj.CORPTYPE = this.formEdit.getForm().findField('CONSIGNEECORPTYPE').getValue(); + + } else if (_TempType == 'F') { + var name = this.formEdit.getForm().findField('SHIPPERNAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '发货人不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('SHIPPERNAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('SHIPPERADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('SHIPPERADDR2').getValue(); + dataObj.ADDRESS3 = this.formEdit.getForm().findField('SHIPPERADDR3').getValue(); + dataObj.CITY = this.formEdit.getForm().findField('SHIPPERCITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('SHIPPERPOSTCODE').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('SHIPPERPROVINCE').getValue(); + dataObj.ATTN = this.formEdit.getForm().findField('SHIPPERATTN').getValue(); + dataObj.COUNTRY = this.formEdit.getForm().findField('SHIPPERCOUNTRY').getValue(); + dataObj.TEL = this.formEdit.getForm().findField('SHIPPERTEL').getValue(); + dataObj.HOUSENO = this.formEdit.getForm().findField('SHIPPERHOUSENO').getValue(); + dataObj.EORI = this.formEdit.getForm().findField('SHIPPEREORI').getValue(); + dataObj.CORPTYPE = this.formEdit.getForm().findField('SHIPPERCORPTYPE').getValue(); + } else if (_TempType == 'T') { + var name = this.formEdit.getForm().findField('NOTIFYPARTYNAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '通知人不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('NOTIFYPARTYNAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('NOTIFYPARTYADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('NOTIFYPARTYADDR2').getValue(); + dataObj.ADDRESS3 = this.formEdit.getForm().findField('NOTIFYPARTYADDR3').getValue(); + dataObj.CITY = this.formEdit.getForm().findField('NOTIFYPARTYCITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('NOTIFYPARTYPOSTCODE').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('NOTIFYPARTYPROVINCE').getValue(); + dataObj.ATTN = this.formEdit.getForm().findField('NOTIFYPARTYATTN').getValue(); + dataObj.COUNTRY = this.formEdit.getForm().findField('NOTIFYPARTYCOUNTRY').getValue(); + dataObj.TEL = this.formEdit.getForm().findField('NOTIFYPARTYTEL').getValue(); + dataObj.HOUSENO = this.formEdit.getForm().findField('NOTIFYPARTYHOUSENO').getValue(); + dataObj.EORI = this.formEdit.getForm().findField('NOTIFYPARTYEORI').getValue(); + dataObj.CORPTYPE = this.formEdit.getForm().findField('NOTIFYPARTYCORPTYPE').getValue(); + + } else if (_TempType == 'SE') { + var name = this.formEdit.getForm().findField('SELLERNAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '卖方名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('SELLERNAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('SELLERADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('SELLERADDR2').getValue(); + dataObj.ADDRESS3 =''; + dataObj.CITY = this.formEdit.getForm().findField('SELLERCITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('SELLEREMAIL').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('SELLERPROVINCE').getValue(); + dataObj.ATTN = this.formEdit.getForm().findField('SELLERATTN').getValue(); + dataObj.COUNTRY = this.formEdit.getForm().findField('SELLERCOUNTRY').getValue(); + dataObj.TEL = this.formEdit.getForm().findField('SELLERTEL').getValue(); + dataObj.HOUSENO = this.formEdit.getForm().findField('SELLERHOUSENO').getValue(); + dataObj.EORI = this.formEdit.getForm().findField('SELLEREORI').getValue(); + dataObj.CORPTYPE = this.formEdit.getForm().findField('SELLERCORPTYPE').getValue(); + + } else if (_TempType == 'BY') { + var name = this.formEdit.getForm().findField('BUYERNAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '买方名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('BUYERNAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('BUYERADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('BUYERADDR2').getValue(); + dataObj.ADDRESS3 = ''; + dataObj.CITY = this.formEdit.getForm().findField('BUYERCITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('BUYEREMAIL').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('BUYERPROVINCE').getValue(); + dataObj.ATTN = this.formEdit.getForm().findField('BUYERATTN').getValue(); + dataObj.COUNTRY = this.formEdit.getForm().findField('BUYERCOUNTRY').getValue(); + dataObj.TEL = this.formEdit.getForm().findField('BUYERTEL').getValue(); + dataObj.EORI = this.formEdit.getForm().findField('BUYEREORI').getValue(); + dataObj.CORPTYPE = this.formEdit.getForm().findField('BUYERCORPTYPE').getValue(); + + } else if (_TempType == 'ST') { + var name = this.formEdit.getForm().findField('SHIPTOPARTYNAME').getValue(); + if (name == null || name == '') { + Ext.Msg.show({ title: '提示', msg: '货物送达公司名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + dataObj.NAME = this.formEdit.getForm().findField('SHIPTOPARTYNAME').getValue(); + dataObj.ADDRESS = this.formEdit.getForm().findField('SHIPTOPARTYADDR1').getValue(); + dataObj.ADDRESS2 = this.formEdit.getForm().findField('SHIPTOPARTYADDR2').getValue(); + dataObj.ADDRESS3 = ''; + dataObj.CITY = this.formEdit.getForm().findField('SHIPTOPARTYCITY').getValue(); + dataObj.POSTCODE = this.formEdit.getForm().findField('SHIPTOPARTYEMAIL').getValue(); + dataObj.PROVINCE = this.formEdit.getForm().findField('SHIPTOPARTYPROVINCE').getValue(); + dataObj.ATTN = ''; + dataObj.COUNTRY = this.formEdit.getForm().findField('SHIPTOPARTYCOUNTRY').getValue(); + dataObj.TEL = ''; + + } else { + return; + } + + var datastr = Ext.JSON.encode(dataObj); + Ext.Ajax.request({ + waitMsg: '正在保存数据...', + url: '/MvcShipping/MsOpSeaeEdiTemplate/Submit?OpStatus=add', + scope: this, + params: { + data: datastr, + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.success) { + Ext.Msg.alert('提示', '模板保存成功!'); + } + } else { + Ext.Msg.show({ + title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + + + }, + + + LoadInit: function () { + + + var CARGOID = this.formHead.getForm().findField('CARGOID').getValue(); + + if (CARGOID == 'R') { + this.panelBodyDr.setVisible(false); + this.panelBodyRf.setVisible(true); + } else if (CARGOID == 'D') { + this.panelBodyDr.setVisible(true); + this.panelBodyRf.setVisible(false); + } else { + this.panelBodyDr.setVisible(false); + this.panelBodyRf.setVisible(false); + } + }, + + //#endregion + getToMonth: function () { + var now = new Date(); + var year = now.getFullYear(); //年 + var month = now.getMonth() + 1; //月 + + var clock = year + "-"; + + if (month < 10) + clock = clock + "0" + month; + else + clock = clock + month; + + return (clock); + }, + + //#region 编辑时按钮等的状态 + GetEditStatus: function () { + var canedit = false; + + // var BSSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); + // var inputby = this.formHead.getForm().findField('INPUTBY').getValue(); + + // _this = this; + // if (BSSTATUS == "0" || BSSTATUS == "1") { + // canedit = false; + // this.setSaveBtnStatus(canedit); + // } else { + // this.setSaveBtnStatus(true); + // } + + }, + + GetStringNum: function (str) { + var num = 0; + if (str == null || str == '') return num; + if (str.length == 0) return num; + var if_find = false; + var str_num = ''; + for (var i = 0; i < str.length; i += 1) { + var member = str.substr(i, 1); + if ((member == '0') || (member == '1') || (member == '2') || (member == '3') + || (member == '4') || (member == '5') || (member == '6') || (member == '7') + || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { + if (!if_find) { + str_num = str_num + member; + } + } else { + if_find = true; + } + } + return str_num; + + }, + + setBtnStatus: function (enable) { + var btnESave = Ext.getCmp('btnESave'); + var btnEAddDetail = Ext.getCmp('btnadddetail'); + + if (enable == 2) { + btnESave.setVisible(false); ; + btnEAddDetail.setVisible(false); + } else { + + btnESave.setVisible(true); ; + btnEAddDetail.setVisible(true); + + } + + }, + + setSaveBtnStatus: function (enable) { + var btnESave = Ext.getCmp('btnESave'); + var btnEAddDetail = Ext.getCmp('btnadddetail'); + + if (enable) { + btnESave.enable(); + + btnEAddDetail.enable(); + } else { + btnESave.disable(); + btnEAddDetail.disable(); + } + }, + //#endregion + + PrevRecord: function () { + + var j = this.StoreList.indexOf(this.editRecord); + if (j == 0) { + Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + + return; + } + if (j == this.StoreList.count) { + Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + + return; + + } + + + j = j - 1; + this.editRecord = this.StoreList.getAt(j); + if (this.opStatus == 'edit') { + condition = "MFNO='" + this.editRecord.get('MFNO') + "'"; + //this.storeBodyList.load({ params: { condition: condition} }); + } + this.LoadData(this.opStatus, condition); + }, + NextRecord: function () { + + + var j = this.StoreList.indexOf(this.editRecord); + + if (j == (this.StoreList.data.length - 1)) { + Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + + return; + + } + + + j = j + 1; + this.editRecord = this.StoreList.getAt(j); + if (this.opStatus == 'edit') { + condition = "MFNO='" + this.editRecord.get('MFNO') + "'"; + //this.storeBodyList.load({ params: { condition: condition} }); + } + this.LoadData(this.opStatus, condition); + }, + + + //#region 打印 + Print: function () { + /* + var basicForm = this.formEdit.getForm(); + var billNo = basicForm.findField('BillNo').value; + if (billNo == '*' || billNo == '') { + Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + return; + } + + var printType = 'MSWLBULKBS'; + var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM tMsWlBulkHead WHERE BillNo = '" + billNo + "'"; + var sql2 = ""; + var sql3 = ""; + var sql4 = ""; + var sql5 = ""; + var sql6 = ""; + + PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); + */ + } + //#endregion +}); + + diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiIndex.js index 2f9b9293..04d5b1c2 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiIndex.js @@ -243,7 +243,7 @@ Ext.extend(Shipping.MsOpSeaeEdiIndex, Ext.Panel, { this.SelectedRecord = record; this.OprationStatus = 'edit'; - DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/ENSEdit'); + DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/Edit'); // window.open('/MvcShipping/MsOpSubSeaOrder/Edit', "ORDER EDIT", 'width=1200,height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes'); }, this); diff --git a/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs b/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs index 6a72381a..9ff47aa8 100644 --- a/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs +++ b/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs @@ -435,6 +435,24 @@ namespace DSWeb.Areas.TruckMng.Controllers } } + + + public ContentResult IsSaveHYRD(string GID,string MBLNO) + { + + var ct = MsRptPcHeadEditDAL.GetRdCount("Gid<>'" + GID + "' AND PGID='" + GID + "' and MblNoSe<>'" + MBLNO + "' "); + if (ct != 0) + { + var jsonRespose = new JsonResponse { Success = false, Message = "存在分单,并且主提单号不一致!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + else + { + var jsonRespose = new JsonResponse { Success = true }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + } public ContentResult SaveHYRD(string opstatus, string data, string ctnbody, string fixbody, string fixdelbody,string createpc="0") { @@ -532,6 +550,18 @@ namespace DSWeb.Areas.TruckMng.Controllers { headData.DbOperationType = DbOperationType.DbotUpd; headData.ModelUIStatus = "E"; + if (headData.BLTYPE != "派车主票") + { + var ct = MsRptPcHeadEditDAL.GetRdCount("Gid<>'" + headData.gId + "' and PGID='" + headData.gId + "' "); + if (ct != 0) + { + isPost = false; + var jsonRespose = new JsonResponse { Success = false, Message = "存在分单,装运方式必须为派车主票,不允许保存!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + } + + } else { diff --git a/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsPcHYRDEdit.js b/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsPcHYRDEdit.js index 236e7054..012bdcb2 100644 --- a/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsPcHYRDEdit.js +++ b/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsPcHYRDEdit.js @@ -2386,18 +2386,18 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { //#endregion - + Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } - /* basicForm.findField('BillNo').setDisabled(false);*/ + /* basicForm.findField('BillNo').setDisabled(false);*/ var data = basicForm.getValues(); -/* basicForm.findField('BillNo').setDisabled(true);*/ + /* basicForm.findField('BillNo').setDisabled(true);*/ var bodyctndatas = []; //for (var i = 0; i < this.storeCtnList.getCount(); i += 1) { // var member = this.storeCtnList.getAt(i); @@ -2425,7 +2425,7 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { data: Ext.JSON.encode(data), fixbody: jsonFixBody, fixdelbody: jsonFixDelBody, - ctnbody:jsonCtnBody + ctnbody: jsonCtnBody }, callback: function (options, success, response) { if (success) { @@ -2457,7 +2457,7 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { } if (type == '0') { this.opStatus = 'edit'; - /* basicForm.findField('BillNo').setDisabled(true);*/ + /* basicForm.findField('BillNo').setDisabled(true);*/ //for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) { // var member = this.storeBodyFix.getAt(i); @@ -2476,6 +2476,9 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: LE_ID } }); this.panelFee.StoreUnit.load({ params: { bsno: LE_ID, bstype: "tMsWlPcHead" } }); this.storeBodyFix.load({ params: { billno: LE_ID } }); + if (jsonresult.Message != '保存成功') + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + } else if (type == '1') { window.close(); @@ -2486,7 +2489,8 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { - Ext.Msg.show({ title: '请重试', + Ext.Msg.show({ + title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); @@ -2494,13 +2498,10 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, { } }); - _thisPc.panelFee.onPostDetailClick(null,null,3); + _thisPc.panelFee.onPostDetailClick(null, null, 3); }, //end save - - - getCustName: function () { var custName = this.formEdit.getForm().findField('CustName'); return custName.getValue(); diff --git a/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsWlPcEdit.js b/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsWlPcEdit.js index 0e59e089..6d52ddbe 100644 --- a/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsWlPcEdit.js +++ b/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/MsWlPcEdit.js @@ -1677,8 +1677,8 @@ Ext.extend(DsTruck.MsWlPcEdit, Ext.Panel, { // member.commit(); // }; let gid = this.editRecord.get('GId'); - let billno = this.editRecord.get('BillNo') - this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } }); + this.storeBodyChFee.load({ params: { billno: gid } }); +/* this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });*/ } else if (type == '1') { diff --git a/DSWeb/DSWeb.csproj b/DSWeb/DSWeb.csproj index 3c1cbaa0..a1ef1df2 100644 --- a/DSWeb/DSWeb.csproj +++ b/DSWeb/DSWeb.csproj @@ -2495,6 +2495,8 @@ + + @@ -3688,6 +3690,7 @@ + diff --git a/JobSendAgentMail/JobSendAgentMail.csproj b/JobSendAgentMail/JobSendAgentMail.csproj index 40a31ce2..064eee9e 100644 --- a/JobSendAgentMail/JobSendAgentMail.csproj +++ b/JobSendAgentMail/JobSendAgentMail.csproj @@ -84,6 +84,7 @@ + diff --git a/JobSendAgentMail/JobSendArrivalNotice.cs b/JobSendAgentMail/JobSendArrivalNotice.cs new file mode 100644 index 00000000..06019862 --- /dev/null +++ b/JobSendAgentMail/JobSendArrivalNotice.cs @@ -0,0 +1,195 @@ +using log4net; +using Quartz; +using System; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using MailKit.Net.Smtp; +using MimeKit; +using HtmlAgilityPack; + + +namespace JobSendAgentMail +{ + public class JobSendArrivalNotice : IJob + { + private ILog log = LogManager.GetLogger(typeof(JobSendArrivalNotice)); + + public void Execute(IJobExecutionContext context) + { + + string connStr = context.JobDetail.JobDataMap.GetString("ConnectString"); + string querySql = context.JobDetail.JobDataMap.GetString("QuerySql"); + string DocType = context.JobDetail.JobDataMap.GetString("DocType"); + string D7FilePath = context.JobDetail.JobDataMap.GetString("D7FilePath"); + string MAILSENDACCOUNT = context.JobDetail.JobDataMap.GetString("MAILSENDACCOUNT"); + string MAILSENDPASSWORD = context.JobDetail.JobDataMap.GetString("MAILSENDPASSWORD"); + string MAILSENDSERVICE = context.JobDetail.JobDataMap.GetString("MAILSENDSERVICE"); + string MAILSENDPORT = context.JobDetail.JobDataMap.GetString("MAILSENDPORT"); + string MAILISSSL = context.JobDetail.JobDataMap.GetString("MAILISSSL"); + string MAILTEMPLATE = context.JobDetail.JobDataMap.GetString("MAILTEMPLATE"); + string MAILTITLEJOB = context.JobDetail.JobDataMap.GetString("MAILTITLE"); + log.Debug($"开始执行发送邮件"); + using (SqlConnection dbcon = new SqlConnection(connStr)) + { + SqlDataAdapter adapter = new SqlDataAdapter(querySql, dbcon); + DataTable table = new DataTable(); + adapter.Fill(table); + if (table.Columns.Contains("EMAIL")) + { + if (table.Rows.Count > 0) + { + + foreach (DataRow row in table.Rows) + { + if (row["EMAIL"].ToString() != "") + { + + var htmlFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, MAILTEMPLATE); + var content = File.ReadAllText(htmlFile); + + //var REMARKSTR = row["BLREMARK"].ToString(); + + //REMARKSTR = REMARKSTR.Replace("\r\n", "
"); + //REMARKSTR = REMARKSTR.Replace("\n", "
"); + //REMARKSTR = REMARKSTR.Replace("\r", ""); + //content = content.Replace("$MBLNO$", row["MBLNO"].ToString()); + //content = content.Replace("$ETD$", row["ETD"].ToString()); + //content = content.Replace("$BLFRT$", row["BLFRT"].ToString()); + //content = content.Replace("$PORTLOAD$", row["PORTLOAD"].ToString()); + //content = content.Replace("$PORTDISCHARGE$", row["PORTDISCHARGE"].ToString()); + //content = content.Replace("$DESTINATION$", row["DESTINATION"].ToString()); + //content = content.Replace("$ATD$", row["ATD"].ToString()); + //content = content.Replace("$HBLNO$", row["HBLNO"].ToString()); + //content = content.Replace("$ORDERNO$", row["ORDERNO"].ToString()); + //content = content.Replace("$ETA$", row["ETA"].ToString()); + //content = content.Replace("$CNTRTOTAL$", row["CNTRTOTAL"].ToString()); + //content = content.Replace("$CARRIERID$", row["CARRIERID"].ToString()); + //content = content.Replace("$ISSUETYPE$", row["ISSUETYPE"].ToString()); + //content = content.Replace("$BLREMARK$", REMARKSTR); + + var MAILTITLE = MAILTITLEJOB; + MAILTITLE = MAILTITLE.Replace("$MBLNO$", row["MBLNO"].ToString()); + MAILTITLE = MAILTITLE.Replace("$HBLNO$", row["HBLNO"].ToString()); + MAILTITLE = MAILTITLE.Replace("$ETA$", row["ETA"].ToString()); + MAILTITLE = MAILTITLE.Replace("$VESSEL$", row["VESSEL"].ToString()); + MAILTITLE = MAILTITLE.Replace("$VOYNO$", row["VOYNO"].ToString()); + + StringWriter writer = new StringWriter(); + HtmlDocument htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(content); + htmlDoc.Save(writer); + string str = writer.ToString(); + try + { + var message = new MimeMessage(); + message.From.Add(new MailboxAddress(row["OPNAME"].ToString(), row["OPEMAIL"].ToString())); + var maillist = row["EMAIL"].ToString().Split(';'); + foreach (var mailaddr in maillist) + { + message.To.Add(MailboxAddress.Parse(mailaddr)); + } + // message.To.Add(MailboxAddress.Parse(row["OPEMAIL"].ToString())); +// message.Subject = "Pre-alert/" + row["ORDERNO"].ToString() + "/" + row["HBLNO"].ToString(); + message.Subject = MAILTITLE; + var html = new TextPart("html") + { + Text = str + }; + MimeEntity entity = html; + + //SendEmail se = new SendEmail(row["AGENTEMAIL"].ToString(), row["OPEMAIL"].ToString(), "", row["OPNAME"].ToString(), "Pre-alert/" + row["ORDERNO"].ToString() + "/" + row["HBLNO"].ToString(), str,true); + + + SqlDataAdapter fileadapter = new SqlDataAdapter("SELECT * FROM Receipt_Doc where RECEIPTTYPE='" + DocType + "' and BSNO='" + row["BSNO"].ToString() + "'", dbcon); + DataTable filetable = new DataTable(); + fileadapter.Fill(filetable); + if (filetable.Rows.Count > 0) + { + var mult = new Multipart("mixed") { html }; + foreach (DataRow filerow in filetable.Rows) + { + var attfile = filerow["Driect_URL"].ToString(); + if (!string.IsNullOrEmpty(attfile)) + { + attfile = attfile.Replace("../../", D7FilePath); + while ((attfile.IndexOf("/") >= 0)) + { + attfile = attfile.Replace("/", @"\"); + } + + if (File.Exists(attfile)) + { + + var tmpDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "temp"); + if (!Directory.Exists(tmpDir)) + { + Directory.CreateDirectory(tmpDir); + } + var tmpFile = Path.Combine(tmpDir, filerow["URL"].ToString()); + File.Copy(attfile, tmpFile, true); + + var attPart = new MimePart(); + attPart.Content = new MimeContent(new FileStream(attfile, FileMode.Open)); + attPart.ContentDisposition = new ContentDisposition(ContentDisposition.Attachment); + attPart.FileName = filerow["URL"].ToString(); + + mult.Add(attPart); + //se.Attachments(attfile); + + } + else + { + log.Debug($"附件文件:{attfile}不存在"); + // logger.Error($"邮件{sendMail.GID}的附件文件{att.FilePath}不存在"); + } + } + } + entity = mult; + } + + //se.SetSmtp(MAILSENDACCOUNT, MAILSENDPASSWORD, MAILSENDSERVICE, Convert.ToInt16(MAILSENDPORT), Convert.ToBoolean(MAILISSSL), System.Net.Mail.MailPriority.Normal); //必须在所有参数设置完后调用此方法 + + message.Body = entity; + using (var client = new SmtpClient()) + { + client.Connect(MAILSENDSERVICE, Convert.ToInt16(MAILSENDPORT), Convert.ToBoolean(MAILISSSL)); + client.Authenticate(MAILSENDACCOUNT, MAILSENDPASSWORD); + client.Send(message); + client.Disconnect(true); + } + log.Debug($"邮件发送成功"); + + + } + catch (Exception ex) + { + log.Debug($"邮件发送失败:错误信息{ex.Message}"); + + } + + + } + else { + log.Debug($"资料不全:{row["BSNO"].ToString()}"); + + } + } + + + } + else + { + log.Debug($"未查询到数据,SQL语句:{querySql}"); + } + } + else + { + log.Error($"未包含所需的列(mblno,carrierid,portloadid),SQL语句:{querySql}"); + } + } + } + } +}