Ext.namespace('Shipping'); Shipping.InspectionEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.InspectionEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.InspectionEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, stroplb: '报关业务', BSTYPE2: '报检', initUIComponents: function () { this.serialNo = 0; this.bodyDel = []; this.itemindex = 1; this.accdatesameetd = 0; this.MsPeriod = null; this.SALEORDERDEPTBYOP = 0; this.ENTERSAMEASCUSTOMER = 0; this.copyfee = false; //枚举参照相关 //#region 表参照相关 this.storeDefValue = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpDef/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeMustBe = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpMustField/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListWmsIn = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'GID', type: 'string' }, { name: 'NAMEMODEL', type: 'string' }, { name: 'GOODSNAME', type: 'string' }, { name: 'GOODSMODEL', type: 'string' }, { name: 'GOODSSTANDARD', type: 'string' }, { name: 'GOODSPACK', type: 'number' }, { name: 'GOODSPACKSTOCK', type: 'number' }, { name: 'GOODAPPLYNUM', type: 'number' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApply/GetWmsIn', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.comboxWmsIn = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListWmsIn, forceSelection: true, // name: 'GOODSNAME', valueField: 'GID', displayField: 'NAMEMODEL' }); this.storeListWmsNo = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'WMSNO', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApply/GetWmsNo', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.comboxWmsNo = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListWmsNo, fieldLabel: '入库单号', name: 'WMSNO', valueField: 'WMSNO', displayField: 'WMSNO', listeners: { scope: this, 'blur': function (field) { if (field.rawValue!=''){ this.storeListWmsIn.load({ params: { wmsno:field.rawValue} }); } else this.storeListWmsIn.load({ params: { wmsno:''} }); } } }); this.storeListBsCustomNo = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'CUSTOMNO', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApply/GetBsCustomNo', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.comboxBsCustomNo = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListBsCustomNo, fieldLabel: '关联报关单号', name: 'BSCUSTOMNO', valueField: 'CUSTOMNO', displayField: 'CUSTOMNO' }); this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeSalesCode.load(); this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeSalesCode, forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (this.SALEORDERDEPTBYOP == 0) this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME); } } } }); 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', value: SHOWNAME, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (this.SALEORDERDEPTBYOP == 1) this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME); } } } }); this.storeCustserviceCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeCustserviceCode.load(); this.comboxCustservice = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客 服', store: this.storeCustserviceCode, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //所属部门 this.storeDept = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DeptModel', proxy: { url: '/CommMng/BasicDataRef/GetDeptList' } }); this.storeDept.load(); this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属部门', //'所属部门', store: this.storeDept, //flex: 0.5, //labelWidth: 55, forceSelection: true, name: 'SALEDEPT', valueField: 'DeptName', displayField: 'DeptName' //,hidden: true }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); this.storeCustCode.load(); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (this.ENTERSAMEASCUSTOMER == 1) { var ENTERP = this.formEdit.getForm().findField('ENTERP'); ENTERP.setValue(combo.value); } if (records[0].data.BSSOURCE != '') { this.formHead.getForm().findField('BSSOURCE').setValue(records[0].data.BSSOURCE); var recs = DsStoreQueryBy(this.storeSource, 'SourceName', records[0].data.BSSOURCE); if (recs.getCount() > 0) { var data = recs.getAt(0).data; var s = "SOURCEID='" + data.SourceID + "'"; this.storeSourceDetail.load({ params: { condition: s } }); } else { var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContact.load({ params: { condition: s }, callback: function (r, options, success) { if (success) { if (this.storeInfoClientContact.getCount() > 0) { var member = this.storeInfoClientContact.getAt(0); this.comboxInfoClientContact.setValue(member.data.SHOWNAME); // this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL); this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL); // this.formHead.getForm().findField('OPERATORFAX').setValue(member.data.FAX); } else { this.comboxInfoClientContact.setValue(''); // this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); this.formHead.getForm().findField('OPERATORTEL').setValue(''); // this.formHead.getForm().findField('OPERATORFAX').setValue(''); } } }, scope: this }); } } }); this.comboxCUSTOMERNAME2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '实际客户', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CUSTOMERNAME2', valueField: 'CustName', displayField: 'CodeAndName', listeners: { //scope: this, //'select': function (combo, records, eOpts) { // if (this.ENTERSAMEASCUSTOMER == 1) { // var ENTERP = this.formEdit.getForm().findField('ENTERP'); // ENTERP.setValue(combo.value); // } // if (records[0].data.BSSOURCE != '') { // this.formHead.getForm().findField('BSSOURCE').setValue(records[0].data.BSSOURCE); // var recs = DsStoreQueryBy(this.storeSource, 'SourceName', records[0].data.BSSOURCE); // if (recs.getCount() > 0) { // var data = recs.getAt(0).data; // var s = "SOURCEID='" + data.SourceID + "'"; // this.storeSourceDetail.load({ params: { condition: s } }); // } else { // var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL'); // BSSOURCEDETAIL.setValue(''); // } // } // var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; // this.storeInfoClientContact.load({ // params: { condition: s }, // callback: function (r, options, success) { // if (success) { // if (this.storeInfoClientContact.getCount() > 0) { // var member = this.storeInfoClientContact.getAt(0); // this.comboxInfoClientContact.setValue(member.data.SHOWNAME); // // this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL); // this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL); // // this.formHead.getForm().findField('OPERATORFAX').setValue(member.data.FAX); // } else { // this.comboxInfoClientContact.setValue(''); // // this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); // this.formHead.getForm().findField('OPERATORTEL').setValue(''); // // this.formHead.getForm().findField('OPERATORFAX').setValue(''); // } // } // }, // scope: this // }); //} } }); //委托单位_联系人 this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); //this.storeInfoClientContact.load(); this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户操作', store: this.storeInfoClientContact, name: 'OPERATORCODE', valueField: 'SHOWNAME', displayField: 'SHOWNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContact, 'GID', records[0].data.GID); if (Cargoinforecords.getCount() > 0) { var Cargoinfodata = Cargoinforecords.getAt(0).data; // this.formHead.getForm().findField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL); // this.formHead.getForm().findField('OPERATORFAX').setValue(Cargoinfodata.FAX); } else { // this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); // this.formHead.getForm().findField('OPERATORFAX').setValue(''); } } } } }); this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.storeCustomCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomCode.load({ params: { condition: "ISCUSTOM='1'"} }); this.comboxCustomCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '报关行', store: this.storeCustomCode, forceSelection: true, name: 'CUSTOMSER', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeSource = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.SourceModel', proxy: { url: '/CommMng/BasicDataRef/GetSource' } }); this.storeSource.load(); this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.SourceDetailModel', proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail' } }); this.comboxSource = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务来源', store: this.storeSource, forceSelection: true, name: 'BSSOURCE', valueField: 'SourceName', displayField: 'SourceName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID); if (recs.getCount() > 0) { var data = recs.getAt(0).data; var s = data.SourceID; this.storeSourceDetail.load({ params: { SourceId: s } }); } else { var BSSOURCEDETAIL = this.formEdit.getForm().findField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } }); this.comboxSourceDetail = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '来源明细', store: this.storeSourceDetail, // forceSelection: true, name: 'BSSOURCEDETAIL', valueField: 'SourceDetail', displayField: 'SourceDetail' }); this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserBaseModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' } }); this.storeUserBase.load(); this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBsType.load({ params: { enumTypeId: 96004} }); this.comboxBsType = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '运输类型', store: this.storeBsType, forceSelection: true, name: 'BSTYPE' }); //键值维护表_贸易方式 this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/MvcShipping/MsCrmKeyCodeSet/GeEnumerationList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " TYPE='监管方式'"} }); this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '贸易方式', tooltip:'内容对应于 系统配置-基本信息-键值表维护 内的 报关业务等分类键值-监管方式', store: this.storeCrmKeyCodeCode, forceSelection: true, id: 'TRADETYPE', name: 'TRADETYPE', valueField: 'NAME', displayField: 'NAME' }); // this.storeENTERP = Ext.create('DsExt.ux.RefTableStore', { // model: 'MsENTERP', // proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' } // }); // this.storeENTERP.load(); // this.comboxENTERP = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '经营单位', // store: this.storeENTERP, // name: 'ENTERP', // valueField: 'ENTERPNAME', // displayField: 'ENTERPID' // }); this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', { fields: [ { name: 'CUSTOMER', type: 'string' }, { name: 'ENTERPID', type: 'string' } ], proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' } }); this.storeEnterpCode.load(); this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '经营单位', store: this.storeEnterpCode, name: 'ENTERP', valueField: 'CUSTOMER', displayField: 'CUSTOMER', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var Cargoinforecords = DsStoreQueryBy(this.storeEnterpCode, 'CUSTOMER', combo.value); if (Cargoinforecords.getCount() > 0) { var Cargoinfodata = Cargoinforecords.getAt(0).data; this.formEdit.getForm().findField('ENTERPID').setValue(Cargoinfodata.ENTERPID); } else { this.formEdit.getForm().findField('ENTERPID').setValue(''); } } } } }); this.storeINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeINSPECTSERVICE.load({ params: { enumTypeId: 97024} }); this.comboxINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '报检项目', store: this.storeINSPECTSERVICE, forceSelection: true, name: 'INSPECTSERVICE' }); this.storeTRADETERM = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeTRADETERM.load({ params: { enumTypeId: 97023} }); this.comboxTRADETERM = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '贸易条款', store: this.storeTRADETERM, forceSelection: true, name: 'TRADETERM' }); this.storeCUSTOMTYPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeCUSTOMTYPE.load({ params: { enumTypeId: 97046} }); this.comboxCUSTOMTYPE = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '报关类型', store: this.storeCUSTOMTYPE, //flex: 0.6, forceSelection: true, name: 'CUSTOMTYPE' }); this.storeISCLEAR = Ext.create('Ext.data.Store', { fields: ['FType', 'NAME'] }); this.storeISCLEAR.add({ "FType": '1', "NAME": "是" }); this.storeISCLEAR.add({ "FType": '0', "NAME": "否" }); this.comboxISCLEAR = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeISCLEAR, fieldLabel: '是否通关', // labelWidth: 60, //flex: 0.4, valueField: 'FType', displayField: 'NAME', forceSelection: true, name: 'ISCLEAR' }); this.storeISCUSTOMEND = Ext.create('Ext.data.Store', { fields: ['FType', 'NAME'] }); this.storeISCUSTOMEND.add({ "FType": '1', "NAME": "是" }); this.storeISCUSTOMEND.add({ "FType": '0', "NAME": "否" }); this.comboxISCUSTOMEND = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeISCUSTOMEND, fieldLabel: '报关完结', valueField: 'FType', ReadOnly: true, displayField: 'NAME', forceSelection: true, name: 'ISCUSTOMEND' }); this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCompanysEntity', proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' } }); this.storeSaleCompany.load({ params: { condition: "" } }); this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属分部', //'委托分公司', store: this.storeSaleCompany, forceSelection: true, name: 'SALECORPID', valueField: 'GID', displayField: 'NAME' }); //币别 this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCurrencyModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' } }); this.storeCodeCurrency.load(); this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', //'币别', store: this.storeCodeCurrency, forceSelection: true, // flex: 0.4, // labelWidth: 40, id: 'CURRENCY', name: 'CURRENCY', valueField: 'CODENAME', displayField: 'CODENAME' }); this.storeISDY = Ext.create('Ext.data.Store', { fields: ['FType', 'NAME'] }); this.storeISDY.add({ "FType": '1', "NAME": "是" }); this.storeISDY.add({ "FType": '0', "NAME": "否" }); this.comboxISDY = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeISDY, labelWidth: 85,hidden:true, fieldLabel: '单一窗口读取', valueField: 'FType', ReadOnly: true, displayField: 'NAME', forceSelection: true, name: 'ISDY' }); this.storeDOCSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeDOCSTATUS.load({ params: { enumTypeId: 96013 } }); this.comboxDOCSTATUS = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '单据状态', store: this.storeDOCSTATUS, forceSelection: true, name: 'DOCSTATUS' }); this.store_etps_category = Ext.create('DsExt.ux.RefEnumStore', {}); this.store_etps_category.load({ params: { enumTypeId: 96100 } }); this.combox_etps_category = Ext.create('DsExt.ux.RefEnumCombox', { store: this.store_etps_category, fieldLabel: '报关企业类别', forceSelection: true, flex: 1,hidden:true, name: 'ETPS_CATEGORY' }); Ext.regModel('cdnType', { fields: [{ name: 'value' }, { name: 'text' }] }) this.storeCdnType = new Ext.data.Store({ model: 'cdnType', data: [{ 'value': 0, 'text': '一般报关单' }, { 'value': 1, 'text': '转关提前报关单' }, { 'value': 2, 'text': '备案清单' }, { 'value': 3, 'text': '转关提前备案清单' }, { 'value': 4, 'text': '出口二次转关' }] }); this.comboxcdnType = Ext.create('Ext.form.ComboBox', { store: this.storeCdnType, fieldLabel: '单据类型', queryMode: 'local', width: 110, hidden: true, id: 'cdnType', name: 'CDNTYPE', forceSelection: true, valueField: 'value', displayField: 'text', value: 0 }); //#endregion this.formHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: '业务锁定状态', name: 'BSSTATUS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '费用锁定状态', name: 'FEESTATUS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '费用锁定状态', name: 'INPUTBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '委托编号', readOnly: false, name: 'CUSTNO' }, { fieldLabel: '业务锁定', readOnly: true, flex: 0.5, name: 'BSSTATUSREF' }, { fieldLabel: '费用锁定', readOnly: true, flex: 0.5, name: 'FEESTATUSREF' }, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATE' }, this.comboxSaleCompany, this.comboxDept, this.comboxDOCSTATUS ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, this.comboxSource, this.comboxSourceDetail, { fieldLabel: '业务日期', format: 'Y-m-d', xtype: 'datefield', allowBlank: false, name: 'OPDATE' }, this.comboxCUSTOMTYPE, this.comboxISCLEAR ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxOp, this.comboxSalesCode, this.comboxBsType, { fieldLabel: '报关单号', name: 'CUSTOMNO' }, this.comboxWmsNo, this.comboxISDY, { flex: 1, xtype: 'hiddenfield' } ] }, { xtype: 'container', layout: 'hbox', flex:6, defaultType: 'textfield', items: [ this.combox_etps_category, this.comboxcdnType, this.comboxCustservice, this.comboxInfoClientContact, this.comboxCUSTOMERNAME2, { flex: 3, xtype: 'hiddenfield' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //编辑form this.formEdit = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, 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: '主提单号', name: 'MBLNO', listeners: { scope: this, 'blur': function (field) { if (field.value!=''){ var BSNO = this.formHead.getForm().findField('BSNO').getValue(); this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+field.value+"' AND BSNO<>'"+data.BSNO+"'" }}); this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+field.value+"'" }}); } } } }, { fieldLabel: '船名', name: 'VESSEL' }, { fieldLabel: '航次', name: 'VOYNO' }, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETD' }, { fieldLabel: '分提单号', name: 'HBLNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '装货港', name: 'PORTLOAD' }, { fieldLabel: '卸货港', name: 'PORTDISCHARGE' }, { fieldLabel: '到港日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETA' }, { fieldLabel: '货源国别', name: 'ARCOUNTRY' }, { fieldLabel: '货源地', name: 'GOODSOURCE' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '报关日期', format: 'Y-m-d', xtype: 'datefield', name: 'CUSTOMDATE' }, { fieldLabel: '商检单号', name: 'INSPECTIONNO' }, { fieldLabel: '商检日期', format: 'Y-m-d', xtype: 'datefield', name: 'INSPECTIONDATE' }, this.comboxCustomCode, { fieldLabel: '通关日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CLEARCUSTOMDATE', listeners: { scope: this, 'blur': function (field) { if (field.rawValue!=''){ this.formHead.getForm().findField('ISCLEAR').setValue('1'); } else this.formHead.getForm().findField('ISCLEAR').setValue('0'); } } } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxEnterp, { fieldLabel: '经营单位编码', name: 'ENTERPID' }, { fieldLabel: '手册号', name: 'BOOKNO' }, { fieldLabel: '发票号', name: 'INVNO' }, { fieldLabel: '合同号', name: 'CONTRACTNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数', name: 'PKGS' }, { fieldLabel: '毛重', name: 'KGS' }, { fieldLabel: '净重', name: 'NETWEIGHT' }, { fieldLabel: '尺码', name: 'CBM' }, { fieldLabel: '所在海关', name: 'BYCUSTOM' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRADETYPE, { fieldLabel: '是否多品名', inputValue: true, xtype: 'checkboxfield', name: 'ISMOREGOOD' }, { fieldLabel: '报关项数', name: 'CUSTOMSNUM' }, this.comboxINSPECTSERVICE, { fieldLabel: '批准文号', name: 'DOCNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBsCustomNo, { fieldLabel: '关联报关序号', name: 'CUSTOMSLNO' }, this.comboxISCUSTOMEND, this.comboxTRADETERM, { fieldLabel: '自理编号', readOnly: true, name: 'BSCUSTNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCodeCurrency, { fieldLabel: '货值', name: 'CARGOVALUE' }, { fieldLabel: '检验检疫号', name: 'INQUNO' }, { fieldLabel: '统一编号', name: 'CUSCIQNO' }, { fieldLabel: '转关单号', name: 'TRANCUSTOMNO' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '关锁号', name: 'CUSTOMLOCKNO' }, { fieldLabel: '出境关别', name: 'EXPCUSTOMTYPE' }, { fieldLabel: '离境口岸', name: 'DESPPORT' }, { fieldLabel: '收货人', flex: 2, name: 'CONSIGNEE' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '备注', //'备注', height: 45, name: 'REMARK', anchor: '100%' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpApplyDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApply/GetBodyList', reader: { id: 'BsNo,SerialNo', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.girdcolums1 = [{ sortable: true, dataIndex: 'BsNo', header: '业务编号', hidden: true, width: 120 }, { sortable: true, dataIndex: 'SerialNo', header: '序号', width: 30 }, { sortable: true, dataIndex: 'GoodsCode', header: '商品编码', editor: { xtype: 'textfield', selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'GoodsName', header: '商品名称', editor: { xtype: 'textfield', selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'GOODSMODEL', header: '型号/品牌', editor: { xtype: 'textfield', selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'GOODSSTANDARD', header: '规格', editor: { xtype: 'textfield', selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'GOODSNUM', header: '件数', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Pkgs', header: '报关件数', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Price', header: '单价', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; } }, { sortable: true, dataIndex: 'Total', header: '总价', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; } }, { sortable: true, dataIndex: 'Currency', header: '币别', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Remark', header: '其他', editor: { xtype: 'textfield', selectOnFocus: true }, width: 110 } ]; this.girdcolums2 = [{ sortable: true, dataIndex: 'BsNo', header: '业务编号', hidden: true, width: 120 }, { sortable: true, dataIndex: 'SerialNo', header: '序号', width: 30 }, { sortable: true, dataIndex: 'WMSIN_GID', header: '商品名称', editor: this.comboxWmsIn, width: 120, renderer: function (value, p, record) { return record.data.GoodsName; }, }, { sortable: true, dataIndex: 'GOODSMODEL', header: '型号/品牌', width: 120 }, { sortable: true, dataIndex: 'GOODSSTANDARD', header: '瓶/规格', width: 120 }, { sortable: true, dataIndex: 'GOODSNUM', header: '规格件数', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'GoodsCode', header: '商品编码', editor: { xtype: 'textfield', selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Pkgs', header: '报关件数', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Price', header: '单价', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 100, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; } }, { sortable: true, dataIndex: 'Total', header: '总价', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 120, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; } }, { sortable: true, dataIndex: 'Currency', header: '币别', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'Remark', header: '其他', editor: { xtype: 'textfield', selectOnFocus: true }, width: 110 } ]; this.girdcolums = this.girdcolums2; this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this }], columns:this.girdcolums }); this.storeBodyList.on('beforeload', function (store) { var BSNO = "xxxxxx"; if (this.opStatus == 'add') { BSNO = "xxxxxx"; } else { BSNO=_this.editRecord.get('BSNO'); } Ext.apply(store.proxy.extraParams, { BsNo: BSNO }); }, this); //#region 集装箱-数据集 this.storeCtnBodyList = Ext.create('Ext.data.Store', { model: 'MsOpCtn', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApply/GetCtnBodyList', reader: { id: 'BSNO,CTNCODE,CTN_ID', root: 'data', totalProperty: 'totalCount' } } }); this.StoreCTNSTATUS = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreCTNSTATUS.add({ "ID": "F", "NAME": "F整箱" }); this.StoreCTNSTATUS.add({ "ID": "E", "NAME": "E空箱" }); this.StoreCTNSTATUS.add({ "ID": "L", "NAME": "L拼箱" }); this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCTNSTATUS, forceSelection: true, name: 'CTNSTATUS', valueField: 'ID', displayField: 'NAME' }); //集装箱_称重方式 this.StoreWEIGHTYPE = Ext.create('Ext.data.Store', { fields: ['NAME'] }); this.StoreWEIGHTYPE.add({ "NAME": "累加" }); this.StoreWEIGHTYPE.add({ "NAME": "总重" }); this.StoreWEIGHTYPE.add({ "NAME": "" }); this.comboxWEIGHTYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreWEIGHTYPE, forceSelection: true, name: 'WEIGHTYPE', valueField: 'NAME', displayField: 'NAME' }); //客户加载_车队 this.storeTRUCKERCTN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListTRUCK' } }); //车队 this.comboxTRUCKERCTN = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeTRUCKERCTN, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'TRUCKER', valueField: 'CustName', displayField: 'CodeAndName' }); //件数包装_集装箱列表中的下拉框加载 this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.KINDPKGS, //'件数包装', store: this.storeCodePackage, // forceSelection: true, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); //箱型_集装箱列表中的下拉框加载 this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCtnModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } }); this.storeCodeCtn.load(); this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.CTNALL, //'箱型', store: this.storeCodeCtn, forceSelection: true, name: 'CTNALL', valueField: 'CTN', displayField: 'CTN' }); //明细表表格 this.gridCtnListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.initctncolumns = [{ sortable: true, dataIndex: 'CTN_ID', header:'编号', //'编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', //'业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'CTNCODE', header: '序号', //'序号', width: 30 }, { dataIndex: 'CTNALL', header: '箱型', //'箱型', width: 65, editor: this.comboxCTNALL }, { dataIndex: 'CTNNUM', header: '箱量', //'箱量', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'CNTRNO', header: '箱号', //'箱号', width: 100, editor: { xtype: 'textfield', // regex: /^[a-zA-Z]{4}[0-9]{7}$/, // regextext: Zi.LAN., //'请输入正确的箱号!', selectOnFocus: true } }, { dataIndex: 'SEALNO', header: '封号', //'封号', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'PKGS', header: '件数', //'件数', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KINDPKGS', header: '包装', //'包装', width: 70, editor: this.comboxKINDPKGS_CTN }, { dataIndex: 'KGS', header: '重量', //'重量', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: '尺码', //'尺码', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TAREWEIGHT', header: '箱皮重', //'箱皮重', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TTLWEIGHT', header: '参考重量', //'参考重量', width: 60, renderer: function (value, meta, record) { return Add(record.data.KGS, record.data.TAREWEIGHT); } }, { dataIndex: 'WEIGHTYPE', header: '称重方式', //'称重方式', width: 60, editor: this.comboxWEIGHTYPE }, { dataIndex: 'WEIGHKGS', header: '称重重量', //'称重重量', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'WEIGHATTN', header: 'VGM联系人', //'VGM联系人', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } },{ dataIndex: 'VGMCONNCOM', header: 'VGM联系公司', //'VGM联系人', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'WEIGHTEL', header: 'VGM联系电话', //'VGM联系电话', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'WEIGHSIGN', header: 'VGM联系人签名', //'VGM联系人签名', width: 100, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'WEIGHDATE', header: 'VGM称重日期', //'VGM称重日期', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { dataIndex: 'REMARK', header: '备注', //'备注', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CTNSTATUS', header: '箱状态', //'箱状态', width: 70, editor: this.comboxCTNSTATUS, renderer: function (value, p, record) { if (value == 'E') return '空箱'; else if (value == 'L') return '拼箱'; else return '整箱'; } }, { dataIndex: 'MASTERNO', header: '主拼号', //'主拼号', width: 100, editor: { xtype: 'textfield', selectOnFocus: true } }]; this.ctncolumns = this.initctncolumns; this.gridCtnList = new Ext.grid.GridPanel({ store: this.storeCtnBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridCtnListCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', //'增加明细', tooltip: '增加明细', //'增加明细', id: "btnaddctndetail", iconCls: "btnadddetail", handler: function (button, event) { this.addCtnDetail(); }, scope: this }, '-', { text: '删除明细', //'删除明细', tooltip: '删除明细', //'删除明细', id: "btndelctndetail", iconCls: "btndeletedetail", handler: function (button, event) { this.deleteCtnDetail(); }, scope: this },'-', { text: "保存列表样式", //"保存列表样式", menu: [ { text: "保存", //"保存", handler: function (button, event) { _this.ctncolumns = DsTruck.SaveGridPanel(USERID, 'APPLYCTNCOLUMN', _this.gridCtnList.columns, _this.ctncolumns, 0, true); _this.gridCtnList.reconfigure(this.storeCtnBodyList, _this.ctncolumns); } }, { text:"初始化", //"初始化", handler: function (menu, event) { _this.gridCtnList.reconfigure(this.storeCtnBodyList, _this.initctncolumns); _this.ctncolumns = DsTruck.SaveGridPanel(USERID, 'APPLYCTNCOLUMN', _this.gridCtnList.columns, _this.initctncolumns, 0, true); } }], scope: this }], columns: this.ctncolumns }); this.ctncolumns = DsTruck.GetGridPanel(USERID, 'APPLYCTNCOLUMN', this.ctncolumns, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.panelBodyCtn = new Ext.Panel({ title:'集装箱信息', //'集装箱信息', layout: "border", width: 320, region: 'east', split: true, //margin: '5 10', frame: true, items: [this.gridCtnList] }); this.storeCtnBodyList.on('beforeload', function (store) { if (this.opStatus == 'add') { var condition = "BSNO='xxxxxx'"; } else { var condition = "BSNO='" + _this.editRecord.get('BSNO') + "'"; } Ext.apply(store.proxy.extraParams, { condition: condition }); }, this); this.gridCtnList.reconfigure(this.storeCtnBodyList, this.ctncolumns); //#endregion //#region EDI及其他信息 //需求编号:SR2017081100003 //枚举维护表tSysEnumValue_易航线业务类型97049 this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.TSysEnumValueDataModel', proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } }); this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97049"} }); this.comboxEDIYWLX = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务类型', store: this.storeTSysEnumValueCode, //forceSelection: true, name: 'EDIYWLX', valueField: 'EnumValueID', displayField: 'CodeAndName' }); //枚举维护表tSysEnumValue_易航线费用类型97050 this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.TSysEnumValueDataModel', proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } }); this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97050"} }); this.comboxCARRIAGETYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运费类型', store: this.storeTSysEnumValueCode, forceSelection: true, name: 'CARRIAGETYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); //枚举维护表tSysEnumValue_易航线费用类型97050 this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.TSysEnumValueDataModel', proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } }); this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97050"} }); this.comboxPREMIUMTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '保费类型', store: this.storeTSysEnumValueCode, forceSelection: true, name: 'PREMIUMTYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.formEdi = Ext.widget('form', { title: '易航线补充信息', region: 'north', frame: true, //bodyPadding: 5, //trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container',//fieldset defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxEDIYWLX, { fieldLabel: '备案号', name: 'RECORDSN' }, { fieldLabel: '征税比例', name: 'PAYMENT' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCARRIAGETYPE, { fieldLabel: '运费金额', name: 'CARRIAGEPRICE' }, { fieldLabel: '运费币制', name: 'CARRIAGECURRENCY' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxPREMIUMTYPE, { fieldLabel: '保费金额', name: 'PREMIUMPRICE' }, { fieldLabel: '保费币制', name: 'PREMIUMCURRENCY' }] }]//end items(fieldset 1) }]//end root items }); //#endregion //按钮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.copyfee = false; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, false); }, scope: this }, { id: 'btnECopyNewFee', text: '复制新建(含费用)', //"复制新建", handler: function (button, event) { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; this.copyfee = true; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, true); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { text: "新建", handler: function (button, event) { this.LoadData('add', ''); var basicForm = this.formEdit.getForm(); basicForm.findField('BsNo').setDisabled(false); }, scope: this }, '-', { text: "刷新", iconCls: "btnrefresh", handler: function (button, event) { this.RefreshClick(); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this } ] }); //end 按钮Toolbar this.panelBodyGood = new Ext.Panel({ title: '商品明细', layout: "border", region: 'center', // margin: '5 10', // frame: true, items: [this.gridList] }); this.panelBodyChFee = new Ext.Panel({ layout: "border", region: 'center', autoScroll: true, containerScroll: true, // margin: '5 10', // frame: true, items: [this.panelBodyGood,this.panelBodyCtn] }); this.panelpage1 = new Ext.Panel({ title: '基本信息', layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.formEdit, this.panelBodyChFee] }); this.panelpage2 = new Ext.Panel({ title: '服务项目流程明细', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false }); this.panelpage3 = new Ext.Panel({ title: 'EDI及其他信息', layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.formEdi] }); this.treestore = new Ext.data.TreeStore({ model: 'DsShipping.ux.ModuleModel', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } }, autoLoad: true, root: { name: '根节点', expanded: true, id: '5E301DAB-1DC4-4635-85FC-711F3FD94D39' } }); this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, items: [ this.panelpage1, this.panelpage2, this.panelpage3 ] }); this.tabtree = new Ext.tree.Panel({ region: 'west', title: '报检业务操作', split: true, width: 180, collapsible: true, margins: '0 0 0 0', store: this.treestore, rootVisible: false, hideHeaders: true, animate: false, lines: false, columns: [{ xtype: 'treecolumn', text: '模块名称', width: 178, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (_this, record, item, index, e, eOpts) { if (record.data.MODULEURL == '@') { this.tabapplypanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { if (Ext.getCmp('pnl' + record.data.NAME)) { var children = this.tabapplypanel.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { if (children.items[i].id) { if (children.items[i].id == 'pnl' + record.data.NAME) { this.tabapplypanel.setActiveTab(i); } } } } } else { if (this.formHead.getForm().findField('CUSTNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } else { if (record.data.NAME == 'modApplyAllFee') { var paneltabitems = new Shipping.ApplyFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modApplyAmendFee') { var paneltabitems = new Shipping.ApplyAmendFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, title: record.data.DESCRIPTION }); } else { var paneltabitems = new Ext.Panel({ id: 'pnl' + record.data.NAME, layout: "fit", region: "center", autoScroll: true, frame: false, title: record.data.DESCRIPTION, html: ' ' }); } this.tabapplypanel.add(paneltabitems); this.tabapplypanel.setActiveTab(paneltabitems); this.tabapplypanel.doLayout(); } } } } } /* , root: { expanded: true, children: [{ text: '基本信息', leaf: true }, { text: '费用信息', leaf: true } ] } */ }); /* this.panel_west = new Ext.Panel ({ id: 'panWestMenu', region: 'west', title: '报关业务操作', split: true, width: 180, collapsible: true, margins: '0 0 0 0', layout: 'accordion', items: [this.tabtree], layoutConfig: { animate: true } }); */ this.panelapply = new Ext.Panel({ title: '报关委托信息', id: 'pnlmodOpApplyOpwt', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, items: [this.panelBtn, this.formHead, this.tabpanel] }); this.tabapplypanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "TabapplyPanel", enableTabScroll: true, items: [ this.panelapply ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard.id == "pnlmodApplyAllFee") { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } } } }); Ext.apply(this, { items: [this.tabtree, this.tabapplypanel] }); parentWin = window.parent.opener; this.InitData(); this.LoadMustBe(); //绑定事件 this.gridList.on('edit', function (editor, e, eOpts) { this.gridAfterEdit(editor, e, eOpts); }, this); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='ACCDATESAMEETD'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { this.accdatesameetd = 1; } else { } } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='APPLYGOODSUSEWMS'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { } else { this.gridList.reconfigure(this.storeBodyList, this.girdcolums1); } } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='SALEORDERDEPTBYOP'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { this.SALEORDERDEPTBYOP = 1; } else { } } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='ENTERSAMEASCUSTOMER'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { this.ENTERSAMEASCUSTOMER = 1; } else { } } } else { } }, scope: this }); }, //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]; } if (this.opStatus == 'copyaddfee') { this.opStatus = 'copyadd'; this.copyfee = true; } if (this.opStatus == 'edit') { condition = " BsNo='" + this.editRecord.get('BSNO') + "'"; var s = " SOURCEID=(select SOURCEID from code_source where SOURCENAME='" + this.editRecord.get('BSSOURCE') + "')"; this.storeSourceDetail.load({ params: { condition: s} }); } this.storecodeservice.load({ params: { condition: "OPTYPE='5'" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var checkboxitems = ""; checkboxitems = "["; for (i = 0; i < this.storecodeservice.getCount(); i += 1) { var memberyf = this.storecodeservice.getAt(i); if (i == 0) { var checkboxSingleItem = "{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'"; checkboxSingleItem += "}"; } else { var checkboxSingleItem = ",{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:'1',name:'Is" + memberyf.data.OPField + "',id:'Is" + memberyf.data.OPField + "'"; checkboxSingleItem += "}"; } checkboxitems += checkboxSingleItem; }; checkboxitems += "]"; _this.myCheckboxGroup = new Ext.form.CheckboxGroup({ id: 'myGroup', xtype: 'checkboxgroup', fieldLabel: '服务项目', columns: 8, items: eval(checkboxitems) }); for (i = 0; i < this.storecodeservice.getCount(); i += 1) { _this.myCheckboxGroup.items.items[i].addListener('change', function (field, newValue, oldValue, eOpts) { this.serviceCheckChange(field, newValue, oldValue, eOpts); }, this); }; this.formHead.add(_this.myCheckboxGroup); this.formHead.doLayout(); } if (this.opStatus == 'copyadd') { this.LoadCopyData(this.editRecord.get('BSNO'), this.copyfee); } else { this.LoadData(this.opStatus, condition); } } }, scope: this }); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpApply/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.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdi.getForm().reset(); this.formEdi.getForm().setValues(data); this.GetEditStatus(); if (this.opStatus == 'add') { this.LoadDefValue(); } if (data.WMSNO != '') { this.storeListWmsIn.load({ params: { wmsno: data.WMSNO} }); } else this.storeListWmsIn.load({ params: { wmsno:''} }); if (data.MBLNO!=''){ this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+data.MBLNO+"' AND BSNO<>'"+data.BSNO+"'" }}); this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+data.MBLNO+"'" }}); } this.LoadPeriod(this.opStatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var billno = '*'; var gid = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('BSNO'); } this.storeBodyList.load({ params: { BsNo: billno} }); var condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; this.storeCtnBodyList.load({ params: { condition: condition} }); }, LoadCopyData: function (bsno, CopyFee) { this.serialNo = 0; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', //'正在查询主表数据...', url: '/MvcShipping/MsOpApply/GetCopyData', params: { condition: "BSNO='" + bsno + "'", copyfee: CopyFee }, 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; // var CUSTOMERNAME = data.CUSTOMERNAME; var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContact.load({ params: { condition: s } }); // this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdi.getForm().reset(); this.formEdi.getForm().setValues(data); this.GetAddText(); _this.opStatus = 'add'; this.GetEditStatus(); this.LoadPeriod(this.opStatus); } else { Ext.MessageBox.alert('服务器响应出错', response.responseText); } }, scope: this }); }, // end LoadDate GetAddText: function () { if (this.opStatus != 'edit') { this.opStatus = 'add' var basicForm = this.formHead.getForm(); if (!this.copyfee) { basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); field.setValue(NewGuid()); basicForm.findField('BSNO').setDisabled(true); } var field = basicForm.findField('CUSTNO'); field.setValue(''); field = basicForm.findField('INPUTBY'); field.setValue(SHOWNAME); var field = basicForm.findField('BSSTATUS'); field.setValue(false); var field = basicForm.findField('BSSTATUSREF'); field.setValue('未锁定'); var field = basicForm.findField('FEESTATUS'); field.setValue(false); var field = basicForm.findField('FEESTATUSREF'); field.setValue('未锁定'); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); field = basicForm.findField('OPDATE'); field.setValue(mydatestr); field = this.formEdit.getForm().findField('CUSTOMDATE'); field.setValue(mydatestr); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = basicForm.findField('ACCDATE'); field.setValue(mydatestr); this.LoadPeriodStatus(this.opStatus); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("BSNO", '*'); memberbody.commit(); }; for (var j = 0; j < this.storeCtnBodyList.getCount(); j += 1) { var memberbody = this.storeCtnBodyList.getAt(j); memberbody.set("CTN_ID", NewGuid()); memberbody.set("BSNO", '*'); memberbody.commit(); }; this.GetEditStatus(); var children = this.panelpage2.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { this.panelpage2.remove(children.items[i], true); } } for (i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) { if (this.myCheckboxGroup.items.items[i].checked) { var panelservice = this.CreateMenuPanel(this.myCheckboxGroup.items.items[i].boxLabel, this.myCheckboxGroup.items.items[i].name); this.panelpage2.add(panelservice); this.panelpage2.doLayout(); } }; var children = this.tabapplypanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodOpApplyOpwt') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabapplypanel.doLayout(); } }, LoadPeriod: function (opstatus) { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; this.MsPeriod = data; this.LoadPeriodStatus(opstatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, LoadPeriodStatus: function (opstatus) { var ETD = this.formEdit.getForm().findField('CUSTOMDATE').getRawValue(); if (ETD == '') { this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false); } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(false); } else { this.formEdit.getForm().findField('CUSTOMDATE').setMinValue(''); this.formEdit.getForm().findField('CUSTOMDATE').setReadOnly(true); } } } var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue(); var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(this.MsPeriod.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { this.formHead.getForm().findField('ACCDATE').setMinValue(''); this.formHead.getForm().findField('ACCDATE').setReadOnly(true); } } }, // end LoadDate RefreshClick: function () { this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); condition = "BSNO='" + data.BSNO + "'"; this.LoadData("edit", condition); }, Save: function (type) { var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); var basicForm3 = this.formEdi.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } if (!basicForm3.isValid()) { return; } var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); var bodyctndatas = []; var cntrnostr = ''; var isnoctn = false; for (var i = 0; i < this.storeCtnBodyList.getCount(); i += 1) { var member = this.storeCtnBodyList.getAt(i); var WEIGHDATE = member.data.WEIGHDATE; if (WEIGHDATE != '') WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d'); member.data.WEIGHDATE = WEIGHDATE; var cntrno = member.data.CNTRNO; if (cntrno != '') { var iscn = cntrno.match(/^[a-zA-Z]{4}[0-9]{7}$/); if (iscn == null) { cntrnostr = cntrnostr + cntrno + ','; } } //if (member.data.CTNALL == '') { // isnoctn = true; //} bodyctndatas.push(member); } if (isnoctn) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '集装箱信息,箱型不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } if (cntrnostr != '') { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: cntrnostr + '箱号不正确,请录入正确箱号再保存!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas); this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); var data3 = this.formEdi.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); _this = this; data.BSTYPE2 = this.BSTYPE2; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpApply/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), data3: Ext.JSON.encode(data3), body: jsonBody, ctnbody:jsonCtnBody }, 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().reset(); this.formEdit.getForm().setValues(returnData); this.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); this.formEdi.getForm().reset(); this.formEdi.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = _this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpApply', 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); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("BSNO", this.editRecord.get('BSNO')); memberbody.commit(); }; for (var j = 0; j < this.storeCtnBodyList.getCount(); j += 1) { var memberbody = this.storeCtnBodyList.getAt(j); memberbody.set("BSNO", this.editRecord.get('BSNO')); memberbody.commit(); }; this.LoadPeriodStatus(this.opStatus); if (returnData.WMSNO != '') { this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO} }); } else this.storeListWmsIn.load({ params: { wmsno:''} }); if (returnData.MBLNO!=''){ this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+returnData.MBLNO+"' AND BSNO<>'"+returnData.BSNO+"'" }}); this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+returnData.MBLNO+"'" }}); } } else if (type == '1') { window.close(); } else if (type == '2') { this.LoadData('add', ''); } } 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 , onAddDetailClick: function (button, event) { // if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true) { // var basicForm = this.formEdit.getForm(); // var basicForm2 = this.formHead.getForm(); // if (!basicForm.isValid()) { // return; // } // if (!basicForm2.isValid()) { // return; // } // var bodydatas = []; // for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { // var member = this.storeBodyList.getAt(i); // bodydatas.push(member); // } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); // var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); // this.formHead.getForm().findField('BSNO').setDisabled(false); // var data = this.formHead.getForm().getValues(false, false, false); // var data2 = this.formEdit.getForm().getValues(false, false, false); // this.formHead.getForm().findField('BSNO').setDisabled(true); // Ext.Msg.wait('正在保存数据, 请稍侯..'); // Ext.Ajax.request({ // waitMsg: '正在保存数据...', // url: '/MvcShipping/MsOpApply/Save', // scope: this, // params: { // opstatus: this.opStatus, // data: Ext.JSON.encode(data), // data2: Ext.JSON.encode(data2), // body: jsonBody // }, // 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().reset(); // this.formEdit.getForm().setValues(returnData); // this.formHead.getForm().reset(); // this.formHead.getForm().setValues(returnData); // if (this.opStatus == 'add') { // var arrNewRecords = this.StoreList.insert(0, returnData); // this.editRecord = this.storeList.getAt(0); // } // else if (this.opStatus == 'edit') { // var editp = Ext.create('MsOpApply', 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(); // } // this.opStatus = 'edit'; // basicForm2.findField('BSNO').setDisabled(true); // for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { // var memberbody = this.storeBodyList.getAt(j); // memberbody.set("BSNO", this.editRecord.get('BSNO')); // memberbody.commit(); // }; // this.LoadPeriodStatus(this.opStatus); // if (returnData.WMSNO != '') { // this.storeListWmsIn.load({ params: { wmsno: returnData.WMSNO} }); // } else this.storeListWmsIn.load({ params: { wmsno:''} }); // this.addDetail(); // if (returnData.MBLNO!=''){ // this.storeListBsCustomNo.load({ params: { constr:" MBLNO='"+returnData.MBLNO+"' AND BSNO<>'"+returnData.BSNO+"'" }}); // this.storeListWmsNo.load({ params: { constr:" w.BLNO='"+returnData.MBLNO+"'" }}); // } // } 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 // }); // } // } // }); // } else { // this.addDetail(); // } this.addDetail(); }, //end onAddDetailClick onDelDetailClick: function (button, event) { this.deleteDetail(); }, //onDelDetailClick gridAfterEdit: function (editor, e, eOpts) { if (e.field == 'Pkgs' || e.field == 'Price') { var Pkgs = e.record.data['Pkgs']; var Price = e.record.data['Price']; e.record.set('Total', (Pkgs * Price).toFixed(2)); } else if (e.field=='WMSIN_GID'){ var records = DsStoreQueryBy(this.storeListWmsIn, 'GID', e.value); if (records.getCount() > 0) { var data = records.getAt(0).data; var GoodsName = data.GOODSNAME; var GOODSMODEL = data.GOODSMODEL; var GOODSSTANDARD = data.GOODSSTANDARD; var GOODSPACK = data.GOODSPACK; var GOODAPPLYNUM = this.calcApplyDetailTotal(e.value); var GOODSNUM=Add(GOODSPACK,-GOODAPPLYNUM); if (GOODSNUM<0) GOODSNUM=0; var Pkgs=Mul(GOODSNUM, GOODSSTANDARD); e.record.set('GoodsName', GoodsName); e.record.set('GOODSMODEL', GOODSMODEL); e.record.set('GOODSSTANDARD', GOODSSTANDARD); e.record.set('GOODSNUM', GOODSNUM); e.record.set('NOAPPLYNUM', GOODSPACK); e.record.set('Pkgs', Pkgs); this.setPkgsTotal(); } }else if (e.field=='GOODSNUM'){ var GOODSNUM=e.value; var WMSIN_GID = e.record.data['WMSIN_GID']; var GOODAPPLYNUM = this.calcApplyDetailTotal(WMSIN_GID); GOODAPPLYNUM=Add(GOODAPPLYNUM,-GOODSNUM); var NOAPPLYNUM =0; var GOODSSTANDARD = e.record.data['GOODSSTANDARD']; var GOODSPACK=0; var WMSNO = this.formHead.getForm().findField('WMSNO').getValue(); if (WMSNO!=''){ var records = DsStoreQueryBy(this.storeListWmsIn, 'GID',WMSIN_GID); if (records.getCount() > 0) { var data = records.getAt(0).data; GOODSPACK = data.GOODSPACK; NOAPPLYNUM=Add(GOODSPACK,-GOODAPPLYNUM); } if (GOODSNUM>NOAPPLYNUM){ GOODSNUM=NOAPPLYNUM; if (GOODSNUM<0) GOODSNUM=0; e.record.set('GOODSNUM', GOODSNUM); Ext.Msg.show({ title: '提示', msg: '规格数量不能大于未报关数量!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } this.setPkgsTotal(); var Pkgs=Mul(GOODSNUM, GOODSSTANDARD); e.record.set('Pkgs', Pkgs); } }, setPkgsTotal: function () { var total = this.calcDetailTotal('GOODSNUM'); this.setHeadFieldValue('PKGS', total); }, calcApplyDetailTotal: function (WMSIN_GID) { var total = 0; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var value = member.get('GOODSNUM'); var GID = member.get('WMSIN_GID'); if (GID==WMSIN_GID){ total = Add(total,value); } } return total; }, calcDetailTotal: function (fieldName) { var total = 0; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var value = member.get(fieldName); total = total + value; } return total; }, setHeadFieldValue: function (fieldName, value) { var field = this.formEdit.getForm().findField(fieldName); field.setValue(value); }, serviceCheckChange: function (field, newValue, oldValue, eOpts) { if (field.checked) { if (Ext.getCmp('pnl' + field.id)) { } else { var panelservice = this.CreateMenuPanel(field.boxLabel, field.name,true); this.panelpage2.add(panelservice); this.panelpage2.doLayout(); } } else { _this = this; if (Ext.getCmp('pnl' + field.id)) { var children = _this.panelpage2.items; if (children) { _this.panelpage2.remove('pnl' + field.id, true); _this.panelpage2.doLayout(); } } } }, CreateMenuPanel: function (title, TypeID,Isinit) { var bsno = this.formHead.getForm().findField('BSNO').value; var type = Ext.util.Format.substr(TypeID, 2, 9) var storeServiceList = Ext.create('Ext.data.Store', { model: 'MsOpApplyServiceDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpApplyService/GetServiceDetailList', reader: { id: 'BSNO,SerialNo', root: 'data', totalProperty: 'totalCount' } } }); storeServiceList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { BsNo: bsno, OPField: type }); }, this); var gridserviceListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); var panelserviceBtn = new Ext.Panel({ region: "north", tbar: [ { id: TypeID + 'Save', text: "保存", iconCls: "btnsave", handler: function (button, event) { var basicForm = servicepanel.getForm(); if (!basicForm.isValid()) { return; } var bodydatas = []; for (var i = 0; i < storeServiceList.getCount(); i += 1) { var member = storeServiceList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); var data = servicepanel.getForm().getValues(); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpApplyService/Save', scope: this, params: { bsno: bsno, data: Ext.JSON.encode(data), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; servicepanel.getForm().setValues(returnData); for (var j = 0; j < storeServiceList.getCount(); j += 1) { var memberbody = storeServiceList.getAt(j); memberbody.set("BSNO", bsno); memberbody.commit(); }; } 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 }); } } }); }, scope: this }, { id: TypeID + 'btnWorkNew', text: "添加流程", iconCls: "btnadd", handler: function (button, event) { var newSerialno = this.GetHandleSerialNo(storeServiceList); var record = Ext.create('MsOpApplyServiceDetail', { BSNO: '*', GID: '', SerialNo: newSerialno, OPFIELD: type, STATUS: '未完成', WORK: '', ISFINISH: 0, NOFINISHRESON: '', OTADVICE: '', HELPOP: '', ENDOP: '', REMARK: '' }); storeServiceList.add(record); var n = storeServiceList.getCount(); gridserviceListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, scope: this }, { id: TypeID + 'btnWorkdel', text: "删除流程", iconCls: "btndelete", handler: function (button, event) { var selectedRecords = servicegridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; storeServiceList.remove(selectedRecords[i]); } }, scope: this }, { id: TypeID + 'btnWorkover', text: "流程确认完成", handler: function (button, event) { var selectedRecords = servicegridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; rec.data.STATUS = '已完成'; rec.data.ENDOP = SHOWNAME; var myDate = new Date(); rec.data.ENDDATETIME = myDate; rec.commit(); } }, scope: this }, { id: TypeID + 'btnWorkOpover', text: "流程审核完成", handler: function (button, event) { var field = servicepanel.getForm().findField('STATUS'); field.setValue('已完成'); var myDate = new Date(); var field2 = servicepanel.getForm().findField('ENDDATETIME'); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s'); field2.setValue(mydatestr); var field3 = servicepanel.getForm().findField('ENDOP'); field3.setValue(SHOWNAME); }, scope: this }, { id: TypeID + 'btnWorkOpback', text: "流程驳回", handler: function (button, event) { var selectedRecords = servicegridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; rec.data.STATUS = '操作驳回'; rec.data.ENDOP = SHOWNAME; var myDate = new Date(); rec.data.ENDDATETIME = myDate; rec.commit(); } }, scope: this }, { id: TypeID + 'btnWorkOpover', text: "流程审核完成", handler: function (button, event) { var selectedRecords = servicegridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; rec.data.STATUS = '已完成'; rec.data.ENDOP = SHOWNAME; var myDate = new Date(); rec.data.ENDDATETIME = myDate; rec.commit(); } }, scope: this }, '-', { id: TypeID + 'btnover', text: "确认完成", handler: function (button, event) { var opstr = this.formHead.getForm().findField('OP').getValue(); if (SHOWNAME != opstr) { Ext.Msg.show({ title: '警告', msg: '你无权确认完成 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var field = servicepanel.getForm().findField('STATUS'); field.setValue('已完成'); var myDate = new Date(); var field2 = servicepanel.getForm().findField('ENDDATETIME'); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s'); field2.setValue(mydatestr); var field3 = servicepanel.getForm().findField('ENDOP'); field3.setValue(SHOWNAME); }, scope: this }, { id: TypeID + 'btnopover', text: "审核完成", handler: function (button, event) { var opstr = this.formHead.getForm().findField('OP').getValue(); if (SHOWNAME != opstr) { Ext.Msg.show({ title: '警告', msg: '你无权审核完成 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var field = servicepanel.getForm().findField('STATUS'); field.setValue('已完成'); var myDate = new Date(); var field2 = servicepanel.getForm().findField('ENDDATETIME'); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s'); field2.setValue(mydatestr); var field3 = servicepanel.getForm().findField('ENDOP'); field3.setValue(SHOWNAME); }, scope: this } ] }); var storeOpCodeSvr = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); storeOpCodeSvr.load(); var opstr = this.formHead.getForm().findField('OP').getValue(); var comboxOp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: title + '操作', store: storeOpCodeSvr, forceSelection: true, name: 'OP', labelWidth: 60, width: 170, value: opstr, valueField: 'UserName', displayField: 'CodeAndName' }); var storeCodeService = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpServiceDetail', proxy: { url: '/MvcShipping/MsCodeOpService/GetBodyList' } }); var condition = "OS_ID in (select OS_ID from code_op_service where OPTYPE='5' and OPField='" + type + "')" storeCodeService.load({ params: { condition: condition} }); var comboxCodeService = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '服务项目类别', store: storeCodeService, forceSelection: true, name: 'SERVICE', labelWidth: 80, width: 170, valueField: 'NAME', displayField: 'NAME' }); var storeCodeWork = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpServiceDetail', proxy: { url: '/MvcShipping/MsCodeOpService/GetWorkList' } }); storeCodeWork.load({ params: { condition: condition} }); var comboxCodeWork = Ext.create('DsExt.ux.RefTableCombox', { store: storeCodeWork, forceSelection: true, name: 'WORK', labelWidth: 80, valueField: 'NAME', displayField: 'NAME' }); var comboxhelpOp = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeOpCode, forceSelection: true, name: 'HELPOP', valueField: 'UserName', displayField: 'CodeAndName' }); var servicepanel = Ext.widget('form', { bodyPadding: 3, layout: "border", region: 'north', height: 40, frame: false, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%', margins: '0 5 5 5' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '服务项目', name: 'OPFIELD', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '当前状态', labelWidth: 60, width: 120, readOnly: true, name: 'STATUS' }, comboxOp, comboxCodeService, { fieldLabel: '开始时间', format: 'Y-m-d', xtype: 'datetimefield', labelWidth: 60, width: 220, name: 'STARTDATETIME' }, { fieldLabel: '计划完成时间', format: 'Y-m-d', xtype: 'datetimefield', labelWidth: 80, width: 220, name: 'PLANENDTIME' }, { fieldLabel: '实际完成时间', format: 'Y-m-d', xtype: 'datetimefield', labelWidth: 80, width: 220, readOnly: true, name: 'ENDDATETIME' }, { fieldLabel: '完成人', labelWidth: 50, width: 120, readOnly: true, name: 'ENDOP' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpApplyService/GetData', params: { BsNo: bsno, OPField: type }, 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; servicepanel.getForm().reset(); servicepanel.getForm().setValues(data); if (servicepanel.getForm().findField('OP').getValue() == '') servicepanel.getForm().findField('OP').setValue(opstr); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var serviceGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); var servicegridList = new Ext.grid.GridPanel({ store: storeServiceList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [gridserviceListCellEditing], selModel: serviceGridCheckBoxModel, selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 120 }, { sortable: true, dataIndex: 'OPFIELD', header: '服务类型', hidden: true, width: 120 }, { sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'SerialNo', header: '序号', width: 30 }, { sortable: true, dataIndex: 'WORK', header: '流程', editor: comboxCodeWork, width: 120 }, { sortable: true, dataIndex: 'STATUS', header: '流程状态', width: 120 } /* , { sortable: true, dataIndex: 'STARTDATETIME', header: '开始时间', editor: { xtype: 'datetimefield', format: 'Y-m-d', allowBlank: false, selectOnFocus: true }, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), width: 130 } */ , { sortable: true, dataIndex: 'PLANENDTIME', header: '计划完成时间', editor: { xtype: 'datetimefield', format: 'Y-m-d', allowBlank: false, selectOnFocus: true }, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), width: 130 }, { sortable: true, dataIndex: 'ENDDATETIME', header: '完成时间', renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), width: 130 }, { sortable: true, dataIndex: 'NOFINISHRESON', header: '未完成原因', editor: { xtype: 'textfield', allowBlank: false, selectOnFocus: true }, width: 120 }, { sortable: true, dataIndex: 'NEXTPLAN', header: '下步计划', editor: { xtype: 'textfield', selectOnFocus: true }, width: 110 }, { sortable: true, dataIndex: 'HELPOP', header: '协助解决人', editor: comboxhelpOp, width: 110 }, { sortable: true, dataIndex: 'ENDOP', header: '完成人', width: 110 } ] }); var panelTop = new Ext.Panel({ layout: "border", region: "north", height: 60, items: [panelserviceBtn, servicepanel] }); storeServiceList.load({ params: { BsNo: bsno, OPField: type}, callback: function (r, options, success) { if (success) { if (storeServiceList.getCount() > 0){ }else { storeWorkList = Ext.create('Ext.data.Store', { model: 'MsCodeOpServiceDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpService/GetWorkList', reader: { id: 'OS_ID,SerialNo', root: 'data', totalProperty: 'totalCount' } } }); storeWorkList.load({ params: { condition: "OS_ID in (select OS_ID from code_op_service where OPField='"+type+"' and OPTYPE=5)" }, callback: function (r, options, success) { if (success) { if (storeWorkList.getCount() > 0) { for (var j = 0; j < storeWorkList.getCount(); j += 1) { var member = storeWorkList.getAt(j); var newSerialno = _this.GetHandleSerialNo(storeServiceList); var record = Ext.create('MsOpApplyServiceDetail', { BSNO: '*', GID: '', SerialNo: newSerialno, OPFIELD: type, STATUS: '未完成', WORK: member.data.NAME, ISFINISH: 0, NOFINISHRESON: '', OTADVICE: '', HELPOP: '', ENDOP: '', REMARK: '' }); storeServiceList.add(record); }; var basicForm = servicepanel.getForm(); if (!basicForm.isValid()) { return; } var bodydatas = []; for (var i = 0; i < storeServiceList.getCount(); i += 1) { var member = storeServiceList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); var data = servicepanel.getForm().getValues(); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpApplyService/Save', scope: this, params: { bsno: bsno, data: Ext.JSON.encode(data), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; servicepanel.getForm().setValues(returnData); for (var j = 0; j < storeServiceList.getCount(); j += 1) { var memberbody = storeServiceList.getAt(j); memberbody.set("BSNO", bsno); memberbody.commit(); }; } 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 }); } } }); } else { } } }, scope: this }); } } } }); return new Ext.Panel({ title: title, height: 200, id: 'pnl' + TypeID, layout: "border", region: 'north', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [panelTop, servicegridList] }); }, GetHandleSerialNo: function (store) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (member.data.SerialNo > result) { result = member.data.SerialNo; } } } result = result + 1; return result; }, addDetail: function () { var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); this.serialNo = newSerialno; // this.tabtree.expandAll(); var record = Ext.create('MsOpApplyDetail', { BsNo: '*', SerialNo: newSerialno, GoodsCode: '', GoodsName: '', WMSNO: '', GOODSMODEL: '', GOODSSTANDARD: '', Pkgs: 0, Price: 0, Total: 0, GOODSNUM: 0, Currency: '', Remark: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, deleteDetail: function () { this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); var selectedRecords = this.gridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.BsNo != "" || rec.BsNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.bodyDel.push(rec); } this.storeBodyList.remove(selectedRecords[i]); } }, addCtnDetail: function () { //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var CTNSTATUS = 'F'; var MASTERNO = ''; if (this.storeCtnBodyList.getCount() > 0) { var memberbody = this.storeCtnBodyList.getAt(0); CTNSTATUS = memberbody.data.CTNSTATUS; MASTERNO = memberbody.data.MASTERNO; } var newSerialno = this.DsGetNewNo(this.storeCtnBodyList); this.serialNo = newSerialno; var record = Ext.create('MsOpCtn', { CTN_ID: NewGuid(), BSNO: '*', CTNCODE: newSerialno, CTNALL: '', CTNNUM: 1, CNTRNO: '', SEALNO: '', PKGS: 0, KINDPKGS: '', KGS: 0, TAREWEIGHT: 0, CBM: 0, FENPKGS: 0, FENKGS: 0, FENCBM: 0, WEIGHTYPE: '', WEIGHKGS: 0, WEIGHATTN: '', WEIGHTEL: '', WEIGHSIGN: '', CTNSTATUS: CTNSTATUS, MASTERNO: MASTERNO, TRUCKER: '', TRUCKFEE: 0, FREESTORAGEDAY: 0, STORAGEDAY: 0, STORAGEPRICE: 0, STORAGEFEE: 0, FREECTNDAY: 0, CTNDAY: 0, CTNPRICE: 0, CTNFEE: 0, REMARK: '' }); this.storeCtnBodyList.add(record); var n = this.storeCtnBodyList.getCount(); this.gridCtnListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, deleteCtnDetail: function (type) { var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue(); if (BSSTATUS == '锁定') { Ext.Msg.show({ title:'警告', msg:'业务已锁定,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'业务已锁定,不允许操作!' return; } var selectedRecords = this.gridCtnList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeCtnBodyList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示','确定要删除集装箱明细吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', //'正在删除数据...', url: '/MvcShipping/MsOpApply/DeleteCtnDetail', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeCtnBodyList.remove(rec); Ext.Msg.show({ title:'提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title:'错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title:'警告', msg:'服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, DsGetNewNo: function (store) { var result = store.getCount(); if (result == 0) { return '01'; } // var record = store.getAt(result - 1).data.CTNCODE; result = result + 1; var resultstr = result.toString(); if (resultstr.length == 1) resultstr = '0' + resultstr; return resultstr; }, GetEditStatus: function () { var canedit = false; var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue(); var inputby = this.formHead.getForm().findField('INPUTBY').getValue(); var op = this.formHead.getForm().findField('OP').getValue(); _this = this; if (bsStatus == "true") { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modOpApplyOpwt" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { canedit = false; } } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); } _this = this; Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsSysBillNoSet/GetData', params: { condition: "OPLBNAME='报关业务' AND RULEBLNO='委托编号'", handle: 'edit' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(false); } else { if (data.RULEBLNO == '') { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(false); } else { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(true); } } } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, 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); var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); }, 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); } var headfield = this.formEdit.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'); var btnEAddDetail = Ext.getCmp('btnadddetail'); var btnEDeleteDetail = Ext.getCmp('btndeldetail'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btnEAddDetail.enable(); btnEDeleteDetail.enable(); if (this.myCheckboxGroup != NaN && this.myCheckboxGroup != null) { for (var i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) { this.myCheckboxGroup.items.items[i].readOnly = false; }; } } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); btnEAddDetail.disable(); btnEDeleteDetail.disable(); if (this.myCheckboxGroup != NaN && this.myCheckboxGroup != null) { for (var i = 0; i < this.myCheckboxGroup.items.getCount(); i += 1) { this.myCheckboxGroup.items.items[i].readOnly = true; }; } } }, 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 = 'MSOPAPPLY'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_apply WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, PrevRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } 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; } var children = this.tabapplypanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodOpApplyOpwt') { } else { children.items[i].close(); } } } } this.tabapplypanel.doLayout(); j = j - 1; this.editRecord = this.StoreList.getAt(j); if (opstatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, NextRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } 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; } var children = this.tabapplypanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodOpApplyOpwt') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabapplypanel.doLayout(); 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); }, getIsModify: function () { var feepanel = Ext.getCmp('pnlmodApplyAllFee'); if (feepanel != NaN && feepanel != null) { var feemodify = feepanel.panelFee.getModifyStatus(); if (feemodify) { return '费用信息'; } } if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true) { return '业务信息'; } else return ''; } });