Ext.namespace('Shipping'); Shipping.MsOpCtnrDynaIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnrDynaIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnrDynaIndex, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, EditRecord: null, //用于从主界面获取 BSNo: '', PageSize: 50, initUIComponents: function () { this.formname = 'MsOpCtnrDynaList'; this.sqlcontext = ''; this.ctncontext = ''; this.ctnport = getUrlParam('ctnport'); this.ctnyard = getUrlParam('ctnyard'); this.ctnstatus = getUrlParam('ctnstatus'); this.ctnisstop = getUrlParam('ctnisstop'); _this = this; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'CtnrDyDetail', pageSize: this.PageSize, // autoLoad: { start: 0, limit: 30 }, remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnr/GetDynaList', reader: { id: 'CTNGID', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.columns = [ { sortable: true, //1 dataIndex: 'GID', header: '惟一编号', width: 80, hidden: true }, { sortable: true, id: '', dataIndex: 'BSSTATUSREF', header: '业务锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, id: '', dataIndex: 'FEESTATUSREF', header: '费用锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, id: '', dataIndex: 'DRFEESTATUS', header: '应收费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, id: '', dataIndex: 'CRFEESTATUS', header: '应付费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, //1 dataIndex: 'CTNGID', header: '箱号', width: 60, hidden: true }, { sortable: true, //1 dataIndex: 'CNTRNO', header: '箱号' }, { sortable: true, dataIndex: 'CTNEFREF', header: '空重', width: 60 }, { sortable: true, dataIndex: 'CTNSTATUS', header: '箱动态', width: 80 }, { sortable: true, dataIndex: 'CTNSTATUSTIME', header: '动态时间', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'PORT', header: '当前港口', width: 100 }, { sortable: true, dataIndex: 'YARD', header: '当前场站', width: 80 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 80 }, { sortable: true, dataIndex: 'ETA', header: '到港日期', width: 80 }, { sortable: true, dataIndex: 'AGENTNAME', header: '目的港代理', width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 60 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'HBLNO', header: '分提单号', width: 100 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 200 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 120 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 60 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运港', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_STATOIN', header: '起运港场站', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_CNT_TIME', header: '起运港提箱日期', width: 80 }, { sortable: true, dataIndex: 'DESTPORT', header: '目的港', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_STATOIN', header: '目的港场站', width: 100 }, { sortable: true, dataIndex: 'DEST_CNT_TIME', header: '目的港提箱日期', width: 100 }, { sortable: true, dataIndex: 'DEST_RTCNT_TIME', header: '目的港还箱日期', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_FREE_DAYS', header: '起运港免箱使天数', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS', header: '起运港超期天数', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS_FEE', header: '起运港箱使费/天', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD_OVER_DAYS_AMT', header: '起运港箱使费', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_FREE_DAYS', header: '目的港免箱使天数', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS', header: '目的港超期天数', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS_FEE', header: '目的港箱使费/天', width: 100 }, { sortable: true, dataIndex: 'DESTPORT_OVER_DAYS_AMT', header: '目的港箱使费', width: 100 }, { sortable: true, dataIndex: 'CREATEBSFEEREF', header: '生成业务费用', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 160 } ]; this.girdcolums = this.columns; this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数',//每页记录数 labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', columnLines: true, selModel: this.GridCheckBoxModel, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolums, viewConfig: { enableTextSelection: true, autoFill: true }, bbar:[Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; var openSet = "height=800, width=1200, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 800) / 2 + ",Left= " + (screen.width - 1200) / 2 var openType = record.data.GID; var openUrl = "/MvcContainer/MsOpCtnr/DynaEdit"; window.open(openUrl, openType, openSet); }, this); this.panelCenter = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridList] }); this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); //#region formSearch this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.storeCodeLoadport.load(); this.comboxPORT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '当前港口', store: this.storeCodeLoadport, //forceSelection: true, id: 'PORT', name: 'PORT', valueField: 'PORT', displayField: 'CodeAndName', matchFieldWidth: false //下拉款自适应宽度 }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', flex: 1, defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '单号', name: 'BILLNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '箱号', name: 'CNTRNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxPORT, { fieldLabel: '租买时间(从)', name: 'BSDATE', format: 'Y-m-d', labelWidth: 90, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '租买时间(到)', labelWidth: 90, name: 'BSDATETO', format: 'Y-m-d', xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 _this = this; this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: '新建', iconCls: "btnadd", handler: function (menu, event) { _this.OprationStatus = 'add'; var openSet = "height=800, width=1200, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 800) / 2 + ",Left= " + (screen.width - 1200) / 2 var openType = ""; var openUrl = "/MvcContainer/MsOpCtnr/DynaEdit"; window.open(openUrl, openType, openSet); }, scope: this }, '-', { text: "删除", iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { // id: "saveandclose", text: "EXCEL导入动态", iconCls: "btnexportexcel", handler: function (button, event) { this.onImportCtnClick(); }, scope: this }, '-', { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, '-', { text: "批量箱号查询", iconCls: "btnrefresh", handler: function (button, event) { this.formCntrList.getForm().findField('CNTRNOLIST').setValue(''); this.winCntrListShow.show(); }, scope: this }, '-', { text: '批量更新箱动态', iconCls: "btnadd", handler: function (menu, event) { var records = this.GridCheckBoxModel.selected.items; if (records.length == 0) { Ext.Msg.show({ title: '提示', msg: '请选择箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要修改的业务! return; } _this.winModifyShow.show(); }, scope: this }, '-', { text: "生成费用到相关业务", handler: function (button, event) { this.onCreateBsFeeClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "保存列表样式", menu: [{ text: "保存", handler: function (button, event) { _this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列 } }, { text: "初始化", handler: function (menu, event) { _this.gridList.reconfigure(_this.storeList, _this.columns); _this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id,表名,中间column数组,跳过一开始的几列 } }], scope: this }, { text: "打印", //"打印", iconCls: 'btnprint', menu: [ { text: "全部", //"全部", handler: function (menu, event) { _this.onPrintClick(); } }, { text: "选择打印", //"选择打印", handler: function (menu, event) { _this.PrintSelect(); } }], scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.panelCenter] }); if (this.ctnport != undefined) { this.sqlcontext = " ISNULL(s.PORT,'')='" + this.ctnport + "' and ISNULL(s.YARD,'')='" + this.ctnyard + "' and ISNULL(s.CTNSTATUS,'')='" + this.ctnstatus + "' AND (ISNULL(C.ISSTOP,0)=" + this.ctnisstop+") "; } this.InitData(); //#region 数据集定义 //空重 this.storeCTNEF = Ext.create('Ext.data.Store', { fields: ['FType', 'NAME'] }); this.storeCTNEF.add({ "FType": 'E', "NAME": "空" }); this.storeCTNEF.add({ "FType": 'F', "NAME": "重" }); this.comboxCTNEF = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCTNEF, fieldLabel: '空重', valueField: 'FType', displayField: 'NAME', forceSelection: true, name: 'CTNEF' }); this.storeCodeLoadport2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.storeCodeLoadport2.load(); this.comboxPORT2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所在港口', store: this.storeCodeLoadport2, //forceSelection: true, // id: 'PORT', name: 'PORT', valueField: 'PORT', displayField: 'CodeAndName', matchFieldWidth: false //下拉款自适应宽度 // }); //场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' } }); this.storeYARD.load(); // this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '场站', store: this.storeYARD, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'YARD', valueField: 'CustName', displayField: 'CodeAndName' }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作', store: this.storeOpCode, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true }); //箱动态类型 this.storeCTNSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeCTNSTATUS.load({ params: { enumTypeId: 99060 } }); this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefEnumCombox', { store: this.storeCTNSTATUS, fieldLabel: '箱动态', name: 'CTNSTATUS', valueField: 'EnumValueName', displayField: 'EnumValueName' }); //#endregion //#region form定义 //编辑form:formEdit this.formCntrList = Ext.widget('form', { // layout: "border", region: 'north', height: 170, frame: true, bodyPadding: 1, trackResetOnLoad: true, fieldDefaults: { margins: '1 1 1 1', labelAlign: 'right', flex: 1, labelWidth: 64, msgTarget: 'qtip' //,split:true }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{//container_1 xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '箱号', name: 'CNTRNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { var cnlist = _this.formCntrList.getForm().findField('CNTRNOLIST').getValue(); if (cnlist == '') { cnlist = field.value; } else { cnlist = cnlist + '\n' + field.value; } _this.formCntrList.getForm().findField('CNTRNOLIST').setValue(cnlist); _this.formCntrList.getForm().findField('CNTRNO').setValue(''); } } } } ] }//container_1 end , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '箱号列表', //'AGENT', height: 120, name: 'CNTRNOLIST', anchor: '100%' } ] } ] } ] }); this.winCntrListShow = Ext.create('Ext.window.Window', { title: "批量箱号查询", //"批量修改", width: 820, //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.formCntrList], buttons: [{ text: '查询', //"确认修改", minWidth: 70, handler: function () { _this.onCntrListClick() _this.winCntrListShow.close(); } }, { text: "取消", //"关闭", minWidth: 70, handler: function () { _this.winCntrListShow.close(); } }] }); //#endregion this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' } }); this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港', store: this.storeCodeDisport, queryMode: 'remote', labelWidth: 120, minChars: 1, queryParam: 'CODENAME', name: 'DESTPORT', valueField: 'PORT', displayField: 'PORT' }); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港', store: this.storeCodeDisport3, labelWidth: 120, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'PORTLOAD', valueField: 'PORT', displayField: 'PORT' }); //客户加载_场站 this.store_PORTLOAD_STATOIN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' } }); this.store_PORTLOAD_STATOIN.load(); //场站 this.comboxPORTLOAD_STATOIN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港场站', store: this.store_PORTLOAD_STATOIN, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'YARD', name: 'PORTLOAD_STATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' } }); this.storeDESTPORT_STATOIN.load(); //场站 this.comboxDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港场站', store: this.storeDESTPORT_STATOIN, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'YARD', name: 'DESTPORT_STATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreTRANSTYPE = Ext.create('Ext.data.Store', { fields: ['OpLb'] }); this.StoreTRANSTYPE.add({ "OpLb": "配货" }); this.StoreTRANSTYPE.add({ "OpLb": "空返" }); this.StoreTRANSTYPE.add({ "OpLb": "调拨" }); this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运输类型', store: this.StoreTRANSTYPE, //flex: 0.5, labelWidth: 120, forceSelection: true, name: 'TRANSTYPE', valueField: 'OpLb', displayField: 'OpLb' }); this.formEdit = Ext.widget('form', { // layout: "border", region: 'north', height: 170, frame: true, bodyPadding: 1, trackResetOnLoad: true, fieldDefaults: { margins: '1 1 1 1', labelAlign: 'right', flex: 1, labelWidth: 120, msgTarget: 'qtip' //,split:true }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{//container_1 xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '船名', name: 'VESSEL' }, { fieldLabel: '航次', name: 'VOYNO' }, this.comboxTRANSTYPE, this.comboxPORTLOAD_STATOIN ] }//container_1 end , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '起运港提箱日期', labelWidth: 120, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'PORTLOAD_CNT_TIME' }, this.comboxPORTLOAD, { fieldLabel: '开船日期', labelWidth: 120, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, this.comboxPORTDISCHARGE ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '到港日期', labelWidth: 120, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA' }, this.comboxDESTPORT_STATOIN, { fieldLabel: '目的港提箱日期', format: 'Y-m-d', labelWidth: 120, flex: 1, xtype: 'datefield', name: 'DEST_CNT_TIME' }, { fieldLabel: '目的港还箱日期', format: 'Y-m-d', labelWidth: 120, flex: 1, xtype: 'datefield', name: 'DEST_RTCNT_TIME' } ] } ] } ] }); this.winModifyShow = Ext.create('Ext.window.Window', { title: "批量修改动态", //"批量修改", width: 1000, //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.formEdit], buttons: [{ text: '确认更新', //"确认修改", minWidth: 70, handler: function () { _this.onModifyClick() } }, { text: "取消", //"关闭", minWidth: 70, handler: function () { _this.winModifyShow.close(); } }] }); this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext }); }, this); }, //end initUIComponents //#region 加载事件 InitData: function () { this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext }, waitMsg: "正在查询数据...", scope: this }); //#endregion }, //end InitData //#endregion onRefreshClick: function (button, event) { var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onCntrListClick: function (button, event) { var cntrliststr = _this.formCntrList.getForm().findField('CNTRNOLIST').getValue(); var sql = ''; if (cntrliststr == '') { Ext.Msg.show({ title: '提示', msg: '没有要查询的箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var cntrlist = cntrliststr.match(/.+[\n]*/g);//按行匹配 for (var j = 0; j < cntrlist.length; j++) { if (cntrlist[j].replace(/\n/g, "") != '') { if (sql == '') { sql = sql + "'" + cntrlist[j].replace(/\n/g, "") + "'"; } else { sql = sql + ",'" + cntrlist[j].replace(/\n/g, "") + "'"; } } } if (sql == '') { Ext.Msg.show({ title: '提示', msg: '没有要查询的箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } sql = " CNTRNO in (" + sql+") " this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onModifyClick: function (menu, event) { var GidStr = ''; var records = this.GridCheckBoxModel.selected.items; var bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; bodyAddDatas.push(rec); } var data = this.formEdit.getForm().getValues(); _this = this; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title:'提示', msg:'没有要修改的箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcContainer/MsOpCtnr/PLCntrStatus', params: { data: jsonbodyAddDatas, modifydata: Ext.JSON.encode(data) }, 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.Msg.INFO, buttons: Ext.Msg.OK }); _this.winModifyShow.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, onImportCtnClick: function () { var data = this.formEdit.getForm().getValues(); me = this; var BSNO = ''; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 20, frame: true, autoScroll: false, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadExcel', name: 'LoadExcel', emptyText: '请选择EXCEL文件', //'请选择EXCEL文件', fieldLabel: 'EXCEL', //'EXCEL', buttontext: '选择文件', //'选择文件', allowBlank: false, width: 200, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', //'上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadExcel').getValue(); if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) { Ext.Msg.show({ title: '错误', msg: '请确认上传的文件类型是否为EXCEL文件', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//'请确认你上传的文件为EXCEL文件!' return; } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcContainer/MsOpCtnr/CtrnStatusFromExcel', waitMsg: '正在上传', //'正在上传', method: 'POST', params: { bsno: BSNO }, success: function (form, a) { me.storeList.reload(); var win = Ext.getCmp("importWinCtnStatus"); win.close(); }, failure: function (form, action) { form.reset(); Ext.Msg.show({ title: '警告', msg:'上传过程出现错误', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'上传过程出现错误!' } }); } }, { text: '关闭', //'关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传EXCEL", //"上传EXCEL", width: 380, height: 120, id: 'importWinCtnStatus', modal: true, resizable: false, border: false, items: imgform }); win.show(); return; }, onDeleteClick: function (button, 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 selectedRecords = []; selectedRecords = this.gridList.selModel.getSelection(); var selectStores = []; for (var i = 0; i < selectedRecords.length; i++) { if (selectedRecords[i].data.BSSTATUSREF != '锁定' && selectedRecords[i].data.CREATEBSFEEREF != '是') selectStores.push(selectedRecords[i].data); } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnr/DeleteDyna', params: { data: Ext.JSON.encode(selectStores) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(selections); 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 } }, this); }, //onDeleteClick onCreateBsFeeClick: function (button, 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 selectedRecords = []; selectedRecords = this.gridList.selModel.getSelection(); var selectStores = []; for (var i = 0; i < selectedRecords.length; i++) { if (selectedRecords[i].data.CREATEBSFEEREF != '是') selectStores.push(selectedRecords[i].data); } Ext.MessageBox.confirm('提示', '确定要将选中的动态产生的费用生成到相关的业务中吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在操作数据...'); Ext.Ajax.request({ waitMsg: '正在操作数据...', url: '/MvcContainer/MsOpCtnr/CreateCtnBsFee', params: { data: Ext.JSON.encode(selectStores) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.reload(); Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { this.storeList.reload(); 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 } }, this); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var BILLNO = form.findField('BILLNO').getValue(); var BSDATE = form.findField('BSDATE').getRawValue(); var BSDATETO = form.findField('BSDATETO').getRawValue(); if ((BILLNO != '' && BILLNO != null) || (BSDATE != '' && BSDATE != null) || (BSDATETO != '' && BSDATETO != null)) { sql = ' EXISTS (SELECT 1 FROM op_ctnmng_detail D left join op_ctnmng m on (m.BSNO=d.BSNO) where op_ctnmng_ctnstatus.CTNGID=d.CTNGID ' sql = sql + getAndConSql(sql, BILLNO, " BILLNO like '%" + BILLNO + "%'"); sql = sql + getAndConSql(sql, BSDATE, " BSDATE >= '" + BSDATE + "'"); sql = sql + getAndConSql(sql, BSDATETO, " BSDATE <= '" + BSDATETO + "'"); sql = sql + ')'; } var PORT = form.findField('PORT').getValue(); sql = sql + getAndConSql(sql, PORT, " PORT= '" + PORT + "'"); var CNTRNO = form.findField('CNTRNO').getValue(); sql = sql + getAndConSql(sql, CNTRNO, " CNTRNO= '" + CNTRNO + "'"); return sql; }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); //this.InitData(); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.EditRecord; ret[4] = this.OPLBNAME; return ret; }, onPrintClick: function (button, event) { var printType = 'MsOpCtnrDynaList'; var uid = USERID; var sql1 = "select * from op_ctnmng_ctndetail "; var wherestr = this.getCondition(); if (wherestr != '') { sql1 += "where 1=1 and " + wherestr; } PrintComm(printType, sql1); }, PrintSelect: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var selectedRecords = []; var storeadd = null; selectedRecords = this.GridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('CTNGID') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var bsno = '11111'; var mblno = ''; var printType = 'MsOpCtnrDynaListSelect'; var sql1 = "select * from op_ctnmng_ctndetail WHERE CTNGID IN (" + feeGidSql + ") "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,""); } });