Ext.namespace('Shipping'); Shipping.MsOpSeaiView = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSeaiView.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSeaiView, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, stroplb: '海运进口', initUIComponents: function () { this.itemindex = 1; this.bsno = getUrlParam('bsno'); //#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: '客服', 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: '揽货人', 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: '操 作', 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: '录入人', store: this.storeINPUTBYCode, 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: '仓储货主', store: this.storeCustWmsCode, 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: '委托单位', // 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.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '联系人', store: this.storeInfoClientContact, 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: '贸易代理', store: this.storeTRADINGAGENCY, 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: '船公司', store: this.storeCARRIER, 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: '车队', store: this.storeTRUCKER, 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: '报关行', store: this.storeCUSTOMSER, id: 'CUSTOMSER', name: 'CUSTOMSER', valueField: 'CustName', displayField: 'CodeAndName' }); this.comboxCustENTERP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '经营单位', store: this.storeCustCode, 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: '报检', 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: '贸易方式', store: this.storeCrmKeyCodeCode, id: 'TRADETYPE', name: 'TRADETYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); //键值维护表_仓储类型 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: '仓储类型', store: this.storeCrmKeyCodeCode2, id: 'WMSTYPE', name: 'WMSTYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); //键值维护表_装运方式 this.storeCrmKeyCodeCode3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode3.load({ params: { condition: " and KEYTYPE='装运方式'"} }); this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装运方式', store: this.storeCrmKeyCodeCode3, forceSelection: true, id: 'BLTYPE', name: 'BLTYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE', 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(); } } 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: '委托单类型', store: this.storeCrmKeyCodeCode4, 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: '品名类型', store: this.storeCodeGoodsType, 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: '品名', 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(''); } } } } }); //状态_业务状态 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.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: '装货港', store: this.storeCodeDisport, // forceSelection: true, id: 'PORTLOAD', name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName' }); //国内港口(出口装货港、进口卸货港) 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: '卸货港', store: this.storeCodeLoadport, // forceSelection: true, id: 'PORTDISCHARGE', name: 'PORTDISCHARGE', valueField: 'PORT', displayField: 'CodeAndName' }); //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); //船公司 this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '场站', 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: '货代', 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: '国外代理', 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: '件数包装', 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: '计费单位', 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: '币别', store: this.storeCodeCurrency, forceSelection: true, id: 'CURRENCY', name: 'CURRENCY', valueField: 'CODENAME', displayField: 'CODENAME' }); 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, name: 'STLNAME', valueField: 'STLNAME', displayField: 'STLNAME' }); //#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: '业务锁定', readOnly: true, name: 'BSSTATUSREF' }, { fieldLabel: '费用锁定', readOnly: true, name: 'FEESTATUSREF' }, { fieldLabel: '会计期间', xtype: 'monthfield', editable: false, name: 'ACCDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m") }, { fieldLabel: '接单日期', 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, this.comboxBLTYPE, this.comboxDept] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.CUSTOMERNAME, //'费用锁定', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: Zi.LAN.BSSOURCE, //'费用锁定', readOnly: true, name: 'BSSOURCE' }, { fieldLabel: Zi.LAN.BSSOURCEDETAIL, //'费用锁定', readOnly: true, name: 'BSSOURCEDETAIL' }, { fieldLabel: '结算方式', //flex: 0.5, readOnly: true, name: 'STLNAME' }, { fieldLabel: Zi.LAN.STLDATE, //'结算日期', //format: 'Y-m-d', //flex: 0.5, //labelWidth: 55, readOnly: true, //xtype: 'datefield', name: 'STLDATE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '委托编号', name: 'CUSTNO' }, { fieldLabel: '主提单号', name: 'MBLNO', allowBlank: false }, { fieldLabel: '分提单号', name: 'HBLNO' }, { fieldLabel: '业务编号', name: 'ORDERNO' }, { fieldLabel: '申请放箱号', //'申请放箱号', name: 'APPLYNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.OP, //'发票号', readOnly: true, name: 'OP' }, { fieldLabel: Zi.LAN.SALE, //'发票号', readOnly: true, name: 'SALE' }, { fieldLabel: Zi.LAN.DOC, //'发票号', readOnly: true, name: 'DOC' }, { fieldLabel: Zi.LAN.CUSTSERVICE, //'发票号', readOnly: true, name: 'CUSTSERVICE' }, { fieldLabel: Zi.LAN.FRCUSTSERVICE, //'发票号', readOnly: true, name: 'FRCUSTSERVICE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '船名', name: 'VESSEL' }, { fieldLabel: '航次', name: 'VOYNO' }, this.comboxPORTLOAD, this.comboxPORTDISCHARGE, { fieldLabel: '所属分部', //'费用锁定', readOnly: true, name: 'SALECORP' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '到港日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETD', listeners: { scope: this, 'blur': function (field) { this.getBMDDATE(); this.getMDTDATE(); } } }, { fieldLabel: '免箱期', name: 'FBP', value: 0, id: 'FBP', blankText: '请填写数值!', allowBlank: false, regex: /^(0|[1-9][0-9]*)$/, regexText: '请输入正确的数值!', listeners: { scope: this, 'blur': function (field) { this.getBMDDATE(); } } }, { fieldLabel: '箱使到期日', format: 'Y-m-d', xtype: 'datefield', name: 'BMDDATE', listeners: { scope: this, 'onfocus': function (field) { this.getBMDDATE2(field.getValue()); }, 'blur': function (field) { this.getBMDDATE2(field.getValue()); } } }, { fieldLabel: '搬倒日期', 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()); } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCARRIER, this.comboxCustENTERP, this.comboxFORWARDER, this.comboxAGENT] }]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 编辑formEdit 货物信息 this.formEdit = Ext.widget('form', { title: '货物信息', region: 'north', height: 290, 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: [this.comboxGOODSNAME, this.comboxGOODSTYPENAME, { fieldLabel: '原产地', name: 'COUNTRYOFORIGIN' }, { fieldLabel: '牌号', name: 'NUMBERPLATE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRADETYPE, { fieldLabel: '合同号', name: 'CONTRACTNO' }, this.comboxWMSTYPE, { fieldLabel: 'BALES', name: 'BALES' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数', name: 'PKGS', value: 0, id: 'PKGS', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, this.comboxKINDPKGS, { fieldLabel: '毛重', name: 'KGS', value: 0, id: 'KGS', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, { fieldLabel: '净重', name: 'NETWEIGHT', value: 0, id: 'NETWEIGHT', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }, this.comboxUNITOFWEIGHT, { fieldLabel: '尺码', name: 'CBM', value: 0, id: 'CBM', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值!' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '货值', 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: '单价', name: 'UNITPRICE', 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: 'hiddenfield'}] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCUSTOMSER, { fieldLabel: '报关单号', name: 'CUSTOMNO' }, { fieldLabel: '通关日期', format: 'Y-m-d', xtype: 'datefield', name: 'CUSTOMDATE' }, { fieldLabel: '申报日期', format: 'Y-m-d', xtype: 'datefield', name: 'UPDATETIME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxINSPECTION, { fieldLabel: '报检单号', name: 'INSPECTIONNO' }, { fieldLabel: '报检日期', format: 'Y-m-d', xtype: 'datefield', name: 'INSPECTIONDATE' }, { fieldLabel: '交关税时间', format: 'Y-m-d', xtype: 'datefield', name: 'TARRIFSPAIEDTIEM' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '审批单号', name: 'APPROVENO' }, this.comboxYARD, this.comboxTRUCKER, { fieldLabel: '箱型箱量', readOnly: true, name: 'CNTRTOTAL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textarea', items: [{ fieldLabel: '备注', 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: 300, frame: true, items: [{ xtype: 'container'}] }); //#endregion //#region 危险品信息 this.panelBodyDr = new Ext.Panel({ title: '危险品信息', layout: "border", hidden: true, height: 60, frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', defaults: { anchor: '96%' }, items: [{ fieldLabel: '危险品等级', flex: 1, labelWidth: 70, name: 'DCLASS' }, { fieldLabel: '危险品编号', flex: 1, labelWidth: 70, name: 'DUNNO' }, { fieldLabel: '危险品页号', flex: 1, labelWidth: 70, name: 'DPAGE' }, { fieldLabel: '危险品标签', flex: 1, labelWidth: 70, name: 'DLABEL' }, { fieldLabel: '危险品联系人', flex: 1, labelWidth: 90, name: 'LINKMAN' }] }] }); this.panelBodyRf = new Ext.Panel({ title: '冻柜信息', layout: "border", hidden: true, height: 60, //margin: '5 10', frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '冷藏通风量', name: 'REEFERF' }, { fieldLabel: '设置温度', name: 'TEMPSET' }, { fieldLabel: '温度单位', name: 'TEMPID' }] }] }); this.StoreCargoid = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" }); this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" }); this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" }); this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" }); this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCargoid, fieldLabel: '货物标示', forceSelection: true, name: 'CARGOID', valueField: 'ID', displayField: 'NAME', 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 编辑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: [{ xtype: 'label', html: 'Shipper (发货人)' }, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'SHIPPER', anchor: '100%' }, { xtype: 'label', html: 'Consignee (收货人) ' }, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'CONSIGNEE', anchor: '100%' }, { xtype: 'label', html: 'Notify Party (通知人)' }, { 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: '开船日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA'//'ETD' }, { fieldLabel: '装港代码', name: 'PORTLOADID' }, { fieldLabel: '卸港代码', name: 'PORTDISCHARGEID' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '目的代码', name: 'DESTINATIONID' }, { fieldLabel: '目的地', name: 'DESTINATION' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '交货代码', name: 'PLACEDELIVERYID' }, { fieldLabel: '交货地', 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: 'Seal No.(封志号)
Marks & Nos.(标记与号码) ' }, { 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: '         No.of containers or pkgs.
         (箱数或件数)' }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelWidth: 20, labelSeparator: '', height: 40, name: 'NOPKGS', anchor: '100%' }, { xtype: 'label', html: '          Gross Weight 毛重(公斤)' }, { xtype: 'textareafield', grow: true, height: 40, labelWidth: 20, labelSeparator: '', fieldLabel: '  ', name: 'GROSSWEIGHT', anchor: '100%' }, { xtype: 'label', html: '          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: '签单方式', name: 'ISSUETYPE' }, { fieldLabel: '签单日期', format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: '签单地点', name: 'ISSUEPLACE' }, { fieldLabel: '提单份数', name: 'NOBILL' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '付费方式', name: 'BLFRT' }, { fieldLabel: '预付地点', name: 'PREPARDAT' }, { fieldLabel: '到付地点', name: 'PAYABLEAT' }, { fieldLabel: '运输条款', 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: "数据加载中,请稍等..." }, 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: '序号', width: 30 }, { dataIndex: 'CTNALL', header: '箱型', width: 70, editor: this.comboxCTNALL }, { dataIndex: 'CTNNUM', header: '箱量', width: 50, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'CNTRNO', header: '箱号', width: 100, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'SEALNO', header: '封号', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'PKGS', header: '件数', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KINDPKGS', header: '件数包装', width: 100, editor: this.comboxKINDPKGS_CTN }, { dataIndex: 'KGS', header: '重量', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TAREWEIGHT', header: '箱皮重', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: '尺码', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }] }); //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.panelSeai = new Ext.Panel({ title: '委托信息', 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: '舱单信息', layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.formBill] }); 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: 'FEDF4D2F-81E8-4C2C-9CAE-5B7A047C5483' } }); 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.tabSeaipanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { var children = this.tabSeaipanel.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.tabSeaipanel.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 == 'modSeaiAllFee') { var paneltabitems = new Shipping.SeaiFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modSeaiAmendFee') { var paneltabitems = new Shipping.SeaiAmendFee({ 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.tabSeaipanel.add(paneltabitems); this.tabSeaipanel.setActiveTab(paneltabitems); this.tabSeaipanel.doLayout(); } } } } } }); 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.tabtree, this.tabSeaipanel] }); //#endregion //#region 其他 this.InitData(); 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 () { var condition = ''; _this = this; condition = "BSNO='" + this.bsno+ "'"; this.LoadData('edit', condition); }, //end InitData LoadData: function (opstatus, condition) { this.opStatus = opstatus; 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); // var editp = Ext.create('MsOpSeaiModel', data); this.editRecord = editp; var paneltabitems = new Ext.Panel({ id: 'pnlTruckBLEdit' , layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title:"派车通知", html: ' ' }); this.tabSeaipanel.add(paneltabitems); 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 联动事件集 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.formHead.getForm().findField('ETD').getValue(); var tbFBP = this.formHead.getForm().findField('FBP').getValue(); // if (tbETD == "") { return; } if (tbFBP == "" || tbFBP == "0" || tbFBP == "1") { this.formHead.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(); } this.formHead.getForm().findField('BMDDATE').setValue(lsDate); }, getMDTDATE: function () { var tbETD = this.formHead.getForm().findField('ETD').getValue(); if (tbETD == "") { return; } var myDate = new Date(Date.parse(tbETD.toString())); myDate.setDate(myDate.getDate() + 9); var lsDate = Ext.util.Format.date(myDate, 'Y-m-d'); if (lsDate.indexOf("-00-") > -1) { lsDate = (myDate.getFullYear() - 1) + "-12-" + myDate.getDate(); } this.formHead.getForm().findField('MDTDATE').setValue(lsDate); }, getBMDDATE2: function (tbBMDDATE) { if (tbBMDDATE == "") { this.getBMDDATE(); } }, getMDTDATE2: function (tbMDTDATE) { if (tbMDTDATE == "") { this.getMDTDATE(); } }, //#endregion 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) headfield.allowBlank = false; var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.allowBlank = false; var headfield = this.formBill.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.allowBlank = false; }; } else { } } }, scope: this }); }, //#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 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 }); } });