Ext.namespace('Shipping'); Shipping.RepairClearing = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.RepairClearing.superclass.constructor.call(this); }; Ext.extend(Shipping.RepairClearing, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, region: 'north', BsNo: '', feeType:null, StoreFee: null, StoreFeeUnit: null, StoreFeeCust: null, BILL: null, GID: "", initUIComponents: function () { this.sqlcontext = ''; this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: "关闭", // iconCls: "btnsave", handler: function (button, event) { window.close(); }, scope: this }] }); //end 按钮Toolbar //#region 维修 this.storeListRepair = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepair', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListRepairImg = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepairImg', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairListImg', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeITEMS = Ext.create('DsExt.ux.RefTableStore', { fields: [{ name: 'FEENAME', type: 'string' } ], proxy: { url: '/MvcContainer/MsOpPrice/GetWXFEELIST' } }); this.storeITEMS.load({ params: { condition: "" } }); this.comboxITEMS = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeITEMS, forceSelection: true, name: 'ITEMNAME', valueField: 'FEENAME', displayField: 'FEENAME' }); //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeYARD.load({ params: { condition: "ISYARD='1'" } }); //场站 this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeYARD, forceSelection: true, name: 'CURSTATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.storeFeeNameRef.load({ params: { condition: "" } }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeNameRef, forceSelection: true, name: 'FEENAME', valueField: 'Name', displayField: 'CodeAndName' }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: "" } }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr, forceSelection: true, name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); //明细表表格 this.gridListRepairCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.RepairGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListRepair = new Ext.grid.GridPanel({ store: this.storeListRepair, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListRepairCellEditing], selModel: this.RepairGridCheckBoxModel, selType: 'cellmodel', tbar: [ { text: '保存明细', tooltip: '保存明细', id: "btnSaveRepair", iconCls: "btnsave", handler: function (button, event) { this.onPostRepairDetailClick(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndelRepair", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelRepairClick(); }, scope: this }, '-', { text: '提交审核', tooltip: '提交审核', id: "btnAuditRepair", menu: [ { text: "提交审核", handler: function (menu, event) { _this.onAuditRepairClick('1'); } }, { text: "撤销提交", handler: function (menu, event) { _this.onAuditRepairClick('2'); } }, { text: "申请修改", handler: function (menu, event) { _this.onAuditRepairClick('6'); } }], scope: this }, '-', { text: "打印", iconCls: 'btnprint', id: 'btnPrintRepair', handler: function (button, event) { this.PrintRepair(); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKGID', header: 'LINKGID', width: 80 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 80 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 120 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 60 }, { sortable: true, dataIndex: 'REPAIRITEMS', header: '维修改装项目', editor: this.comboxITEMS, width: 150 }, { sortable: true, dataIndex: 'REPAIRTIME', header: '维修改装日期', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', editor: this.comboxYARD, width: 100 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', editor: this.comboxFeeNameRef, width: 100 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', editor: this.comboxCurr, width: 50 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 60 }, { sortable: true, dataIndex: 'IMAGE1', hidden: true, header: '改装前照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', hidden: true, header: '改装后照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisfee.onNextKeyClick(1, 17) } else if (e.getKey() == 38) { _thisfee.onUpKeyClick(1, 17) } } } }, width: 150 }] }); this.gridListRepair.getSelectionModel().on('select', function (model, record, index) { this.BILL = record.data; this.GID = record.data.GID; if (this.GID != "" || this.GID != "*") { this.storeListRepairImg.load({ params: { start: "0", limit: "999", sort: "", condition: " LINKGID='" + this.GID + "'" } }); } else { this.storeListRepairImg.removeAll(); } // }, this); this.gridListRepairImgCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.RepairImgGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListRepairImg = new Ext.grid.GridPanel({ store: this.storeListRepairImg, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListRepairImgCellEditing], selModel: this.RepairImgGridCheckBoxModel, selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnaddRepairImg", iconCls: "btnadddetail", handler: function (button, event) { this.addRepairDetailImg(); }, scope: this }, '-', { text: '保存明细', tooltip: '保存明细', id: "btnSaveRepairImg", iconCls: "btnsave", handler: function (button, event) { this.onPostRepairDetailImgClick(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndelRepairImg", iconCls: "btndeletedetailImg", handler: function (button, event) { this.onDelRepairImgClick(); }, scope: this }, '-', { text: '上传照片', tooltip: '上传照片', id: "btnupRepairImg", menu: [ { text: '上传改装前照片', tooltip: '上传改装前照片', handler: function (button, event) { this.onUpRepairImgClick(1); }, scope: this }, { text: '上传改装后照片', tooltip: '上传改装后照片', handler: function (button, event) { this.onUpRepairImgClick(2); }, scope: this }], scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'IMAGE1', header: '改装前照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', header: '改装后照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisfee.onNextKeyClick(1, 17) } else if (e.getKey() == 38) { _thisfee.onUpKeyClick(1, 17) } } } }, width: 150 }] }); this.panelRepairItemImg = new Ext.Panel({ title: '照片明细', layout: "border", region: 'east', animate: true, width: 550, split: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepairImg ] }); this.panelRepairItem = new Ext.Panel({ title: '改装信息', layout: "border", region: 'north', height:450, animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepair , this.panelRepairItemImg ] }); //this.panelRepair = new Ext.Panel({ // title: '改装信息', // layout: "border", // region: 'north', // height:450, // animate: true, // split: true, // // autoScroll: true, // // containerScroll: true, // frame: false, // items: [this.panelRepairItem] //}); //#endregion //#region 清洗 this.StoreCLEARINGMODE = Ext.create('Ext.data.Store', { fields: ['BLTYPE'] }); this.StoreCLEARINGMODE.add({ "BLTYPE": "简单清洗" }); this.StoreCLEARINGMODE.add({ "BLTYPE": "彻底清洗" }); this.comboxCLEARINGMODE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCLEARINGMODE, forceSelection: true, name: 'CLEARINGMODE', valueField: 'BLTYPE', displayField: 'BLTYPE' }); this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomerNameRef.load({ params: { condition: "" } }); this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRef, forceSelection: true, name: 'CHECKGOV', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeListClearing = Ext.create('Ext.data.Store', { model: 'MsOpCtnClearing', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnClearingList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListClearingCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.ClearingGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListClearing = new Ext.grid.GridPanel({ store: this.storeListClearing, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListClearingCellEditing], selModel: this.ClearingGridCheckBoxModel, selType: 'cellmodel', tbar: [ //{ //text: '增加明细', //tooltip: '增加明细', //id: "btnaddClearing", //iconCls: "btnadddetail", //handler: function (button, event) { // this.addClearingDetail(); //}, //scope: this //}, '-', { text: '保存明细', tooltip: '保存明细', id: "btnsaveClearing", iconCls: "btnsave", handler: function (button, event) { this.onPostClearingDetailClick(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndelClearing", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelClearingClick(); }, scope: this }, '-', { text: '提交审核', tooltip: '提交审核', id: "btnauditClearing", menu: [ { text: "提交审核", handler: function (menu, event) { _this.onAuditClearingClick('1'); } }, { text: "撤销提交", handler: function (menu, event) { _this.onAuditClearingClick('2'); } }, { text: "申请修改", handler: function (menu, event) { _this.onAuditClearingClick('6'); } }], scope: this }, '-', { text: '上传照片', tooltip: '上传照片', id: "btnupimgClearing", menu: [ { text: '上传进场照片', tooltip: '上传进场照片', handler: function (button, event) { this.onUpImgClearingClick(3); }, scope: this }, { text: '上传EIR照片', tooltip: '上传EIR照片', handler: function (button, event) { this.onUpImgClearingClick(4); }, scope: this }, { text: '上传清洗照片', tooltip: '上传清洗照片', handler: function (button, event) { this.onUpImgClearingClick(5); }, scope: this }, { text: '上传清洁证照片', tooltip: '上传清洁证照片', handler: function (button, event) { this.onUpImgClearingClick(6); }, scope: this }], scope: this }, '-', { text: "打印", iconCls: 'btnprint', id: 'btnPrintClearing', handler: function (button, event) { this.PrintClearing(); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 80 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 120 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 150 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', editor: this.comboxYARD, width: 100 }, { sortable: true, dataIndex: 'INSTATOINTIME', header: '进场时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE1', header: '进场照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'EIR', header: 'EIR照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'CLEARINGMODE', header: '清洗方式', editor: this.comboxCLEARINGMODE, width: 120 }, { sortable: true, dataIndex: 'PREGOODSNAME', header: '清洗品名', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true }, width: 150 }, { sortable: true, dataIndex: 'ISCLEAR_CERT', header: '是否有清洁证', hidden: true, editor: { xtype: 'checkboxfield', inputValue: '1', uncheckedValue: '0' // selectOnFocus: true }, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CHECKGOV', header: '检测机构', editor: this.comboxCustomerNameRef, width: 120 }, { sortable: true, dataIndex: 'ISCLEAR_PLAN', header: '发送清洗计划', hidden: true, editor: { xtype: 'checkboxfield', inputValue: '1', uncheckedValue: '0' // selectOnFocus: true }, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CLEARTIME', header: '清洗时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE_CLEAR', header: '清洗照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE_CHECKGOV', header: '清洁证', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'ISCOMPLETE', header: '是否完成', hidden: true, editor: { xtype: 'checkboxfield', inputValue: '1', uncheckedValue: '0' // selectOnFocus: true }, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', editor: this.comboxFeeNameRef, width: 150 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', editor: this.comboxCurr, width: 150 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 150 }, { sortable: true, dataIndex: 'REMARKS', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _thisfee.onNextKeyClick(1, 17) } else if (e.getKey() == 38) { _thisfee.onUpKeyClick(1, 17) } } } }, width: 150 }] }); this.panelClearing = new Ext.Panel({ title: '清洗信息', layout: "border", region: 'center', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListClearing] }); this.storeListRepair.on('beforeload', function (store) { var acondition = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeListRepairImg.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext }); }, this); this.storeListClearing.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext }); }, this); //#endregion Ext.apply(this, { items: [this.panelBtn, this.panelRepairItem, this.panelClearing] }); parentWin = window.parent.opener; this.InitData(); }, //#region 加载事件 InitData: function () { this.opStatus = 'add'; var condition = ''; _thisCtnPLFee = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[3]; this.EditRecord = ret[2]; } this.BsNo ='1111'; this.LoadData(); }, //end InitData LoadData: function () { var BSNOStr = ''; for (i = 0; i < this.StoreList.getCount(); i += 1) { var memberyf = this.StoreList.getAt(i); this.BsNo = memberyf.data.GID; var BSNO = "'" + memberyf.data.GID + "'"; if (BSNOStr == '') BSNOStr = BSNO; else { BSNOStr = BSNOStr + ',' + BSNO; } } this.sqlcontext = " LINKGID IN (" + BSNOStr + ") "; this.storeListClearing.load({ params: { condition: this.sqlcontext } }); this.storeListRepair.load({ params: { condition: this.sqlcontext } }); }, // end LoadDate //#region 维修改装信息 addRepairDetailImg: function () { if (this.GID == "" || this.GID == "*") { Ext.Msg.show({ title: '提示', msg: '改装明细未保存或不存在,无法添加改装照片!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = Ext.create('MsOpCtnRepairImg', { GID: '*', LINKGID: this.GID, IMAGEDESC: '', REMARKS: '' }); this.storeListRepairImg.add(record); var n = this.storeListRepairImg.getCount(); this.gridListRepairCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onPostRepairDetailClick: function (button, event) { var bodyDrChFeeDatas = []; var i; var MSDSID =""; for (i = 0; i < this.storeListRepair.getCount(); i += 1) { var memberyf = this.storeListRepair.getAt(i); memberyf.data.REPAIRTIME = Ext.util.Format.date(memberyf.data.REPAIRTIME, 'Y-m-d').toString(); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnBsCard/SaveOpCtnRepair', scope: this, params: { body: jsonChFeeBody, PID: MSDSID }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListRepair.reload(); } 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 onPostRepairDetailImgClick: function (button, event) { var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListRepairImg.getCount(); i += 1) { var memberyf = this.storeListRepairImg.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnBsCard/SaveOpCtnRepairImg', scope: this, params: { body: jsonChFeeBody, PID: this.GID }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.GID + "'"; this.storeListRepairImg.load({ params: { condition: acondition } }); } 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 onDelRepairClick: function () { var selections = this.gridListRepair.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的维修改装信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS != '录入状态' && rec.data.AUDITSTATUS != '驳回提交') { Ext.Msg.show({ title: '提示', msg: '当前状态不允许删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS == '录入状态' || rec.data.AUDITSTATUS == '驳回提交') bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnBsCard/DeleteOpCtnRepair', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { // var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeListRepair.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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onDelRepairImgClick: function () { var selections = this.gridListRepairImg.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的照片信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnBsCard/DeleteOpCtnRepairImg', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.GID + "'"; this.storeListRepairImg.load({ params: { condition: acondition } }); 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); }, onAuditRepairClick: function (type) { var selections = this.gridListRepair.getSelectionModel().getSelection(); var statusstr = '提交'; if (type == '2' || type == '6') statusstr = '撤销'; if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要' + statusstr + '的清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定' + statusstr + '该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (type == '1' && rec.data.AUDITSTATUS == '录入状态') bodyAddDatas.push(rec); if (type == '2' && rec.data.AUDITSTATUS == '提交审核') bodyAddDatas.push(rec); if (type == '6' && rec.data.AUDITSTATUS == '审核通过') bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在' + statusstr + '数据...'); Ext.Ajax.request({ waitMsg: '正在' + statusstr + '数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnRepair', params: { data: jsonbodyAddDatas, type: type }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListRepair.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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onUpRepairImgClick: function (type) { var selections = this.gridListRepairImg.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择上传记录信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var GID = record.data.GID; var LINKGID = record.data.LINKGID; if (GID == '*') { Ext.Msg.show({ title: '提示', msg: '没有保存,请先保存!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BSNO = this.BILL.BSNO; if (BSNO == '') { Ext.Msg.show({ title: '提示', msg: '业务卡编号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } PGID = this.BILL.LINKGID; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, bodyStyle: 'padding:5px 5px 0', autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcContainer/MsOpCtnBsCard/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { GID: GID, BSNO: BSNO, type: type }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var acondition = " LINKGID='" + LINKGID + "'"; me.storeListRepairImg.load({ params: { condition: acondition } }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); }, PrintRepair: function () { var selections = this.gridListRepairImg.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择上传记录信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var GID = record.data.GID; var billNo = record.data.LINKGID; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var printType = 'MSOPCTNBSCARDREPAIR'; var sql1 = "SELECT * FROM op_ctnbscard WHERE GID='" + billNo + "'"; var sql2 = "SELECT * FROM op_ctnrepair WHERE AUDITSTATUS='审核通过' and LINKGID='" + billNo + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion //#region 清洗信息 onPostClearingDetailClick: function (button, event) { var bodyDrChFeeDatas = []; var i; var MSDSID =''; for (i = 0; i < this.storeListClearing.getCount(); i += 1) { var memberyf = this.storeListClearing.getAt(i); memberyf.data.INSTATOINTIME = Ext.util.Format.date(memberyf.data.INSTATOINTIME, 'Y-m-d').toString(); memberyf.data.CLEARTIME = Ext.util.Format.date(memberyf.data.CLEARTIME, 'Y-m-d').toString(); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnBsCard/SaveOpCtnClearing', scope: this, params: { body: jsonChFeeBody, PID: MSDSID }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListClearing.reload(); } 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 onDelClearingClick: function () { var selections = this.gridListClearing.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS != '录入状态' && rec.data.AUDITSTATUS != '驳回提交') { Ext.Msg.show({ title: '提示', msg: '当前状态不允许删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.AUDITSTATUS == '录入状态' || rec.data.AUDITSTATUS == '驳回提交') bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnBsCard/DeleteOpCtnClearing', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListClearing.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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onAuditClearingClick: function (type) { var selections = this.gridListClearing.getSelectionModel().getSelection(); var statusstr = '提交'; if (type == '2' || type == '6') statusstr = '撤销'; if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要' + statusstr + '的清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定' + statusstr + '该记录吗?', function (btn) { if (btn == 'yes') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (type == '1' && rec.data.AUDITSTATUS == '录入状态') bodyAddDatas.push(rec); if (type == '2' && rec.data.AUDITSTATUS == '提交审核') bodyAddDatas.push(rec); if (type == '6' && rec.data.AUDITSTATUS == '审核通过') bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在' + statusstr + '数据...'); Ext.Ajax.request({ waitMsg: '正在' + statusstr + '数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnClearing', params: { data: jsonbodyAddDatas, type: type }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListClearing.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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onUpImgClearingClick: function (type) { var selections = this.gridListClearing.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要上传图片的清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var GID = record.data.GID; if (GID == '*') { Ext.Msg.show({ title: '提示', msg: '维修记录没保存,请先保存清洗记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BSNO = record.data.BSNO; if (BSNO == '') { Ext.Msg.show({ title: '提示', msg: '业务卡编号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } PGID = record.data.LINKGID; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, bodyStyle: 'padding:5px 5px 0', autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcContainer/MsOpCtnBsCard/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { GID: GID, BSNO: BSNO, type: type }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); me.storeListClearing.reload(); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); }, PrintClearing: function () { var selections = this.gridListClearing.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要打印的清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var billNo = record.data.LINKGID; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var printType = 'MSOPCTNBSCARDCLEARING'; var sql1 = "SELECT * FROM op_ctnbscard WHERE GID='" + billNo + "'"; var sql2 = "SELECT * FROM op_ctnclearing WHERE AUDITSTATUS='审核通过' and LINKGID='" + billNo + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var billNo = basicForm.findField('BSNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPSEAE'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#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); this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); }, 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); this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); }, getModifyStatus: function () { return this.panelFee.getModifyStatus(); }, feeType: function () { return this.panelFee.feeType; }, StoreFee: function () { return this.panelFee.StoreFee; }, StoreFeeUnit: function () { return this.panelFee.StoreFeeUnit; }, StoreFeeCust: function () { return this.panelFee.StoreFeeCust; } });