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: 'MsOpCtnrDetail', pageSize: this.PageSize, // autoLoad: { start: 0, limit: 30 }, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpCtnr/GetCtnrList', reader: { id: 'CTNGID', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.columns = [ { sortable: true, //1 dataIndex: 'CTNGID', header: '惟一编号', width: 80, hidden: true }, { sortable: true, //1 dataIndex: 'CNTRNO', header: '箱号', width: 120, hidden: false }, { sortable: true, dataIndex: 'CTNEFREF', header: '空重', width: 60 }, { sortable: true, dataIndex: 'CTNALL', header: '箱型', width: 60 }, { sortable: true, dataIndex: 'CNTRSOURCE', header: '箱源', width: 80 }, { sortable: true, dataIndex: 'CTNSTATUS', header: '当前箱动态', width: 80 }, { sortable: true, dataIndex: 'CTNSTATUSTIME', header: '箱动态时间', width: 100, 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: 'ISBERETURNREF', header: '需返箱', width: 100 }, { sortable: true, dataIndex: 'ISSTOPREF', 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] }); //#region 历史动态显示 this.storeCtnrDyna = Ext.create('Ext.data.Store', { model: 'CtnrDyDetail', pageSize: this.PageSize, remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsOpCtnr/GetDynaList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.dynacolumns = [ { sortable: true, //1 dataIndex: 'GID', header: '惟一编号', width: 80, hidden: true }, { 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: 'REMARK', header: '备注', width: 160 } ]; this.dynagirdcolums = this.dynacolumns; this.dynagirdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.dynagirdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.GridDynaCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.GridCtnrDyna = new Ext.grid.GridPanel({ store: this.storeCtnrDyna, enableHdMenu: false, region: 'center', columnLines: true, //layout: "border", //title: '费用明细', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, // plugins: [this.cellEditing], // selModel: this.CheckBoxModel, selModel: this.GridDynaCheckBoxModel, tbar: [ { text: '删除', id: "del1", tooltip: '删除', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelCtnrDynaClick(button, event); }, scope: this }], columns: this.dynagirdcolums }); this.panelDyNa = new Ext.Panel({ layout: "border", region: 'east', title: '历史动态显示', width: 560, split: true, margin: '2 2', items: [this.GridCtnrDyna] }); this.panelCenter = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridList, this.panelDyNa] }); this.gridList.getSelectionModel().on('select', function (model, record, index) { var cntrno = record.data.CNTRNO; var sql = ""; sql = " CNTRNO='" + cntrno + "'"; this.ctncontext = sql; this.storeCtnrDyna.load({ params: { condition: sql } }); }, this); this.storeCtnrDyna.on('beforeload', function (store) { var sql = this.ctncontext; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); //#endregion //#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) { 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 }, '-', { // 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: "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.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: 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: [this.comboxPORT2, this.comboxYARD, this.comboxCTNSTATUS ] }//container_1 end , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '动态日期', name: 'CTNSTATUSTIME', format: 'Y-m-d', xtype: 'datefield', enableKeyEvents: true }, { fieldLabel: '主提单号', flex: 1, name: 'MBLNO', id: 'MBLNO' }, this.comboxCTNEF ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '备注', //'AGENT', height: 60, name: 'REMARK', anchor: '100%' } ] } ] } ] }); this.winModifyShow = 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.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: '/MvcShipping/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 }); } }, onDelCtnrDynaClick: function (button, event, type) { var selectedRecords = []; selectedRecords = this.GridDynaCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的集装箱动态信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的集装箱动态信息吗?', function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { var CtnrIndatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; CtnrIndatas.push(rec); } //if (CtnrIndatas.length > 0) { // var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas); // Ext.Msg.wait('正在删除...'); // Ext.Ajax.request({ // waitMsg: '正在删除...', //'正在删除数据...', // url: '/MvcShipping/MsOpCtnr/DeleteSellDetail', // params: { // headdata: Ext.JSON.encode(data), // data: CtnrInBody, // bsno: bsno // }, // callback: function (options, success, response) { // if (success) { // var jsonresult = Ext.JSON.decode(response.responseText); // if (jsonresult.Success) { // this.storeCtnrSell.reload(); // 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); }, 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: '/MvcShipping/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; }, 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 c.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, " c.PORT= '" + PORT + "'"); var CNTRNO = form.findField('CNTRNO').getValue(); sql = sql + getAndConSql(sql, CNTRNO, " c.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,""); } });