Ext.namespace('Shipping'); Shipping.MsOpSubSeaeOrderAEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSubSeaeOrderAEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSubSeaeOrderAEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, Editdata: null, isAudit: null, accdate: null, seaeop: "", seaecustservice: "", reason: "", BillType: null, OrType: null, initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; 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: 'CARGO', 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.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: 'KINDPKGS', store: this.storeCodePackage, forceSelection: true, labelWidth: 70, 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', valueField: 'CTN', displayField: 'CTN' }); this.storeAgent = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOtCompany', proxy: { url: '/MvcShipping/MsBaseInfo/GetOTCompanyEN' } }); this.storeAgent.load(); this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'Discharge Agent', store: this.storeAgent, readOnly:true, // forceSelection: true, name: 'AGENTID', valueField: 'GID', displayField: 'ENNAME' }); //付费方式 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: 'BLFRT', 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); } } } } }); this.StoreCTNSOURCE = Ext.create('Ext.data.Store', { fields: ['NAME'] }); this.StoreCTNSOURCE.add({ "NAME": "OWNER" }); this.StoreCTNSOURCE.add({ "NAME": "RENT" }); this.StoreCTNSOURCE.add({ "NAME": "FREEUSE" }); this.comboxCTNSOURCE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCTNSOURCE, forceSelection: true, name: 'CTNSOURCE', valueField: 'NAME', displayField: 'NAME' }); this.StoreCTNSTATUS = Ext.create('Ext.data.Store', { fields: ['NAME'] }); this.StoreCTNSTATUS.add({ "NAME": "F" }); this.StoreCTNSTATUS.add({ "NAME": "E" }); this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCTNSTATUS, forceSelection: true, name: 'STATUS', valueField: 'NAME', displayField: 'NAME' }); this.storeCtnNo = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'CTNNO', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpCtnStatus/GetCtnNoData', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeCtnNo.load({ params: { condition: ""} }); //#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: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'BSNO', name: 'BSNO', hidden: true }, { fieldLabel: 'ORSTATUS', name: 'ORSTATUS', hidden: true }, { fieldLabel: 'BILLTYPE', name: 'BILLTYPE', hidden: true, value: 2 }, { fieldLabel: 'MBLNO', name: 'MBLNO' }, { fieldLabel: 'ORDNO', readOnly: true, name: 'ORDNO' }, { fieldLabel: 'STATUS', readOnly: true, name: 'ORSTATUSREF' }, { fieldLabel: 'INPUTBY', readOnly: true, name: 'INPUTBY' }, this.comboxAgent, { xtype: 'checkboxfield', boxLabel: 'SPECIAL CHARGE', name: 'SPCHARGE', inputValue: true, checked: true }] } ]//end items(fieldset 1) }); //end this.formEdit //#endregion //#region 集装箱-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsSubSeaOrderCtn', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSubSeaOrder/GetBodyList', 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: "Data is Loading,Wait..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', tbar: [{ text: 'ADD', tooltip: 'ADD', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { text: 'EXCEL IMPORT', tooltip: 'EXCEL IMPORT', iconCls: "btnexportexcel", handler: function (button, event) { this.onImportDetailClick(button, event); }, scope: this }, '-', { text: 'DELETE', tooltip: 'DELETE', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'CTN_ID', header: 'CTN_ID', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 0 }, { sortable: true, dataIndex: 'CTNCODE', header: 'NO', width: 30 }, { dataIndex: 'CTNALL', header: 'CTN SIZE', width: 70, editor: this.comboxCTNALL }, { dataIndex: 'CTNSOURCE', header: 'CTN SOURCE', width: 70, editor: this.comboxCTNSOURCE }, { dataIndex: 'STATUS', header: 'CTN STATUS', width: 70, editor: this.comboxCTNSTATUS }, { dataIndex: 'CNTRNO', header: 'CNTRNO', width: 120, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'SEALNO', header: 'SEALNO', width: 100, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'PKGS', header: 'PKGS', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { dataIndex: 'KGS', header: 'KGS', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'CBM', header: 'CBM', width: 60, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: 'REMARK', width: 150, editor: { xtype: 'textfield', selectOnFocus: true } }] }); //#endregion this.panelBodyCtn = new Ext.Panel({ title: 'Container Information', layout: "border", height: 280, //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: 'Dangerous Goods Information', layout: "border", hidden: true, height: 60, frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', defaults: { anchor: '96%' }, items: [{ fieldLabel: 'DCLASS', flex: 1, labelWidth: 70, name: 'DCLASS' }, { fieldLabel: 'DUNNO', flex: 1, labelWidth: 70, name: 'DUNNO' }, { fieldLabel: 'DPAGE', flex: 1, labelWidth: 70, name: 'DPAGE' }, { fieldLabel: 'DLABEL', flex: 1, labelWidth: 70, name: 'DLABEL' }, { fieldLabel: 'LINKMAN', 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: 'Temperature', forceSelection: true, name: 'TEMPID', valueField: 'ID', displayField: 'NAME' }); this.panelBodyRf = new Ext.Panel({ title: 'Frozen Container Information', layout: "border", hidden: true, height: 60, //margin: '5 10', frame: true, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'REEFERF', name: 'REEFERF' }, { fieldLabel: 'TEMPSET', name: 'TEMPSET' }, this.comboxTemp] }] }); 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: 'VESSEL', 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, 'VoyName', 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.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeLoadport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'PORTLOAD', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORT', displayField: 'PORT', 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: 'PORTDISCHARGE', 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: 'DESTINATION', 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: 'PLACEDELIVERY', 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: 'PLACERECEIPT', 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: 'SERVICE', 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: 'ISSUETYPE', 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: 'NOBILL', 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: 90, 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: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'SHIPPER CODE', flex: 1, name: 'SHIPPERCODE' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'TEL', flex: 1, name: 'SHIPPERTEL' }, { fieldLabel: 'COUNTRY CODE', flex: 1, name: 'SHIPPERCOUNTRY' }] }, { xtype: 'label', html: 'Consignee ' }, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'CONSIGNEE', anchor: '100%' }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'CONSIGNEE CODE', labelWidth:100, flex: 1, name: 'CONSIGNEECODE' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'TEL', flex: 1, name: 'CONSIGNEETEL' }, { fieldLabel: 'COUNTRY CODE', flex: 1, name: 'CONSIGNEECOUNTRY' }] }, { xtype: 'label', html: 'Notify Party ' }, { xtype: 'textareafield', grow: true, labelWidth: 0, height: 90, name: 'NOTIFYPARTY', anchor: '100%' }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'NOTIFYPARTY CODE', labelWidth: 100, flex: 1, name: 'NOTIFYPARTYCODE' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'TEL', flex: 1, name: 'NOTIFYPARTYTEL' }, { fieldLabel: 'COUNTRY CODE', flex: 1, name: 'NOTIFYPARTYCOUNTRY' }] } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [this.panelBodyCtn ] } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'ETD', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, { fieldLabel: 'ETA', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA' }, this.comboxVoyVeg, { fieldLabel: 'VOYNO', flex: 1, name: 'VOYNO' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxDESTINATION, this.comboxPLACEDELIVERY, this.comboxPLACERECEIPT] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'PORTLOAD CODE', name: 'PORTLOADID' }, { fieldLabel: 'PORTDISCHARGE CODE', name: 'PORTDISCHARGEID' }, { fieldLabel: 'DESTINATION CODE', name: 'DESTINATIONID' }, { fieldLabel: 'PLACEDELIVERY CODE', name: 'PLACEDELIVERYID' }, { fieldLabel: 'VESSELID', 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: [{ labelWidth: 170, fieldLabel: 'Description of Goods ', name: 'GOODSNAME' }, 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%', 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: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: 'PKGS', labelWidth: 70, readOnly: true, name: 'PKGS' }, this.comboxKINDPKGS] }, { 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: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [{ labelWidth: 70, fieldLabel: 'KGS', name: 'KGS' }, { xtype: 'label', width: 50, text: 'KGS' }] }, { 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', defaultType: 'textfield', layout: 'hbox', items: [{ labelWidth: 70, fieldLabel: 'CBM', name: 'CBM' }, { xtype: 'label', width: 50, text: 'CBM' }] } ] } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'TOTALNO', name: 'TOTALNO' }] }, this.panelBodyDr, this.panelBodyRf, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxISSUETYPE, { fieldLabel: 'ISSUEDATE', format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: 'ISSUEPLACE', name: 'ISSUEPLACE' }, this.comboxBLNUM] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxBLFRT, { fieldLabel: 'PREPARDAT', name: 'PREPARDAT' }, { fieldLabel: 'PAYABLEAT', name: 'PAYABLEAT' }, this.comboxSERVICE] }, { xtype: 'textareafield', grow: true, fieldLabel: 'REMARK', height: 60, name: 'REMARK', anchor: '100%' }] } ] }); //end this.formEdit //#endregion this.panelFee = new Shipping.FeeEditGrid({ region: 'center', layout: 'border' }); this.panelFee.stroplb = 'op_sub_seaorder'; this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "HG-海关", "CUSTTYPE": "海关", "CUSTNAME": "" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } }); this.panelFee.storeFeeNameRef.load({ params: { condition: "" } }); this.panelFee.storeBodyList_GuDingFeeWeiHu.load(); //this.panelFee.StoreUnit.load({ params: { bsno: this.bsno, bstype: "op_Seae" } }); //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnESave', text: "Save", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'btnESaveAndClose', text: "Save&Close", handler: function (button, event) { this.Save('1'); }, scope: this }, { id: 'btnESaveAndNew', text: "Save&New", iconCls: "btnadd", handler: function (button, event) { this.Save('2'); }, scope: this }, { id: 'btnECopyNew', text: "Copy New", 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'); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("BSNO", '*'); memberbody.commit(); }; for (var j = 0; j < this.storeDrChFee.getCount(); j += 1) { var memberbody = this.storeDrChFee.getAt(j); memberbody.set("BSNO", '*'); memberbody.commit(); }; this.GetEditStatus(); }, scope: this }, '-', { text: "Close", iconCls: "btnlogout", handler: function (button, event) { window.close(); }, scope: this }, { id: 'btnENew', text: "New", iconCls: "btnadd", handler: function (button, event) { this.LoadData('add', ''); var basicForm = this.formEdit.getForm(); basicForm.findField('BsNo').setDisabled(false); }, scope: this }, '-', { id: 'btnSubmitAudit', text: 'Post', iconCls: "btnsubmit", tooltip: 'POST', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, { id: 'btnSubmitAuditBack', text: 'Cancel Post', iconCls: "btncancel", tooltip: 'CANCEL POST', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.panelpage = new Ext.Panel({ title: 'information', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.formEdit] }); this.panelfee = new Ext.Panel({ title: 'Charge Information', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.panelFee] }); this.tabSeaepanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "TabSeaePanel", enableTabScroll: true, items: [ this.panelpage, this.panelfee ] }); this.panelSeae = new Ext.Panel({ id: 'pnlmodSeaeOrderInfo', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [this.panelBtn, this.formHead, this.tabSeaepanel] }); Ext.apply(this, { items: [this.panelSeae] }); //#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.BillType = ret[4]; this.OrType = ret[5]; } this.setBtnStatus(this.BillType); 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: 'Is Loading...', url: '/MvcShipping/MsOpSubSeaOrder/GetData', params: { handle: opstatus, condition: condition, billtype: this.BillType, ortype: this.OrType }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: 'Prompt', 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(); this.GetEditStatus(); } else { Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); this.panelFee.EditRecord = this.editRecord; this.panelFee.strBSNO = this.editRecord.get("ORDNO"); if (this.opStatus == 'edit') { this.storeBodyList.load({ params: { condition: condition} }); this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other" } }); this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other"} }); } else { condition = "BSNO='XX'"; this.storeBodyList.load({ params: { condition: condition} }); this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other"} }); this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other"} }); } this.panelFee.StoreUnit.load({ params: { bsno: this.panelFee.strBSNO, bstype: "op_suborder" } }); }, // 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); var ctnsource = member.data.CTNSOURCE; //if (ctnsource != 'FREEUSE') { // var CTNNO = member.data.CNTRNO; // var ctnrecords = DsStoreQueryBy(this.storeCtnNo, 'CTNNO', CTNNO); // if (ctnrecords.getCount() > 0) { } else { // Ext.Msg.show({ title: 'Warning', // msg: "THIS CTN NO." + CTNNO + ",IS NOT IN CONTAINER SYSTEM,ONLY AFTER ENTRY THIS CTN NO IN CONTAINER SYSTEM,THIS CTN NO CAN USED", // icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK // }); // return; // } //} //var ctnstatus = member.data.STATUS; //if (ctnstatus == "") { // Ext.Msg.show({ title: 'Warning', // msg: "THIS CTN NO." + CTNNO + ", CTN STATUS IS NOT EMPTY!", // icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK // }); // return; //} bodydatas.push(member); } var feedatas = []; //for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { // var member = this.storeDrChFee.getAt(i); // feedatas.push(member); //} var feedatascarrier = []; var jsonfeecarrier = ConvertRecordsToJsonAll(feedatascarrier); // var jsonBody = ConvertRecordsToJsonAll(bodydatas); var jsonfee = ConvertRecordsToJsonAll(feedatas); this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); // Ext.Msg.wait('Saveing, Please Wait..'); Ext.Ajax.request({ waitMsg: 'Saveing...', url: '/MvcShipping/MsOpSubSeaOrder/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody, fee: jsonfee, feecarrier: jsonfeecarrier, ortype: this.OrType }, 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('MsSubSeaOrderModel', 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.panelFee.EditRecord = this.editRecord; this.panelFee.strBSNO = this.editRecord.get("ORDNO"); this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other" } }); this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other" } }); this.panelFee.StoreUnit.load({ params: { bsno: this.panelFee.strBSNO, bstype: "op_suborder" } }); if (type == '0') { this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("BSNO", this.editRecord.get('BSNO')); memberbody.commit(); }; //for (var j = 0; j < this.storeDrChFee.getCount(); j += 1) { // var memberbody = this.storeDrChFee.getAt(j); // memberbody.set("BSNO", this.editRecord.get('BSNO')); // memberbody.commit(); //}; } else if (type == '1') { window.close(); } else if (type == '2') { this.LoadData('add', ''); } } else { Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: 'Please Try Again', msg: 'The Server Response Error', 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 ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Add Ctn!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var newSerialno = this.DsGetNewNo(this.storeBodyList); this.serialNo = newSerialno; var record = Ext.create('MsSubSeaOrderCtn', { CTN_ID: NewGuid(), BSNO: '*', CTNCODE: newSerialno, CTNALL: '', CNTRNO: '', SEALNO: '', PKGS: 0, KGS: 0, CBM: 0, CTNSOURCE: 'OWNER', STATUS: 'F', REMARK: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, DsGetNewNo: function (store) { var result = store.getCount(); if (result == 0) { return 1; } var record = store.getAt(result - 1).data.CTNCODE; result = parseInt(record) + 1; return result; }, gridListChFeeAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'UnitPrice' || e.field == 'Quantity') { var unitPrice = e.record.data['UnitPrice']; var quantity = e.record.data['Quantity']; var amount = (parseFloat(unitPrice).mul(quantity)).toFixed(2); e.record.set('Amount', amount); } else if (e.field == 'Currency') { if (e.value == 'RMB') { e.record.set('ExChangerate', 1); } else { e.record.set('ExChangerate', 0); } } }, onNextKeyClick: function (type, col) { var rows = this.gridDrChFee.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridDrChFee.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridDrChFee.getStore().getCount()) { } else { this.cellEditingDrChFee.startEditByPosition({ row: number, column: col }); } }, cellEditingChFeeBeforeEdit: function (editor, e) { var canedit = true; var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Edit Ctn!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); canedit = false; } return canedit; }, deleteDetail: function () { var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Delete Ctn!", 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.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('Warning', 'Sure To Delete This Ctn?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('Deleting...'); Ext.Ajax.request({ waitMsg: 'Deleting...', url: '/MvcShipping/MsOpSubSeaOrder/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.hide(); } else { Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: 'Warning', msg: 'The Server Response Error, Please Try Again', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, //#endregion //#region LoadInit: function () { var CARGOID = this.formEdit.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('BSNO').getValue(); var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if ((billstatus != "9") && (billstatus != "2")) { Ext.Msg.show({ title: 'Prompt', msg: "The BILL Is Posted,Can't Post!", 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 feedatas = []; for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { var member = this.storeDrChFee.getAt(i); feedatas.push(member); } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); var jsonfee = ConvertRecordsToJsonAll(feedatas); //var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); var feedatascarrier = []; var jsonfeecarrier = ConvertRecordsToJsonAll(feedatascarrier); _this = this; Ext.Ajax.request({ waitMsg: 'Posting...', url: '/MvcShipping/MsOpSubSeaOrder/SubmitAuditForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody, fee: jsonfee, feecarrier: jsonfeecarrier }, 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/MsOpSubSeaOrder/GetData', params: { handle: 'edit', condition: " BSNO='" + Duino + "'", billtype: _this.BillType, ortype: _this.OrType }, 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('MsSubSeaOrderModel', 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('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); }, onSubmitAuditBackClick: function () { var Duino = this.formHead.getForm().findField('BSNO').getValue(); var billstatus = this.formHead.getForm().findField('ORSTATUS').getValue(); if (billstatus != "1") { Ext.Msg.show({ title: 'Prompt', 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 feedatas = []; for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { var member = this.storeDrChFee.getAt(i); feedatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); var jsonfee = ConvertRecordsToJsonAll(feedatas); this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); _this = this; Ext.Ajax.request({ waitMsg: 'Cancel Posting...', url: '/MvcShipping/MsOpSubSeaOrder/SubmitAuditBackForm', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2), body: jsonBody, fee: jsonfee }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: 'Prompt', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({ waitMsg: 'Loading...', url: '/MvcShipping/MsOpSubSeaOrder/GetData', params: { handle: 'edit', condition: " BSNO='" + Duino + "'", billtype: _this.BillType, ortype: _this.OrType }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: 'Prompt', 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('MsSubSeaOrderModel', 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('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); } } else { Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText); } }, scope: this }); }, onImportDetailClick: function (button, event) { var BSNO = this.formHead.getForm().findField('BSNO').getValue(); var condition = " BSNO='" + BSNO + "'"; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 20, frame: true, autoScroll: false, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadExcel', name: 'LoadExcel', emptyText: 'Please Select EXCEL File', fieldLabel: 'EXCEL', buttonText: 'Select File', allowBlank: false, width: 200, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: 'Upload', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadExcel').getValue(); if (!CheckFileExt(UserFilePath, /.xls|.xlsx|.csv/i)) { Ext.Msg.show({ title: 'Error', msg: 'Pls Select Excel File!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpSubSeaOrder/ImportDetail', waitMsg: 'UpLoading', method: 'POST', params: { bsno: BSNO }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: 'Upload Successful !', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); me.storeBodyList.load({ params: { condition: condition} }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.Message); } }); } }, { text: 'Close', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "Upload EXCEL", width: 380, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); return; }, 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(); _this = this; if (BSSTATUS == "1") { canedit = false; this.setSaveBtnStatus(canedit); } else { this.setSaveBtnStatus(true); } }, 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; }, setBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnEAddDetail = Ext.getCmp('btnadddetail'); var btnEDeleteDetail = Ext.getCmp('btndeldetail'); 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'); //if (enable == 1) { //btnESave.setVisible(false); ; //btnESaveAndClose.setVisible(false); //btnESaveAndNew.setVisible(false); //btnEAddDetail.setVisible(false); //btnEDeleteDetail.setVisible(false); //btnENew.setVisible(false); ; //btnECopyNew.setVisible(false); btnSubmitAudit.setVisible(false); btnSubmitAuditBack.setVisible(false); //} else { btnESave.setVisible(true); ; btnESaveAndClose.setVisible(true); btnESaveAndNew.setVisible(true); btnEAddDetail.setVisible(true); btnEDeleteDetail.setVisible(true); btnENew.setVisible(true); ; btnECopyNew.setVisible(true); // btnSubmitAudit.setVisible(true); // btnSubmitAuditBack.setVisible(true); //} }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnEAddDetail = Ext.getCmp('btnadddetail'); var btnEDeleteDetail = Ext.getCmp('btndeldetail'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btnEAddDetail.enable(); btnEDeleteDetail.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); btnEAddDetail.disable(); btnEDeleteDetail.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 });