Ext.namespace('Shipping'); Shipping.MsOpAiriEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpAiriEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpAiriEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, MainEditRecord: null, stroplb: '空运进口', isfen: false, initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; this.initloaddata = 0; this.accdatesameetd = 0; this.MsPeriod = null; this.SALEORDERDEPTBYOP = 0; this.copyfee = false; //#region 信息加载 this.storeDefValue = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpDef/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeMustBe = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpMustField/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.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: "modOpAiriList"} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); 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.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', store: this.storeOpCode, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //揽货人 this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeOpCode2, forceSelection: true, 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.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME); } } } }); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode3, //forceSelection: true, 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.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME); this.formHead.getForm().findField('SALECORPID').setValue(records[0].data.CORPID); } } } }); //单证 this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '单 证', store: this.storeOpCode4, //forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'DOC', valueField: 'UserName', displayField: 'CodeAndName' }); this.comboxFRCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '海外客服', //'客服', store: this.storeOpCode5, forceSelection: true, 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.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', allowBlank: false, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var data = combo.value; this.formHead.getForm().findField('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.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL); this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL); // this.formHead.getForm().findField('OPERATORFAX').setValue(member.data.FAX); } else { this.comboxInfoClientContact.setValue(''); // this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); this.formHead.getForm().findField('OPERATORTEL').setValue(''); // this.formHead.getForm().findField('OPERATORFAX').setValue(''); } } }, scope: this }); 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.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(member.data.EMAIL); this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(member.data.TEL); // this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue(member.data.FAX); } else { this.comboxClientFCContact.setValue(''); // this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(''); this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(''); // this.formHead.getForm().findField('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.formHead.getForm().findField('BSSOURCE').setValue(records[0].data.BSSOURCE); var recs = DsStoreQueryBy(this.storeSource, 'SourceName', records[0].data.BSSOURCE); if (recs.getCount() > 0) { var data = recs.getAt(0).data; var s = "SOURCEID='" + data.SourceID + "'"; this.storeSourceDetail.load({ params: { condition: s} }); } else { var BSSOURCEDETAIL = this.formHead.getForm().findField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } } }); //委托单位_联系人 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.formHead.getForm().findField('OPERATOREMAIL').setValue(Cargoinfodata.EMAIL); this.formHead.getForm().findField('OPERATORTEL').setValue(Cargoinfodata.TEL); // this.formHead.getForm().findField('OPERATORFAX').setValue(Cargoinfodata.FAX); } else { // this.formHead.getForm().findField('OPERATOREMAIL').setValue(''); this.formHead.getForm().findField('OPERATORTEL').setValue(''); // this.formHead.getForm().findField('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.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(Cargoinfodata.EMAIL); this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(Cargoinfodata.TEL); // this.formHead.getForm().findField('FINANCIALSTAFFFAX').setValue(Cargoinfodata.FAX); } else { // this.formHead.getForm().findField('FINANCIALSTAFFEMAIL').setValue(''); this.formHead.getForm().findField('FINANCIALSTAFFTEL').setValue(''); // this.formHead.getForm().findField('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: '航空公司', 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: '卸货代理', 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', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == "空运主票") { } } } } }); //品名 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, fieldLabel: '品名', // 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.formHead.getForm().findField('BSSOURCEDETAIL'); BSSOURCEDETAIL.setValue(''); } } } } }); this.storeSourceDetail.load(); this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '贸易条款', 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, labelWidth: 60, flex: 0.5, 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: '包 装', labelWidth: 35, 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/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //发货人 this.comboxShipper = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Shipper (发货人)', store: this.storeShipper, // forceSelection: true, 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.formEdit.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('SHIPPER').setValue(''); } } } } }); //客户加载_收货人 this.storeConsignee = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //收货人 this.comboxConsignee = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Consignee (收货人)', labelWidth: 150, labelAlign: 'left', store: this.storeConsignee, // forceSelection: true, 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.formEdit.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('CONSIGNEE').setValue(''); } } } } }); //客户加载_通知人 this.storenotifyparty = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // 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, 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.formEdit.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('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, 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.formEdit.getForm().findField('AGENT').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('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.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' }); 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, flex: 0.5, 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, name: 'SALECORPID', valueField: 'GID', displayField: 'NAME' }); //币别 this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCurrencyModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' } }); this.storeCodeCurrency.load(); this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '币别', //'币别', store: this.storeCodeCurrency, forceSelection: true, flex: 0.4, labelWidth: 40, id: 'CURRENCY', name: 'CURRENCY', valueField: 'CODENAME', displayField: 'CODENAME' }); this.storeISBONDED = Ext.create('Ext.data.Store', { fields: ['FType', 'NAME'] }); this.storeISBONDED.add({ "FType": '1', "NAME": "是" }); this.storeISBONDED.add({ "FType": '0', "NAME": "否" }); this.comboxISBONDED = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeISBONDED, fieldLabel: '是否保税业务', labelWidth: 90, valueField: 'FType', displayField: 'NAME', forceSelection: true, name: 'ISBONDED' }); //#endregion //#region 编辑formHead 基本信息 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: 'INPUTBY', name: 'INPUTBY', hidden: true }, { fieldLabel: 'MASTERNO', name: 'MASTERNO', hidden: true }, { fieldLabel: '业务锁定', disabled: true, readOnly: true, name: 'BSSTATUSREF' }, { fieldLabel: '费用锁定', readOnly: true, disabled: true, name: 'FEESTATUSREF' }, { fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATE' }, this.comboxBLTYPE, this.comboxISSUETYPE, this.comboxDept] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, { fieldLabel: '结算方式', flex: 0.5, readOnly: true, name: 'STLNAME' }, { fieldLabel: '结算日期', // format: 'Y-m-d', flex: 0.5, labelWidth: 55, // xtype: 'datefield', name: 'STLDATE' }, this.comboxSaleCompany] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxOP, this.comboxSALE, this.comboxDOC, this.comboxCUSTSERVICE, this.comboxFRCUSTSERVICE] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '委托编号', //'委托编号', allowBlank: true, name: 'CUSTNO' }, { 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.formHead.getForm().findField('MBLNO') .setValue(field.value.toUpperCase()); } } }, { fieldLabel: '分单号', name: 'HBLNO', listeners: { scope: this, blur: function (field, The, eOpts) { _this.formHead.getForm().findField('HBLNO') .setValue(field.value.toUpperCase()); } } }, { fieldLabel: '合约号', name: 'CONTRACTNO' }] }, this.myCheckboxService, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxInfoClientContact, { fieldLabel: 'TEL', name: 'OPERATORTEL' }, this.comboxClientFCContact, { fieldLabel: 'TEL', name: 'FINANCIALSTAFFTEL' }, this.comboxLANE] } ]//end items(fieldset 1) }); //end this.formEdit //#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.comboxPORTLOADID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运港', store: this.storeCodeDisport, name: 'PORTLOADID', valueField: 'PORTID', displayField: 'CODEANDNAME', 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.formEdit.getForm().findField('PORTLOAD').setValue(selectdata.PORTENAME); this.formEdit.getForm().findField('LANE').setValue(selectdata.LANE); } else { this.formEdit.getForm().findField('PORTLOAD').setValue(''); } } } } }); this.comboxPORTDISCHARGEID = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的港', store: this.storeCodeDisport2, name: 'PORTDISCHARGEID', valueField: 'PORTID', displayField: 'CODEANDNAME', 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.formEdit.getForm().findField('PORTDISCHARGE').setValue(selectdata.PORTENAME); } else { this.formEdit.getForm().findField('PORTDISCHARGE').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' }); this.comboxOTBLFRT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '杂费', store: this.storeFrt, forceSelection: true, name: 'OTFRT', valueField: 'FRT', displayField: 'FRT' }); me = this; //#endregion //#region 编辑formEdit 基本信息 this.panelAIRLINES = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: 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.formEdit.getForm().findField('VESSEL').setValue(newValue.toUpperCase()); } } } }, this.comboxAIRLINES, this.comboxFORWARDER] }, { 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.comboxPORTLOADID, { name: 'PORTLOAD' }, { fieldLabel: '离港日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '换单日期', format: 'Y-m-d', xtype: 'datefield', name: 'CHANGEDOCDATE' }, this.comboxCUSTOMSER, this.comboxTRUCKER] }] }] }); //运输条款 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: 'SERVICE' }); // this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '贸易条款', // store: this.storeSERVICE, // forceSelection: true, // name: 'SERVICE', // valueField: 'SERVICE', // displayField: 'SERVICE' // }); this.panelKGS = new Ext.Panel({ layout: 'anchor', bodyPadding: 5, frame: 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' }, { fieldLabel: '体积', flex: 1, name: 'CBM' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '等级', flex: 1, name: 'CLASS' }, { fieldLabel: '计费重量', flex: 1, name: 'FEEKGS' }, { fieldLabel: '计量单位', flex: 1, name: 'UNIT' }, { fieldLabel: '送仓日期', //'ATD', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'DELIVERYDATE' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [this.comboxISBONDED,this.comboxTRADETERM, this.comboxBLFRT, this.comboxOTBLFRT] }] }] }); this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', { fields: [ { name: 'CUSTOMER', type: 'string' }, { name: 'ENTERPID', type: 'string' } ], proxy: { url: '/MvcShipping/MsOpApply/GetENTERPLIST' } }); this.storeEnterpCode.load(); this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '经营单位', store: this.storeEnterpCode, name: 'ENTERP', valueField: 'CUSTOMER', displayField: 'CUSTOMER', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var Cargoinforecords = DsStoreQueryBy(this.storeEnterpCode, 'CUSTOMER', combo.value); if (Cargoinforecords.getCount() > 0) { var Cargoinfodata = Cargoinforecords.getAt(0).data; this.formEdit.getForm().findField('ENTERPID').setValue(Cargoinfodata.ENTERPID); } else { this.formEdit.getForm().findField('ENTERPID').setValue(''); } } } } }); this.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.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.formEdit.getForm().findField('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.formEdit.getForm().findField('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.formEdit.getForm().findField('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.formEdit.getForm().findField('AGENT') .setValue(field.rawValue.toUpperCase()); } } } ] }, { xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [this.panelAIRLINES, this.panelKGS, { xtype: 'textareafield', grow: true, fieldLabel: '唛头', height: 100, name: 'MARKS', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.formEdit.getForm().findField('MARKS') .setValue(field.rawValue.toUpperCase()); } } }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [this.comboxGOODSNAME, { fieldLabel: 'HS编码', name: 'HSCODE' }] }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelSeparator: '', fieldLabel: '货物描述', height: 100, name: 'DESCRIPTION', anchor: '100%', listeners: { scope: this, blur: function (field, The, eOpts) { _this.formEdit.getForm().findField('DESCRIPTION') .setValue(field.rawValue.toUpperCase()); } } } ] } ] }, { 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, { fieldLabel: '商检单号', name: 'INSPECTIONNO' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '商检日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'INSPECTIONDATE' }, this.comboxEnterp, { fieldLabel: '单位编码', name: 'ENTERPID' }, this.comboxCodeCurrency, { fieldLabel: '货值', labelWidth: 40, flex: 0.6, name: 'CARGOVALUE' },] } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'textareafield', grow: true, fieldLabel: '备 注', height: 60, name: 'REMARK', anchor: '100%' }] }] } ] }); //end this.formEdit //#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: '复制新建', //"国外舱单", menu: [{ id: 'btnECopyNew', text: "复制新建", handler: function (button, event) { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; this.copyfee = false; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, false); }, scope: this }, { id: 'btnECopyNewFee', text: '复制新建(含费用)', //"复制新建", handler: function (button, event) { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; this.copyfee = true; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); this.LoadCopyData(oldbsno, true); }, scope: this }] }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { text: "新建", handler: function (button, event) { this.LoadData('add', ''); var basicForm = this.formEdit.getForm(); basicForm.findField('BsNo').setDisabled(false); this.panelOcr.hide(); }, 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(); } }], scope: this }, '-', { text: 'OCR', //快速录入, handler: function (button, event) { this.tabtree.hide(); this.tabSeaeWTpanel.setActiveTab(1); this.panelOcr.body.dom.children[0].src = "/MvcShipping/Ocr/UpOcrAuto"; if (this.panelOcr.isHidden()) { this.panelOcr.show(); } if (this.panelOcr.width < 2) { var wSeaePanel = this.tabSeaeWTpanel.getWidth(); this.panelOcr.setWidth(wSeaePanel * 0.6); } }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.panelpage = new Ext.Panel({ title: '委托详细信息', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.formEdit] }); this.tabSeaeWTpanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', enableTabScroll: true, items: [ this.panelpage ] }); this.panelSeae = new Ext.Panel({ title: '委托信息', id: 'pnlmodNewOpAiriInfo', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.tabSeaeWTpanel] }); 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: '16E13948-D20D-452B-852F-6EC58173996C' } }); 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.formHead.getForm().findField('CUSTNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } else { if (record.data.NAME == 'modAiriAllFee') { var paneltabitems = new Shipping.AiriFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modAiriAmendFee') { var paneltabitems = new Shipping.AiriAmendFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modOpAiriFenList') { var paneltabitems = new Shipping.MsOpAiriFenIndex({ 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 ], 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._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 }); }, //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]; if (this.isfen) this.MainEditRecord = ret[3]; } if (this.opStatus == 'copyaddfee') { this.opStatus = 'copyadd'; this.copyfee = true; } if (this.opStatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.storecodeservice.load({ params: { condition: "OPTYPE='4'" }, 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.copyfee); } else { this.LoadData(this.opStatus, condition); } } }, scope: this }); // this.LoadData(this.opStatus, condition); this.LoadMustBe(); // if (this.initloaddata == 0) { // this.LoadInitData(); // this.initloaddata = 1; // }; }, //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('CUSTNO').toString().trim(); } } else { document.title = "空运进口-新增"; } if (this.isfen && this.opStatus == 'add') { this.LoadInit(this.MainEditRecord.data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(this.MainEditRecord.data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.MainEditRecord.data); var newBsNo = NewGuid(); this.formHead.getForm().findField('BSNO').setValue(newBsNo); this.formHead.getForm().findField('BLTYPE').setValue('空运分票'); this.formHead.getForm().findField('BLTYPE').readOnly = true; this.formHead.getForm().findField('CUSTNO').setValue(''); this.LoadPeriod(this.opStatus); } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpAiri/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.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); if (this.opStatus == 'add') { this.LoadDefValue(); } this.Editdata = data; this.GetEditStatus(); if (this.isfen) this.formHead.getForm().findField('BLTYPE').readOnly = true; this.LoadPeriod(this.opStatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } var billno = '*'; var gid = '*'; }, LoadCopyData: function (bsno, CopyFee) { this.serialNo = 0; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', //'正在查询主表数据...', url: '/MvcShipping/MsOpAiri/GetCopyData', params: { condition: "BSNO='" + bsno + "'", copyfee: CopyFee }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title:'提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } // data = result.data; // var CUSTOMERNAME = data.CUSTOMERNAME; var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContact.load({ params: { condition: s } }); // this.LoadInit(data); this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.GetAddText(); _this.opStatus = 'add'; this.GetEditStatus(); if (this.isfen) this.formHead.getForm().findField('BLTYPE').readOnly = true; this.LoadPeriod(this.opStatus); } else { Ext.MessageBox.alert('服务器响应出错', response.responseText); } }, scope: this }); }, // end LoadDate GetAddText: function () { if (this.opStatus != 'edit') { this.opStatus = 'add' var basicForm = this.formHead.getForm(); if (!this.copyfee) { basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); var oldmasterno = basicForm.findField('MASTERNO').getValue(); var strbsno = "topairi" + NewGuid().toString().replace(/-/g, '') field.setValue(strbsno); // var BSNO = 'topseae' + NewGuid(); // field.setValue(BSNO); if (oldbsno == oldmasterno) { field = basicForm.findField('MASTERNO'); field.setValue(strbsno); } //field.setValue('*');alert("abacacf".replace(/a/g,'9')); basicForm.findField('BSNO').setDisabled(true); } field = basicForm.findField('CUSTNO'); field.setValue(''); field = basicForm.findField('MBLNO'); field.setValue(''); field = basicForm.findField('HBLNO'); field.setValue(''); field = basicForm.findField('OP'); field.setValue(SHOWNAME); field = basicForm.findField('INPUTBY'); field.setValue(SHOWNAME); var field = basicForm.findField('BSSTATUSREF'); field.setValue('未锁定'); var field = basicForm.findField('FEESTATUSREF'); field.setValue('未锁定'); //field = basicForm.findField('BSTYPE'); //field.setValue('普通货'); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); field = basicForm.findField('BSDATE'); field.setValue(mydatestr); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = basicForm.findField('ACCDATE'); field.setValue(mydatestr); this.GetEditStatus(); // var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue(); if (CUSTOMERNAME != null) { var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContact.load({ params: { condition: s } }); } else { this.formHead.getForm().findField('SHOWNAME').setValue(''); } if (Ext.getCmp('pnlmodNewOpAireInfo')) { var pnlfee = Ext.getCmp('pnlmodNewOpAireInfo'); pnlfee.close(); this.tabSeaepanel.doLayout(); } } }, LoadPeriod: function (opstatus) { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; this.MsPeriod = data; this.LoadPeriodStatus(opstatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, LoadPeriodStatus: function (opstatus) { var ETD = this.formEdit.getForm().findField('ETA').getRawValue(); if (ETD == '') { this.formEdit.getForm().findField('ETA').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('ETA').setReadOnly(false); } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { this.formEdit.getForm().findField('ETA').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('ETA').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formEdit.getForm().findField('ETA').setMinValue(this.MsPeriod.FDAY); this.formEdit.getForm().findField('ETA').setReadOnly(false); } else { this.formEdit.getForm().findField('ETA').setMinValue(''); this.formEdit.getForm().findField('ETA').setReadOnly(true); } } } var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue(); var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(this.MsPeriod.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { this.formHead.getForm().findField('ACCDATE').setMinValue(''); this.formHead.getForm().findField('ACCDATE').setReadOnly(true); } } }, // end LoadDate //#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.storeCodeDisport.load(); this.storeCodeDisport2.load(); }, //#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.formEdit.getForm().findField('ETA').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.formHead.getForm().findField('ACCDATE'); field.setValue(mydatestr); } } } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpAiri/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; // 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); } 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('MsOpAiriModel', 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', ''); } } } 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 = 'topairi' + 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.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpAiri/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('MsOpAiriModel', 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 = 'topairi' + 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.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 == 'pnlmodNewOpAiriInfo') { // 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 //#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.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='空运进口'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } }; } else { } } }, scope: this }); }, LoadInit: function (data) { var CUSTOMERNAME = this.formHead.getForm().findField('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.formEdit.getForm().findField('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.formEdit.getForm().findField('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.formEdit.getForm().findField('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.formEdit.getForm().findField('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.formHead.getForm().findField('BLTYPE').getValue(); if (BLTYPE == "空运单票" || BLTYPE == "空运分票") { } else { } }, //#endregion //#region 转换成大写字符 onUpCaseClick: function (menu, event) { this.formEdit.getForm().findField('SHIPPER').setValue(this.formEdit.getForm().findField('SHIPPER').getValue().toUpperCase()); this.formEdit.getForm().findField('CONSIGNEE').setValue(this.formEdit.getForm().findField('CONSIGNEE').getValue().toUpperCase()); this.formEdit.getForm().findField('NOTIFYPARTY').setValue(this.formEdit.getForm().findField('NOTIFYPARTY').getValue().toUpperCase()); this.formEdit.getForm().findField('AGENT').setValue(this.formEdit.getForm().findField('AGENT').getValue().toUpperCase()); this.formEdit.getForm().findField('MARKS').setValue(this.formEdit.getForm().findField('MARKS').getValue().toUpperCase()); this.formEdit.getForm().findField('DESCRIPTION').setValue(this.formEdit.getForm().findField('DESCRIPTION').getValue().toUpperCase()); }, //#endregion //#region 保存报关 SaveBG: function (type) { var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在生成数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在生成数据...', url: '/MvcShipping/MsOpAiri/SaveBG', scope: this, params: { 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) { 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 }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save //#endregion GetFeeCustNoStatus: function () { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); //var btnCUSTNO = Ext.getCmp('btnCUSTNO'); var custno = _this.formHead.getForm().findField('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 }); }, //#region 清空委托编号 ClearCustNo: function () { var CUSTNO = this.formHead.getForm().findField('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.formHead.getForm().findField('CUSTNO').setValue(''); } } else { Ext.MessageBox.alert('服务器响应出错...', response.responseText); } }, scope: this }); }, //#endregion //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; //var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue(); var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue(); var inputby = this.formHead.getForm().findField('INPUTBY').getValue(); var op = this.formHead.getForm().findField('OP').getValue(); _this = this; if (BSSTATUS == '锁定') { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modOpAiriList" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { canedit = false; } } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); } _this = this; Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsSysBillNoSet/GetData', params: { condition: "OPLBNAME='空运进口' AND RULEBLNO='委托编号'", handle: 'edit' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(false); _this.GetFeeCustNoStatus(); } else { if (data.RULEBLNO == '') { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(false); } else { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(true); } _this.GetFeeCustNoStatus(); } } } 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.formHead.getForm().findField('HBLNO'); // hblno.setReadOnly(true); // } // } 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.formHead.getForm().findField('HBLNO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.formHead.getForm().findField('HBLNO'); custno.setReadOnly(false); } else { if (data.RULEBLNO == '') { var custno = _this.formHead.getForm().findField('HBLNO'); custno.setReadOnly(false); } else { var custno = _this.formHead.getForm().findField('HBLNO'); custno.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; }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); } }, //#endregion //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var billNo = basicForm.findField('BSNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPAIRI'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_airi WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion PrevRecord: function () { var 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 == 'pnlmodNewOpAiriInfo') { } 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 == 'pnlmodNewOpAiriInfo') { // 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('pnlmodAiriAllFee'); if (feepanel != NaN && feepanel != null) { var feemodify = feepanel.panelFee.getModifyStatus(); if (feemodify) { return '费用信息'; } } var feeamendpanel = Ext.getCmp('pnlmodAiriAmendFee'); 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 ''; } });