Ext.namespace('Shipping'); Shipping.MsAireOrderEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsAireOrderEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsAireOrderEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, MainEditRecord: null, stroplb: '空运出口', isAudit: false, AUDITDATA1: {}, AUDITDATA2: {}, initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; this.initloaddata = 0; this.accdatesameetd = 0; this.MsPeriod = null; this.copybill = false; this.copyfee = false; this.SALEORDERDEPTBYOP = 0; this.editcolumnindex = 0; parentWin = window.parent.opener; this.mainWin = getMainForm(parentWin); //#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.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOrderManagement"} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode4 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode5 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode.on('beforeload', function (store) { var sql = " u.GID IN (SELECT USERID FROM user_userattribute WHERE ATTRIBUTEID='D4BF2204-F0AC-4F12-B02C-6520D57BF806' and VALUE='true' ) "; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeOpCode.load({ params: { condition: " u.GID IN (SELECT USERID FROM user_userattribute WHERE ATTRIBUTEID='D4BF2204-F0AC-4F12-B02C-6520D57BF806' and VALUE='true' ) "} }); //客服 this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', store: this.storeOpCode, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName' }); //揽货人 this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeOpCode2, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (this.SALEORDERDEPTBYOP == 0) this.getFormField('SALEDEPT').setValue(records[0].data.DEPTNAME); this.getFormField('SALECORPID').setValue(records[0].data.CORPID); } } } }); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode3, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { //if (this.SALEORDERDEPTBYOP == 1) // this.getFormField('SALEDEPT').setValue(records[0].data.DEPTNAME); this.getFormField('AUDITOPERATOR2').setValue(records[0].data.UserName); } } } }); //单证 this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '单 证', store: this.storeOpCode4, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, flex: 1, queryParam: 'CODENAME', name: 'DOC', valueField: 'UserName', displayField: 'CodeAndName' }); this.comboxFRCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '海外客服', //'客服', store: this.storeOpCode5, forceSelection: true, hidden:true, flex: 0.5, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'FRCUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName' }); //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); this.storeCustCode_fen = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '下单客户', store: this.storeCustCode, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', allowBlank: false, flex:1, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var SALE = records[0].data.SALE; var _r = this.storeOpCode2.findRecord('UserName', SALE); if (!_r) { var recordCustCode = Ext.create('DsShipping.ux.UserRefModel', { GId: NewGuid(), UserCode: SALE, UserName: SALE, CodeAndName: SALE }); this.storeOpCode2.add(recordCustCode); } this.formHead.getForm().findField('SALE').setValue(); var data = combo.value; this.getFormField('SALE').setValue(records[0].data.SALE); 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.getFormField('OPERATOREMAIL').setValue(member.data.EMAIL); this.getFormField('OPERATORTEL').setValue(member.data.TEL); // this.getFormField('OPERATORFAX').setValue(member.data.FAX); } else { this.comboxInfoClientContact.setValue(''); this.getFormField('OPERATOREMAIL').setValue(''); this.getFormField('OPERATORTEL').setValue(''); // this.getFormField('OPERATORFAX').setValue(''); } } }, scope: this }); var sF = " ISFINANCIALSTAFF=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContactFF.load({ params: { condition: sF }, callback: function (r, options, success) { if (success) { if (this.storeInfoClientContactFF.getCount() > 0) { var member = this.storeInfoClientContactFF.getAt(0); this.comboxClientFCContact.setValue(member.data.SHOWNAME); // this.getFormField('FINANCIALSTAFFEMAIL').setValue(member.data.EMAIL); this.getFormField('FINANCIALSTAFFTEL').setValue(member.data.TEL); // this.getFormField('FINANCIALSTAFFFAX').setValue(member.data.FAX); } else { this.comboxClientFCContact.setValue(''); // this.getFormField('FINANCIALSTAFFEMAIL').setValue(''); this.getFormField('FINANCIALSTAFFTEL').setValue(''); // this.getFormField('FINANCIALSTAFFFAX').setValue(''); } } }, scope: this }); this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} }); this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} }); this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} }); this.storeagent.load({ params: { condition: "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + combo.value + "') )"} }); if (records[0].data.BSSOURCE != '') { this.getFormField('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.getFormField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } } }); this.comboxCustCode_Fen = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustCode_fen, queryMode: 'remote', forceSelection: true, minChars: 1, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', allowBlank: false, listeners: { scope: this, 'select': function (combo, records, eOpts) { } } }); //委托单位_联系人 this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.storeInfoClientContactFF = 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.getFormField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL); this.getFormField('OPERATORTEL').setValue(Cargoinfodata.TEL); // this.getFormField('OPERATORFAX').setValue(Cargoinfodata.FAX); } else { this.getFormField('OPERATOREMAIL').setValue(''); this.getFormField('OPERATORTEL').setValue(''); // this.getFormField('OPERATORFAX').setValue(''); } } } } }); this.storeInfoClientContact2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.storeInfoClientContact2.add({ SHOWNAME: '' }); this.comboxInfoClientContact2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeInfoClientContact2, name: 'OPERATOR', 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.getFormField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL); // // this.getFormField('OPERATORTEL').setValue(Cargoinfodata.TEL); // // // this.getFormField('OPERATORFAX').setValue(Cargoinfodata.FAX); // //} else { // // this.getFormField('OPERATOREMAIL').setValue(''); // // this.getFormField('OPERATORTEL').setValue(''); // // // this.getFormField('OPERATORFAX').setValue(''); // //} // } // } //} }); this.comboxClientFCContact = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户财务', store: this.storeInfoClientContactFF, name: 'FINANCIALSTAFFCODE', valueField: 'SHOWNAME', displayField: 'SHOWNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var Cargoinforecords = DsStoreQueryBy(this.storeInfoClientContactFF, 'GID', records[0].data.GID); if (Cargoinforecords.getCount() > 0) { var Cargoinfodata = Cargoinforecords.getAt(0).data; // this.getFormField('FINANCIALSTAFFEMAIL').setValue(Cargoinfodata.EMAIL); this.getFormField('FINANCIALSTAFFTEL').setValue(Cargoinfodata.TEL); // this.getFormField('FINANCIALSTAFFFAX').setValue(Cargoinfodata.FAX); } else { // this.getFormField('FINANCIALSTAFFEMAIL').setValue(''); this.getFormField('FINANCIALSTAFFTEL').setValue(''); // this.getFormField('FINANCIALSTAFFFAX').setValue(''); } } } } }); //客户加载_船公司 this.storeAIRLINES = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //船公司 this.comboxAIRLINES = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航空公司', matchFieldWidth: false, store: this.storeAIRLINES, forceSelection: true, name: 'AIRLINES', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_订舱代理 this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //船公司 this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订舱代理', matchFieldWidth: false, store: this.storeFORWARDER, forceSelection: true, name: 'FORWARDER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_车队 this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //车队 this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '车队', store: this.storeTRUCKER, forceSelection: true, name: 'TRUCKER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_报关报检 this.storeCUSTOMSER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //报关行 this.comboxCUSTOMSER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '报关行', store: this.storeCUSTOMSER, forceSelection: true, name: 'CUSTOMSER', valueField: 'CustName', displayField: 'CodeAndName' }); 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, name: 'LANE', valueField: 'LANE', displayField: 'LANE' }); //键值维护表_装运方式 this.StoreBLTYPE = Ext.create('Ext.data.Store', { fields: ['BLTYPE'] }); this.StoreBLTYPE.add({ "BLTYPE": "空运单票" }); this.StoreBLTYPE.add({ "BLTYPE": "空运主票" }); this.StoreBLTYPE.add({ "BLTYPE": "空运分票" }); this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装运方式', store: this.StoreBLTYPE, forceSelection: true, name: 'BLTYPE', valueField: 'BLTYPE', displayField: 'BLTYPE', value: '空运单票', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == "拼箱单票" || combo.value == "拼箱分票") { } else { } } } } }); //品名 this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeGoodsModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsList' } }); this.storeCodeGoodsList.load(); this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCodeGoodsList, labelWidth: 250, // forceSelection: true, name: 'GOODSNAME', valueField: 'GOODNAME', 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/GetSourceDetail2' } }); this.comboxBSSOURCE = 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 = "SOURCEID='" + data.SourceID + "'"; this.storeSourceDetail.load({ params: { condition: s} }); } else { var BSSOURCEDETAIL = this.getFormField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } }); this.storeSourceDetail.load(); this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '来源明细', hidden:true, store: this.storeSourceDetail, // forceSelection: true, name: 'BSSOURCEDETAIL', valueField: 'SourceDetail', displayField: 'SourceDetail' }); //所属部门 //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, // forceSelection: true, // name: 'SALEDEPT', // valueField: 'DeptName', // displayField: 'DeptName' // //,hidden: true //}); //件数包装 this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodePackageModel', proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } }); this.storeCodePackage.load(); this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '包 装', flex: 1, store: this.storeCodePackage, // padding: '0 0 0 10', // forceSelection: true, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); //客户加载_发货人 this.storeShipper = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //发货人 this.comboxShipper = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Shipper (发货人)', store: this.storeShipper, // forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', labelWidth: 150, labelAlign: 'left', name: 'SHIPPERID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeShipper, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('SHIPPER').setValue(selectdata.SHIPPERDETAIL); } else { this.getFormField('SHIPPER').setValue(''); } } } } }); //客户加载_收货人 this.storeConsignee = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //收货人 this.comboxConsignee = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Consignee (收货人)', labelWidth: 150, labelAlign: 'left', store: this.storeConsignee, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', name: 'CONSIGNEEID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeConsignee, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL); } else { this.getFormField('CONSIGNEE').setValue(''); } } } } }); //客户加载_通知人 this.storenotifyparty = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //通知人 this.comboxNotifyParty = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Notify Party (通知人)', store: this.storenotifyparty, labelWidth: 150, labelAlign: 'left', // forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', name: 'NOTIFYPARTYID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); } else { this.getFormField('NOTIFYPARTY').setValue(''); } } } } }); //客户加载_代理 this.storeagent = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //收货人 this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '代 理', store: this.storeagent, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', labelWidth: 150, labelAlign: 'left', // forceSelection: true, name: 'AGENTID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeagent, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('AGENT').setValue(selectdata.SHIPPERDETAIL); } else { this.getFormField('AGENT').setValue(''); } } } } }); //this.StoreStlName = Ext.create('Ext.data.Store', { // fields: ['STLNAME'] //}); //this.StoreStlName.add({ "STLNAME": "票结" }); //this.StoreStlName.add({ "STLNAME": "半月结" }); //this.StoreStlName.add({ "STLNAME": "月结" }); //this.StoreStlName.add({ "STLNAME": "周结" }); //this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', { // store: this.StoreStlName, // fieldLabel: '结算方式', // forceSelection: true, // flex: 0.5, // name: 'STLNAME', // valueField: 'STLNAME', // displayField: 'STLNAME' //}); this.StoreCURR = Ext.create('Ext.data.Store', { fields: ['CURR'] }); this.StoreCURR.add({ "CURR": "USD" }); this.StoreCURR.add({ "CURR": "JPY" }); this.StoreCURR.add({ "CURR": "RMB" }); this.StoreCURR.add({ "CURR": "HKD" }); this.comboxCURR = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCURR, fieldLabel: '币制', name: 'CURR', valueField: 'CURR', displayField: 'CURR' }); this.storeISSUETYPE = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_BLTYPE', proxy: { url: '/CommMng/BasicDataRef/GetCodeBLTYPEList' } }); this.storeISSUETYPE.load({ params: { condition: ""} }); this.comboxISSUETYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '签单方式', //'签单方式', store: this.storeISSUETYPE, forceSelection: true, name: 'ISSUETYPE', valueField: 'BLTYPE', displayField: 'BLTYPE' }); 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, readOnly:true, name: 'SALECORPID', valueField: 'GID', displayField: 'NAME' }); //#endregion //#region 数据集 //国际港口(进口装货港、出口卸货港) this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeAirPort', proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' } }); // this.storeCodeDisport.load(); this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeAirPort', proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' } }); this.storeCodeTRANSPORT = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeAirPort', proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' } }); this.storeCodeTRANSPORT2 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeAirPort', proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' } }); this.storeCodeTRANSPORT3 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeAirPort', proxy: { url: '/MvcShipping/MsCodeAirPort/GetDataList' } }); this.comboxPORTLOADID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '始发地', store: this.storeCodeDisport, name: 'PORTLOADID', valueField: 'PORTID', displayField: 'CODEANDNAME', matchFieldWidth: false, forceSelection:true, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('PORTLOAD').setValue(selectdata.PORTENAME); } else { this.getFormField('PORTLOAD').setValue(''); } } } } }); this.comboxPORTDISCHARGEID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的站', store: this.storeCodeDisport2, name: 'PORTDISCHARGEID', valueField: 'PORTID', displayField: 'CODEANDNAME', matchFieldWidth: false, forceSelection: true, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('PORTDISCHARGE').setValue(selectdata.PORTENAME); this.getFormField('LANE').setValue(selectdata.LANE); } else { this.getFormField('PORTDISCHARGE').setValue(''); } } } } }); this.comboxTRANSPORTID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转站', store: this.storeCodeTRANSPORT, name: 'TRANSPORTID', valueField: 'PORTID', displayField: 'CODEANDNAME', matchFieldWidth: false, forceSelection: true, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeTRANSPORT, 'PORTID', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('TRANSPORT').setValue(selectdata.PORTENAME); } else { this.getFormField('TRANSPORT').setValue(''); } } } } }); this.comboxTRANSPORT2ID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转站2', store: this.storeCodeTRANSPORT2, name: 'TRANSPORT2ID', valueField: 'PORTID', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeTRANSPORT2, 'PORTID', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('TRANSPORT2').setValue(selectdata.PORTENAME); } else { this.getFormField('TRANSPORT2').setValue(''); } } } } }); this.comboxTRANSPORT3ID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转站3', store: this.storeCodeTRANSPORT3, name: 'TRANSPORT3ID', valueField: 'PORTID', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeTRANSPORT3, 'PORTID', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.getFormField('TRANSPORT3').setValue(selectdata.PORTENAME); } else { this.getFormField('TRANSPORT3').setValue(''); } } } } }); //付费方式 this.storeFrt = Ext.create('Ext.data.Store', { fields: ['FRT'] }); this.storeFrt.add({ "FRT": "PP" }); this.storeFrt.add({ "FRT": "CC" }); this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运费', store: this.storeFrt, forceSelection: true, name: 'BLFRT', valueField: 'FRT', displayField: 'FRT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { var ttl = parseFloatDef(this.getFormField('TTLFREIGHT').getValue(), 0); var BLFRT = this.getFormField('BLFRT').getValue(); var OTFRT = this.getFormField('OTFRT').getValue(); if (BLFRT == 'PP') { if (ttl != 0) this.getFormField('PFREIGHT').setValue(ttl); } else if (OTFRT == 'CC') { if (ttl != 0) this.getFormField('PFREIGHT').setValue(ttl); } } } }); this.comboxOTBLFRT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '杂费', store: this.storeFrt, forceSelection: true, name: 'OTFRT', valueField: 'FRT', displayField: 'FRT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }); this.comboxHBLBLFRT = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFrt, forceSelection: true, name: 'HBLBLFRT', valueField: 'FRT', displayField: 'FRT' }); this.comboxHBLOTBLFRT = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFrt, forceSelection: true, name: 'HBLOTBLFRT', valueField: 'FRT', displayField: 'FRT' }); this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='贸易方式'" } }); this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '贸易方式', store: this.storeCrmKeyCodeCode, forceSelection: true, id: 'TRADETYPE', name: 'TRADETYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); me = this; //客户加载_船公司 this.storeTRANSAIRLINES = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //船公司 this.comboxTRANSAIRLINES = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转航司', store: this.storeTRANSAIRLINES, matchFieldWidth:true, forceSelection: true, name: 'TRANSAIRLINES', valueField: 'CustName', displayField: 'CodeAndName' }); 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.storeAuditCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserActionRefListRm' } }); this.storeAuditCode.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { MODULENAME: 'modSaleOrderAudit' }); }, this); this.storeAuditCode.load(); this.comboxAUDITOPERATOR = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审核人', store: this.storeAuditCode, matchFieldWidth: false, forceSelection: true, name: 'AUDITOPERATOR', valueField: 'UserName', displayField: 'CodeAndName' }); this.storeAUDITOPERATOR2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeAUDITOPERATOR2.load(); this.comboxAUDITOPERATOR2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '确认订舱', store: this.storeAUDITOPERATOR2, matchFieldWidth: false, forceSelection: true, readOnly:true, name: 'AUDITOPERATOR2', valueField: 'UserName', displayField: 'CodeAndName' }); this.storeShipper_fen = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); this.comboxShipper_Fen = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeShipper_fen, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', labelAlign: 'left', name: 'SHIPPERID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { } } }); this.storeConsignee_fen = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); this.comboxConsignee_Fen = Ext.create('DsExt.ux.RefTableCombox', { labelAlign: 'left', store: this.storeConsignee_fen, forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', name: 'CONSIGNEEID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { } } }); this.storenotifyparty_fen = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperListRm' } }); this.comboxNotifyParty_Fen = Ext.create('DsExt.ux.RefTableCombox', { store: this.storenotifyparty_fen, labelAlign: 'left', forceSelection: true, matchFieldWidth: false, queryMode: 'remote', minChars: 2, queryParam: 'CODENAME', name: 'NOTIFYPARTYID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { //if (records.length > 0) { // var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value); // if (selectrecords.getCount() > 0) { // var selectdata = selectrecords.getAt(0).data; // this.formBill.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); // } else { // this.formBill.getForm().findField('NOTIFYPARTY').setValue(''); // } //} } } }); //#endregion //#region 编辑formHead 基本信息 this.panelAIRLINES = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '航班号', flex: 1, name: 'VESSEL', listeners: { scope: this, blur: function (field, newValue, oldValue, eOpts) { if (newValue != oldValue) { _this.getFormField('VESSEL').setValue(newValue.toUpperCase()); } } } }, this.comboxAIRLINES, this.comboxFORWARDER] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxPORTLOADID, { name: 'PORTLOAD' }, { fieldLabel: '航班日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxPORTDISCHARGEID, { name: 'PORTDISCHARGE' }, { fieldLabel: '到港日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxTRANSPORTID, { name: 'TRANSPORT' }, this.comboxTRANSAIRLINES] }, { xtype: 'container', layout: 'hbox', hidden:true, flex: 1, defaultType: 'textfield', items: [this.comboxTRANSPORT2ID, { name: 'TRANSPORT2' }, { xtype: 'hiddenfield', flex: 1 }] }, { xtype: 'container', layout: 'hbox', hidden: true, flex: 1, defaultType: 'textfield', items: [this.comboxTRANSPORT3ID, { name: 'TRANSPORT3' }, { xtype: 'hiddenfield', flex: 1 }] }, { xtype: 'container', layout: 'hbox', hidden: true, flex: 1, defaultType: 'textfield', items: [this.comboxCUSTOMSER, this.comboxTRUCKER, this.comboxLANE] }] }] }); this.panelVALUE = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxCURR, this.comboxBLFRT, this.comboxOTBLFRT] }, { xtype: 'container', layout: 'hbox', hidden: true, flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '运输申明价', flex: 1, name: 'CUSTVALUE' }, { fieldLabel: '海关申明价', flex: 1, name: 'CUSTOMVALUE' }, { fieldLabel: '保险金额', flex: 1, name: 'INAMOUT', 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; } }] }] }] }); this.panelKGS = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '件数', flex: 1, name: 'PKGS' }, this.comboxKINDPKGS, { fieldLabel: '毛重', flex: 1, name: 'KGS', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { //if (newValue == null || newValue == '') return; //if (newValue != oldValue) { // this.SetFEEKGSChangeNew(); //} } } }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '体积', flex: 1, name: 'CBM', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { this.SetFEEKGSChangeNew(); } } } }, { xtype: 'button', id: 'btnDetail', iconCls: "btnadddetail", handler: function (button, event) { var BSNO = this.getFormField('BSNO').getValue(); var sql = " BSNO='" + BSNO + "'"; this.storeBodyList.load({ params: { condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.winCtnListShow.show(); }, scope: this } ] }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '等级', flex: 1, name: 'CLASS' }, { fieldLabel: '计费重量', flex: 1, name: 'FEEKGS', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var feekgs = newValue; var price = this.getFormField('PRICE').getValue(); if (price == '') price = '0'; var ttl = Mul(feekgs, price); this.getFormField('TTLFREIGHT').setValue(ttl); } } } }, { fieldLabel: 'X运价', flex: 1, name: 'PRICE', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var feekgs = newValue; var price = this.getFormField('FEEKGS').getValue(); var ttl = Mul(feekgs, price); this.getFormField('TTLFREIGHT').setValue(ttl); } } } }, { fieldLabel: '=总价', flex: 1, name: 'TTLFREIGHT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == oldValue) return; var ttl = parseFloatDef(newValue, 0); var BLFRT = this.getFormField('BLFRT').getValue(); var OTFRT = this.getFormField('OTFRT').getValue(); if (BLFRT == 'PP') { if (ttl != 0) this.getFormField('PFREIGHT').setValue(ttl); } else if (OTFRT == 'CC') { if (ttl != 0) this.getFormField('PFREIGHT').setValue(ttl); } } } }] }] }] }); //隐藏费用1 this.panelOTFEE = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, hidden:true, frame: true, //hidden:true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 0, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [ { xtype: 'label', flex: 1, text: '费用名称' }, { xtype: 'label', flex: 1, text: '金额', 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; } }, { xtype: 'label', flex: 1, text: '费用名称' }, { xtype: 'label', flex: 1, text: '金额', 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; } }, { xtype: 'label', flex: 1, text: '费用名称' }, { xtype: 'label', flex: 1, text: '金额', 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; } }, { xtype: 'label', flex: 1, text: '费用名称' }, { xtype: 'label', flex: 1, text: '金额', 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; } }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ flex: 1, name: 'OTFEE1' }, { flex: 1, name: 'OTFEE1AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE2' }, { flex: 1, name: 'OTFEE2AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE3' }, { flex: 1, name: 'OTFEE3AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE4' }, { flex: 1, name: 'OTFEE4AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ flex: 1, name: 'OTFEE5' }, { flex: 1, name: 'OTFEE5AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE6' }, { flex: 1, name: 'OTFEE6AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE7' }, { flex: 1, name: 'OTFEE7AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }, { flex: 1, name: 'OTFEE8' }, { flex: 1, name: 'OTFEE8AMOUNT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { this.otfeechange(field, newValue, oldValue, eOpts); } } }] }] }] }); //隐藏 费用2 this.panelFEETOTAL = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: true, hidden:true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '运费预付', flex: 1, name: 'PFREIGHT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var pfreight = parseFloatDef(newValue, 0); var PCARRIEROT = this.getFormField('PCARRIEROT').getValue(); var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0)); var POTFREIGHT = this.getFormField('POTFREIGHT').getValue(); ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0)); if (ttl != 0) this.getFormField('PTOTAL').setValue(ttl); } } } }, { fieldLabel: '运费到付', flex: 1, name: 'CFREIGHT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var pfreight = parseFloatDef(newValue, 0); var PCARRIEROT = this.getFormField('CCARRIEROT').getValue(); var ttl = Add(pfreight, parseFloatDef(PCARRIEROT, 0)); var POTFREIGHT = this.getFormField('COTFREIGHT').getValue(); ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0)); if (ttl != 0) this.getFormField('CTOTAL').setValue(ttl); } } } }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '杂费预付', flex: 1, name: 'PCARRIEROT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var PCARRIEROT = newValue; var pfreight = this.getFormField('PFREIGHT').getValue(); var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(PCARRIEROT, 0)); var POTFREIGHT = this.getFormField('POTFREIGHT').getValue(); ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0)); if (ttl != 0) this.getFormField('PTOTAL').setValue(ttl); } } } }, { fieldLabel: '杂费到付', flex: 1, name: 'CCARRIEROT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var PCARRIEROT = newValue; var pfreight = this.getFormField('CFREIGHT').getValue(); var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(PCARRIEROT, 0)); var POTFREIGHT = this.getFormField('COTFREIGHT').getValue(); ttl = Add(ttl, parseFloatDef(POTFREIGHT, 0)); if (ttl != 0) this.getFormField('CTOTAL').setValue(ttl); } } } }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '其他预付', flex: 1, name: 'POTFREIGHT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var POTFREIGHT = newValue; var pfreight = this.getFormField('PFREIGHT').getValue(); var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(POTFREIGHT, 0)); var PCARRIEROT = this.getFormField('PCARRIEROT').getValue(); ttl = Add(ttl, parseFloatDef(PCARRIEROT, 0)); if (ttl != 0) this.getFormField('PTOTAL').setValue(ttl); } } } }, { fieldLabel: '其他到付', flex: 1, name: 'COTFREIGHT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var POTFREIGHT = newValue; var pfreight = this.getFormField('CFREIGHT').getValue(); var ttl = Add(parseFloatDef(pfreight, 0), parseFloatDef(POTFREIGHT, 0)); var PCARRIEROT = this.getFormField('CCARRIEROT').getValue(); ttl = Add(ttl, parseFloatDef(PCARRIEROT, 0)); if (ttl != 0) this.getFormField('CTOTAL').setValue(ttl); } } } }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '合计预付', flex: 1, name: 'PTOTAL' }, { fieldLabel: '合计到付', flex: 1, name: 'CTOTAL' }] }] }] }); this.formHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, collapsed: false, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'MASTERNO', name: 'MASTERNO', hidden: true }, { fieldLabel: '业务锁定', disabled: true, readOnly: true, name: 'BSSTATUSREF', hidden: true }, { fieldLabel: '费用锁定', readOnly: true, disabled: true, name: 'FEESTATUSREF', hidden: true }, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATE', hidden: true }, { fieldLabel: '订单号', //'委托编号', readOnly: true, name: 'ORDERNO' } , { fieldLabel: '订单状态', hidden: true, name: 'ORSTATUS' } , { fieldLabel: '委托编号', //'委托编号', readOnly: true, name: 'CUSTNO' }, { fieldLabel: '订单状态', readOnly: true, name: 'ORSTATUSREF' }, this.comboxBLTYPE, this.comboxTRADETERM, this.comboxSaleCompany, this.comboxAUDITOPERATOR] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSALE, //this.comboxDept, { fieldLabel: '销售部门', readOnly: true, name: 'SALEDEPT' }, this.comboxOP, this.comboxCUSTSERVICE, this.comboxDOC, { fieldLabel: '录入人', readOnly:true, name: 'INPUTBY' }, this.comboxAUDITOPERATOR2] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode , { fieldLabel: '入仓号', flex: 1, name: 'WAREHOUSINGNO'//SERVICECONTRACTNO } , { fieldLabel: '参考号', flex: 1, name: 'SERVICECONTRACTNO'//SERVICECONTRACTNO } , this.comboxInfoClientContact, { fieldLabel: 'TEL', name: 'OPERATORTEL' }, { fieldLabel: 'Email', flex:2, name: 'OPERATOREMAIL' } ] } , { xtype: 'container', layout: 'hbox', hidden:true, defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [ { xtype: 'button', id: 'btnCUSTNO', iconCls: "btncancel", handler: function (button, event) { this.ClearCustNo(); }, scope: this }] } // , { //fieldLabel: '订舱编号', //name: 'ORDERNO' // } , { fieldLabel: '主单号', name: 'MBLNO', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('MBLNO') .setValue(field.value.toUpperCase()); } } }, { fieldLabel: '分单号', name: 'HBLNO', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('HBLNO') .setValue(field.value.toUpperCase()); } } }, { fieldLabel: '合约号', name: 'CONTRACTNO' } ] } , { xtype: 'container', layout: 'hbox', hidden:true, defaultType: 'textfield', items: [ this.comboxBSSOURCE , this.comboxBSSOURCEDETAIL , this.comboxISSUETYPE , { fieldLabel: '结算方式', readOnly: true, flex: 0.5, name: 'STLNAME' }, { fieldLabel: '结算日期', // format: 'Y-m-d', flex: 0.5, labelWidth: 55, // xtype: 'datefield', name: 'STLDATE' }, this.comboxFRCUSTSERVICE ] } , this.myCheckboxService, { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: '发票号', //'发票号', name: 'INVNO' }, this.comboxClientFCContact, { fieldLabel: 'TEL', name: 'FINANCIALSTAFFTEL' }] } , { xtype: 'container', layout: 'hbox', //hidden: true, flex: 3, defaultType: 'textfield', items: [ { xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [ this.panelAIRLINES ] } , { xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [ , this.panelVALUE , this.panelKGS , this.panelOTFEE , { xtype: 'label', text: '' }, { hidden: true, xtype: 'textareafield', // grow: true, fieldLabel: '其他费用', height: 70, name: 'OTFEE', anchor: '100%' } ] } ] } , { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [{ xtype: 'label', html: '唛头' }, { xtype: 'textareafield', grow: true, height: 100, name: 'MARKS', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('MARKS') .setValue(field.rawValue.toUpperCase()); } } } ] }, { xtype: 'container', layout: 'anchor', flex: 2, defaultType: 'textfield', items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '货物描述' }, this.comboxGOODSNAME, this.comboxCargoid, { fieldLabel: 'HS编码', name: 'HSCODE' }] }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelSeparator: '', labelWidth: 20, height: 100, name: 'DESCRIPTION', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('DESCRIPTION') .setValue(field.rawValue.toUpperCase()); } } }] }, this.panelFEETOTAL ] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '签单日期', format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: '签单地点', name: 'ISSUEPLACE' }, { fieldLabel: '送仓日期', //'ATD', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'DELIVERYDATE' }, {xtype:"hiddenfield"}, { hidden: true, fieldLabel: '商检单号', name: 'INSPECTIONNO' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '报关单号', name: 'CUSTOMNO' }, { fieldLabel: '报关日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CUSTOMDATE' }, this.comboxTRADETYPE] }, { xtype: 'container', layout: 'hbox', hidden: true, flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '商检日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'INSPECTIONDATE' }, this.comboxEnterp, { fieldLabel: '单位编码', name: 'ENTERPID' }] } ] }, { xtype: 'textareafield', grow: true, fieldLabel: '备 注', height: 60, name: 'REMARK', anchor: '100%' }] }] } ]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 编辑formEdit 基本信息 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.getFormField('ENTERPID').setValue(Cargoinfodata.ENTERPID); } else { this.getFormField('ENTERPID').setValue(''); } } } } }); this.formEdit = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, layout: 'anchor', trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ { xtype: 'fieldset', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '96%' }, items: [ { xtype: 'container', layout: 'anchor', flex: 2, defaultType: 'textfield', items: [ this.comboxShipper, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 70, name: 'SHIPPER', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('SHIPPER') .setValue(field.rawValue.toUpperCase()); } } }, //this.comboxConsignee, { // xtype: 'textareafield', // grow: true, // labelWidth: 0, // height: 70, // name: 'CONSIGNEE', // anchor: '100%', // listeners: { // scope: this, // blur: function (field, The, eOpts) { // _this.getFormField('CONSIGNEE') // .setValue(field.rawValue.toUpperCase()); // } // } //}, this.comboxNotifyParty, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 70, name: 'NOTIFYPARTY', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('NOTIFYPARTY') .setValue(field.rawValue.toUpperCase()); } } }, //this.comboxAgent, { // xtype: 'textareafield', // grow: true, // labelWidth: 0, // height: 70, // name: 'AGENT', // anchor: '100%', // listeners: { // scope: this, // blur: function (field, The, eOpts) { // _this.getFormField('AGENT') // .setValue(field.rawValue.toUpperCase()); // } // } //} ] } , { xtype: 'container', layout: 'anchor', flex: 2, defaultType: 'textfield', items: [ //this.comboxShipper, //{ // xtype: 'textareafield', // grow: true, // labelWidth: 0, // height: 70, // name: 'SHIPPER', // anchor: '100%', // listeners: { // scope: this, // blur: function (field, The, eOpts) { // _this.getFormField('SHIPPER') // .setValue(field.rawValue.toUpperCase()); // } // } //}, this.comboxConsignee, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 70, name: 'CONSIGNEE', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('CONSIGNEE') .setValue(field.rawValue.toUpperCase()); } } }, //this.comboxNotifyParty, { // xtype: 'textareafield', // grow: true, // labelWidth: 0, // height: 70, // name: 'NOTIFYPARTY', // anchor: '100%', // listeners: { // scope: this, // blur: function (field, The, eOpts) { // _this.getFormField('NOTIFYPARTY') // .setValue(field.rawValue.toUpperCase()); // } // } //}, this.comboxAgent, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 70, name: 'AGENT', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.getFormField('AGENT') .setValue(field.rawValue.toUpperCase()); } } } ] } ] } ] }); //end this.formEdit //#endregion //#region 分单 this.storeFenList = Ext.create('Ext.data.Store', { model: 'MsSeaeOrderModel', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsSeaeOrder/GetFenList', reader: { id: 'ORDNO', root: 'data', totalProperty: 'totalCount' } } }); this.FenListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); _this = this; this.FenList = new Ext.grid.GridPanel({ store: this.storeFenList, height: 265, //width: 1200, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, singleSelect: true, plugins: [this.FenListCellEditing], selType: 'cellmodel', tbar: [ { text: '增加明细', tooltip: '增加明细', id: "btnaddfen", iconCls: "btnadddetail", handler: function (button, event) { this.onAddFenClick(button, event); }, scope: this }, { text: '删除明细', tooltip: '删除明细', id: "btndelfen", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFenClick(button, event); }, scope: this }, '-', { id: 'btnFenSave', text: "保存分票信息", iconCls: "btnsave", handler: function (button, event) { this.SaveFen(); }, scope: this }, { xtype: 'label', text: '注意,请及时保存分票信息。', //'应收费用', style: 'font-size:12px', labelColor: '#000', id: 'fennotice', //style:'background-color: #4b9bf5', x: '30%', y: '5%' } ], columns: [{ sortable: true, dataIndex: 'CTN_ID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ORDNO', header: '业务编号', width: 0 }, { dataIndex: 'CUSTOMERNAME', //CTNEXHIBIT header: '委托单位', width: 120, editor: this.comboxCustCode_Fen } , { dataIndex: 'OPERATORCODE', header: 'OPERATORCODE', width: 0, editor: { xtype: 'textfield', //allowBlank: false, selectOnFocus: true, listeners: { focus: function () { //alert('hidden focus'); var selectedRecords = _this.FenList.selModel.getSelection(); for (var i = 0; i < _this.storeFenList.getCount(); i += 1) { var member = _this.storeFenList.getAt(i); if (member.data.BSNO == selectedRecords[0].data.BSNO) { _this.FenList.getSelectionModel().setCurrentPosition({ row: i, column: 4 }); } } }, blur: function () { //alert('hidden blur'); } } } } , { dataIndex: 'OPERATOR', header: '联系人', width: 80, editor: this.comboxInfoClientContact2 }, { dataIndex: 'OPERATORTEL', header: '电话', width: 80, editor: { xtype: 'textfield', //allowBlank: false, selectOnFocus: true } }, { dataIndex: 'OPERATOREMAIL', header: '邮箱', width: 80, editor: { xtype: 'textfield', //allowBlank: false, selectOnFocus: true } } , { dataIndex: 'SHIPPERID', header: '发货人', width: 120, editor: this.comboxShipper_Fen }, { dataIndex: 'CONSIGNEEID', header: '收货人', width: 120, editor: this.comboxConsignee_Fen }, { dataIndex: 'NOTIFYPARTYID', header: '通知人', width: 50, editor: this.comboxNotifyParty_Fen }, { dataIndex: 'PKGS', header: '件数', width: 90, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KGS', header: '毛重', width: 90, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'FEEKGS', header: '计费重', width: 90, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'CBM', header: '尺码', width: 90, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'MARKS', header: 'MARKS', width: 150, editor: { height: 120, xtype: 'textareafield', selectOnFocus: true } }, { dataIndex: 'DESCRIPTION', header: '货描', width: 150, editor: { height: 120, xtype: 'textareafield', selectOnFocus: true } } ] }); this.FenList.getSelectionModel().on('select', function (button, event) { this.onSelectFen(button, event); }, this); this.formFen = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, layout: 'anchor', trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', height: 280, defaults: { anchor: '96%' }, items: [ this.FenList ] }] }); this.panelFenPiao = new Ext.Panel({ title: '分单', //'分票信息', layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [ this.formFen ] }); this.FenList.on('edit', function (editor, e, eOpts) { this.FenAfterEdit(editor, e, eOpts); }, this); //#endregion //#region 按钮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'); this.panelOcr.hide(); }, scope: this }, { text: '复制新建', //"国外舱单", id: 'btncopyaddbs', menu: [{ id: 'btnECopyNew', text: "复制新建", handler: function (button, event) { var btnESave = Ext.getCmp('btnESave'); if (btnESave.isDisabled() || this.getIsModify == '') { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var BSNO = 'topaire' + NewGuid(); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.copybill = false; this.LoadCopyData(oldbsno, this.copybill, true); this.LoadPeriodStatus(this.opStatus); var children = this.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpAireInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.doLayout(); this.panelFee.storeDrChFee.removeAll(); this.panelFee.storeCrChFee.removeAll(); } else { this.CopyNew(); } this.panelOcr.hide(); }, scope: this }, { id: 'btnECopyNewBill', text: '复制新建(含分单)', //"复制新建", handler: function (button, event) { var btnESave = Ext.getCmp('btnESave'); if (btnESave.isDisabled() || this.getIsModify == '') { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var BSNO = 'topaire' + NewGuid(); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, true, false); var children = this.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpAireInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.doLayout(); this.panelFee.strBSNO = BSNO; this.LoadFenCopy(oldbsno); } else { this.copybill = true; this.copyfee = false; this.CopyNew(); } this.panelOcr.hide(); }, scope: this }, { id: 'btnECopyNewFee', text:'复制新建(含费用)', //"复制新建", handler: function (button, event) { var btnESave = Ext.getCmp('btnESave'); if (btnESave.isDisabled() || this.getIsModify == '') { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var BSNO = 'topaire' + NewGuid(); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, false, true); var children = this.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpAireInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.doLayout(); } else { this.copybill = false; this.copyfee = true; this.CopyNew(); } this.panelOcr.hide(); }, 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); this.panelOcr.hide(); }, scope: this }, '-', { text: "提交审核", id: "btnSubmit", handler: function (button, event) { this.onSubmitClick(); }, scope: this }, { text: "撤销提交", id: "btnAuditReset", handler: function (button, event) { this.onAuditResetClick(); }, scope: this }, { text: "审核通过", id: "btnAudit", handler: function (button, event) { this.onAuditClick(); }, scope: this }, { text: "驳回提交", id: "btnAuditCallBack", iconCls: "btndelete", handler: function (button, event) { var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if ((billstatus != "1") && (billstatus != "0")) { Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.winAuditBackShow.show(); }, scope: this }, { text: "确认订舱", id: "btnConfirm", iconCls: "btnadd", handler: function (button, event) { this.onConfirmClick(); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }, '-', { text: "其他操作", menu: [ { text: "转换成大写字母", handler: function (menu, event) { _this.onUpCaseClick(menu, event); } } //, { // text: "生成报关业务", // handler: function (menu, event) { // _this.SaveBG(); // } //} //, { // text: '生成保单', //"生成报关业务", // handler: function (menu, event) { // _this.ShengChengBaoDan(); // } // } ], scope: this }] }); //end 按钮Toolbar //#endregion this.formAuditBack = Ext.widget('form', { frame: true, region: 'center', title: "驳回原因", bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'textareafield', grow: true, fieldLabel: '', labelSeparator: '', labelWidth: 0, height: 100, name: 'ORREASON', anchor: '100%' } ]//end root items }); me = this; this.winAuditBackShow = Ext.create('Ext.window.Window', { title: "驳回销售订舱", width: 450, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formAuditBack], buttons: [{ text: "确认驳回", minWidth: 70, handler: function () { var form = me.formAuditBack.getForm(); var ORREASON = form.findField('ORREASON').getRawValue(); if (ORREASON == '' || ORREASON == null || ORREASON == undefined) { Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; //me.reason = ORREASON; me.onAuditCallBackClick(ORREASON); me.winAuditBackShow.close(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditBackShow.close(); } }] }); //#endregion //#region 费用列表 this.panelFee = new Shipping.OrderFeeGrid({ region: 'center', layout: 'border' }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaeOrderList" } }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaeOrderList" } }); //this.panelFee.storeFeeNameRef.load({ params: { condition: "ISSEA='1' " } }); //this.panelFee.storeFeeNameRefCr.load({ params: { condition: "ISSEA='1' " } }); this.panelFee.storeFeeNameRef.loadData(this.mainWin.GetPubStore("CODE_FEE_AIR").data.items); this.panelFee.storeFeeNameRefCr.loadData(this.mainWin.GetPubStore("CODE_FEE_AIR").data.items); //#endregion //#region 审核窗口 this.formAudit = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '会计期间', xtype: 'monthfield', id:'Confirm_ACCDATE', name: 'ACCDATE' }, this.comboxSeaeOp ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSeaeCustService ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxFORWARDER2 ] }, { xtype: 'textareafield', grow: true, fieldLabel: '备注', labelWidth: 0, height: 90, id: 'Confirm_REMARK', name: 'REMARK', anchor: '100%' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); me = this; this.winAuditShow = Ext.create('Ext.window.Window', { title: "接受销售订舱", width: 450, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formAudit], buttons: [{ text: "确认接受", minWidth: 70, handler: function () { var form = me.formAudit.getForm(); var ACCDATE = form.findField('ACCDATE').getRawValue(); if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) { Ext.Msg.show({ title: '提示', msg: '会计期间为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; //me.formHead.getForm().findField('ORSTATUS').getValue(); //me.formHead.getForm().findField('ACCDATE').setValue(ACCDATE); //var ORREMARK = form.findField('REMARK').getValue(); let oldremark = me.formHead.getForm().findField('REMARK').getValue(); //me.formHead.getForm().findField('REMARK').setValue(oldremark + " " + ORREMARK); me.onConfirm(ACCDATE, oldremark); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditShow.close(); } }] }); //#endregion //#region 按钮Toolbar2 this.panelBtn2 = new Ext.Panel({ region: "north", tbar: [{ id: 'btnESave2', text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }] }); //end 按钮Toolbar //#region 框架结构 this.tabSeaeWTpanel = new Ext.Panel({ title: '主单', activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', enableTabScroll: true, items: [ this.panelBtn2, this.formEdit ] }); this.panelSeae = new Ext.Panel({ title: '委托信息', id: 'pnlmodNewOpAireInfo', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.panelFee] }); 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: '75B5DB48-FBA3-4858-87E9-543F7C180C93' //75B5DB48-FBA3-4858-87E9-543F7C180C93 空运出口订舱 //5840B545-4012-4FCE-A2F4-A03911A2D1BE 空运出口 } }); 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) { var finded = false; if (record.data.MODULEURL == '@') { this.tabSeaepanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { var children = this.tabSeaepanel.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.tabSeaepanel.setActiveTab(i); finded = true; } } } } if (finded == false) { if (this.getFormField('ORDERNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } else { if (record.data.NAME == 'modAireAllFee') { var paneltabitems = new Shipping.AireFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modAireAmendFee') { var paneltabitems = new Shipping.AireAmendFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); // } else if (record.data.NAME == 'BILLOFLOADING') { // var paneltabitems = new Shipping.MsOpBillIndex({ // id: 'pnl' + record.data.NAME, // layout: "border", // region: "center", // autoScroll: true, // frame: false, // closable: true, // title: record.data.DESCRIPTION // }); } else if (record.data.NAME == 'modOpAireFenList') { var paneltabitems = new Shipping.MsOpAireFenIndex({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else { var paneltabitems = new Ext.Panel({ id: 'pnl' + record.data.NAME, layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION, html: ' ' }); } this.tabSeaepanel.add(paneltabitems); this.tabSeaepanel.setActiveTab(paneltabitems); this.tabSeaepanel.doLayout(); } } } } } }); this.tabSeaepanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "TabSeaePanel", enableTabScroll: true, items: [ this.panelSeae , this.tabSeaeWTpanel , this.panelFenPiao ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard.id == "pnlmodAireAllFee") { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } if (oldCard.id == "pnlmodAireAmendFee") { var feemodify = oldCard.panelAmendFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } } } }); this.panelOcr = new Ext.Panel({ title: 'OCR', id: 'panelOcr', width: 0, visible: false, region: 'east', animate: true, autoScroll: true, split: true, closeAction: 'hide', closable: true, html: '' }); this.panelOcr.on({ hide: function () { this.tabtree.show(); }, scope: this }); Ext.apply(this, { items: [this.tabtree, this.tabSeaepanel, this.panelOcr] }); //#endregion this.LoadInitData(); //#region 其他 parentWin = window.parent.opener._this; //parentWin = window.parent.opener._thisfenlist; //if (parentWin == NaN || parentWin == null) { // parentWin = window.parent.opener._this; //} else { // this.isfen = true; //} this.InitData(); 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='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 }); //#endregion //#region 明细表表格 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpAirCbmDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpAire/GetAirCbmDetail', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeBodyList.on('beforeload', function (store) { var condition = "BSNO='" + _this.editRecord.get('BSNO') + "'"; Ext.apply(store.proxy.extraParams, { condition: condition }); }, this); this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.initctncolumns = [{ sortable: true, dataIndex: 'GID', header:'GID', //'编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', //'业务编号', hidden: true, width: 0 }, new Ext.grid.RowNumberer(), { dataIndex: 'LENGTH', header:'长(cm)', //'封号', width: 80, editor: { xtype: 'textfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { _this.onUpKeyClick(1, 13) } } } } }, { dataIndex: 'WIDTH', header: '宽(cm)', //'封号', width: 80, editor: { xtype: 'textfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { _this.onUpKeyClick(1, 13) } } } } }, { dataIndex: 'HEIGHT', header: '高(cm)', //'封号', width: 80, editor: { xtype: 'textfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { _this.onUpKeyClick(1, 13) } } } } }, { dataIndex: 'PKGS', header: '件数', //'箱号', width: 100, editor: { xtype: 'textfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { _this.onUpKeyClick(1, 13) } } } } }, { dataIndex: 'CBM', header: '尺码(M3)', //'封号', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }]; this.ctncolumns = this.initctncolumns; this.GridCheckBoxModelCtn = Ext.create('Ext.selection.CheckboxModel'); this.gridListshow = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." },//"数据加载中,请稍等..." trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModelCtn, plugins: [this.gridListCellEditing], selType: 'cellmodel', features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], tbar: [{ text: '增加明细', //'增加明细', tooltip: '增加明细', //'增加明细', id: "btnadddetails", iconCls: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { id: 'btnsavedetails', text: "保存", //"保存", iconCls: "btnsave", handler: function (button, event) { this.SaveCbmDetail(); }, scope: this }, '-', { text: '删除明细', //'删除明细', tooltip: '删除明细', //'删除明细', id: "btndeldetails", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this }], columns: this.ctncolumns }); this.gridListshow.on('edit', function (editor, e, eOpts) { this.gridAfterEdit(editor, e, eOpts); }, this); this.gridListCellEditing.on('beforeedit', function (editor, e) { return this.cellEditingBeforeEdit(editor, e); }, this); this.winCtnListShow = Ext.create('Ext.window.Window', { title: "尺码明细", //"集装箱明细", width: 500, height: 450, //plain : true, layout: "border", iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.gridListshow], buttons: [{ text: "确定", //"关闭", minWidth: 70, handler: function () { var CBM = 0; for (var i = 0; i < _this.storeBodyList.getCount(); i += 1) { var member = _this.storeBodyList.getAt(i); CBM = Add(CBM, member.data.CBM); } _this.getFormField('CBM').setValue(CBM); me.winCtnListShow.close(); } },{ text: "关闭", //"关闭", minWidth: 70, handler: function () { me.winCtnListShow.close(); } }] }); //#endregion }, //end initUIComponents //#region 加载事件 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.isAudit = ret[3]; //if (this.isfen) this.MainEditRecord = ret[3]; } if (this.opStatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } if (this.opStatus == 'copyaddbill') { this.opStatus = 'copyadd'; this.copybill = true; this.copyfee = false; } if (this.opStatus == 'copyaddfee') { this.opStatus = 'copyadd'; this.copybill = false; this.copyfee = true; } this.storecodeservice.load({ params: { condition: "OPTYPE='3'" }, 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) }); this.formHead.add(_this.myCheckboxGroup); this.formHead.doLayout(); } if (this.opStatus == 'copyadd') { this.LoadCopyData(this.editRecord.get('BSNO'), this.copybill, this.copyfee); } else { this.LoadData(this.opStatus, condition); } } }, scope: this }); this.LoadMustBe(); // if (this.initloaddata == 0) { // this.LoadInitData(); // this.initloaddata = 1; // }; //this.SetSubmitBtn_CanSee(); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; if (this.opStatus == 'edit') { var sMBLNO = this.editRecord.get('MBLNO').toString().trim(); if(sMBLNO!="") { document.title = "空运出口订单-主提单号:" + this.editRecord.get('MBLNO').toString().trim(); } else { document.title = "空运出口订单-订单号:" + this.editRecord.get('ORDERNO').toString().trim(); } } else { document.title = "空运出口订单-新增"; } Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsAireOrder/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.LoadInit(data); this.LoadLazy(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); if (this.opStatus == 'add') { this.LoadDefValue(); } else { this.LoadFen(data.BSNO); } if (this.opStatus == 'copyadd') this.CopyNewData(data); this.Editdata = data; this.GetEditStatus(); this.LoadPeriod(this.opStatus); this.panelFee.EditRecord = this.editRecord; this.panelFee.stroplb = 'op_Seae'; if (this.opStatus == 'add') this.panelFee.strBSNO = ""; else this.panelFee.strBSNO = this.editRecord.get('BSNO'); this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seae", bsno: data.ORDNO } }); this.panelFee.StoreUnit.load({ params: { bsno: data.ORDNO, bstype: "op_SeaeOrder" } }); if (this.copyfee) { } else { this.panelFee.storeDrChFee.load({ params: { billno: data.BSNO, type: 1, optype: "op_Seae" } }); this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_Seae" } }); } this.panelFee.storeBodySum.load({ params: { bsno: data.BSNO }, callback: function (r, options, success) { if (success) { _this.panelFee.setTotalHead(); } } }); this.SetButtonStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var billno = '*'; var gid = '*'; }, LoadCopyData: function (bsno, CopyBill, CopyFee) { let _opstatus = this.opStatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsAireOrder/GetData', params: { handle: _opstatus, 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.LoadInit(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.opStatus = 'add'; this.Editdata = data; this.GetEditStatus(); this.LoadPeriod(this.opStatus); if (CopyBill) { this.LoadFenCopy(bsno); } if (CopyFee) { this.LoadFeeCopy(bsno); } this.SetButtonStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, 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.getFormField('ETD').getRawValue(); if (ETD == '') { this.getFormField('ETD').setMinValue(this.MsPeriod.FDAY); this.getFormField('ETD').setReadOnly(false); } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { this.getFormField('ETD').setMinValue(this.MsPeriod.FDAY); this.getFormField('ETD').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.getFormField('ETD').setMinValue(this.MsPeriod.FDAY); this.getFormField('ETD').setReadOnly(false); } else { this.getFormField('ETD').setMinValue(''); this.getFormField('ETD').setReadOnly(true); } } } var ACCDATE = this.getFormField('ACCDATE').getValue(); var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(this.MsPeriod.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.getFormField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.getFormField('ACCDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.getFormField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.getFormField('ACCDATE').setReadOnly(false); } else { this.getFormField('ACCDATE').setMinValue(''); this.getFormField('ACCDATE').setReadOnly(true); } } }, // end LoadDate //#endregion LoadInitData: function () { //this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.storeOpCode.load(); this.storeAIRLINES.load({ params: { condition: "ISAIRLINES='1'"} }); this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} }); //this.storeCUSTOMSER.load({ params: { condition: "ISCUSTOM='1'"} }); //this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} }); this.storeTRANSAIRLINES.load({ params: { condition: "ISAIRLINES='1'" } }); this.storeCodeDisport.load(); _this = this; this.storeCodeDisport2.load( { callback: function (r, options, success) { _this.storeCodeTRANSPORT.removeAll(); _this.storeCodeTRANSPORT2.removeAll(); _this.storeCodeTRANSPORT3.removeAll(); _this.storeCodeDisport2.each(function (record) { _this.storeCodeTRANSPORT.add(record); _this.storeCodeTRANSPORT2.add(record); _this.storeCodeTRANSPORT3.add(record); }); } } ); }, LoadLazy: function (data) { //this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'" } }); //valueField: 'CustName', // displayField: 'CodeAndName', var currCust = { CustName: data.CUSTOMERNAME, CodeAndName: data.CUSTOMERNAME }; this.storeCustCode.add(currCust) //name: 'PORTLOADID', // valueField: 'PORTID', // displayField: 'CODEANDNAME', var currPORTLOADID = { PORTID: data.PORTLOADID, CODEANDNAME: data.PORTLOADID }; this.storeCodeDisport.add(currPORTLOADID) //PORTDISCHARGEID var currPORTDISCHARGEID = { CustName: data.PORTDISCHARGEID, CodeAndName: data.PORTDISCHARGEID }; this.storeCodeDisport2.add(currPORTDISCHARGEID) var currAIRLINES = { CustName: data.AIRLINES, CodeAndName: data.AIRLINES }; this.storeAIRLINES.add(currAIRLINES) var currFORWARDER = { CustName: data.FORWARDER, CodeAndName: data.FORWARDER }; this.storeFORWARDER.add(currFORWARDER) var currCUSTOMSER = { CustName: data.CUSTOMSER, CodeAndName: data.CUSTOMSER }; this.storeCUSTOMSER.add(currCUSTOMSER) var currTRUCKER = { CustName: data.TRUCKER, CodeAndName: data.TRUCKER }; this.storeTRUCKER.add(currTRUCKER) var currSHIPPERID = { SHORTNAME: data.SHIPPERID, CodeAndName: data.SHIPPERID }; this.storeShipper.add(currSHIPPERID) var currCONSIGNEEID = { SHORTNAME: data.CONSIGNEEID, CodeAndName: data.CONSIGNEEID }; this.storeConsignee.add(currCONSIGNEEID) var currNOTIFYPARTYID = { SHORTNAME: data.NOTIFYPARTYID, CodeAndName: data.NOTIFYPARTYID }; this.storenotifyparty.add(currNOTIFYPARTYID) var currAGENTID = { SHORTNAME: data.AGENTID, CodeAndName: data.AGENTID }; this.storeagent.add(currAGENTID) }, //#region 保存 Save: function (type) { var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } if (this.accdatesameetd == 1) { var ETD = this.getFormField('ETD').getRawValue(); if (ETD == '') { } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { var mydatestr = Ext.util.Format.date(ETD, 'Y-m'); if (this.MsPeriod.CLOSEDAY != 0) { var myday = Ext.util.Format.date(ETD, 'd'); if (myday > this.MsPeriod.CLOSEDAY) { var mymonth = Ext.util.Format.date(ETD, 'm'); var myyear = Ext.util.Format.date(ETD, 'Y'); mymonth = parseInt(mymonth) + 1; var mymonthstr = mymonth.toString(); if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr; mydatestr = myyear.toString() + '-' + mymonthstr; } } else { } var field = this.getFormField('ACCDATE'); field.setValue(mydatestr); } } } this.getFormField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.getFormField('BSNO').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsAireOrder/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, 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.Editdata = returnData; this.panelFee.onPostDetailClick('', '', 1); this.panelFee.onPostDetailClick('', '', 2); // if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); if (type == '0') { this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); this.LoadPeriodStatus(this.opStatus); this.panelFee.EditRecord = this.editRecord; } else if (type == '1') { window.close(); } else if (type == '2') { this.LoadData('add', ''); } if (type == '0') { this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); } else if (type == '1') { window.close(); } else if (type == '2') { this.LoadData('add', ''); } } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpAireModel', 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); this.LoadPeriodStatus(this.opStatus); } else if (type == '1') { window.close(); } else if (type == '2') { this.LoadData('add', ''); } } this.panelFee.strBSNO = returnData.BSNO; } 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 //#endregion //#region 复制新建 CopyNewData: function () { var data = this.editRecord.data; var basicForm = this.formHead.getForm(); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var BSNO = 'topaire' + NewGuid(); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); var oldmasterno = basicForm.findField('MASTERNO').getValue(); field.setValue(BSNO); if (oldbsno == oldmasterno) { field = basicForm.findField('MASTERNO'); field.setValue(BSNO); } basicForm.findField('BSNO').setDisabled(true); field = basicForm.findField('CUSTNO'); field.setValue(''); field = basicForm.findField('INPUTBY'); field.setValue(SHOWNAME); field = basicForm.findField('OP'); field.setValue(SHOWNAME); var field = basicForm.findField('BSSTATUSREF'); field.setValue('未锁定'); var field = basicForm.findField('FEESTATUSREF'); field.setValue('未锁定'); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = basicForm.findField('ACCDATE'); field.setValue(mydatestr); this.LoadPeriod(this.opStatus); }, CopyNew: function () { var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } this.getFormField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.getFormField('BSNO').setDisabled(true); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsAireOrder/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, 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.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpAireModel', 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(); } var basicForm = this.formHead.getForm(); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var BSNO = 'topaire' + NewGuid(); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, this.copybill); //var oldmasterno = basicForm.findField('MASTERNO').getValue(); //field.setValue(BSNO); //if (oldbsno == oldmasterno) { // field = basicForm.findField('MASTERNO'); // field.setValue(BSNO); //} //basicForm.findField('BSNO').setDisabled(true); //field = basicForm.findField('CUSTNO'); //field.setValue(''); //field = basicForm.findField('INPUTBY'); //field.setValue(SHOWNAME); //field = basicForm.findField('OP'); //field.setValue(SHOWNAME); //var field = basicForm.findField('BSSTATUSREF'); //field.setValue('未锁定'); //var field = basicForm.findField('FEESTATUSREF'); //field.setValue('未锁定'); //var myDate = new Date(); //var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); //field = basicForm.findField('ACCDATE'); //field.setValue(mydatestr); //this.GetEditStatus(); var children = this.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodAireOrderInfo') { //pnlmodAireOrderInfo //pnlmodNewOpAireInfo // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.doLayout(); this.LoadPeriodStatus(this.opStatus); } 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 //#endregion otfeechange: function (field, newValue, oldValue, eOpts) { if (newValue == oldValue) return; var s = ''; var ttl = 0.0; var otfee1amount = parseFloatDef(this.getFormField('OTFEE1AMOUNT').getValue(), 0); var otfee1 = this.getFormField('OTFEE1').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE2AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE2').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE3AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE3').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE4AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE4').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE5AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE5').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE6AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE6').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE7AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE7').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } otfee1amount = parseFloatDef(this.getFormField('OTFEE8AMOUNT').getValue(), 0); otfee1 = this.getFormField('OTFEE8').getValue(); if (otfee1 != '' && otfee1amount != 0) { s = s + otfee1 + ':' + otfee1amount + ';'; ttl = Add(ttl, otfee1amount); } var OTFRT = this.getFormField('OTFRT').getValue(); if (OTFRT == 'PP') { if (ttl != 0) this.getFormField('PCARRIEROT').setValue(ttl); } else if (OTFRT == 'CC') { if (ttl != 0) this.getFormField('CCARRIEROT').setValue(ttl); } this.getFormField('OTFEE').setValue(s); }, //#region 加载初始 默认 数据 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.getFormField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); var headfield = this.getFormField(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.getFormField(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.getFormField(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 }); }, LoadInit: function (data) { var CUSTOMERNAME = this.getFormField('CUSTOMERNAME').getValue(); var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContact.load({ params: { condition: s} }); var sF = " ISFINANCIALSTAFF=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContactFF.load({ params: { condition: sF} }); //this.storeShipper.load({ params: { condition: "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, // callback: function (r, options, success) { // if (success) { // this.getFormField('SHIPPERID').setValue(data.SHIPPERID); // } // }, // scope: this //}); //this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, // callback: function (r, options, success) { // if (success) { // this.getFormField('CONSIGNEEID').setValue(data.CONSIGNEEID); // } // }, // scope: this //}); //this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, // callback: function (r, options, success) { // if (success) { // this.getFormField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID); // } // }, // scope: this //}); //this.storeagent.load({ params: { condition: "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, // callback: function (r, options, success) { // if (success) { // this.getFormField('AGENTID').setValue(data.AGENTID); // } // }, // scope: this //}); if (data.SALE != '') { var recordCustCode = Ext.create('DsShipping.ux.UserRefModel', { GId: NewGuid(), UserCode: data.SALE, UserName: data.SALE, CodeAndName: data.SALE }); this.storeOpCode2.add(recordCustCode); } if (data.OP != '') { var recordCustCode = Ext.create('DsShipping.ux.UserRefModel', { GId: NewGuid(), UserCode: data.OP, UserName: data.OP, CodeAndName: data.OP }); this.storeOpCode3.add(recordCustCode); } // if (data.DOC != '') { // var recordCustCode = Ext.create('DsShipping.ux.UserRefModel', { // GId: NewGuid(), // UserCode: data.DOC, // UserName: data.DOC, // CodeAndName: data.DOC // }); // this.storeOpCode4.add(recordCustCode); // } if (data.FRCUSTSERVICE != '') { var recordCustCode = Ext.create('DsShipping.ux.UserRefModel', { GId: NewGuid(), UserCode: data.FRCUSTSERVICE, UserName: data.FRCUSTSERVICE, CodeAndName: data.FRCUSTSERVICE }); this.storeOpCode5.add(recordCustCode); } if (data.CUSTOMERNAME != '') { var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: data.CUSTOMERNAME, CustName: data.CUSTOMERNAME, CodeAndName: data.CUSTOMERNAME }); this.storeCustCode.add(recordCustCode); } var BLTYPE = this.getFormField('BLTYPE').getValue(); if (BLTYPE == "空运单票" || BLTYPE == "空运分票") { } else { } }, //#endregion //#region 转换成大写字符 onUpCaseClick: function (menu, event) { this.getFormField('SHIPPER').setValue(this.getFormField('SHIPPER').getValue().toUpperCase()); this.getFormField('CONSIGNEE').setValue(this.getFormField('CONSIGNEE').getValue().toUpperCase()); this.getFormField('NOTIFYPARTY').setValue(this.getFormField('NOTIFYPARTY').getValue().toUpperCase()); this.getFormField('AGENT').setValue(this.getFormField('AGENT').getValue().toUpperCase()); this.getFormField('MARKS').setValue(this.getFormField('MARKS').getValue().toUpperCase()); this.getFormField('DESCRIPTION').setValue(this.getFormField('DESCRIPTION').getValue().toUpperCase()); }, SetFEEKGSChange:function(){ var KGS = this.getFormField('KGS').getValue(); var CBM = this.getFormField('CBM').getValue(); var ACBM=Mul(CBM,167); var feekgs=0; if (ACBM >= KGS) { feekgs = ACBM } else feekgs = KGS; this.getFormField('FEEKGS').setValue(feekgs); var price = this.getFormField('PRICE').getValue(); if (price == '') price = '0'; var ttl = Mul(feekgs, price); this.getFormField('TTLFREIGHT').setValue(ttl); }, SetFEEKGSChangeNew: function () { var KGS = this.getFormField('KGS').getValue(); var CBM = this.getFormField('CBM').getValue(); var ACBM = Div(CBM, 0.006); var ACBMSTR = ACBM.toString(); if (ACBMSTR.indexOf('.') > 0) { var arr1 = ACBMSTR.split("."); var postr = arr1[1].substr(1, 1); var acbm = Number(arr1[0]); if (postr == '0') ACBMSTR = arr1[0]; else if (postr == '1' || postr == '2' || postr == '3' || postr == '4' || postr == '5') ACBMSTR = arr1[0] + '.5'; else if (postr == '6' || postr == '7' || postr == '8' || postr == '9') ACBMSTR = Add(acbm,1); } ACBM = Number(ACBMSTR); var feekgs = 0; if (ACBM >= KGS) { feekgs = ACBM } else feekgs = KGS; this.getFormField('FEEKGS').setValue(feekgs); var price = this.getFormField('PRICE').getValue(); if (price == '') price = '0'; var ttl = Mul(feekgs, price); this.getFormField('TTLFREIGHT').setValue(ttl); }, //#endregion //#region 尺码明细 cellEditingBeforeEdit: function (editor, e) { var BSSTATUS = this.getFormField('BSSTATUSREF').getValue(); if (BSSTATUS == '锁定') { Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'业务已锁定,不允许操作!' return false; } this.editcolumnindex = e.colIdx; return true; }, onNextKeyClick: function (type, col) { var rows = this.gridListshow.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridListshow.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridListshow.getStore().getCount()) { this.addDetail(); } else { this.gridListCellEditing.startEditByPosition({ row: number, column: this.editcolumnindex }); } }, onUpKeyClick: function (type, col) { var rows = this.gridListshow.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridListshow.getStore(); var number = s.indexOf(row) - 1; if (number < 0) number = 0; this.gridListCellEditing.startEditByPosition({ row: number, column: this.editcolumnindex }); }, onAddDetailClick: function (button, event) { this.addDetail(); }, //end onAddDetailClick onDelDetailClick: function (button, event, type) { this.deleteDetail(type); }, //onDelDetailClick gridAfterEdit: function (editor, e, eOpts) { if (e.field == 'PKGS' || e.field == 'LENGTH' || e.field == 'WIDTH' || e.field == 'HEIGHT') { var PKGS = e.record.data['PKGS']; var LENGTH = e.record.data['LENGTH']; var WIDTH = e.record.data['WIDTH']; var HEIGHT = e.record.data['HEIGHT']; var CTNFEE = Mul3(LENGTH, WIDTH, HEIGHT, 2); var CBM = Mul(PKGS, CTNFEE, 2); CBM = CBM / 1000; CBM = (CBM / 1000).toFixed(2); e.record.set('CBM', CBM); } }, addDetail: function () { var record = Ext.create('MsOpAirCbmDetail', { GID: NewGuid(), BSNO: '*', PKGS: 0, LENGTH: 0, WIDTH: 0, CBM: 0, HEIGHT: 0 }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 4}); }, SaveCbmDetail: function () { var BSNO = this.getFormField('BSNO').getValue(); var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var LENGTH = member.data.LENGTH; var WIDTH = member.data.WIDTH; var HEIGHT = member.data.HEIGHT; var PKGS = member.data.PKGS; var CBM = member.data.CBM; if (LENGTH == '' || LENGTH == null) member.data.LENGTH = '0'; if (WIDTH == '' || WIDTH == null) member.data.WIDTH = '0'; if (HEIGHT == '' || HEIGHT == null) member.data.HEIGHT = '0'; if (PKGS == '' || PKGS == null) member.data.PKGS = '0'; if (CBM == '' || CBM == null) member.data.CBM= '0'; bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); // // me = this; Ext.Msg.wait('正在保存数据...'); Ext.Ajax.request({ waitMsg: '正在保存数据...', //'正在保存数据...', url: '/MvcShipping/MsOpAire/SaveOpAirCbmDetail', scope: this, params: { bsno: BSNO, body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.storeBodyList.reload(); } else { Ext.Msg.show({ title:'错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title:'警告', msg:'服务器响应出错!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save deleteDetail: function (type) { var BSSTATUS = this.getFormField('BSSTATUSREF').getValue(); if (BSSTATUS == '锁定') { Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'业务已锁定,不允许操作!' return; } var selectedRecords = this.gridListshow.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示','确实要删除明细吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', //'正在删除数据...', url: '/MvcShipping/MsOpAire/DeleteCbmDetail', 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.storeBodyList.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]); } }, //#endregion //#region 清空委托编号 ClearCustNo: function () { var CUSTNO = this.getFormField('CUSTNO').getValue(); Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', //'正在查询委托编号状态...', url: '/MvcShipping/MsSysBillNoSet/DeleteBsNo', params: { custno: CUSTNO }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { this.getFormField('CUSTNO').setValue(''); } } else { Ext.MessageBox.alert('服务器响应出错...', response.responseText); } }, scope: this }); }, //#endregion //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var billNo = basicForm.findField('BSNO').value; var MBLNO = basicForm.findField('MBLNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPAIRE'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO); }, //#endregion 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.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpAireInfo') { } else { children.items[i].close(); } } } } this.tabSeaepanel.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); }, 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.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpAireInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.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('pnlmodAireAllFee'); if (feepanel != NaN && feepanel != null) { var feemodify = feepanel.panelFee.getModifyStatus(); if (feemodify) { return '费用信息'; } } var feeamendpanel = Ext.getCmp('pnlmodAireAmendFee'); if (feeamendpanel != NaN && feeamendpanel != null) { var feemodify = feeamendpanel.panelFee.getModifyStatus(); if (feemodify) { return '更改单信息'; } } if (panelEdit.formEdit.getForm().isDirty() == true || panelEdit.formHead.getForm().isDirty() == true) { return '业务信息'; } else return ''; } , getFormField(fieldname) { formHead = this.formHead.getForm(); formEdit = this.formEdit.getForm(); if (formHead.findField(fieldname)) { return formHead.findField(fieldname); } if (formEdit.findField(fieldname)) { return formEdit.findField(fieldname); } } , getFormFieldValue(fieldname) { field = this.getFormField(fieldname); if (field) { return field.getValue(); } } //根据状态值判断能否做何种操作 //#region 编辑时按钮等的状态 , SetButtonStatus() { this.SetSaveBtn(); this.SetSubmitBtn_CanSee(); this.SetSubmitBtn(); }, GetEditStatus: function () { var canedit = false; //var bsStatus = this.getFormField('BSSTATUS').getValue(); var BSSTATUS = this.getFormField('BSSTATUSREF').getValue(); var inputby = this.getFormField('INPUTBY').getValue(); var op = this.getFormField('OP').getValue(); _this = this; if (BSSTATUS == '锁定') { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modAireOrder" }, 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; } if (_this.opStatus == "add" || _this.opStatus == "copyadd") { canedit = true; } _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.getFormField('CUSTNO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.getFormField('CUSTNO'); custno.setReadOnly(false); _this.GetFeeCustNoStatus(); } else { if (data.RULEBLNO == '') { var custno = _this.getFormField('CUSTNO'); custno.setReadOnly(false); } else { var custno = _this.getFormField('CUSTNO'); custno.setReadOnly(true); } _this.GetFeeCustNoStatus(); } } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: 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.getFormField('HBLNO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.getFormField('HBLNO'); custno.setReadOnly(false); } else { if (data.RULEBLNO == '') { var custno = _this.getFormField('HBLNO'); custno.setReadOnly(false); } else { var custno = _this.getFormField('HBLNO'); custno.setReadOnly(true); } } } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //Ext.Ajax.request({ // waitMsg: '正在查询委托编号状态...', // url: '/MvcShipping/MsBaseInfo/GetRuleEdit', // params: { // rulename: '分提单号', // ruletype: '1' // }, // callback: function (options, success, response) { // if (success) { // var result = Ext.JSON.decode(response.responseText); // if (result.Success != true) { // var hblno = _this.getFormField('HBLNO'); // hblno.setReadOnly(true); // } // } else { // Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); // } // }, // scope: this //}); }, GetStringNum: function (str) { var num = 0; if (str == null || str == '') return num; if (str.length == 0) return num; var if_find = false; var str_num = ''; for (var i = 0; i < str.length; i += 1) { var member = str.substr(i, 1); if ((member == '0') || (member == '1') || (member == '2') || (member == '3') || (member == '4') || (member == '5') || (member == '6') || (member == '7') || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { if (!if_find) { str_num = str_num + member; } } else { if_find = true; } } return str_num; }, GetFeeCustNoStatus: function () { var BSNO = this.getFormField('BSNO').getValue(); //var btnCUSTNO = Ext.getCmp('btnCUSTNO'); var custno = _this.getFormField('CUSTNO'); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetFeeCustNoEnable', params: { bsno: BSNO, custno: custno }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success == true) { custno.setReadOnly(true); //btnCUSTNO.setVisible(false); } } else { } }, scope: this }); }, setSaveBtnStatus: function (enable) { if (enable) { //btnESave.enable(); //btnESaveAndClose.enable(); //btnESaveAndNew.enable(); this.SetSaveBtn(); } else { //btnESave.disable(); //btnESaveAndClose.disable(); //btnESaveAndNew.disable(); this.SetSaveBtn_CanNotSave(); } }, CanSave(ORSTATUS) { if (ORSTATUS == 9) return true;//录入 else if (ORSTATUS == 8) return false; else if (ORSTATUS == 0) return false; else if (ORSTATUS == 1) return false; else if (ORSTATUS == 2) return true;//驳回 else if (ORSTATUS == 4) return false; else return true; } , CanSubmit(ORSTATUS) { if (ORSTATUS == 9) return true;//录入 else if (ORSTATUS == 8) return false; else if (ORSTATUS == 0) return false; else if (ORSTATUS == 1) return false; else if (ORSTATUS == 2) return true; else if (ORSTATUS == 4) return false; else return true; } , CanAudit(ORSTATUS) { if (ORSTATUS == 9) return false;//录入 else if (ORSTATUS == 8) return false; else if (ORSTATUS == 0) return false; else if (ORSTATUS == 1) return true; else if (ORSTATUS == 2) return false; else if (ORSTATUS == 4) return false; else return false; } , CanCallback(ORSTATUS) { if (ORSTATUS == 9) return false;//录入 else if (ORSTATUS == 8) return false; else if (ORSTATUS == 0) return true; else if (ORSTATUS == 1) return true; else if (ORSTATUS == 2) return false; else if (ORSTATUS == 4) return false; else return false; } , CanConfirm(ORSTATUS) { if (ORSTATUS == 9) return false;//录入 else if (ORSTATUS == 8) return false; else if (ORSTATUS == 0) return true; else if (ORSTATUS == 1) return false; else if (ORSTATUS == 2) return false; else if (ORSTATUS == 4) return false; else return false; } //根据当前状态设定save按键状态 , SetSaveBtn() { //(CASE ORSTATUS WHEN '8' THEN '确认订舱' WHEN '0' THEN '审核通过' WHEN '1' THEN '提交审核' WHEN '2' THEN '驳回' WHEN '4' THEN '退舱' else '录入状态' end) as ORSTATUSREF var ORSTATUS = this.getFormFieldValue("ORSTATUS"); if (this.CanSave(ORSTATUS)) { this.SetSaveBtn_CanSave(); } else { this.SetSaveBtn_CanNotSave(); } } //根据当前状态设定提交与撤回按键状态 , SetSubmitBtn() { var ORSTATUS = this.getFormFieldValue("ORSTATUS"); if (this.CanSubmit(ORSTATUS)) { this.SetAuditBtn_CanSubmit(); } if (this.CanAudit(ORSTATUS)) { this.SetAuditBtn_CanAudit(); } if (this.CanCallback(ORSTATUS)) { this.SetAuditBtn_CanCallback(); } if (this.CanConfirm(ORSTATUS)) { this.SetAuditBtn_CanConfirm(); } } , SetSubmitBtn_CanSee() { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnSubmit = Ext.getCmp('btnSubmit'); var btnAuditReset = Ext.getCmp('btnAuditReset'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditCallBack = Ext.getCmp('btnAuditCallBack'); var btnConfirm = Ext.getCmp('btnConfirm'); //看this.isaudit=true 代表是从审核列表打开的 //隐藏所有的新建保存提交撤回按钮 //显示所有的审核通过驳回确认按钮 if (this.isAudit) { btnESave.hide(); btnESaveAndClose.hide(); btnESaveAndNew.hide(); btnSubmit.hide(); btnAuditReset.hide(); btnAudit.show(); btnAuditCallBack.show(); btnConfirm.show(); } else { //反之则显示所有的新建保存提交撤回按钮 //隐藏所有的审核通过驳回确认按钮 btnESave.show(); btnESaveAndClose.show(); btnESaveAndNew.show(); btnSubmit.show(); btnAuditReset.show(); btnAudit.hide(); btnAuditCallBack.hide(); btnConfirm.hide(); } } , SetSaveBtn_CanSave() { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btncopyaddbs = Ext.getCmp('btncopyaddbs'); btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btncopyaddbs.enable(); } , SetSaveBtn_CanNotSave() { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btncopyaddbs = Ext.getCmp('btncopyaddbs'); btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); //btncopyaddbs.disable(); btncopyaddbs.enable() } , SetAuditBtn_CanSubmit() { var btnSubmit = Ext.getCmp('btnSubmit'); var btnAuditReset = Ext.getCmp('btnAuditReset'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditCallBack = Ext.getCmp('btnAuditCallBack'); var btnConfirm = Ext.getCmp('btnConfirm'); btnSubmit.enable(); btnAuditReset.disable(); btnAudit.disable(); btnAuditCallBack.disable(); btnConfirm.disable(); } , SetAuditBtn_CanAudit() { var btnSubmit = Ext.getCmp('btnSubmit'); var btnAuditReset = Ext.getCmp('btnAuditReset'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditCallBack = Ext.getCmp('btnAuditCallBack'); var btnConfirm = Ext.getCmp('btnConfirm'); btnSubmit.disable(); btnAuditReset.enable(); btnAudit.enable(); btnAuditCallBack.enable(); btnConfirm.disable(); } , SetAuditBtn_CanCallback() { this.SetAuditBtn_CanAudit(); } , SetAuditBtn_CanConfirm() { var btnSubmit = Ext.getCmp('btnSubmit'); var btnAuditReset = Ext.getCmp('btnAuditReset'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditCallBack = Ext.getCmp('btnAuditCallBack'); var btnConfirm = Ext.getCmp('btnConfirm'); btnSubmit.disable(); btnAuditReset.disable(); btnAudit.disable(); btnAuditCallBack.enable(); btnConfirm.enable(); } //#endregion //#region 审核动作 , //提交审核 onSubmitClick: function () { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if ((billstatus != "9") && (billstatus != "2")) { Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } //var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); //this.formHead.getForm().findField('ORDERNO').setDisabled(false); //this.formEdit.getForm().findField('STLNAME').setDisabled(false); //this.formEdit.getForm().findField('STLDATE').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, true); var data2 = this.formEdit.getForm().getValues(false, false, false); data.BSNO = BSNO; //this.formHead.getForm().findField('ORDNO').setDisabled(true); //this.formHead.getForm().findField('STLNAME').setDisabled(true); //this.formHead.getForm().findField('STLDATE').setDisabled(true); var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } _this = this; //string execution, string data, string reason Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcShipping/MsAireOrder/PushStatus', params: { execution: "提交审核", data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.opStatus = 'edit'; condition = "BSNO='" + BSNO + "'"; _this.LoadData(_this.opStatus, condition); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //审核通过 onAuditClick: function () { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); //this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; //string execution, string data, string reason Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcShipping/MsAireOrder/PushStatus', params: { execution:"审核通过", data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { Ext.MessageBox.hide(); if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.opStatus = 'edit'; condition = "BSNO='" + BSNO + "'"; _this.LoadData(_this.opStatus, condition); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //撤回提交 onAuditResetClick: function () { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); //this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); //this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcShipping/MsAireOrder/PushStatus', params: { execution:"撤回提交", data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.opStatus = 'edit'; condition = "BSNO='" + BSNO + "'"; _this.LoadData(_this.opStatus, condition); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //驳回提交 onAuditCallBackClick: function (ORREASON) { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); //this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); //this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回数据...'); Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/MvcShipping/MsAireOrder/PushStatus', params: { execution:"驳回提交", data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), reason: ORREASON }, callback: function (options, success, response) { Ext.MessageBox.hide(); if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { _this.opStatus = 'edit'; condition = "BSNO='" + BSNO + "'"; _this.LoadData(_this.opStatus, condition); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, // 确认订舱 onConfirmClick: function () { var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (billstatus != "0") { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核通过!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } //var SALE = this.formHead.getForm().findField('SALE').getValue(); //this.formHead.getForm().findField('ORDNO').setDisabled(false); this.AUDITDATA = this.formHead.getForm().getValues(false, false, false); this.AUDITDATA2 = this.formEdit.getForm().getValues(false, false, false); //this.formHead.getForm().findField('ORDNO').setDisabled(true); //this.AuditDuino = this.formHead.getForm().findField('ORDERNO').getValue(); _accdate = Ext.getCmp('Confirm_ACCDATE'); _accdate.setValue(this.AUDITDATA.ACCDATE); _remark = Ext.getCmp('Confirm_REMARK'); _remark.setValue(this.AUDITDATA.REMARK); this.winAuditShow.show(); //this.setAuditEditValue(); }, onConfirm: function (ACCDATE,ORREMARK) { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); var data = this.formHead.getForm().getValues(false, false, false); data.ACCDATE = ACCDATE; var data2 = this.formEdit.getForm().getValues(false, false, false); data.REMARK = ORREMARK; _this = this; Ext.MessageBox.confirm('提示', '确定接收选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcShipping/MsAireOrder/PushStatus', params: { execution: "确认订舱", data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.opStatus = 'edit'; condition = "BSNO='" + BSNO + "'"; _this.LoadData(_this.opStatus, condition); Ext.Msg.show({ title: '提示', msg: '接受订舱成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } _this.winAuditShow.close() } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //#endregion onAddFenClick: function () { _this = this; if (this.formHead.getForm().findField('ORDERNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再录入分票信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } let dirtycount = 0; for (var i = 0; i < this.storeFenList.getCount(); i += 1) { var member = this.storeFenList.getAt(i); if (member.dirty) { dirtycount++; } } //if (dirtycount > 0) { // Ext.MessageBox.alert('请先保存未保存的分票信息'); // return; //} //else { var record = Ext.create('MsOpAireModel', { BSNO: _this.GetNewBSNO(), ORDNO: '*', PKGS: 0, KGS: 0, CBM: 0 }); this.storeFenList.add(record); var n = this.storeFenList.getCount(); this.FenListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); //} }, onDelFenClick: function () { var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); var selectedRecords = this.FenList.selModel.getSelection(); var dellist = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeFenList.remove(selectedRecords[i]); } else { dellist.push(rec) } } if (dellist.length == 0) return; var jsonFen = ConvertRecordsToJsonAll(dellist); Ext.MessageBox.confirm('提示', '确定删除这些记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsAireOrder/DeleteFen', params: { fen: jsonFen }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeFenList.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]); }, SaveFen: function () { if (this.formHead.getForm().findField('ORDERNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再录入分票信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } else { var Headbsno = this.formHead.getForm().findField('BSNO').getValue(); var bodydatas = []; for (var i = 0; i < this.storeFenList.getCount(); i += 1) { var member = this.storeFenList.getAt(i); bodydatas.push(member); } var jsonFen = ConvertRecordsToJson(bodydatas); if (jsonFen == "") return; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsAireOrder/SaveFen', scope: this, params: { bsno: Headbsno, fen: jsonFen }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.LoadFen(); //this.LoadData(this.opStatus, " ORDNO='" + HeadORDNO + "'"); } 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 }); } } }); } }, FenAfterEdit: function (editor, e, eOpts) { //选择委托单位后自动填联系人电话邮箱 if (e.value == e.originalValue) return; if (e.field == 'OPERATOR') { alert('edit OPERATOR' + e.value); } if (e.field == 'CUSTOMERNAME') { var s = " (ISOPERATOR=1 or ISSALEMAN=1) and LINKID in (select gid from [info_client] where SHORTNAME='" + e.value + "')"; this.storeInfoClientContact2.load({ params: { condition: s }, callback: function (r, options, success) { if (success) { if (this.storeInfoClientContact2.getCount() > 0) { //alert('storeInfoClientContact2 load'); var member = this.storeInfoClientContact2.getAt(0); //e.setActiveEditor(); e.record.set('OPERATOR', ''); e.record.set('OPERATOR', member.data.SHOWNAME); e.record.set('OPERATOR', ''); e.record.set('OPERATOR', member.data.SHOWNAME); e.record.set('OPERATORTEL', member.data.TEL); e.record.set('OPERATOREMAIL', member.data.EMAIL); //this.formHead.getForm().findField('OPERATOR').setValue(member.data.SHOWNAME); //this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL); //this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL); } else { e.record.set('OPERATOR', ""); e.record.set('OPERATORTEL', ""); e.record.set('OPERATOREMAIL', ""); //this.formHead.getForm().findField('OPERATOR').setValue(''); //this.formHead.getForm().findField('OPERATORTEL').setValue(''); //this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); } } }, scope: this }); //var records = DsStoreQueryBy(this.storeInfoClientContact, 'CNTRNO', e.value); //if (records.getCount() > 0) { // var data = records.getAt(0).data; // e.record.set('SEALNO', data.SEALNO); // e.record.set('KINDPKGS', data.KINDPKGS); // var PKGS = data.PKGS; // var KGS = data.KGS; // var CBM = data.CBM; // var GID = e.record.data['GID']; // for (var i = 0; i < this.storeManifestList.getCount(); i += 1) { // var member = this.storeManifestList.getAt(i); // if (member.data.CNTRNO == e.value && member.data.GID != GID) { // PKGS = PKGS.add(-member.data.PKGS); // KGS = KGS.add(-member.data.KGS); // CBM = CBM.add(-member.data.CBM); // } // } // e.record.set('PKGS', PKGS); // e.record.set('KGS', KGS); // e.record.set('CBM', CBM); //} else { // // e.record.set('CustomerName', 0); //} } } , LoadFen() { //载入分票信息 let BSNO = this.editRecord.get('BSNO').toString(); this.storeFenList.load({ params: { MASTERNO: BSNO } }); }, LoadFenCopy(BSNO) { //载入原分票信息 this.ClearFen(); this.storeFenList.load({ params: { MASTERNO: BSNO }, callback: function (options, success, response) { if (success) { for (var j = 0; j < this.storeFenList.getCount(); j += 1) { var memberbody = this.storeFenList.getAt(j); memberbody.set("BSNO", NewGuid()); memberbody.set("ORDNO", '*'); memberbody.commit(); }; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } } }); //this.storeFenList.load({ // params: { MASTERNO: bsno }, // callback: function (options, success, response) { // if (success) { // for (var j = 0; j < this.storeFenList.getCount(); j += 1) { // var memberbody = this.storeFenList.getAt(j); // memberbody.set("BSNO", NewGuid()); // memberbody.set("ORDNO", '*'); // memberbody.commit(); // }; // } else { // Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); // } // } //}); }, ClearFen() { this.storeFenList.removeAll(); }, LoadFeeCopy: function (BSNO) { this.panelFee.storeDrChFee.load({ params: { billno: data.BSNO, type: 1, optype: "op_Seae" }, callback: function (options, success, response) { if (success) { for (var j = 0; j < this.panelFee.storeDrChFee.getCount(); j += 1) { var memberbody = this.panelFee.storeDrChFee.getAt(j); memberbody.set("GId", NewGuid()); memberbody.set("FeeStatus", 1); memberbody.set("BsNo", '*'); memberbody.commit(); }; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } } }); this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_Seae" }, callback: function (options, success, response) { if (success) { for (var j = 0; j < this.panelFee.storeCrChFee.getCount(); j += 1) { var memberbody = this.panelFee.storeCrChFee.getAt(j); memberbody.set("GId", NewGuid()); memberbody.set("BsNo", '*'); memberbody.set("FeeStatus", 1); memberbody.commit(); }; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } } }); }, GetNewBSNO() { return NewGuid().toLowerCase(); } ,onSelectFen: function (button, event) { //选中分票时 记录行数 } });