Ext.namespace('Shipping'); Shipping.MsOpSeaiSaleEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSeaiSaleEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSeaiSaleEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, Editdata: null, MainEditRecord: null, stroplb: '海运进口', isfen: false, initUIComponents: function () { this.itemindex = 1; var BLTYPEDFIELDNAME = 'EnumValueName'; if (strLANGUAGES == "en-us") { BLTYPEDFIELDNAME = 'EnumValueName_2'; } this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); //#region formSearch 下拉框信息加载 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.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modSeaImportList"} }); //客服 this.storeCUSTSERVICECode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeCUSTSERVICECode.load(); this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CUSTSERVICE, store: this.storeCUSTSERVICECode, forceSelection: true, id: 'CUSTSERVICE', name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName' }); //揽货人 this.storeSALECode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeSALECode.load(); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.SALE, store: this.storeSALECode, forceSelection: true, id: 'SALE', name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //操 作 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.OP, store: this.storeOpCode, forceSelection: true, id: 'OP', name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var rec = records[0].data; //alert(rec.DEPTNAME); var DEPTNAME = rec.DEPTNAME; Ext.getCmp("SALEDEPT").setValue(DEPTNAME); } } } }); //录入人 this.storeINPUTBYCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeINPUTBYCode.load(); this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.INPUTBY, store: this.storeINPUTBYCode, forceSelection: true, id: 'INPUTBY', name: 'INPUTBY', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME, hidden: true }); //仓储出库货主 this.storeCustWmsCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustWmsCode.load({ params: { condition: "ISWAREHOUSE='1'"} }); this.comboxCustWmsCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CUSTOMERNAME_WMS, store: this.storeCustWmsCode, forceSelection: true, id: 'CUSTOMERNAME_WMS', name: 'CUSTOMERNAME_WMS', valueField: 'CustName', displayField: 'CodeAndName' }); //委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CUSTOMERNAME, store: this.storeCustCode, forceSelection: true, id: 'CUSTOMERNAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', allowBlank: false, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var data = combo.value; var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContact.load({ params: { condition: s} }); 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.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.SHOWNAME_Client, store: this.storeInfoClientContact, id: 'SHOWNAME_Client', name: 'SHOWNAME_Client', 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('EMAIL').setValue(Cargoinfodata.EMAIL); this.formHead.getForm().findField('TEL').setValue(Cargoinfodata.TEL); // this.formHead.getForm().findField('FAX').setValue(Cargoinfodata.FAX); } else { // this.formHead.getForm().findField('EMAIL').setValue(''); this.formHead.getForm().findField('TEL').setValue(''); // this.formHead.getForm().findField('FAX').setValue(''); } } } } }); //客户加载_贸易代理 this.storeTRADINGAGENCY = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeTRADINGAGENCY.load({ params: { condition: "ISTRADINGAGENCY='1'"} }); this.comboxTRADINGAGENCY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.TRADINGAGENCY, store: this.storeTRADINGAGENCY, forceSelection: true, id: 'TRADINGAGENCY', name: 'TRADINGAGENCY', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} }); this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CARRIER, store: this.storeCARRIER, forceSelection: true, id: 'CARRIER', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_车队 this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} }); this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.TRUCKER, store: this.storeTRUCKER, forceSelection: true, id: 'TRUCKER', name: 'TRUCKER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_报关 this.storeCUSTOMSER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCUSTOMSER.load({ params: { condition: "ISCUSTOM='1'"} }); this.comboxCUSTOMSER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CUSTOMSER, store: this.storeCUSTOMSER, forceSelection: true, id: 'CUSTOMSER', name: 'CUSTOMSER', valueField: 'CustName', displayField: 'CodeAndName' }); this.comboxCustENTERP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.ENTERP, store: this.storeCustCode, forceSelection: true, name: 'ENTERP', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_报检 this.storeINSPECTION = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeINSPECTION.load({ params: { condition: "ISCUSTOM='1'"} }); this.comboxINSPECTION = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.INSPECTION, store: this.storeINSPECTION, forceSelection: true, id: 'INSPECTION', name: 'INSPECTION', valueField: 'CustName', displayField: 'CodeAndName' }); //键值维护表_贸易方式 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: Zi.LAN.TRADETYPE, store: this.storeCrmKeyCodeCode, forceSelection: true, id: 'TRADETYPE', name: 'TRADETYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); this.storeTRADETERM = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeTRADETERM.load({ params: { enumTypeId: 97023} }); this.comboxTRADETERM = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: Zi.LAN.TRADETERM, store: this.storeTRADETERM, forceSelection: true, name: 'TRADETERM' }); //键值维护表_仓储类型 this.storeCrmKeyCodeCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode2.load({ params: { condition: " and KEYTYPE='仓储类型'"} }); this.comboxWMSTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.WMSTYPE, store: this.storeCrmKeyCodeCode2, forceSelection: true, id: 'WMSTYPE', name: 'WMSTYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); //键值维护表_装运方式 this.StoreBLTYPE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsExtEnumModel', proxy: { url: '/CommMng/PubSys/GetEnumValueList' } }); this.StoreBLTYPE.load({ params: { enumTypeId: 97042 } }); this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.BLTYPE, store: this.storeCrmKeyCodeCode3, forceSelection: true, id: 'BLTYPE', name: 'BLTYPE', valueField: 'EnumValueName', displayField: BLTYPEDFIELDNAME, value: '整箱', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == "拼箱单票" || combo.value == "拼箱分票") { if (this.storeBodyList.getCount() > 0) { combo.setValue(combo.originalValue); alert("拼箱单票、拼箱分票是不允许添加集装箱信息的,因此请先删除集装箱信息!"); return; } else { this.panelBodyChFee.hide(); } this.formEdit.getForm().findField('CNTRTOTAL').setValue('LCL'); } else { this.panelBodyChFee.show(); } // } } } }); //键值维护表_委托单类型 this.storeCrmKeyCodeCode4 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode4.load({ params: { condition: " and KEYTYPE='委托单类型'"} }); this.comboxBSTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.BSTYPE, store: this.storeCrmKeyCodeCode4, forceSelection: true, id: 'BSTYPE', name: 'BSTYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE', value: '普通货', readOnly: true }); //品名类型 this.storeCodeGoodsType = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeGoodsTypeModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsTypeList' } }); this.storeCodeGoodsType.load(); this.comboxGOODSTYPENAME = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.GOODSTYPENAME, store: this.storeCodeGoodsType, forceSelection: true, id: 'GOODSTYPENAME', name: 'GOODSTYPENAME', valueField: 'GoodsTypeName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var data = combo.value; var s = "GoodsTypeGID in (select gid from [code_goodsType] where GOODSTYPENAME='" + combo.value + "')"; this.storeCodeGoodsList.load({ params: { condition: s} }); } } } }); //品名 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', { fieldLabel: Zi.LAN.GOODSNAME, store: this.storeCodeGoodsList, id: 'GOODSNAME', name: 'GOODSNAME', valueField: 'GOODNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var Cargoinforecords = DsStoreQueryBy(this.storeCodeGoodsList, 'GOODNAME', records[0].data.GOODNAME); if (Cargoinforecords.getCount() > 0) { var Cargoinfodata = Cargoinforecords.getAt(0).data; this.formEdit.getForm().findField('GOODSTYPENAME').setValue(Cargoinfodata.GoodsTypeName); } else { this.formEdit.getForm().findField('GOODSTYPENAME').setValue(''); } } } } }); //业务来源 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: Zi.LAN.BSSOURCE, store: this.storeSource, forceSelection: true, id: 'BSSOURCE', 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: Zi.LAN.BSSOURCEDETAIL, store: this.storeSourceDetail, forceSelection: true, id: 'BSSOURCEDETAIL', name: 'BSSOURCEDETAIL', valueField: 'SourceDetail', displayField: 'SourceDetail' }); //状态_业务状态 Ext.define('BSSTATUSModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataBSSTATUS = [{ "Name": "未锁定" }, { "Name": "锁定" }, { "Name": ""}]; var storeBSSTATUS = Ext.create('Ext.data.Store', { model: 'BSSTATUSModel', data: dataBSSTATUS }); //业务状态 this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务状态', forceSelection: true, store: storeBSSTATUS, id: 'BSSTATUS', name: 'BSSTATUS', valueField: 'Name', displayField: 'Name' }); //费用状态 this.comboxFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用状态', forceSelection: true, store: storeBSSTATUS, id: 'FEESTATUS', name: 'FEESTATUS', valueField: 'Name', displayField: 'Name' }); //所属部门 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: Zi.LAN.SALEDEPT2, store: this.storeDept, forceSelection: true, id: 'SALEDEPT', name: 'SALEDEPT', valueField: 'DeptName', displayField: 'DeptName' //,hidden: true }); //国际港口(进口装货港、出口卸货港) this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.PORTLOAD, store: this.storeCodeDisport, forceSelection: true, id: 'PORTLOAD', name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName', matchFieldWidth: false, //下拉款自适应宽度 listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (records[0].data.EDICODE.toString().trim() != "") { this.formBill.getForm().findField('PORTLOADID').setValue(records[0].data.EDICODE); } // var BLFRT = this.formBill.getForm().findField('BLFRT').getValue(); if (BLFRT.indexOf("PREPAID") > -1) { this.formBill.getForm().findField('PREPARDAT').setValue(combo.value.toString()); //预付 this.formBill.getForm().findField('PAYABLEAT').setValue(''); //到付 this.formBill.getForm().findField('ISSUEPLACE').setValue(combo.value.toString()); //签单 //this.formBill.getForm().findField('ISSUEPLACEID').setValue(portloadid); } } } } // }); //国内港口(出口装货港、进口卸货港) this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.storeCodeLoadport.load(); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.PORTDISCHARGE, store: this.storeCodeLoadport, //forceSelection: true, id: 'PORTDISCHARGE', name: 'PORTDISCHARGE', valueField: 'PORT', displayField: 'CodeAndName', matchFieldWidth: false, //下拉款自适应宽度 listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (records[0].data.EDICODE.toString().trim() != "") { this.formBill.getForm().findField('PORTDISCHARGEID').setValue(records[0].data.EDICODE); this.formBill.getForm().findField('DESTINATIONID').setValue(records[0].data.EDICODE); this.formBill.getForm().findField('PLACEDELIVERYID').setValue(records[0].data.EDICODE); } if (records[0].data.PORT.toString().trim() != "") { this.formBill.getForm().findField('DESTINATION').setValue(records[0].data.PORT); this.formBill.getForm().findField('PLACEDELIVERY').setValue(records[0].data.PORT); } // var BLFRT = this.formBill.getForm().findField('BLFRT').getValue(); if (BLFRT.indexOf("COLLECT") > -1) { this.formBill.getForm().findField('PREPARDAT').setValue(''); //预付 this.formBill.getForm().findField('PAYABLEAT').setValue(combo.value.toString()); //到付 this.formBill.getForm().findField('ISSUEPLACE').setValue(combo.value.toString()); //签单 //this.formBill.getForm().findField('ISSUEPLACEID').setValue(PORTDISCHARGEID); } } } } // }); //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //船公司 this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.YARD, store: this.storeYARD, forceSelection: true, name: 'YARD', 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: Zi.LAN.FORWARDER, store: this.storeFORWARDER, forceSelection: true, name: 'FORWARDER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_订舱代理 this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //货代 this.comboxAGENT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.AGENTID, store: this.storeAGENT, forceSelection: true, name: 'AGENTID', valueField: 'CustName', displayField: 'CodeAndName' }); //件数包装 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: Zi.LAN.KINDPKGS, store: this.storeCodePackage, forceSelection: true, id: 'KINDPKGS', name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); //件数包装_集装箱列表中的下拉框加载 this.storeCodePackage_CTN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodePackageModel', proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } }); this.storeCodePackage_CTN.load(); this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '件数包装', store: this.storeCodePackage_CTN, forceSelection: true, id: 'KINDPKGS_CTN', name: 'KINDPKGS_CTN', valueField: 'PKGS', displayField: 'PKGS' }); //箱型_集装箱列表中的下拉框加载 this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCtnModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } }); this.storeCodeCtn.load(); this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '箱型', store: this.storeCodeCtn, forceSelection: true, id: 'CTNALL', name: 'CTNALL', valueField: 'CTN', displayField: 'CTN' }); //计费单位 Ext.define('UNITOFWEIGHTModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataUNITOFWEIGHT = [{ "Name": "吨" }, { "Name": "CBM" }, { "Name": "千克" }, { "Name": ""}]; var storeUNITOFWEIGHT = Ext.create('Ext.data.Store', { model: 'UNITOFWEIGHTModel', data: dataUNITOFWEIGHT }); this.comboxUNITOFWEIGHT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.UNITOFWEIGHT, forceSelection: true, store: storeUNITOFWEIGHT, id: 'UNITOFWEIGHT', name: 'UNITOFWEIGHT', valueField: 'Name', 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: Zi.LAN.CURRENCY, store: this.storeCodeCurrency, forceSelection: true, flex: 0.4, labelWidth: 40, id: 'CURRENCY', name: 'CURRENCY', valueField: 'CODENAME', displayField: 'CODENAME' }); this.StoreStlName = Ext.create('Ext.data.Store', { fields: ['STLNAME', 'DISPLAYNAME'] }); this.StoreStlName.add({ "STLNAME": "月结", "DISPLAYNAME": Zi.LAN.YUEJIE }); this.StoreStlName.add({ "STLNAME": "半月结", "DISPLAYNAME": Zi.LAN.BANYUEJIE }); this.StoreStlName.add({ "STLNAME": "约定天数", "DISPLAYNAME": Zi.LAN.YUEDINGTIANSHU }); this.StoreStlName.add({ "STLNAME": "周结", "DISPLAYNAME": Zi.LAN.ZHOUJIE }); this.StoreStlName.add({ "STLNAME": "现结买单", "DISPLAYNAME": Zi.LAN.XIANJIEMAIDAN }); this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreStlName, fieldLabel: Zi.LAN.STLNAME, //'结算方式', forceSelection: true, readOnly: true, //flex: 0.5, name: 'STLNAME', valueField: 'STLNAME', displayField: 'DISPLAYNAME' }); 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: Zi.LAN.LANE, store: this.storeLANE, // forceSelection: true, name: 'LANE', valueField: 'LANE', displayField: 'LANE' }); this.storeINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeINSPECTSERVICE.load({ params: { enumTypeId: 97024} }); this.comboxINSPECTSERVICE = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: Zi.LAN.INSPECTSERVICE, store: this.storeINSPECTSERVICE, forceSelection: true, name: 'INSPECTSERVICE' }); this.StoreBSSTATUSREF = Ext.create('Ext.data.Store', { fields: ['STLNAME', 'DISPLAYNAME'] }); this.StoreBSSTATUSREF.add({ "STLNAME": "锁定", "DISPLAYNAME": Zi.LAN.LOCK }); this.StoreBSSTATUSREF.add({ "STLNAME": "未锁定", "DISPLAYNAME": Zi.LAN.UNLOCK }); this.comboxBSSTATUSREF = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreBSSTATUSREF, fieldLabel: Zi.LAN.BSSTATUSREF, //'结算方式', forceSelection: true, readOnly: true, //flex: 0.5, name: 'BSSTATUSREF', valueField: 'STLNAME', displayField: 'DISPLAYNAME' }); this.comboxFEESTATUSREF = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreBSSTATUSREF, fieldLabel: Zi.LAN.FEESTATUSREF, //'结算方式', forceSelection: true, readOnly: true, //flex: 0.5, name: 'FEESTATUSREF', valueField: 'STLNAME', displayField: 'DISPLAYNAME' }); //#endregion //#region 编辑formHead 基本信息 this.formHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true, value: 'topseai' + NewGuid().toString().replace(/-/g, '') }, { fieldLabel: '业务编号', name: 'MASTERNO', hidden: true }, this.comboxBSSTATUSREF, this.comboxFEESTATUSREF, { fieldLabel: Zi.LAN.ACCDATE, xtype: 'monthfield', editable: false, name: 'ACCDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m") }, { fieldLabel: Zi.LAN.BSDATE, format: 'Y-m-d', xtype: 'datefield', name: 'BSDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d") }, this.comboxINPUTBY] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, this.comboxBLTYPE, this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxStlName, { fieldLabel: Zi.LAN.STLDATE, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'STLDATE' }, this.comboxInfoClientContact, { fieldLabel: 'TEL', name: 'TEL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.CUSTNO, name: 'CUSTNO' }, { fieldLabel: Zi.LAN.MBLNO, name: 'MBLNO' }, { fieldLabel: Zi.LAN.HBLNO, name: 'HBLNO' }, { fieldLabel: Zi.LAN.ORDERNO, name: 'ORDERNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxOP, this.comboxSALE, this.comboxCUSTSERVICE, this.comboxDept] }]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 编辑formEdit 货物信息 this.formEdit = Ext.widget('form', { //title: '货物信息', region: 'north', height: 360, frame: true, bodyPadding: 5, 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: Zi.LAN.VESSEL, name: 'VESSEL' }, { fieldLabel: Zi.LAN.VOYNO, name: 'VOYNO' }, this.comboxPORTLOAD, this.comboxPORTDISCHARGE, { fieldLabel: Zi.LAN.ETD, format: 'Y-m-d', xtype: 'datefield', name: 'ETD', listeners: { scope: this, 'blur': function (field) { this.getBMDDATE(); this.getMDTDATE(); } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.CHANGEDOCDATE, format: 'Y-m-d', xtype: 'datefield', name: 'CHANGEDOCDATE' }, { fieldLabel: Zi.LAN.FBP, name: 'FBP', id: 'FBP', value: 0, listeners: { scope: this, 'blur': function (field) { this.getBMDDATE(); } } }, { fieldLabel: Zi.LAN.BMDDATE, format: 'Y-m-d', name: 'BMDDATE', listeners: { scope: this, 'onfocus': function (field) { this.getBMDDATE2(field.getValue()); }, 'blur': function (field) { this.getBMDDATE2(field.getValue()); } } }, { fieldLabel: Zi.LAN.MDTDATE, format: 'Y-m-d', xtype: 'datefield', name: 'MDTDATE', listeners: { scope: this, 'onfocus': function (field) { this.getMDTDATE2(field.getValue()); }, 'blur': function (field) { this.getMDTDATE2(field.getValue()); } } }, this.comboxYARD] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCARRIER, this.comboxLANE, this.comboxCustENTERP, this.comboxFORWARDER, this.comboxAGENT] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRUCKER, this.comboxGOODSNAME, this.comboxGOODSTYPENAME, { fieldLabel: Zi.LAN.COUNTRYOFORIGIN, name: 'COUNTRYOFORIGIN' }, { fieldLabel: Zi.LAN.NUMBERPLATE, name: 'NUMBERPLATE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.PKGS, name: 'PKGS', value: 0, id: 'PKGS', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, this.comboxKINDPKGS, { fieldLabel: Zi.LAN.KGS2, name: 'KGS', value: 0, id: 'KGS', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, { fieldLabel: Zi.LAN.NETWEIGHT, name: 'NETWEIGHT', value: 0, id: 'NETWEIGHT', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, { fieldLabel: Zi.LAN.CBM, name: 'CBM', value: 0, id: 'CBM', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.APPROVENO, name: 'APPROVENO' }, this.comboxUNITOFWEIGHT, this.comboxTRADETYPE, this.comboxTRADETERM, { fieldLabel: Zi.LAN.CONTRACTNO, name: 'CONTRACTNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxWMSTYPE, { fieldLabel: 'BALES', name: 'BALES' }, { fieldLabel: Zi.LAN.CNTRTOTAL3, readOnly: true, name: 'CNTRTOTAL' }, { fieldLabel: Zi.LAN.INVNO, name: 'INVNO' }, { xtype: 'hiddenfield'}] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCUSTOMSER, { fieldLabel: Zi.LAN.CUSTOMNO, name: 'CUSTOMNO' }, { fieldLabel: Zi.LAN.CUSTOMDATE, format: 'Y-m-d', xtype: 'datefield', name: 'CUSTOMDATE' }, { fieldLabel: Zi.LAN.UPDATETIME, format: 'Y-m-d', xtype: 'datefield', name: 'UPDATETIME' }, { fieldLabel: Zi.LAN.TARRIFSPAIEDTIEM, format: 'Y-m-d', xtype: 'datefield', name: 'TARRIFSPAIEDTIEM' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxINSPECTION, { fieldLabel: Zi.LAN.INSPECTIONNO, name: 'INSPECTIONNO' }, { fieldLabel: Zi.LAN.INSPECTIONDATE, format: 'Y-m-d', xtype: 'datefield', name: 'INSPECTIONDATE' }, { fieldLabel: Zi.LAN.IMPORTVALUE, name: 'IMPORTVALUE', value: 0, id: 'IMPORTVALUE', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!', 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; } }, { fieldLabel: Zi.LAN.UNITPRICE, name: 'UNITPRICE', flex: 0.6, value: 0, id: 'UNITPRICE', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!', 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.comboxCodeCurrency] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.CUSTOMSNUM, name: 'CUSTOMSNUM', value: 0, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, { fieldLabel: Zi.LAN.ISMOREGOOD, inputValue: true, xtype: 'checkboxfield', name: 'ISMOREGOOD' }, this.comboxINSPECTSERVICE, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}] }, { xtype: 'container', layout: 'hbox', defaultType: 'textarea', items: [{ fieldLabel: Zi.LAN.REMARK, height: 54, name: 'REMARK', flex: 4 }]//, { xtype: 'hiddenfield'} }]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 空白form信息 this.formBlank = Ext.widget('form', { region: 'south', height: 50, frame: true, items: [{ xtype: 'container'}] }); //#endregion //#region 危险品信息 this.panelBodyDr = new Ext.Panel({ title: Zi.LAN.panelBodyDr, //'危险品信息', layout: "border", hidden: true, height: 60, frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', defaults: { anchor: '96%' }, items: [{ fieldLabel: Zi.LAN.DCLASS, //'危险品等级', flex: 1, labelWidth: 70, name: 'DCLASS' }, { fieldLabel: Zi.LAN.DUNNO, //'危险品编号', flex: 1, labelWidth: 70, name: 'DUNNO' }, { fieldLabel: Zi.LAN.DPAGE, //'危险品页号', flex: 1, labelWidth: 70, name: 'DPAGE' }, { fieldLabel: Zi.LAN.DLABEL, //'危险品标签', flex: 1, labelWidth: 70, name: 'DLABEL' }, { fieldLabel: Zi.LAN.LINKMAN, //'危险品联系人', flex: 1, labelWidth: 90, name: 'LINKMAN' }] }] }); this.panelBodyRf = new Ext.Panel({ title: Zi.LAN.panelBodyRf, //'冻柜信息', layout: "border", hidden: true, height: 60, //margin: '5 10', frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.REEFERF, //'冷藏通风量', name: 'REEFERF' }, { fieldLabel: Zi.LAN.TEMPSET, //'设置温度', name: 'TEMPSET' }, { fieldLabel: Zi.LAN.TEMPID, //'温度单位', name: 'TEMPID' }] }] }); this.StoreCargoid = Ext.create('DsExt.ux.RefTableStore', { model: 'DsExtEnumModel', proxy: { url: '/CommMng/PubSys/GetEnumValueList' } }); this.StoreCargoid.load({ params: { enumTypeId: 96012 } }); this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCargoid, fieldLabel: Zi.LAN.CARGOID, //'货物标示', forceSelection: true, name: 'CARGOID', valueField: 'EnumValueId', displayField: BLTYPEDFIELDNAME, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == 'R') { this.panelBodyDr.setVisible(false); this.panelBodyRf.setVisible(true); } else if (combo.value == 'D') { this.panelBodyDr.setVisible(true); this.panelBodyRf.setVisible(false); } else { this.panelBodyDr.setVisible(false); this.panelBodyRf.setVisible(false); } } } } }); //#endregion //#region 收、发货人通知人 //客户加载_发货人 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: Zi.LAN.SHIPPERID, 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.formBill.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL); } else { this.formBill.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: Zi.LAN.CONSIGNEEID, 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.formBill.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL); } else { this.formBill.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: Zi.LAN.NOTIFYPARTYID, 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.formBill.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); } else { this.formBill.getForm().findField('NOTIFYPARTY').setValue(''); } } } } }); //#endregion //#region 编辑formbill 基本信息 this.formBill = 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: 1, defaultType: 'textfield', items: [this.comboxShipper, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'SHIPPER', anchor: '100%' }, this.comboxConsignee, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'CONSIGNEE', anchor: '100%' }, this.comboxNotifyParty, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'NOTIFYPARTY', anchor: '100%' } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: Zi.LAN.ETA, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA'//'ETD' }, { fieldLabel: Zi.LAN.PORTLOADID, name: 'PORTLOADID' }, { fieldLabel: Zi.LAN.PORTDISCHARGEID, name: 'PORTDISCHARGEID' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: Zi.LAN.DESTINATIONID, name: 'DESTINATIONID' }, { fieldLabel: Zi.LAN.DESTINATION, name: 'DESTINATION' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: Zi.LAN.PLACEDELIVERYID, name: 'PLACEDELIVERYID' }, { fieldLabel: Zi.LAN.PLACEDELIVERY, name: 'PLACEDELIVERY' }] } ] } ] }, { 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: Zi.LAN.MARKSSTR }, { xtype: 'textareafield', grow: true, height: 250, name: 'MARKS', anchor: '100%' } ] }, { xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [this.comboxCargoid] }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelSeparator: '', labelWidth: 20, height: 250, name: 'DESCRIPTION', anchor: '100%' }] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [{ xtype: 'label', html: Zi.LAN.NOPKGS }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelWidth: 20, labelSeparator: '', height: 40, name: 'NOPKGS', anchor: '100%' }, { xtype: 'label', html: Zi.LAN.GROSSWEIGHT }, { xtype: 'textareafield', grow: true, height: 40, labelWidth: 20, labelSeparator: '', fieldLabel: '  ', name: 'GROSSWEIGHT', anchor: '100%' }, { xtype: 'label', html: Zi.LAN.MEASUREMENT }, { xtype: 'textareafield', grow: true, height: 40, labelWidth: 20, labelSeparator: '', fieldLabel: '  ', name: 'MEASUREMENT', anchor: '100%' } ] } ] }, this.panelBodyDr, this.panelBodyRf, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: Zi.LAN.ISSUETYPE, name: 'ISSUETYPE' }, { fieldLabel: Zi.LAN.ISSUEDATE, format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: Zi.LAN.ISSUEPLACE, name: 'ISSUEPLACE' }, { fieldLabel: Zi.LAN.NOBILL, name: 'NOBILL' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: Zi.LAN.BLFRT, name: 'BLFRT' }, { fieldLabel: Zi.LAN.PREPARDAT, name: 'PREPARDAT' }, { fieldLabel: Zi.LAN.PAYABLEAT, name: 'PAYABLEAT' }, { fieldLabel: Zi.LAN.SERVICE, name: 'SERVICE' }] }] } ] }); //end this.formEdit //#endregion //#region 集装箱-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpSeaiDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeai/GetBodyList', reader: { id: 'BsNo,CTNCODE,CTN_ID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhongQingShaoDeng}, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'CTN_ID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'CTNCODE', header: Zi.LAN.CTNCODE, width: 30 }, { dataIndex: 'CTNALL', header: Zi.LAN.CTNALL, width: 70, editor: this.comboxCTNALL }, { dataIndex: 'CTNNUM', header: Zi.LAN.CTNNUM, width: 50, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'CNTRNO', header: Zi.LAN.CNTRNO, width: 100, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'SEALNO', header: Zi.LAN.SEALNO, width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'PKGS', header: Zi.LAN.PKGS, width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KINDPKGS', header: Zi.LAN.KINDPKGS, width: 100, editor: this.comboxKINDPKGS_CTN }, { dataIndex: 'KGS', header: Zi.LAN.KGS, width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TAREWEIGHT', header: Zi.LAN.TAREWEIGHT, width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: Zi.LAN.CBM, width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: Zi.LAN.REMARK, width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }] }); //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnEPrev', text: Zi.LAN.btnEPrev, // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: Zi.LAN.btnENext, // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this }, '-', { text: Zi.LAN.GuanBi, handler: function (button, event) { window.close(); }, scope: this }, '-', { text: Zi.LAN.btnprint, iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.panelSeai = new Ext.Panel({ title: Zi.LAN.panelSeai, id: 'pnlmodNewOpSeaiInfo', //layout: "border", //region: 'center', //animate: true, autoScroll: true, //height: 900, //frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.formEdit, this.gridList, this.formBlank] }); this.panelBill = new Ext.Panel({ title: Zi.LAN.panelBill, layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.formBill] }); this.tabSeaipanel = new Ext.TabPanel({ activeTab: 0, autoScroll: true, autoWidth: true, border: true, frame: false, region: 'center', id: "TabSeaiPanel", enableTabScroll: true, items: [ this.panelSeai, this.panelBill ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard.id == "pnlmodSeaiAllFee") { 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 == "pnlmodSeaiAmendFee") { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '更改单未保存,请先保存更改单!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } } } }); Ext.apply(this, { items: [this.tabSeaipanel] }); //#endregion //#region 其他 // parentWin = window.parent.opener; parentWin = window.parent.opener._thisfenlist; if (parentWin == NaN || parentWin == null) { parentWin = window.parent.opener._this; } else { this.isfen = true; } this.InitData(); this.LoadMustBe(); this.storeYARD.load({ params: { condition: "ISYARD='1'"} }); this.storeAGENT.load({ params: { condition: "ISAGENT='1'"} }); this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} }); //绑定事件 this.gridList.on('edit', function (editor, e, eOpts) { this.gridAfterEdit(editor, e, eOpts); }, this); //#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]; if (this.isfen) this.MainEditRecord = ret[3]; } this.storecodeservice.load({ params: { condition: "OPTYPE='2'" }, 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:true,name:'" + memberyf.data.OPField + "',id:'" + memberyf.data.OPField + "'"; checkboxSingleItem += "}"; } else { var checkboxSingleItem = ",{boxLabel:'" + memberyf.data.SERVICENAME + "',inputValue:true,name:'" + memberyf.data.OPField + "',id:'" + memberyf.data.OPField + "'"; checkboxSingleItem += "}"; } checkboxitems += checkboxSingleItem; }; checkboxitems += "]"; _this.myCheckboxGroup = new Ext.form.CheckboxGroup({ id: 'myGroup', xtype: 'checkboxgroup', fieldLabel: Zi.LAN.myGroup, columns: 8, items: eval(checkboxitems) }); this.formHead.add(_this.myCheckboxGroup); this.formHead.doLayout(); } condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData('edit', condition); } }, scope: this }); // if (this.opStatus == 'edit') { // condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; // this.LoadData('edit', condition); // } else if (this.opStatus == 'add') { // this.LoadDefValue(); // } }, //end InitData LoadData: function (opstatus, condition) { 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 = "海运出口-新增"; } Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpSeai/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; // var CUSTOMERNAME = data.CUSTOMERNAME; var s = "LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')"; this.storeInfoClientContact.load({ params: { condition: s} }); // this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formBill.getForm().reset(); this.formBill.getForm().setValues(data); this.LoadInit(data); // if (opstatus == "add") { this.GetAddText(); } this.GetEditStatus(); var paneltabfee = new Shipping.SeaiFee({ id: 'pnlmodSeaiAllFee', layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: '费用信息' }); this.tabSeaipanel.add(paneltabfee); var paneltabfeeamend = new Shipping.SeaiAmendFee({ id: 'pnlmodSeaiAmendFee', layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: '更改单信息' }); this.tabSeaipanel.add(paneltabfeeamend); this.tabSeaipanel.doLayout(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //var billno = '*'; //var gid = '*'; if (this.opStatus == 'edit') { //billno = this.editRecord.get('BSNO'); //condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; this.storeBodyList.load({ params: { condition: condition} }); } }, // end LoadDate //#endregion //#region 保存 Save: function (type) { var basicForm = this.formEdit.getForm(); var basicForm2 = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (!basicForm2.isValid()) { return; } // var bodydatas = []; var iCount = this.storeBodyList.getCount(); for (var i = 1; i <= iCount; i++) { var member = this.storeBodyList.getAt(i - 1); var sn = i.toString(); var al = iCount.toString().length; var bl = i.toString().length; if (iCount.toString().length > i.toString().length) { for (var j = 0; j < (iCount.toString().length - i.toString().length); j++) { sn = "0" + i.toString().toString(); } } member.data.CTNCODE = sn; bodydatas.push(member); } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); var data3 = this.formBill.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpSeai/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), data3: Ext.JSON.encode(data3), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(returnData); this.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); this.formBill.getForm().reset(); this.formBill.getForm().setValues(returnData); bodydatas = []; // if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpSeaiModel', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } // this.opStatus = 'edit'; if (type == '0') { this.formHead.getForm().findField('BSNO').setDisabled(false); this.formHead.getForm().findField('BSNO').setValue(returnData.BSNO); this.formHead.getForm().findField('BSNO').setDisabled(true); var condition = "BSNO='" + returnData.BSNO + "'"; this.storeBodyList.load({ params: { condition: condition} }); // for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { // var memberbody = this.storeBodyList.getAt(j); // memberbody.set("BSNO", this.editRecord.get('BSNO')); // memberbody.commit(); // }; } 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 集装箱按钮事件 onAddDetailClick: function (button, event) { this.addDetail(); }, //end onAddDetailClick onDelDetailClick: function (button, event) { this.deleteDetail(); }, //onDelDetailClick // gridAfterEdit: function (editor, e, eOpts) { // if (e.field == 'Pkgs' || e.field == 'Price') { // var Pkgs = e.record.data['Pkgs']; // var Price = e.record.data['Price']; // e.record.set('Total', (Pkgs * Price).toFixed(2)); // } // }, addDetail: function () { var newSerialno = this.DsGetNewNo(this.storeBodyList); //this.tabtree.expandAll(); //展开所有树节点 //collapseAll():收缩所有树节点 //getRootNode():获取根节点 var record = Ext.create('MsOpSeaiDetail', { CTN_ID: '*', CTNCODE: newSerialno, CTNALL: '', CTNNUM: 1, CNTRNO: '', SEALNO: '', PKGS: 0, KINDPKGS: '', KGS: 0, TAREWEIGHT: 0, CBM: 0, REMARK: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, DsGetNewNo: function (store) { var result = store.getCount(); if (result == 0) { return 1; } var record = store.getAt(result - 1).data.CTNCODE; result = parseInt(record) + 1; return result; }, deleteDetail: function () { var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue(); if (BSSTATUS == '锁定') { Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var selectedRecords = this.gridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.CTN_ID == "" || rec.data.CTN_ID == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpSeai/DeleteDetail', 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 编辑时按钮等的状态 GetEditStatus: function () { }, GetAddText: function () { if (this.opStatus != 'edit') { var basicForm = this.formHead.getForm(); basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); var oldbsno = field.getValue(); var oldmasterno = basicForm.findField('MASTERNO').getValue(); var strbsno = "topseai" + 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.storeBodyList.removeAll(); //清空所有; // 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_Client').setValue(''); } // this.GetEditStatus(); if (Ext.getCmp('pnlmodSeaiAllFee')) { var pnlfee = Ext.getCmp('pnlmodSeaiAllFee'); pnlfee.close(); this.tabSeaipanel.doLayout(); } } }, //#endregion //#region 联动事件集 getBMDDATE: function () { //Ext.getCmp('text2').setValue(Ext.getCmp('text1').getValue()); //this.formHead.getForm().findField('EMAIL').setValue(''); //this.formHead.getForm().findField('EMAIL').getValue(); var tbETD = this.formEdit.getForm().findField('ETD').getRawValue(); var tbFBP = this.formEdit.getForm().findField('FBP').getValue(); // if (tbETD == "") { return; } if (tbFBP == "" || tbFBP == "0" || tbFBP == "1") { this.formEdit.getForm().findField('BMDDATE').setValue(tbETD); return; } // // var myDate = new Date(Date.parse(tbETD.toString())); // myDate.setDate(myDate.getDate() + (parseInt(tbFBP) - 1)); // var lsDate = Ext.util.Format.date(myDate, 'Y-m-d'); // if (lsDate.indexOf("-00-") > -1) { // lsDate = (myDate.getFullYear() - 1) + "-12-" + myDate.getDate(); // } var lsDate = getNewDay(tbETD, tbFBP); this.formEdit.getForm().findField('BMDDATE').setValue(lsDate); }, getMDTDATE: function () { var tbETD = this.formEdit.getForm().findField('ETD').getRawValue(); if (tbETD == "") { return; } var lsDate = getNewDay(tbETD, 9); this.formEdit.getForm().findField('MDTDATE').setValue(lsDate); }, getBMDDATE2: function (tbBMDDATE) { if (tbBMDDATE == "") { this.getBMDDATE(); } }, getMDTDATE2: function (tbMDTDATE) { if (tbMDTDATE == "") { this.getMDTDATE(); } }, //#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); var data3 = this.formBill.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在生成数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在生成数据...', url: '/MvcShipping/MsOpSeai/SaveBG', scope: this, params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), data3: Ext.JSON.encode(data3) }, 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 //#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); var headfield = this.formBill.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); this.GetEditStatus(); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='海运进口'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); } 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' }); } var headfield = this.formBill.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' }); } }; } else { } } }, scope: this }); }, //#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 = 'MSOPSEAI'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM OP_SEAI WHERE BSNO= '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion //#region 上一票,下一票 PrevRecord: function () { var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var children = this.tabSeaipanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpSeaiInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaipanel.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 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.tabSeaipanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodNewOpSeaiInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaipanel.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); }, //#endregion //#region 其他舱单信息 LoadInit: function (data) { var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getValue(); 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.formBill.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.formBill.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.formBill.getForm().findField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID); } }, scope: this }); }, getIsModify: function () { var feepanel = Ext.getCmp('pnlmodSeaiAllFee'); if (feepanel != NaN && feepanel != null) { var feemodify = feepanel.panelFee.getModifyStatus(); if (feemodify) { return '费用信息'; } } var feeamendpanel = Ext.getCmp('pnlmodSeaiAmendFee'); if (feeamendpanel != NaN && feeamendpanel != null) { var feemodify = feeamendpanel.panelFee.getModifyStatus(); if (feemodify) { return '更改单信息'; } } if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true || this.formBill.getForm().isDirty() == true) { return '业务信息'; } else return ''; }, gridAfterEdit: function (editor, e, eOpts) { if (e.field == 'PKGS' || e.field == 'KGS' || e.field == 'CBM') { this.setAllTotal(); if (e.field == 'KGS') { var KGS = this.formEdit.getForm().findField('KGS').getValue(); this.formBill.getForm().findField('GROSSWEIGHT').setValue(KGS + 'KGS'); } if (e.field == 'CBM') { var CBM = this.formEdit.getForm().findField('CBM').getValue(); this.formBill.getForm().findField('MEASUREMENT').setValue(CBM + 'CBM'); } if (e.field == 'PKGS') { var PKGS = this.formEdit.getForm().findField('PKGS').getValue(); var KINDPKGS = this.formEdit.getForm().findField('KINDPKGS').getValue(); this.formBill.getForm().findField('NOPKGS').setValue(PKGS + KINDPKGS); // this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.'); } } else if (e.field == 'KINDPKGS') { var KINDPKGS = e.record.data['KINDPKGS']; this.setHeadFieldValue('KINDPKGS', KINDPKGS); var PKGS = this.formEdit.getForm().findField('PKGS').getValue(); this.formBill.getForm().findField('NOPKGS').setValue(PKGS + KINDPKGS); // this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.'); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); if (memberbody.data.KINDPKGS == "" || memberbody.data.KINDPKGS == NaN || memberbody.data.KINDPKGS == null) { memberbody.set("KINDPKGS", KINDPKGS); memberbody.commit(); } }; } }, setAllTotal: function () { this.setPKGSTotal(); this.setKGSTotal(); this.setCBMTotal(); }, setPKGSTotal: function () { var total = this.calcDetailTotal('PKGS'); this.setHeadFieldValue('PKGS', total); }, setKGSTotal: function () { var total = this.calcDetailTotal('KGS'); this.setHeadFieldValue('KGS', total); }, setCBMTotal: function () { var total = this.calcDetailTotal('CBM'); this.setHeadFieldValue('CBM', total); }, calcDetailTotal: function (fieldName) { var total = 0; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var value = member.get(fieldName); total = Add(total, value); } return total; }, setHeadFieldValue: function (fieldName, value) { var field = this.formEdit.getForm().findField(fieldName); field.setValue(value); }, onUpDetailClick: function () { var StoreCtn = Ext.create('Ext.data.Store', { fields: [{ name: 'CTN', type: 'string' }, { name: 'CTNNUM', type: 'number' }, { name: 'PKGS', type: 'number' }, { name: 'KINDPKGS', type: 'string' }, { name: 'KGS', type: 'number' }, { name: 'CBM', type: 'number' } ] }); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); if (memberbody.data.CTNNUM > 1) { StoreCtn.add({ "CTN": memberbody.data.CTNALL, "CTNNUM": memberbody.data.CTNNUM, "PKGS": memberbody.data.PKGS, "KINDPKGS": memberbody.data.KINDPKGS, "KGS": memberbody.data.KGS, "CBM": memberbody.data.CBM }); }; var pkgs = memberbody.data.PKGS; var kgs = memberbody.data.KGS; var cbm = memberbody.data.CBM; var ctnnum = memberbody.data.CTNNUM; memberbody.set("CTNNUM", 1); memberbody.set("PKGS", Div(pkgs, ctnnum)); memberbody.set("KGS", Div(kgs, ctnnum)); memberbody.set("CBM", Div(cbm, ctnnum)); memberbody.commit(); }; for (var j = 0; j < StoreCtn.getCount(); j += 1) { var memberbody = StoreCtn.getAt(j); for (var I = 0; I < memberbody.data.CTNNUM - 1; I += 1) { var pkgs = memberbody.data.PKGS; var kgs = memberbody.data.KGS; var cbm = memberbody.data.CBM; var ctnnum = memberbody.data.CTNNUM; var kingpkgs = memberbody.data.KINDPKGS; var newSerialno = this.DsGetNewNo(this.storeBodyList); this.serialNo = newSerialno; var record = Ext.create('MsOpSeaiDetail', { CTN_ID: '*', BSNO: '*', CTNCODE: newSerialno, CTNALL: memberbody.data.CTN, CTNNUM: 0, CNTRNO: '', SEALNO: '', PKGS: Div(pkgs, ctnnum), KINDPKGS: kingpkgs, KGS: Div(kgs, ctnnum), TAREWEIGHT: 0, CBM: Div(cbm, ctnnum), REMARK: '' }); this.storeBodyList.add(record); var _c = this.storeBodyList.getCount() - 1; var _d = this.storeBodyList.getAt(_c); _d.set('CTNNUM', 1); } }; var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); } //#endregion });