Ext.namespace('Shipping'); Shipping.MsOpBsCardEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpBsCardEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpBsCardEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, editFactryRecord: null, FactryStatus: 'add', initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; //#region 编辑form //枚举参照相关(编辑form) //客户加载_委托单位 this.storeCUSTOMER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCUSTOMER.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 this.comboxCUSTOMER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCUSTOMER, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeListGood = Ext.create('Ext.data.Store', { model: 'MsCodeMSDS', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeMSDS/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListGood.load({ params: { start: 0, limit: 20000, condition: ""} }); this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListGood, fieldLabel: '品名', // forceSelection: true, name: 'GOODSNAME', valueField: 'CHEMICALCGOODSNAME', displayField: 'GOODNAMEANDCNAME', listeners: { 'render': function (_field, eOpts) {//自定义函数,定义双击事件 var _this = this; _field.getEl().on('dblclick', function (e, t, eOpts) { var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value; window.open(openUrl, openType, openSet); }); } } }); this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeAGENT.load({ params: { condition: "ISAGENT='1'"} }); this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港代理', store: this.storeAGENT, forceSelection: true, name: 'AGENTNAME', valueField: 'CustName', displayField: 'CodeAndName' }); _this = this; this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisportI_PORTLOAD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisportI_DESTPORT = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load({ callback: function (r, options, success) { if (success) { _this.storeCodeDisport3.add(r); _this.storeCodeDisportI_PORTLOAD.add(r); _this.storeCodeDisportI_DESTPORT.add(r); } } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港', store: this.storeCodeDisport, name: 'DESTPORT', valueField: 'PORT', displayField: 'PORT' }); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港', store: this.storeCodeDisport3, name: 'PORTLOAD', valueField: 'PORT', displayField: 'PORT' }); //#region 空返 //客户加载_船公司 this.storeICARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeICARRIER.load({ params: { condition: "ISCARRIER='1'"} }); //船公司 this.comboxICARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeICARRIER, forceSelection: true, name: 'I_CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); this.comboxI_PORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港', store: this.storeCodeDisportI_PORTLOAD, name: 'I_PORTLOAD', valueField: 'PORT', displayField: 'PORT' }); this.comboxI_DESTPORT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港', store: this.storeCodeDisportI_DESTPORT, name: 'I_DESTPORT', valueField: 'PORT', displayField: 'PORT' }); //客户加载_场站 this.storeI_DESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeI_DESTPORT_STATOIN.load({ params: { condition: "ISYARD='1'"} }); //场站 this.comboxI_DESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港场站', store: this.storeI_DESTPORT_STATOIN, forceSelection: true, name: 'I_DESTPORT_STATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); _this = this; this.formEdit_I = Ext.widget('form', { region: 'north', frame: true, // title: '空返信息', bodyPadding: 5, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 100, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '空返委托编号', name: 'I_CUSTNO' }, { fieldLabel: '空返提单号', name: 'I_MBLNO' }, { fieldLabel: '空返委托单位', name: 'I_CUSTNAME' }, { fieldLabel: '空返开船日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'I_ETD' }, { fieldLabel: '空返到港日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'I_ETA' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxICARRIER, { fieldLabel: '运费约价', name: 'I_CONTRACT' }, { fieldLabel: '起运港提箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'I_PORTLOAD_CNT_TIME' }, this.comboxI_PORTLOAD, this.comboxI_DESTPORT ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '目的港提箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'I_DEST_CNT_TIME' }, { fieldLabel: '目的港还箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'I_DEST_RTCNT_TIME' }, this.comboxI_DESTPORT_STATOIN, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //表参照相关(编辑form) //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'COMPANYID', name: 'COMPANYID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'PREGOODSNAME', name: 'PREGOODSNAME', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '业务卡编号', allowBlank: true, flex: 1, name: 'BSNO' }, { fieldLabel: '委托编号', name: 'CUSTNO' }, this.comboxCUSTOMER, { fieldLabel: '箱号', name: 'CTNNO' }, { fieldLabel: '箱属', name: 'CTNPROP' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '提单号', name: 'MBLNO' }, this.comboxGoods, { fieldLabel: '开船日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, { fieldLabel: '到港日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA' }, this.comboxAgent ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE , { fieldLabel: '当前位置', name: 'CURSTATOIN' }, { fieldLabel: '周期', name: 'CYCLE_DAY' }, { fieldLabel: '是否订舱', inputValue: true, flex: 0.5, xtype: 'checkboxfield', name: 'IS_BOOKING' }, { fieldLabel: '是否返空', inputValue: true, flex: 0.5, xtype: 'checkboxfield', name: 'IS_RETURE_EMPTY', listeners: { scope: this, 'change': function (field, newValue, oldValue, eOpts) { if (field.checked) { _this.formEdit_I.setVisible(true); // _this.panelTop.height = 418; _this.doLayout(); } else { _this.formEdit_I.setVisible(false); // _this.panelTop.height = 300; _this.doLayout(); } } } }, { fieldLabel: '是否目的港清洗', inputValue: true, flex: 0.5, xtype: 'checkboxfield', name: 'IS_POD_CLEAN' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '备注', flex: 4, name: 'REMARKS' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //客户加载_场站 this.storeDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeDESTPORT_STATOIN.load({ params: { condition: "ISYARD='1'"} }); //场站 this.comboxDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港场站', store: this.storeDESTPORT_STATOIN, forceSelection: true, name: 'DESTPORT_STATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); this.formEdit2 = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 100, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '起运港免箱使天数', readOnly: true, name: 'PORTLOAD_FREE_DAYS' }, { fieldLabel: '起运港超期天数', name: 'PORTLOAD_OVER_DAYS' }, { fieldLabel: '起运港箱使费/天', readOnly: true, name: 'PORTLOAD_OVER_DAYS_FEE' }, { fieldLabel: '起运港箱使费', name: 'PORTLOAD_OVER_DAYS_AMT' }, this.comboxDESTPORT_STATOIN] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '目的港提箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'DEST_CNT_TIME' }, { fieldLabel: '目的港还箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'DEST_RTCNT_TIME' }, { fieldLabel: '目的港免箱使天数', readOnly: true, name: 'DESTPORT_FREE_DAYS' }, { fieldLabel: '目的港超期天数', name: 'DESTPORT_OVER_DAYS' }, { fieldLabel: '滞箱天数', name: 'DETAIN_CTN_DAYS' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '目的港箱使费/天', readOnly: true, name: 'DESTPORT_OVER_DAYS_FEE' }, { fieldLabel: '目的港箱使费', name: 'DESTPORT_OVER_DAYS_AMT' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit this.formDeliveryHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, hidden: true, // autoScroll: true, trackResetOnLoad: true, collapsed: false, collapsible: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: 'TRUCKNAME', hidden: true, name: 'TRUCKNAME' }, { fieldLabel: 'TRUCKLINKNAME', hidden: true, name: 'TRUCKLINKNAME' }, { fieldLabel: '联系电话', hidden: true, name: 'TRUCKLINKTEL' }, { fieldLabel: '装货地址', hidden: true, name: 'LOADADDR' }, { fieldLabel: '报关品名', hidden: true, name: 'CUSTOMGOODNAME' }] }]//end items(fieldset 1) }] }); //end this.formEdit //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this } ] }); //end 按钮Toolbar //#endregion //#region 布局 //控件布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 190, items: [this.panelBtn, this.formEdit] }); Ext.apply(this, { items: [this.panelTop, this.formEdit2, this.formEdit_I, this.formDeliveryHead] }); //#endregion //绑定查询窗体 this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; } if (this.opStatus == 'edit') condition = " b.GID='" + this.editRecord.get('GID') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsOpCtnBsCard/GetData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formEdit2.getForm().reset(); this.formEdit2.getForm().setValues(data); this.formEdit_I.getForm().reset(); this.formEdit_I.getForm().setValues(data); if (data.IS_RETURE_EMPTY == true) { this.formEdit_I.setVisible(true); } else { this.formEdit_I.setVisible(false); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('GID').setDisabled(true); if (this.opStatus == 'add') { data.GID = NewGuid(); } var data2 = this.formEdit2.getForm().getValues(false, false, false); var data3 = this.formEdit_I.getForm().getValues(false, false, false); var data4 = this.formDeliveryHead.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnBsCard/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), data3: Ext.JSON.encode(data3), data4: Ext.JSON.encode(data4) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); this.formEdit2.getForm().setValues(returnData); this.formEdit_I.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { this.editRecord = returnData; this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); } else if (type == '1') { window.close(); } else { this.LoadData('add', ''); basicForm.findField('GID').setDisabled(false); } } 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 //#region 清洗信息 addClearingDetail: function () { if (this.opStatus == "add") { Ext.Msg.show({ title: '提示', msg: '业务卡信息未保存,无法添加清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var MSDSID = this.formEdit.getForm().findField('GID').getValue(); var PREGOODSNAME = this.formEdit.getForm().findField('PREGOODSNAME').getValue(); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsOpCtnClearing', { GID: '*', LINKGID: MSDSID, INSTATOINTIME: '', CLEARINGMODE: '', PREGOODSNAME: PREGOODSNAME, CHECKGOV: '', CLEARTIME: '', FEENAME: '', CURRENCY: '', AMOUNT: 0, REMARKS: '' }); this.storeListClearing.add(record); var n = this.storeListClearing.getCount(); this.gridListClearingCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onPostClearingDetailClick: function (button, event) { var bodyDrChFeeDatas = []; var i; var MSDSID = this.formEdit.getForm().findField('GID').getValue(); for (i = 0; i < this.storeListClearing.getCount(); i += 1) { var memberyf = this.storeListClearing.getAt(i); 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) { var acondition = " LINKGID='" + MSDSID + "'"; this.storeListClearing.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 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; } _this = this; 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/DeleteOpCtnClearing', 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.storeListClearing.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); }, 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 = this.formEdit.getForm().findField('BSNO').getValue(); if (BSNO == '') { Ext.Msg.show({ title: '提示', msg: '业务卡编号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } PGID = this.formEdit.getForm().findField('GID').getValue(); 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='" + PGID + "'"; me.storeListClearing.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(); }, //#endregion //#region 维修改装信息 addRepairDetail: function () { if (this.opStatus == "add") { Ext.Msg.show({ title: '提示', msg: '业务卡信息未保存,无法添加清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var MSDSID = this.formEdit.getForm().findField('GID').getValue(); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsOpCtnRepair', { GID: '*', LINKGID: MSDSID, REPAIRITEMS: '', REPAIRTIME: '', CURSTATOIN: '', FEENAME: '', CURRENCY: '', AMOUNT: 0, REMARKS: '' }); this.storeListRepair.add(record); var n = this.storeListRepair.getCount(); this.gridListRepairCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onPostRepairDetailClick: function (button, event) { var bodyDrChFeeDatas = []; var i; var MSDSID = this.formEdit.getForm().findField('GID').getValue(); for (i = 0; i < this.storeListRepair.getCount(); i += 1) { var memberyf = this.storeListRepair.getAt(i); 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) { var acondition = " LINKGID='" + MSDSID + "'"; this.storeListRepair.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; } 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/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.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); }, onUpRepairImgClick: function (type) { var selections = this.gridListRepair.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 = this.formEdit.getForm().findField('BSNO').getValue(); if (BSNO == '') { Ext.Msg.show({ title: '提示', msg: '业务卡编号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } PGID = this.formEdit.getForm().findField('GID').getValue(); 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='" + PGID + "'"; me.storeListRepair.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(); }, //#endregion //#region 提箱信息 addDeliveryDetail: function () { if (this.opStatus == "add") { Ext.Msg.show({ title: '提示', msg: '业务卡信息未保存,无法添加清洗信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var MSDSID = this.formEdit.getForm().findField('GID').getValue(); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsOpCtnRepair', { GID: '*', LINKGID: MSDSID, REPAIRITEMS: '', REPAIRTIME: '', CURSTATOIN: '', FEENAME: '', CURRENCY: '', AMOUNT: 0, REMARKS: '' }); this.storeListDelivery.add(record); var n = this.storeListDelivery.getCount(); this.gridListDeliveryCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onPostDeliveryDetailClick: function (button, event) { var bodyDrChFeeDatas = []; var i; var MSDSID = this.formEdit.getForm().findField('GID').getValue(); for (i = 0; i < this.storeListDelivery.getCount(); i += 1) { var memberyf = this.storeListDelivery.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnBsCard/SaveOpCtnDelivery', 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) { var acondition = " LINKGID='" + MSDSID + "'"; this.storeListDelivery.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 onDelDeliveryClick: function () { var selections = this.gridListDelivery.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/DeleteOpCtnDelivery', 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.storeListDelivery.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); }, //#endregion getIsModify: function () { var drmodify = this.storeListClearing.getModifiedRecords(); if (drmodify.length != 0) return '清洗信息'; var drmodify = this.storeListDelivery.getModifiedRecords(); if (drmodify.length != 0) return '检查信息'; var drmodify = this.storeListRepair.getModifiedRecords(); if (drmodify.length != 0) return '维修改装信息'; if (panelEdit.formEdit.getForm().isDirty() == true) { return '业务卡信息'; } else return ''; } // });