Ext.namespace('Shipping'); Shipping.MsOpSeaePreEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSeaePreEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSeaePreEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', OpType: 'bs', StoreList: null, editRecord: null, Editdata: null, stroplb: '预订舱', initUIComponents: function () { this.bodyDel = []; this.itemindex = 1; this.myDate = new Date(); this.accdatesameetd = 0; this.MsPeriod = null; this.SALEORDERDEPTBYOP = 0; this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataCtnList' } }); //人员信息加载 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' }); //委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.storeCARRIER.load(); //船公司 this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', //'船公司', store: this.storeCARRIER, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_订舱代理 this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListFORWARDER' } }); this.storeFORWARDER.load(); //船公司 this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订舱代理', //'订舱代理', store: this.storeFORWARDER, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'FORWARDER', valueField: 'CustName', displayField: 'CodeAndName' }); //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportListRm' } }); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', //'装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName', queryMode: 'remote', minChars: 2, queryParam: 'PORT', matchFieldWidth: false }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', //'卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', matchFieldWidth: false, valueField: 'PORT', queryMode: 'remote', minChars: 2, queryParam: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, blur: function (field, The, eOpts) { field.setRawValue(field.value); }, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formHead.getForm().findField('LANE').setValue(records[0].data.LANE); } } } }); //箱型_集装箱列表中的下拉框加载 this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.Lane', proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } }); this.storeLANE.load(); this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航线', //'航线', store: this.storeLANE, forceSelection: true, name: 'LANE', valueField: 'LANE', displayField: 'LANE' }); this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load(); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', //'船 名', store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', displayField: 'VESSEL', listeners: { scope: this, blur: function (field, The, eOpts) { _this.formEdit.getForm().findField('VESSEL').setValue(field.rawValue.toUpperCase()); } } }); this.storeVoyNo = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VoyNoModel', proxy: { url: '/CommMng/BasicDataRef/GetVoyNoList' } }); this.comboxVoyNo = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', //'航次', store: this.storeVoyNo, name: 'VOYNO', valueField: 'VOYNO', forceSelection: false, displayField: 'VOYNO', listeners: { scope: this, 'focus': function (combo, The, eOpts) { var VESSEL = this.formEdit.getForm().findField('VESSEL').getValue(); var conditionstr = " VSID IN (SELECT VSID from code_vessel where VESSEL='" + VESSEL + "') "; _this.storeVoyNo.load({ params: { condition: conditionstr } }); }, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (records[0].data.ETD != '') this.formEdit.getForm().findField('ETD').setValue(records[0].data.ETD); if (records[0].data.CLOSINGDATE != '') this.formEdit.getForm().findField('CLOSINGDATE').setValue(records[0].data.CLOSINGDATE); } }, blur: function (field, The, eOpts) { _this.formEdit.getForm().findField('VOYNO').setValue(field.rawValue.toUpperCase()); } } }); this.storeBSSTATUS = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeBSSTATUS.add({ "FSTATUS": "船公司处理中" }); this.storeBSSTATUS.add({ "FSTATUS": "船公司已放舱未使用" }); this.storeBSSTATUS.add({ "FSTATUS": "已分配操作使用" }); this.storeBSSTATUS.add({ "FSTATUS": "订舱修改中" }); this.storeBSSTATUS.add({ "FSTATUS": "已退舱" }); this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务状态', store: this.storeBSSTATUS, valueField: 'FSTATUS', displayField: 'FSTATUS', forceSelection: true, name: 'BSSTATUS', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.formHead = Ext.widget('form', { region: 'north', frame: true, collapsed: false, collapsible: true, height:260, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, this.comboxCARRIER, { fieldLabel: '约号', name: 'CONTRACTNO' }, this.comboxFORWARDER] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxLANE] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '主提单号', name: 'MBLNO', listeners: { scope: this, blur: function (field, The, eOpts) { _this.formHead.getForm().findField('MBLNO').setValue(field.value.toUpperCase().trim()); } } //allowBlank: false }, this.comboxVoyVeg, this.comboxVoyNo] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel:'开船日期', //'ETD', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, { fieldLabel: '截港日期', //'截港日期', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'CLOSINGDATE', listeners: { scope: this, 'select': function (combo, mdate) { var mydate = new Date(mdate); var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00'); combo.setValue(mydatestr); } } }, { fieldLabel: '截单日期', //'截单日期', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'CLOSEDOCDATE', listeners: { scope: this, 'select': function (combo, mdate) { var mydate = new Date(mdate); var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00'); combo.setValue(mydatestr); } } }] },{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '箱型1', name: 'CNTR1', hidden: true }, { fieldLabel: '箱型2', name: 'CNTR2', hidden: true }, { fieldLabel: '箱型3', name: 'CNTR3', hidden: true }, { fieldLabel: '箱型4', name: 'CNTR4', hidden: true }, { fieldLabel: '箱型5', name: 'CNTR5', hidden: true }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '箱型6', name: 'CNTR6', hidden: true }, { fieldLabel: '箱型7', name: 'CNTR7', hidden: true }, { fieldLabel: '箱型8', name: 'CNTR8', hidden: true }, { fieldLabel: '箱型9', name: 'CNTR9', hidden: true }, { fieldLabel: '箱型10', name: 'CNTR10', hidden: true }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBSSTATUS, this.comboxCustCode, this.comboxOP] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '备注', //'备注', height: 60, name: 'REMARK', anchor: '100%' }] }]//end items(fieldset 1) }]//end root items }); //end this.formHead //按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnEPrev', text: "上一票", //"上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: "下一票", //"下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this },{ id: 'btnESave', text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'btnESaveAndClose', text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { id: 'btnESaveAndNew', text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this }, { id: 'btnECopyNew', text: "复制新建", handler: function (button, event) { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; this.OpType = 'bs'; basicForm.findField('BSNO').setDisabled(false); var BSNO = NewGuid(); var field = basicForm.findField('BSNO'); field.setValue(BSNO); basicForm.findField('BSNO').setDisabled(true); //var myDate = new Date(); //var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); //field = basicForm.findField('BSDATE'); //field.setValue(mydatestr); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { text: "新建", id: 'btnENew', handler: function (button, event) { this.LoadData('add', '','bs'); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }] }); //end 按钮Toolbar Ext.apply(this, { items: [this.panelBtn, this.formHead] }); parentWin = window.parent.opener; this.InitData(); }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; _this = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; this.OpType = ret[6]; } this.LoadCtn(); if (this.opStatus == 'edit' ) { condition = " BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData(this.opStatus, condition, this.OpType); } else if (this.opStatus == 'add') { condition = ""; this.LoadData(this.opStatus, condition, this.OpType); }else if (this.opStatus == 'copyadd') { this.LoadCopyData(this.editRecord.get('BSNO')); } }, //end InitData LoadData: function (opstatus, condition,optype) { this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpSeaePre/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; } data = result.data; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); if (this.opStatus == 'add') { var basicForm = this.formHead.getForm(); basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); field.setValue(NewGuid()); basicForm.findField('BSNO').setDisabled(true); //field = basicForm.findField('CUSTNO'); //field.setValue(''); //field = basicForm.findField('OP'); //field.setValue(SHOWNAME); //var myDate = new Date(); //var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); //field = basicForm.findField('BSDATE'); //field.setValue(mydatestr); } this.GetEditStatus(this.OpType, data.BSLOCK); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var billno = '*'; var gid = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('BSNO'); } }, LoadCtn: function () { this.storecodeservice.load({ params: { condition: "OPTYPE='1'" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { for (i = 0; i < this.storecodeservice.getCount(); i += 1) { var itemindex = i + 1; var memberyf = this.storecodeservice.getAt(i); var headfield = this.formHead.getForm().findField(memberyf.data.OPField); if (headfield != NaN && headfield != null) { headfield.setVisible(true); headfield.setFieldLabel(memberyf.data.SERVICENAME); } } this.formHead.doLayout(); } } }, scope: this }); }, LoadCopyData: function (bsno) { this.bodyDel = []; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpSeaePre/GetCopyData', params: { condition: "BSNO='" + bsno + "'" }, 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; } data = result.data; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.opStatus = 'add'; if (this.opStatus == 'add') { var basicForm = this.formHead.getForm(); basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); field.setValue(NewGuid()); basicForm.findField('BSNO').setDisabled(true); } this.GetEditStatus(this.OpType, false); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate Save: function (type) { var basicForm2 = this.formHead.getForm(); if (!basicForm2.isValid()) { return; } if (this.OpType == 'op') { this.formHead.getForm().findField('CARRIER').setDisabled(false); this.formHead.getForm().findField('MBLNO').setDisabled(false); this.formHead.getForm().findField('CONTRACTNO').setDisabled(false); this.formHead.getForm().findField('VESSEL').setDisabled(false); this.formHead.getForm().findField('VOYNO').setDisabled(false); this.formHead.getForm().findField('ETD').setDisabled(false); this.formHead.getForm().findField('CLOSINGDATE').setDisabled(false); this.formHead.getForm().findField('CLOSEDOCDATE').setDisabled(false); this.formHead.getForm().findField('PORTLOAD').setDisabled(false); this.formHead.getForm().findField('PORTDISCHARGE').setDisabled(false); this.formHead.getForm().findField('LANE').setDisabled(false); this.formHead.getForm().findField('FORWARDER').setDisabled(false); this.formHead.getForm().findField('CNTR1').setDisabled(false); this.formHead.getForm().findField('CNTR2').setDisabled(false); this.formHead.getForm().findField('CNTR3').setDisabled(false); this.formHead.getForm().findField('CNTR4').setDisabled(false); this.formHead.getForm().findField('CNTR5').setDisabled(false); this.formHead.getForm().findField('CNTR6').setDisabled(false); this.formHead.getForm().findField('CNTR7').setDisabled(false); this.formHead.getForm().findField('CNTR8').setDisabled(false); this.formHead.getForm().findField('CNTR9').setDisabled(false); this.formHead.getForm().findField('CNTR10').setDisabled(false); if (this.formHead.getForm().findField('CNTR10').getValue() == '') this.formHead.getForm().findField('CNTR10').setValue('0'); if (this.formHead.getForm().findField('CNTR1').getValue() == '') this.formHead.getForm().findField('CNTR1').setValue('0'); if (this.formHead.getForm().findField('CNTR2').getValue() == '') this.formHead.getForm().findField('CNTR2').setValue('0'); if (this.formHead.getForm().findField('CNTR3').getValue() == '') this.formHead.getForm().findField('CNTR3').setValue('0'); if (this.formHead.getForm().findField('CNTR4').getValue() == '') this.formHead.getForm().findField('CNTR4').setValue('0'); if (this.formHead.getForm().findField('CNTR5').getValue() == '') this.formHead.getForm().findField('CNTR5').setValue('0'); if (this.formHead.getForm().findField('CNTR6').getValue() == '') this.formHead.getForm().findField('CNTR6').setValue('0'); if (this.formHead.getForm().findField('CNTR7').getValue() == '') this.formHead.getForm().findField('CNTR7').setValue('0'); if (this.formHead.getForm().findField('CNTR8').getValue() == '') this.formHead.getForm().findField('CNTR8').setValue('0'); if (this.formHead.getForm().findField('CNTR9').getValue() == '') this.formHead.getForm().findField('CNTR9').setValue('0'); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('CARRIER').setDisabled(true); this.formHead.getForm().findField('MBLNO').setDisabled(true); this.formHead.getForm().findField('CONTRACTNO').setDisabled(true); this.formHead.getForm().findField('VESSEL').setDisabled(true); this.formHead.getForm().findField('VOYNO').setDisabled(true); this.formHead.getForm().findField('ETD').setDisabled(true); this.formHead.getForm().findField('CLOSINGDATE').setDisabled(true); this.formHead.getForm().findField('CLOSEDOCDATE').setDisabled(true); this.formHead.getForm().findField('PORTLOAD').setDisabled(true); this.formHead.getForm().findField('PORTDISCHARGE').setDisabled(true); this.formHead.getForm().findField('LANE').setDisabled(true); this.formHead.getForm().findField('FORWARDER').setDisabled(true); this.formHead.getForm().findField('CNTR1').setDisabled(true); this.formHead.getForm().findField('CNTR2').setDisabled(true); this.formHead.getForm().findField('CNTR3').setDisabled(true); this.formHead.getForm().findField('CNTR4').setDisabled(true); this.formHead.getForm().findField('CNTR5').setDisabled(true); this.formHead.getForm().findField('CNTR6').setDisabled(true); this.formHead.getForm().findField('CNTR7').setDisabled(true); this.formHead.getForm().findField('CNTR8').setDisabled(true); this.formHead.getForm().findField('CNTR9').setDisabled(true); this.formHead.getForm().findField('CNTR10').setDisabled(true); } else { this.formHead.getForm().findField('BSNO').setDisabled(false); if (this.formHead.getForm().findField('CNTR10').getValue() == '') this.formHead.getForm().findField('CNTR10').setValue('0'); if (this.formHead.getForm().findField('CNTR1').getValue() == '') this.formHead.getForm().findField('CNTR1').setValue('0'); if (this.formHead.getForm().findField('CNTR2').getValue() == '') this.formHead.getForm().findField('CNTR2').setValue('0'); if (this.formHead.getForm().findField('CNTR3').getValue() == '') this.formHead.getForm().findField('CNTR3').setValue('0'); if (this.formHead.getForm().findField('CNTR4').getValue() == '') this.formHead.getForm().findField('CNTR4').setValue('0'); if (this.formHead.getForm().findField('CNTR5').getValue() == '') this.formHead.getForm().findField('CNTR5').setValue('0'); if (this.formHead.getForm().findField('CNTR6').getValue() == '') this.formHead.getForm().findField('CNTR6').setValue('0'); if (this.formHead.getForm().findField('CNTR7').getValue() == '') this.formHead.getForm().findField('CNTR7').setValue('0'); if (this.formHead.getForm().findField('CNTR8').getValue() == '') this.formHead.getForm().findField('CNTR8').setValue('0'); if (this.formHead.getForm().findField('CNTR9').getValue() == '') this.formHead.getForm().findField('CNTR9').setValue('0'); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpSeaePre/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpSeaePre', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); } else if (type == '1') { this.opStatus = 'edit'; window.close(); } else if (type == '2') { this.LoadData('add', '','bs'); } } 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 GetEditStatus: function (optype,islock) { var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnECopyNew = Ext.getCmp('btnECopyNew'); var btnENew = Ext.getCmp('btnENew'); if (optype == 'op') { btnESaveAndNew.disable(); btnECopyNew.disable(); btnENew.disable(); if (islock) { btnESave.disable(); btnESaveAndClose.disable(); } else { btnESave.enable(); btnESaveAndClose.enable(); } this.formHead.getForm().findField('CARRIER').setDisabled(true); this.formHead.getForm().findField('MBLNO').setDisabled(true); this.formHead.getForm().findField('CONTRACTNO').setDisabled(true); this.formHead.getForm().findField('VESSEL').setDisabled(true); this.formHead.getForm().findField('VOYNO').setDisabled(true); this.formHead.getForm().findField('ETD').setDisabled(true); this.formHead.getForm().findField('CLOSINGDATE').setDisabled(true); this.formHead.getForm().findField('CLOSEDOCDATE').setDisabled(true); this.formHead.getForm().findField('PORTLOAD').setDisabled(true); this.formHead.getForm().findField('PORTDISCHARGE').setDisabled(true); this.formHead.getForm().findField('LANE').setDisabled(true); this.formHead.getForm().findField('FORWARDER').setDisabled(true); this.formHead.getForm().findField('CNTR1').setDisabled(true); this.formHead.getForm().findField('CNTR2').setDisabled(true); this.formHead.getForm().findField('CNTR3').setDisabled(true); this.formHead.getForm().findField('CNTR4').setDisabled(true); this.formHead.getForm().findField('CNTR5').setDisabled(true); this.formHead.getForm().findField('CNTR6').setDisabled(true); this.formHead.getForm().findField('CNTR7').setDisabled(true); this.formHead.getForm().findField('CNTR8').setDisabled(true); this.formHead.getForm().findField('CNTR9').setDisabled(true); this.formHead.getForm().findField('CNTR10').setDisabled(true); this.formHead.getForm().findField('CUSTOMERNAME').setVisible(true); this.formHead.getForm().findField('BSSTATUS').setVisible(true); this.formHead.getForm().findField('OP').setVisible(true); this.formHead.getForm().findField('REMARK').setVisible(true); var OPFIELD = this.formHead.getForm().findField('OP'); if (OPFIELD.getValue() == '') OPFIELD.setValue(SHOWNAME); var headfield = this.formHead.getForm().findField('CUSTOMERNAME'); if (headfield != NaN && headfield != null) { headfield.allowBlank = false; headfield.setFieldStyle({ background: '#ffc' }); } var headfield = this.formHead.getForm().findField('OP'); if (headfield != NaN && headfield != null) { headfield.allowBlank = false; headfield.setFieldStyle({ background: '#ffc' }); } } else { btnESaveAndNew.enable(); btnECopyNew.enable(); btnENew.enable(); this.formHead.getForm().findField('CUSTOMERNAME').setVisible(false); this.formHead.getForm().findField('BSSTATUS').setVisible(false); this.formHead.getForm().findField('OP').setVisible(false); this.formHead.getForm().findField('REMARK').setVisible(false); } }, LoadDefValue: function () { this.storeDefValue.load({ params: { condition: "BSTYPE='预订舱'" }, callback: function (r, options, success) { if (success) { if (this.storeDefValue.getCount() > 0) { for (var j = 0; j < this.storeDefValue.getCount(); j += 1) { var member = this.storeDefValue.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); // this.GetEditStatus(); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='预订舱'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } }; } else { } } }, scope: this }); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); } }, //#region 上一票,下一票 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; } j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition, this.OpType); }, 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); if (this.opStatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition, this.OpType); }, //#endregion 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 = 'MSOPSEAEPRE'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_pre WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, getIsModify: function () { if (this.formHead.getForm().isDirty() == true) { return '业务信息'; } else return ''; } });