Ext.namespace('Shipping'); Shipping.FenBillList = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.FenBillList.superclass.constructor.call(this); }; Ext.extend(Shipping.FenBillList, Ext.Panel, { ParentWin: null, OpStatus: 'add', EditRecord: null, StoreList: null, region: 'north', BsNo: '', FenBsNo:'', OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { this.formHead = Ext.widget('form', { frame: true, title: "主票信息", region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ { xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: '委托编号', readOnly: true, name: 'CUSTNO' }, { fieldLabel: '主提单号', readOnly: true, name: 'MBLNO' }, { fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '箱型箱量', readOnly: true, name: 'CNTRTOTAL' }, { fieldLabel: '付费方式', readOnly: true, name: 'BLFRT' }, { fieldLabel: 'MBL付费方式', readOnly: true, name: 'MBLFRT' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '船名', readOnly: true, name: 'VESSEL' }, { fieldLabel: '航次', readOnly: true, name: 'VOYNO' }, { fieldLabel: '开船日期', readOnly: true, name: 'ETD' }, { fieldLabel: '装货港', readOnly: true, name: 'PORTLOAD' }, { fieldLabel: '卸货港', readOnly: true, name: 'PORTDISCHARGE' }, { fieldLabel: '船公司', readOnly: true, name: 'CARRIER' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '件数', readOnly: true, name: 'PKGS' }, { fieldLabel: '包装', readOnly: true, name: 'KINGPKGS' }, { fieldLabel: '毛重', readOnly: true, name: 'KGS' }, { fieldLabel: '尺码', readOnly: true, name: 'CBM' }, { fieldLabel: '国外代理', readOnly: true, name: 'AGENTID' }, { fieldLabel: '箱封号', readOnly: true, name: 'CNTRSEALNO' } ] } ] }] }); //end this.formEdit //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnEPrev', text: "上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: "下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }, '-', { text: "导出", iconCls: "btnexportexcel", menu: [ { text: "中远舱单EXCEL", handler: function (menu, event) { _thisfenlist.ExpCosco(); } }], scope: this }] }); //end 按钮Toolbar //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 160, items: [this.panelBtn, this.formHead] }); _thisfenlist = this; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOrderManagement"} }); //#region 分票列表 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpSeaeModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeae/GetFenList', reader: { id: 'BsNo', root: 'data', totalProperty: 'totalCount' } } }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeOpCode, forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName' }); this.storeFrt = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_FRT', proxy: { url: '/CommMng/BasicDataRef/GetCodeFrtList' } }); this.storeFrt.load({ params: { condition: ""} }); this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFrt, forceSelection: true, valueField: 'FRT', displayField: 'FRT' }); 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, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCodeDisport, name: 'DESTINATION', valueField: 'PORT', displayField: 'PORT' }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selModel: this.GridCheckBoxModel, selType: 'cellmodel', tbar: [{ text: '添加分票', tooltip: '添加分票', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { text: '保存分票', tooltip: '保存分票', iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(button, event); }, scope: this }, '-', { text: '删除分票', tooltip: '删除分票', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this }, '-', { text: '委托信息', tooltip: '委托信息', handler: function (button, event) { var selectedRecords = this.GridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要编辑的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var rec = selectedRecords[0]; this.SelectedRecord = rec; this.OprationStatus = 'edit'; // DsOpenEditWin('/MvcShipping/MsOpSeae/FenEdit', "分票信息"); DsOpenEditWin('/MvcShipping/MsOpSeae/Edit', "分票信息"); }, scope: this }, '-', { text: '费用信息', tooltip: '费用信息', handler: function (button, event) { _thisfenlist.onFenFeeEditClick(button, event); }, scope: this }, '-', { text: '提单信息', tooltip: '提单信息', handler: function (button, event) { // this.onPostDetailClick(button, event); }, scope: this }, '-', { text: '业务函电', tooltip: '业务函电', handler: function (button, event) { // this.onPostDetailClick(button, event); }, scope: this }, '-', { text: '历史引入', tooltip: '历史引入', handler: function (button, event) { DsOpenEditWin('/MvcShipping/MsOpSeae/HistryFenIndex', "拼箱历史引入", "600", "940", "10", "10"); }, scope: this }], columns: [{ sortable: true, dataIndex: 'MASTERNO', header: '主编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 0 }, { dataIndex: 'MBLNO', header: '主提单号', width: 130, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'HBLNO', header: '分提单号', width: 130, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120, editor: this.comboxCustCode }, { dataIndex: 'SALE', header: '销售', width: 70, editor: this.comboxSALE }, { sortable: true, dataIndex: 'PKGS', header: '件数', width: 80, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KINDPKGS', header: '包装', width: 100, editor: this.comboxKINDPKGS }, { dataIndex: 'KGS', header: '重量', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: '尺码', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'BLFRT', header: '付费方式', width: 120, editor: this.comboxBLFRT }, { dataIndex: 'DESTINATION', header: '目的地', width: 140, editor: this.comboxDESTINATION }, { dataIndex: 'PLACEDELIVERY', header: '交货地', width: 140, editor: this.comboxDESTINATION }, { dataIndex: 'GOODSNAME', header: '品名', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'HSCODE', header: 'HSCODE', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CUSTNO', header: '委托编号', width: 130 }] }); //#endregion //#region 分票集装箱明细 this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodePackageModel', proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } }); this.storeCodePackage.load(); this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '件数包装', store: this.storeCodePackage, // forceSelection: true, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); this.storeBodyListCtn = Ext.create('Ext.data.Store', { model: 'MsOpSeaeDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeae/GetBodyList', reader: { id: 'BSNO,CTNCODE,CTN_ID', root: 'data', totalProperty: 'totalCount' } } }); this.comboxCTNNO = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeBodyListCtn, name: 'CTNNO', valueField: 'CTN_ID', flex: 1, displayField: 'CNTRNO' }); this.storeBodyFenCtn = Ext.create('Ext.data.Store', { model: 'MsOpSeaeDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeae/GetFenCtnList', reader: { id: 'BSNO,CTN_ID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListFenCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListFenCtn = new Ext.grid.GridPanel({ store: this.storeBodyFenCtn, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListFenCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddFenCtnDetailClick(button, event); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFenCtnDetailClick(button, event); }, scope: this }, '-', { text: '保存明细', tooltip: '保存明细', iconCls: "btnsave", handler: function (button, event) { this.onPostFenCtnDetailClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 0 }, { dataIndex: 'CTN_ID', header: '箱号', width: 100, editor: this.comboxCTNNO, renderer: function (value, p, record) { return record.data.CNTRNO; }, }, { dataIndex: 'CTNALL', header: '箱型', width: 48 }, { dataIndex: 'SEALNO', header: '封号', width: 65 }, { sortable: true, dataIndex: 'PKGS', header: '件数', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KINDPKGS', header: '包装', width: 70, editor: this.comboxKINDPKGS_CTN }, { dataIndex: 'KGS', header: '重量', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: '尺码', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 150 }] }); this.panelBodyFenCtn = new Ext.Panel({ title: '分票装箱信息', layout: "border", region: 'center', //margin: '5 10', frame: true, items: [this.gridListFenCtn] }); this.gridListFenCtn.on('edit', function (editor, e, eOpts) { this.gridListFenAfterEdit(editor, e, eOpts); }, this); //#endregion //#region 合计列表 this.SumField = [ { name: 'NOBILL', type: 'number' }, { name: 'KGS', type: 'number' }, { name: 'PKGS', type: 'number' }, { name: 'CBM', type: 'number' } ]; this.storeSumList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: this.SumField, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeae/GetDataListSum', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolumsSum = [{ sortable: true, dataIndex: 'NOBILL', header: '票数', align: 'right', width: 60 }, { sortable: true, dataIndex: 'PKGS', header: '件数', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'KGS', header: '毛重', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'CBM', header: '尺码', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 60 } ]; this.gridListSum = new Ext.grid.GridPanel({ store: this.storeSumList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolumsSum }); this.panelSum = new Ext.Panel({ title: '分票合计', layout: "border", width: 280, region: 'west', margin: '0 0', frame: true, items: [this.gridListSum] }); //#endregion this.panelBodysouth = new Ext.Panel({ layout: "border", height: 160, region: 'south', //margin: '5 10', frame: true, items: [this.panelSum,this.panelBodyFenCtn] }); this.gridList.on('edit', function (editor, e, eOpts) { this.gridListAfterEdit(editor, e, eOpts); }, this); this.gridListCellEditing.on('beforeedit', function (editor, e) { return this.cellEditingBeforeEdit(editor, e); }, this); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsOpSeae/FenEdit', "分票信息"); }, this); this.gridList.getSelectionModel().on('select', function (model, record, index) { var drmodify = this.storeBodyFenCtn.getModifiedRecords(); if (drmodify.length != 0) _thisfenlist.onPostFenCtnDetailClick(); _thisfenlist.FenBsNo=record.data.BSNO; var sql = ""; sql = " f.BSNO='"+record.data.BSNO+"'"; this.storeBodyFenCtn.load({ params: { condition: sql} }); }, this); this.panelBody = new Ext.Panel({ title: '分票信息', region: 'center', layout: "border", frame: true, items: [this.gridList, this.panelBodysouth] }); Ext.apply(this, { items: [this.panelTop, this.panelBody] }); this.storeBodyList.on('beforeload', function (store) { var sql = " MASTERNO='" + this.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeBodyFenCtn.on('beforeload', function (store) { var sql = " f.BSNO='" +_thisfenlist.FenBsNo + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); parentWin = window.parent.opener; this.InitData(); this.formDownloadShow = Ext.widget('form', { frame: true, region: 'center', 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', id: 'downloadfile', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '', width: 120, text: '' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); me = this; this.winDownloadShow = Ext.create('Ext.window.Window', { title: "下载文件", width: 450, 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.formDownloadShow], buttons: [{ text: "关闭", minWidth: 70, handler: function () { me.winDownloadShow.close(); } }] }); }, //#region 加载事件 InitData: function () { this.opStatus = 'add'; var condition = ''; _this = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.EditRecord = ret[2]; } this.BsNo = this.EditRecord.get('BSNO'); condition = " MASTERNO='" + this.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO"; this.LoadData(); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.storeOpCode.load(); this.storeCodeDisport.load(); this.storeBodyList.load({ params: { condition: condition} }); this.storeSumList.load({ params: { condition: condition} }); this.storeBodyListCtn.load({ params: { condition: " BSNO='" + this.BsNo + "'"} }); }, //end InitData LoadData: function () { this.formHead.getForm().loadRecord(this.EditRecord); }, // end LoadDate 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); this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); }, NextRecord: function () { var j = this.StoreList.indexOf(this.EditRecord); if (j == (this.StoreList.count - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } j = j + 1; this.EditRecord = this.StoreList.getAt(j); this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); }, onNextKeyClick: function (col) { var rows = this.gridList.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridList.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridList.getStore().getCount()) { this.onAddDetailClick(s, event); } else { this.gridListCellEditing.startEditByPosition({ row: number, column: col }); } }, onAddDetailClick: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var store = null; store = this.storeBodyList; var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); var record = null; record = Ext.create('MsOpSeaeModel', { BSNO: 'topseae' + NewGuid(), ORDERTYPE: '操作录入', MASTERNO: '*', CUSTNO: '', MBLNO: this.EditRecord.get('MBLNO'), HBLNO: '', BSSTATUS: false, FEESTATUS: false, BSSTATUSREF: '未锁定', FEESTATUSREF: '未锁定', ACCDATE: this.EditRecord.get('ACCDATE'), BSDATE: mydatestr, INPUTBY: SHOWNAME, OP: SHOWNAME, CUSTSERVICE: SHOWNAME, VESSEL: this.EditRecord.get('VESSEL'), VESSELID: this.EditRecord.get('VESSELID'), VOYNO: this.EditRecord.get('VOYNO'), ETD: this.EditRecord.get('ETD'), PORTLOADID: this.EditRecord.get('PORTLOADID'), PORTLOAD: this.EditRecord.get('PORTLOAD'), PORTDISCHARGEID: this.EditRecord.get('PORTDISCHARGEID'), PORTDISCHARGE: this.EditRecord.get('PORTDISCHARGE'), BLTYPE: '拼箱分票', AGENTID: this.EditRecord.get('AGENTID'), AGENT: this.EditRecord.get('AGENT'), YARD: this.EditRecord.get('YARD'), ETA: this.EditRecord.get('ETA'), CLOSINGDATE: this.EditRecord.get('CLOSINGDATE'), PLACEDELIVERYID: this.EditRecord.get('PLACEDELIVERYID'), PLACEDELIVERY: this.EditRecord.get('PLACEDELIVERY'), DESTINATIONID: this.EditRecord.get('DESTINATIONID'), DESTINATION: this.EditRecord.get('DESTINATION'), BLFRT: 'FREIGHT PREPAID', SERVICE: 'FCL-FCL', LANE: this.EditRecord.get('LANE'), FORWARDER: this.EditRecord.get('FORWARDER'), CARRIER: this.EditRecord.get('CARRIER'), KINGPKGS: 'CTNS', CARGOID: 'S', PKGS: 0, KGS: 0, CBM: 0, CNTR1: 0, CNTR2: 0, CNTR3: 0, CNTR4: 0, CNTR5: 0, CNTR6: 0, CNTR7: 0, CNTR8: 0, CNTR9: 0, CNTR10: 0, OTCNTR: 0, TEU: 0, CUSTOMSNUM: 0, INAMOUT: 0, ISVOU: false, ISCONTAINERSOC: false }); store.add(record); var editColumnIndex = 0; var cellediting = this.gridListCellEditing; editColumnIndex = 3; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex }); }, onPostDetailClick: function (button, event) { var bodyDatas = []; var i; for (i = 0; i < this.storeBodyList.getCount(); i += 1) { var memberyf = this.storeBodyList.getAt(i); bodyDatas.push(memberyf); }; var jsonBody = ConvertRecordsToJsonAll(bodyDatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpSeae/SaveFen', scope: this, params: { bsno: _thisfenlist.BsNo, fenbody: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); member.set("MASTERNO", _thisfenlist.BsNo); member.commit(); } } 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 onDelDetailClick: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.GridCheckBoxModel.selected.items; var candelete = this.CheckDelete(selectedRecords); if (candelete == false) return; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyDatas = []; Ext.MessageBox.confirm('提示', '确定要删除选中的分票吗?', function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.MASTERNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList.remove(selectedRecords[i]); } else { bodyDatas.push(rec); var feeGId = "'" + rec.data.BSNO + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } var jsonBody = ConvertRecordsToJsonAll(bodyDatas); _thisfenlist = this; Ext.Msg.wait('正在删除数据...'); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpSeae/DeleteFen', params: { bsno: _thisfenlist.BsNo, fenbody: jsonBody }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeBodyList.load({ params: { condition: " MASTERNO='" + _thisfenlist.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO"} }); 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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); }, getAllowOperationDetail: function () { var BsStatus = this.EditRecord.get('BSSTATUS'); if (BsStatus == '0') return true; else { Ext.Msg.show({ title: '错误', msg: "此票主票已业务锁定,不允许操作分票!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return false; } }, CheckDelete: function (records) { for (var i = 0; i < records.length; i++) { var rec = records[i]; var BsStatus = rec.data.BSSTATUS; if (BsStatus == true) { Ext.Msg.show({ title: '提示', msg: '已业务锁定无法修改或删除!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return false; } if (BsStatus != true) { var op = rec.data.OP; var inputby = rec.data.INPUTBY; var records = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return false; } } if (canedit == false) { Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return false; } } } }, cellEditingBeforeEdit: function (editor, e) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var chfeefeeStatus = e.record.get('BSSTATUS'); var canedit = chfeefeeStatus != true; if (canedit) { var op = e.record.get('OP'); var inputby = e.record.get('INPUTBY'); var records = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canedit = false; } } } return canedit; }, gridListAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'CUSTOMERNAME') { var records = DsStoreQueryBy(this.storeCustCode, 'CustName', e.value); if (records.getCount() > 0) { var data = records.getAt(0).data; e.record.set('SALE', data.SALE); } } else if (e.field == 'PKGS') { var PKGS = e.value; var KINDPKGS = e.record.data['KINDPKGS']; e.record.set('NOPKGS', PKGS + KINDPKGS); e.record.set('TOTALNO', 'SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.'); this.calcDetailTotal(); } else if (e.field == 'KINDPKGS') { var PKGS = e.record.data['PKGS']; var KINDPKGS = e.value e.record.set('NOPKGS', PKGS + KINDPKGS); e.record.set('TOTALNO', 'SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.'); } else if (e.field == 'DESTINATION') { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('DESTINATIONID', selectdata.EDICODE); } else { e.record.set('DESTINATIONID', ''); } } else if (e.field == 'PLACEDELIVERY') { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('PLACEDELIVERYID', selectdata.EDICODE); } else { e.record.set('PLACEDELIVERYID', ''); } } else if (e.field == 'BLFRT') { if (e.value == "FREIGHT PREPAID") { var portload = e.record.data['PORTLOAD']; e.record.set('PREPARDAT', portload); e.record.set('PAYABLEAT', ''); } else if (e.value == "FREIGHT COLLECT") { var PORTDISCHARGE = e.record.data['PORTDISCHARGE']; e.record.set('PREPARDAT', ''); e.record.set('PAYABLEAT', PORTDISCHARGE); } } else if (e.field == 'CBM') { e.record.set('MEASUREMENT', e.value + 'CBM'); this.calcDetailTotal(); } else if (e.field == 'KGS') { e.record.set('GROSSWEIGHT', e.value + 'KGS'); this.calcDetailTotal(); } }, calcDetailTotal: function () { var blcount = 0; var ttlpkgs = 0; var ttlkgs = 0; var ttlcbm = 0; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var PKGS = member.get('PKGS'); var KGS = member.get('KGS'); var CBM = member.get('CBM'); ttlpkgs = Add(parseFloat(ttlpkgs), PKGS); ttlkgs = Add(parseFloat(ttlkgs), KGS); ttlcbm = Add(parseFloat(ttlcbm), CBM); blcount = blcount + 1; } var memberyf = this.storeSumList.getAt(0); memberyf.set("NOBILL", blcount); memberyf.set("PKGS", ttlpkgs); memberyf.set("KGS", ttlkgs); memberyf.set("CBM", ttlcbm); memberyf.commit(); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeBodyList; ret[2] = this.SelectedRecord; ret[3] = this.EditRecord; return ret; }, onFenFeeEditClick: function (menu, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsOpSeae/PiLiangFenFee', '分票费用'); }, //#region 分票集装箱操作 gridListFenAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'CTN_ID') { var selectrecords = DsStoreQueryBy(this.storeBodyListCtn, 'CTN_ID', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('CTNALL', selectdata.CTNALL); e.record.set('CNTRNO', selectdata.CNTRNO); e.record.set('SEALNO', selectdata.SEALNO); } else { e.record.set('CTNALL', ''); e.record.set('CNTRNO', ''); e.record.set('SEALNO', ''); } } }, onAddFenCtnDetailClick: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } if (this.storeBodyListCtn.getCount() == 0) { Ext.Msg.show({ title: '提示', msg: '主票不存在集装箱信息,请先维护主票集装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var recordctn =this.storeBodyListCtn.getAt(0); if (this.storeBodyList.getCount() == 0) { Ext.Msg.show({ title: '提示', msg: '不存在分票信息,不能添加分票集装箱!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要添加集装箱信息的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.BSNO=='*'){ Ext.Msg.show({ title: '提示', msg: '分票没有保存,无法添加分票装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = Ext.create('MsOpSeaeDetail', { GID:NewGuid(), CTN_ID:recordctn.data.CTN_ID, MASTERNO:'*', BSNO: record.data.BSNO, CTNCODE:0, CTNALL: recordctn.data.CTNALL, CNTRNO:recordctn.data.CNTRNO, SEALNO:recordctn.data.SEALNO, PKGS:record.data.PKGS, KINDPKGS:record.data.KINDPKGS, KGS:record.data.KGS, TAREWEIGHT: 0, CBM: record.data.CBM, REMARK: '' }); this.storeBodyFenCtn.add(record); var n = this.storeBodyFenCtn.getCount(); this.gridListFenCellEditing.startEditByPosition({ row: n - 1, column: 3 }); }, onPostFenCtnDetailClick: function (button, event) { var bodyDatas = []; var i; for (i = 0; i < this.storeBodyFenCtn.getCount(); i += 1) { var memberyf = this.storeBodyFenCtn.getAt(i); bodyDatas.push(memberyf); }; var jsonBody = ConvertRecordsToJsonAll(bodyDatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpSeae/SaveFenCtn', scope: this, params: { bsno: _thisfenlist.BsNo, fenbody: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < this.storeBodyFenCtn.getCount(); i += 1) { var member = this.storeBodyFenCtn.getAt(i); member.set("MASTERNO", _thisfenlist.BsNo); member.commit(); } } 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 onDelFenCtnDetailClick: function (button, event) { var allow = this.getAllowOperationDetail(); if (allow == false) { return; } var selectedRecords = this.gridListFenCtn.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.MASTERNO == "" || rec.data.MASTERNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyFenCtn.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpSeae/DeleteFenCtn', 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.storeBodyFenCtn.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 ExpCosco: function () { var bodyDatas = []; var i; for (i = 0; i < this.storeBodyList.getCount(); i += 1) { var memberyf = this.storeBodyList.getAt(i); bodyDatas.push(memberyf); }; var jsonBody = ConvertRecordsToJsonAll(bodyDatas); var strlo = window.location.host; _this = this; Ext.Msg.wait('正在导出...'); Ext.Ajax.request({ waitMsg: 'Changing...', url: '/MvcShipping/MsOpSeae/SaveCoscoExcel', params: { mbill: _this.EditRecord.get('BSNO'), fenbody: jsonBody }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); Ext.Msg.close( ); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { var downloadfile = Ext.getCmp('downloadfile'); var children = downloadfile.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { downloadfile.remove(children.items[i], true); } } var downloadfiles = '' + result.Message + ''; var htmla = Ext.widget('label', { html: downloadfiles, width: 120, text: '' }); downloadfile.items.add(htmla); this.winDownloadShow.show(); } } else { Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); }, Print: function () { var printType = 'MSOPSEAEFENLIST'; var sql1 = "select * from op_seae WHERE BSNO='" + this.BsNo + "'"; var sql2 = "select * from op_seae where MASTERNO='" + this.BsNo + "' AND BSNO<>MASTERNO ORDER BY HBLNO"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });