Ext.namespace('Shipping'); Shipping.MsSeaeWebOrderEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsSeaeWebOrderEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsSeaeWebOrderEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, isAudit: null, accdate: null, seaeop: "", seaecustservice: "", reason: "", initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; //#region 信息加载 //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modSeaeOrderList"} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //客服 this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', store: this.storeOpCode, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //揽货人 this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeOpCode, forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //单证 this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '单 证', store: this.storeOpCode, forceSelection: true, name: 'DOC', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); //客户加载_委托单位 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, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', allowBlank: false, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var data = combo.value; this.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.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, forceSelection: true, name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContact.load({ params: { condition: s }, callback: function (r, options, success) { if (success) { if (this.storeInfoClientContact.getCount() > 0) { var member = this.storeInfoClientContact.getAt(0); this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME); this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL); this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL); } else { this.formHead.getForm().findField('CARRIERATTN').setValue(''); this.formHead.getForm().findField('CARRIERTEL').setValue(''); this.formHead.getForm().findField('CARRIEREMAIL').setValue(''); } } }, scope: this }); } } } }); //客户加载_订舱代理 this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeFORWARDER.load({ params: { condition: "ISBOOKING='1'"} }); //船公司 this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订舱代理', store: this.storeFORWARDER, forceSelection: true, name: 'FORWARDER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContact.load({ params: { condition: s }, callback: function (r, options, success) { if (success) { if (this.storeInfoClientContact.getCount() > 0) { var member = this.storeInfoClientContact.getAt(0); this.formHead.getForm().findField('FORWARDERATTN').setValue(member.data.SHOWNAME); this.formHead.getForm().findField('FORWARDERTEL').setValue(member.data.TEL); this.formHead.getForm().findField('FORWARDEREMAIL').setValue(member.data.EMAIL); } else { this.formHead.getForm().findField('FORWARDERATTN').setValue(''); this.formHead.getForm().findField('FORWARDERTEL').setValue(''); this.formHead.getForm().findField('FORWARDEREMAIL').setValue(''); } } }, scope: this }); } } } }); this.storePKGTYPE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsExtEnumModel', proxy: { url: '/CommMng/PubSys/GetEnumValueList' } }); this.storePKGTYPE.load({ params: { enumTypeId: 97011} }); this.comboxPKGTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装箱类型', store: this.storePKGTYPE, forceSelection: true, name: 'PACKINGTYPE', valueField: 'KINDPKGS', //EnumValueName displayField: 'KINDPKGS'//EnumValueName }); 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); } } } } }); //键值维护表_装运方式 this.StoreBLTYPE = Ext.create('Ext.data.Store', { fields: ['BLTYPE'] }); this.StoreBLTYPE.add({ "BLTYPE": "整箱" }); this.StoreBLTYPE.add({ "BLTYPE": "拼箱主票" }); this.StoreBLTYPE.add({ "BLTYPE": "拼箱分票" }); this.StoreBLTYPE.add({ "BLTYPE": "拼箱单票" }); this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装运方式', store: this.StoreBLTYPE, forceSelection: true, name: 'BLTYPE', valueField: 'BLTYPE', displayField: 'BLTYPE', value: '整箱', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == "拼箱单票" || combo.value == "拼箱分票") { if (this.storeBodyList.getCount() > 0) { combo.setValue(combo.originalValue); alert("拼箱单票、拼箱分票是不允许添加集装箱信息的,因此请先删除集装箱信息!"); return; } else { this.panelBodyCtn.hide(); } } else { this.panelBodyCtn.show(); } } } } }); //品名 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: 'Description of Goods (包装种类与货名)', store: this.storeCodeGoodsList, flex: 1.5, labelWidth: 250, forceSelection: true, name: 'GOODSNAME', valueField: 'GOODNAME', displayField: 'CodeAndName' }); 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' }); //件数包装 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, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var str_num = this.formEdit.getForm().findField('PKGS').getValue(); this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + combo.value + ' ONLY.'); } } } }); //件数包装_集装箱列表中的下拉框加载 this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '件数包装', store: this.storeCodePackage, forceSelection: true, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); //箱型_集装箱列表中的下拉框加载 this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCtnModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } }); this.storeCodeCtn.load(); this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '箱型', store: this.storeCodeCtn, forceSelection: true, name: 'CTNALL', //CTNEXHIBIT valueField: 'CTN', displayField: 'CTN' }); //客户加载_发货人 this.storeShipper = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //发货人 this.comboxShipper = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Shipper (发货人)', store: this.storeShipper, forceSelection: true, labelWidth: 150, labelAlign: 'left', name: 'SHIPPERID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeShipper, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('SHIPPER').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('SHIPPER').setValue(''); } } } } }); //客户加载_收货人 this.storeConsignee = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //收货人 this.comboxConsignee = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Consignee (收货人)', labelWidth: 150, labelAlign: 'left', store: this.storeConsignee, forceSelection: true, name: 'CONSIGNEEID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeConsignee, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('CONSIGNEE').setValue(''); } } } } }); //客户加载_通知人 this.storenotifyparty = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //通知人 this.comboxNotifyParty = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Notify Party (通知人)', store: this.storenotifyparty, labelWidth: 150, labelAlign: 'left', forceSelection: true, name: 'NOTIFYPARTYID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); } else { this.formEdit.getForm().findField('NOTIFYPARTY').setValue(''); } } } } }); this.myCheckboxService = new Ext.form.CheckboxGroup({ id: 'myService', xtype: 'checkboxgroup', fieldLabel: '服务项目', columns: 8, items: [{ boxLabel: '熏蒸', inputValue: true, name: 'ISFUMIGATION', id: 'ISFUMIGATION' }, { boxLabel: '仓储', inputValue: true, name: 'ISSTORAGE', id: 'ISSTORAGE' }, { boxLabel: '陆运', inputValue: true, name: 'ISLAND', id: 'ISLAND' }, { boxLabel: '报关', inputValue: true, name: 'ISCUSTOMS', id: 'ISCUSTOMS' }, { boxLabel: '报检', inputValue: true, name: 'ISINSPECTION', id: 'ISINSPECTION' }, { boxLabel: '订舱', inputValue: true, name: 'ISBOOKING', id: 'ISBOOKING' }, { boxLabel: '使用代理', inputValue: true, name: 'ISAGENT', id: 'ISAGENT' }, { boxLabel: '分单签单', inputValue: true, name: 'ISHBLNO', id: 'ISHBLNO' } ] }); //付费方式 this.storeFrt = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_FRT', proxy: { url: '/CommMng/BasicDataRef/GetCodeFrtList' } }); this.storeFrt.load({ params: { condition: ""} }); this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '付费方式', store: this.storeFrt, forceSelection: true, name: 'BLFRT', valueField: 'FRT', displayField: 'FRT', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { if (combo.value == "FREIGHT PREPAID") { var portload = this.formEdit.getForm().findField('PORTLOAD').getValue(); this.formEdit.getForm().findField('PREPARDAT').setValue(portload); this.formEdit.getForm().findField('PAYABLEAT').setValue(''); } else if (combo.value == "FREIGHT COLLECT") { var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue(); this.formEdit.getForm().findField('PREPARDAT').setValue(''); this.formEdit.getForm().findField('PAYABLEAT').setValue(PORTDISCHARGE); } } } } }); //#endregion //#region 编辑formHead 基本信息 this.formHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, collapsed: false, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'ORSTATUS', name: 'ORSTATUS', hidden: true }, { fieldLabel: '订舱单号', readOnly: true, name: 'ORDNO' }, { fieldLabel: '订舱状态', readOnly: true, name: 'ORSTATUSREF' }, this.comboxCustCode, this.comboxBLTYPE] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '委托编号', readOnly: true, name: 'CUSTNO' }, this.comboxSALE, this.comboxOP, this.comboxCUSTSERVICE] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxStlName, { fieldLabel: '结算日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'STLDATE' }, this.comboxBLFRT, this.comboxCargoid] }, this.myCheckboxService, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '订舱人', name: 'INPUTBY' }, { fieldLabel: '电话', name: 'OPERATORTEL' }, { fieldLabel: '邮箱', name: 'OPERATOREMAIL' }, { xtype: 'hiddenfield'}] } ]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 集装箱-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpSeaeDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsSeaeOrder/GetWebBodyList', reader: { id: 'BSNO,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 }, { dataIndex: 'CTNALL', //CTNEXHIBIT header: '箱型', width: 70, editor: this.comboxCTNALL }, { dataIndex: 'CTNNUM', header: '箱量', width: 50, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }] }); //#endregion this.panelBodyCtn = new Ext.Panel({ title: '集装箱信息', layout: "border", height: 150, //margin: '5 10', frame: true, items: [this.gridList] }); this.panelORREASON = new Ext.Panel({ title: "驳回原因", layout: "border", height: 100, //margin: '5 10', frame: true, items: [{ xtype: 'textareafield', grow: true, fieldLabel: '', labelSeparator: '', labelWidth: 0, height: 100, name: 'ORREASON', anchor: '100%' }] }); 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.StoreTemp = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreTemp.add({ "ID": "C", "NAME": "C摄氏" }); this.StoreTemp.add({ "ID": "F", "NAME": "F华氏" }); this.comboxTemp = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreTemp, fieldLabel: '温度单位', forceSelection: true, name: 'TEMPID', valueField: 'ID', displayField: 'NAME' }); 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' }, this.comboxTemp] }] }); Ext.define('VesselModel', { extend: 'Ext.data.Model', fields: [ { name: 'VSID', type: 'string' }, { name: 'VESSEL', type: 'string' }, { name: 'CNAME', type: 'string' }, { name: 'CodeAndName', type: 'string' }, { name: 'CARRIER', type: 'string' }, { name: 'EDICODE', type: 'string' } ] }); // this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { // model: 'VesselModel', // proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } // }); // this.storeVoyVeg.load({ params: { condition: ""} }); this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load({ params: { condition: ""} }); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', flex: 2, displayField: 'VESSEL', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeVoyVeg, 'VESSEL', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('VESSELID').setValue(selectdata.EDICODE); } else { this.formEdit.getForm().findField('VESSELID').setValue(''); } } } } }); //国际港口(进口装货港、出口卸货港) this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load(); this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport2.load(); this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport3.load(); this.storeCodeDisport4 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport4.load(); //国内港口(出口装货港、进口卸货港) this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.storeCodeLoadport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PORTLOADID').setValue(selectdata.EDICODE); } else { this.formEdit.getForm().findField('PORTLOADID').setValue(''); } } } } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', valueField: 'PORT', queryMode: 'local', displayField: 'PORT', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(selectdata.EDICODE); var DESTINATION = this.formEdit.getForm().findField('DESTINATIONID').getValue(); if (DESTINATION == null || DESTINATION == '') { this.formEdit.getForm().findField('DESTINATION').setValue(combo.value); this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE); } var PLACEDELIVERY = this.formEdit.getForm().findField('PLACEDELIVERY').getValue(); if (PLACEDELIVERY == null || PLACEDELIVERY == '') { this.formEdit.getForm().findField('PLACEDELIVERY').setValue(combo.value); this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE); } } else { this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(''); } } } } }); this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的地', store: this.storeCodeDisport2, name: 'DESTINATION', // valueField: 'PORT', displayField: 'PORT', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.EDICODE); } else { this.formEdit.getForm().findField('DESTINATIONID').setValue(''); } } } } }); this.comboxPLACEDELIVERY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '交货地', store: this.storeCodeDisport3, name: 'PLACEDELIVERY', valueField: 'PORT', displayField: 'PORT', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(selectdata.EDICODE); } else { this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(''); } } } } }); this.comboxPLACERECEIPT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '收货地点', store: this.storeCodeDisport4, name: 'PLACERECEIPT', valueField: 'PORT', displayField: 'PORT' }); //运输条款 this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_SERVICE', proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' } }); this.storeSERVICE.load({ params: { condition: ""} }); this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运输条款', store: this.storeSERVICE, forceSelection: true, name: 'SERVICE', valueField: 'SERVICE', displayField: 'SERVICE' }); //签单方式 this.storeISSUETYPE = Ext.create('DsExt.ux.RefTableStore', { model: 'CODE_BLTYPE', proxy: { url: '/CommMng/BasicDataRef/GetCodeBLTYPEList' } }); this.storeISSUETYPE.load({ params: { condition: ""} }); this.comboxISSUETYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '签单方式', store: this.storeISSUETYPE, forceSelection: true, name: 'ISSUETYPE', // valueField: 'BLTYPE', // displayField: 'BLTYPE'// }); this.StoreBLNUM = Ext.create('Ext.data.Store', { fields: ['NUM'] }); this.StoreBLNUM.add({ "NUM": "ZERO" }); this.StoreBLNUM.add({ "NUM": "ONE" }); this.StoreBLNUM.add({ "NUM": "TWO" }); this.StoreBLNUM.add({ "NUM": "THREE" }); this.StoreBLNUM.add({ "NUM": "FOUR" }); this.StoreBLNUM.add({ "NUM": "FIVE" }); this.StoreBLNUM.add({ "NUM": "SIX" }); this.StoreBLNUM.add({ "NUM": "SEVEN" }); this.StoreBLNUM.add({ "NUM": "EIGHT" }); this.StoreBLNUM.add({ "NUM": "NINE" }); this.StoreBLNUM.add({ "NUM": "TEN" }); this.comboxBLNUM = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '提单份数', store: this.StoreBLNUM, forceSelection: true, name: 'NOBILL', // valueField: 'NUM', // displayField: 'NUM'// }); //#region 编辑formEdit 基本信息 this.formEdit = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, layout: 'anchor', trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'fieldset', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '96%' }, items: [{ xtype: 'container', layout: 'anchor', flex: 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: 'textareafield', grow: true, labelWidth: 0, height: 90, fieldLabel: 'AMSShipper', name: 'AMSShipper', anchor: '100%' },{ xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, fieldLabel: 'AMSConsignee', name: 'AMSConsignee', anchor: '100%' }, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, fieldLabel: 'AMSNotifyparty', name: 'AMSNotifyparty', anchor: '100%' }*/ ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETD' }, this.comboxPORTLOAD, this.comboxPORTDISCHARGE] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '总件数', labelWidth: 70, name: 'PKGS' }, this.comboxKINDPKGS, { labelWidth: 70, fieldLabel: '总重量', name: 'KGS' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ labelWidth: 70, fieldLabel: '总尺码', name: 'CBM' }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '约号', labelWidth: 50, name: 'ContractNo' }] }, this.comboxPKGTYPE] }, this.panelBodyCtn, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '主提单号', name: 'MBLNO' }, { fieldLabel: '审核人', readOnly: true, name: 'AUDITOPERATOR' }, { fieldLabel: '审核日期', readOnly: true, name: 'AUDITDATE' }] }, this.panelORREASON, { xtype: 'textareafield', grow: true, fieldLabel: '备 注', height: 60, name: 'REMARK', anchor: '100%' } ] } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxVoyVeg, { fieldLabel: '航次', flex: 1, name: 'VOYNO' }, this.comboxDESTINATION, this.comboxPLACEDELIVERY, this.comboxPLACERECEIPT] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '装港代码', name: 'PORTLOADID' }, { fieldLabel: '卸港代码', name: 'PORTDISCHARGEID' }, { fieldLabel: '目的代码', name: 'DESTINATIONID' }, { fieldLabel: '交货代码', name: 'PLACEDELIVERYID' }, { fieldLabel: '船舶呼号', name: 'VESSELID' }] }, { 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.comboxGOODSNAME] }, { 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%', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var SS = newValue; var i = SS.indexOf("\n"); var num = 0; if (i > 0) { var slist = SS.split("\n"); for (var i = 0; i < slist.length; i += 1) { var member = slist[i]; var str_num = this.GetStringNum(member); if (i == 0) { var str_kind = member.substring(str_num.length); } num = parseFloat(num).add(parseFloat(str_num)); } this.formEdit.getForm().findField('PKGS').setValue(num); this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind); this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(num).toUpperCase() + ' ' + str_kind + ' ONLY.'); } else { var str_num = this.GetStringNum(SS); var str_kind = SS.substring(str_num.length); this.formEdit.getForm().findField('PKGS').setValue(str_num); this.formEdit.getForm().findField('KINDPKGS').setValue(str_kind); this.formEdit.getForm().findField('TOTALNO').setValue('SAY:' + ToEn(str_num).toUpperCase() + ' ' + str_kind + ' ONLY.'); } } } } }, { xtype: 'label', html: '          Gross Weight 毛重(公斤)' }, { xtype: 'textareafield', grow: true, height: 40, labelWidth: 20, labelSeparator: '', fieldLabel: '  ', name: 'GROSSWEIGHT', anchor: '100%', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var SS = newValue; var i = SS.indexOf("\n"); var num = 0; if (i > 0) { var slist = SS.split("\n"); for (var i = 0; i < slist.length; i += 1) { var member = slist[i]; var str_num = this.GetStringNum(member); num = parseFloat(num).add(parseFloat(str_num)); } this.formEdit.getForm().findField('KGS').setValue(num); } else { var str_num = this.GetStringNum(SS); this.formEdit.getForm().findField('KGS').setValue(str_num); } } } } }, { xtype: 'label', html: '          Measurement 尺码(立方米)' }, { xtype: 'textareafield', grow: true, height: 40, labelWidth: 20, labelSeparator: '', fieldLabel: '  ', name: 'MEASUREMENT', anchor: '100%', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { if (newValue == null || newValue == '') return; if (newValue != oldValue) { var SS = newValue; var i = SS.indexOf("\n"); var num = 0; if (i > 0) { var slist = SS.split("\n"); for (var i = 0; i < slist.length; i += 1) { var member = slist[i]; var str_num = this.GetStringNum(member); num = parseFloat(num).add(parseFloat(str_num)); } this.formEdit.getForm().findField('CBM').setValue(num); } else { var str_num = this.GetStringNum(SS); this.formEdit.getForm().findField('CBM').setValue(str_num); } } } } } ] } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数大写', name: 'TOTALNO' }] }, this.panelBodyDr, this.panelBodyRf, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '签单日期', format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: '签单地点', name: 'ISSUEPLACE' }, this.comboxISSUETYPE, this.comboxBLNUM] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '预付地点', name: 'PREPARDAT' }, { fieldLabel: '到付地点', name: 'PAYABLEAT' }, this.comboxSERVICE] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'AMSShipper', labelWidth: 100, height: 80, xtype: 'textareafield', name: 'AMSShipper' }, { fieldLabel: 'AMSConsignee', labelWidth: 100, height: 80, xtype: 'textareafield', name: 'AMSConsignee' }, { fieldLabel: 'AMSNotifyparty', labelWidth: 100, height: 80, xtype: 'textareafield', name: 'AMSNotifyparty' }] }, ] } ] }); //end this.formEdit //#endregion //#region 审核或驳回界面 this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxSeaeOp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作', store: this.storeUser, forceSelection: true, name: 'OP', valueField: 'UserCode', displayField: 'CodeAndName' }); this.comboxSeaeCustService = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', store: this.storeUser, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserCode', displayField: 'CodeAndName' }); Ext.define('DataInputType', { extend: 'Ext.data.Model', fields: [ { name: 'ID', type: 'string' }, { name: 'InputType', type: 'string' } ] }); var DataInputType = [{ "ID": "0", "InputType": "海运出口" }, { "ID": "1", "InputType": "海运进口"}]; this.storeDataInputType = Ext.create('Ext.data.Store', { model: 'DataInputType', data: DataInputType }); this.comboxDataInputType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '海运类型', store: this.storeDataInputType, name: 'DataInputType', //id: "ISPAYED", valueField: 'InputType', displayField: 'InputType', allowBlank: false, value: '海运出口' }); this.formAudit = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '会计期间', xtype: 'monthfield', name: 'ACCDATE' }, this.comboxSeaeOp ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSeaeCustService ]//,this.comboxDataInputType }// ]//end items(fieldset 1) }, this.comboxDataInputType//end fieldset 1 ]//end root items }); me = this; this.winAuditShow = Ext.create('Ext.window.Window', { title: "接受订舱", width: 450, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formAudit], buttons: [{ text: "确认接受", minWidth: 70, handler: function () { var form = me.formAudit.getForm(); var ACCDATE = form.findField('ACCDATE').getRawValue(); if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) { Ext.Msg.show({ title: '提示', msg: '会计期间为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.accdate = ACCDATE; var User = me.comboxSeaeOp.getValue(); if (User == '' || User == null || User == undefined) { Ext.Msg.show({ title: '提示', msg: '操作员为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.seaeop = User; me.seaecustservice = me.comboxSeaeCustService.getValue(); me.onAuditPassClick(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditShow.close(); } }] }); this.formAuditBack = Ext.widget('form', { frame: true, region: 'center', title: "驳回原因", bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'textareafield', grow: true, fieldLabel: '', labelSeparator: '', labelWidth: 0, height: 100, name: 'ORREASON', anchor: '100%' } ]//end root items }); me = this; this.winAuditBackShow = Ext.create('Ext.window.Window', { title: "驳回订舱", width: 450, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formAuditBack], buttons: [{ text: "确认驳回", minWidth: 70, handler: function () { var form = me.formAuditBack.getForm(); var ORREASON = form.findField('ORREASON').getRawValue(); if (ORREASON == '' || ORREASON == null || ORREASON == undefined) { Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.reason = '订舱驳回: ' + ORREASON; me.onAuditBack(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditBackShow.close(); } }] }); //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnESave', text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'btnESaveAndClose', text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { id: 'btnESaveAndNew', text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this }, { id: 'btnECopyNew', text: "复制新建", handler: function (button, event) { var basicForm = this.formHead.getForm(); this.opStatus = 'add'; basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); field.setValue(NewGuid()); basicForm.findField('BSNO').setDisabled(true); field = basicForm.findField('ORDNO'); field.setValue(''); field = basicForm.findField('INPUTBY'); field.setValue(SHOWNAME); field = basicForm.findField('OP'); field.setValue(SHOWNAME); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("ORDNO", '*'); memberbody.commit(); }; this.GetEditStatus(); var children = this.tabSeaepanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodSeaeOrderInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabSeaepanel.doLayout(); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { id: 'btnENew', text: "新建", handler: function (button, event) { this.LoadData('add', ''); var basicForm = this.formEdit.getForm(); basicForm.findField('BsNo').setDisabled(false); }, scope: this }, '-', { id: 'btnSubmitAudit', text: '提交审核', tooltip: '提交审核', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, { id: 'btnSubmitAuditBack', text: '撤销审核', tooltip: '撤销审核', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, { text: "审核通过", id: 'btnAudit', iconCls: "btnadd", handler: function (button, event) { var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (billstatus != 'CI20150711000004') { Ext.Msg.show({ title: '警告', msg: '当前状态,不无法审核!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var form = this.formAudit.getForm(); var VoucherDate = form.findField('ACCDATE'); var thisday = this.getToMonth(); VoucherDate.setRawValue(thisday) this.winAuditShow.show(); }, scope: this }, { text: "驳回提交", id: 'btnAuditBack', iconCls: "btndelete", handler: function (button, event) { var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (billstatus != 'CI20150711000004') { Ext.Msg.show({ title: '警告', msg: '当前状态,不无法驳回!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } this.winAuditBackShow.show(); }, scope: this }, { id: 'btnEPrint', text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.panelpage = new Ext.Panel({ title: '订舱详细信息', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.formEdit] }); this.panelSeae = new Ext.Panel({ title: '订舱信息', id: 'pnlmodSeaeOrderInfo', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.panelpage] }); this.tabSeaepanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "TabSeaePanel", enableTabScroll: true, items: [ this.panelSeae ] }); Ext.apply(this, { items: [this.tabSeaepanel] }); //#endregion //#region 其他 parentWin = window.parent.opener; this.InitData(); //#endregion }, //end initUIComponents //#region 加载事件 InitData: function () { this.opStatus = 'add'; var condition = ''; _this = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; this.isAudit = ret[3]; } this.setAuditBtnStatus(this.isAudit); if (this.opStatus == 'edit') { condition = "BSNO='" + this.editRecord.get('BSNO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsSeaeOrder/GetWebData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } data = result.data; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.LoadInit(data); this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); if (this.opStatus == 'edit') { this.storeBodyList.load({ params: { condition: condition} }); } else { condition = "BSNO='XX'"; 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 = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); //var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('ORDNO').setDisabled(true); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsSeaeOrder/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(returnData); this.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); // if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsSeaeOrderModel', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; basicForm2.findField('ORDNO').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("ORDNO", this.editRecord.get('ORDNO')); 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 addDetail: function () { var record = Ext.create('MsSeaeOrderCtn', { CTN_ID: NewGuid(), ORDNO: '*', CTNALL: '', //CTNEXHIBIT CTNNUM: 0, REMARK: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, deleteDetail: function () { var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); var selectedRecords = this.gridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsSeaeOrder/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 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.formEdit.getForm().findField('SHIPPERID').setValue(data.SHIPPERID); } }, scope: this }); this.storeConsignee.load({ params: { condition: "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, callback: function (r, options, success) { if (success) { this.formEdit.getForm().findField('CONSIGNEEID').setValue(data.CONSIGNEEID); } }, scope: this }); this.storenotifyparty.load({ params: { condition: "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" }, callback: function (r, options, success) { if (success) { this.formEdit.getForm().findField('NOTIFYPARTYID').setValue(data.NOTIFYPARTYID); } }, scope: this }); var BLTYPE = this.formHead.getForm().findField('BLTYPE').getValue(); if (BLTYPE == "拼箱单票" || BLTYPE == "拼箱分票") { this.panelBodyCtn.hide(); } else { this.panelBodyCtn.show(); } var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == "2") { this.panelORREASON.show(); } else { this.panelORREASON.hide(); } var CARGOID = this.formHead.getForm().findField('CARGOID').getValue(); if (CARGOID == 'R') { this.panelBodyDr.setVisible(false); this.panelBodyRf.setVisible(true); } else if (CARGOID == 'D') { this.panelBodyDr.setVisible(true); this.panelBodyRf.setVisible(false); } else { this.panelBodyDr.setVisible(false); this.panelBodyRf.setVisible(false); } }, //#endregion onSubmitAuditClick: function () { var Duino = this.formHead.getForm().findField('ORDNO').getValue(); var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (Duino == '*') { Ext.Msg.show({ title: '提示', msg: '请先保存此订舱单,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; if ((billstatus != "9") && (billstatus != "2")) { Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); //var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcShipping/MsSeaeOrder/SubmitAuditForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsSeaeOrder/GetData', params: { handle: 'edit', condition: " ORDNO='" + Duino + "'" }, 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; } var data = result.data; _this.formHead.getForm().reset(); _this.formHead.getForm().setValues(data); _this.formEdit.getForm().reset(); _this.formEdit.getForm().setValues(data); var editp = Ext.create('MsSeaeOrderModel', data); 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.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onSubmitAuditBackClick: function () { var Duino = this.formHead.getForm().findField('ORDNO').getValue(); var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (Duino == '*') { Ext.Msg.show({ title: '提示', msg: '请先保存付费申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; if (billstatus != "1") { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcShipping/MsSeaeOrder/SubmitAuditBackForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsSeaeOrder/GetData', params: { handle: 'edit', condition: " ORDNO='" + Duino + "'" }, 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; } var data = result.data; _this.formHead.getForm().reset(); _this.formHead.getForm().setValues(data); _this.formEdit.getForm().reset(); _this.formEdit.getForm().setValues(data); var editp = Ext.create('MsSeaeOrderModel', data); 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.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onAuditPassClick: function () { this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('ORDNO').setDisabled(true); var _type = this.formAudit.getForm().findField('DataInputType').getRawValue(); //alert(_type); var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); _this = this; Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcShipping/MsSeaeOrder/AuditWebOrderForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody, accdate: _this.accdate, op: _this.seaeop, custservice: _this.seaecustservice, type: _type }, callback: function (options, success, response) { if (success) { 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); var editp = Ext.create('MsSeaeOrderModel', 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.GetEditStatus(); Ext.Msg.show({ title: '提示', msg: '审核成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } _this.winAuditShow.close() } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onAuditBack: function () { this.formHead.getForm().findField('ORDNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('ORDNO').setDisabled(true); _this = this; Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回数据...'); Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/MvcShipping/MsSeaeOrder/AuditBackWebOrderForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), orreason: _this.reason }, callback: function (options, success, response) { if (success) { 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); var editp = Ext.create('MsSeaeOrderModel', 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.GetEditStatus(); Ext.Msg.show({ title: '提示', msg: '驳回成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } _this.winAuditBackShow.close(); } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, getToMonth: function () { var now = new Date(); var year = now.getFullYear(); //年 var month = now.getMonth() + 1; //月 var clock = year + "-"; if (month < 10) clock = clock + "0" + month; else clock = clock + month; return (clock); }, //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; var BSSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); var inputby = this.formHead.getForm().findField('INPUTBY').getValue(); var op = this.formHead.getForm().findField('OP').getValue(); _this = this; if (BSSTATUS == "0" || BSSTATUS == "1") { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modSeaeOrderList" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { canedit = false; } } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); } }, GetStringNum: function (str) { var num = 0; if (str == null || str == '') return num; if (str.length == 0) return num; var if_find = false; var str_num = ''; for (var i = 0; i < str.length; i += 1) { var member = str.substr(i, 1); if ((member == '0') || (member == '1') || (member == '2') || (member == '3') || (member == '4') || (member == '5') || (member == '6') || (member == '7') || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { if (!if_find) { str_num = str_num + member; } } else { if_find = true; } } return str_num; }, setAuditBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnENew = Ext.getCmp('btnENew'); var btnECopyNew = Ext.getCmp('btnECopyNew'); var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); var btnEPrint = Ext.getCmp('btnEPrint'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditBack = Ext.getCmp('btnAuditBack'); btnESave.setVisible(!enable); ; btnESaveAndClose.setVisible(!enable); btnESaveAndNew.setVisible(!enable); btnENew.setVisible(!enable); ; btnECopyNew.setVisible(!enable); btnSubmitAudit.setVisible(!enable); btnSubmitAuditBack.setVisible(!enable); btnEPrint.setVisible(!enable); btnAudit.setVisible(enable); btnAuditBack.setVisible(enable); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); } }, //#endregion //#region 打印 Print: function () { /* var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('BillNo').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSWLBULKBS'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM tMsWlBulkHead WHERE BillNo = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); */ } //#endregion });