Ext.namespace('Shipping'); Shipping.MsOpRailwayOrderEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpRailwayOrderEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpRailwayOrderEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, Editdata: null, MainEditRecord: null, 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: "modOrderManagement"} }); Ext.define('OpSeaeShipper', { extend: 'Ext.data.Model', idProperty: 'SHIPPERID', fields: [ { name: 'SHIPPERID', type: 'string' }, { name: 'CODENAME', type: 'string' }, { name: 'SHORTNAME', type: 'string' }, { name: 'CodeAndName', type: 'string' }, { name: 'SHIPPERDETAIL', type: 'string' }, { name: 'SHIPPERTYPE', type: 'int' }, { name: 'LOADADDRESS', type: 'string' }, { name: 'DELIVERADDRESS', type: 'string' }, { name: 'ISPUBLIC', type: 'bool' } ] }); //品名 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.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(''); } } } } }); //#endregion //提单模板 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: 'CodeAndName', 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: 'MsCodeRailwayPort', proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' } }); this.storeCodeDisport.load(); this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeRailwayPort', proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' } }); this.storeCodeDisport2.load(); this.storeCodeDisport3 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeRailwayPort', proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' } }); this.storeCodeDisport3.load(); this.storeCodeDisport4 = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeRailwayPort', proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' } }); this.storeCodeDisport4.load(); //国内港口(出口装货港、进口卸货港) this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeRailwayPort', proxy: { url: '/MvcShipping/MsOpRailway/GetPortList' } }); this.storeCodeLoadport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORTENAME', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORTENAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PORTLOADID').setValue(selectdata.PORTID); } else { this.formEdit.getForm().findField('PORTLOADID').setValue(''); } } } } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', valueField: 'PORTENAME', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTENAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(selectdata.PORTID); 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.PORTID); } 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.PORTID); } } else { this.formEdit.getForm().findField('PORTDISCHARGEID').setValue(''); } } } } }); this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的地', store: this.storeCodeDisport2, name: 'DESTINATION', valueField: 'PORTENAME', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORTENAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('DESTINATIONID').setValue(selectdata.PORTID); } else { this.formEdit.getForm().findField('DESTINATIONID').setValue(''); } } } } }); this.comboxPLACEDELIVERY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '交货地', store: this.storeCodeDisport3, name: 'PLACEDELIVERY', valueField: 'PORTENAME', displayField: 'CODEANDNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport3, 'PORTENAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(selectdata.PORTID); } else { this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(''); } } } } }); this.comboxPLACERECEIPT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '收货地点', store: this.storeCodeDisport4, name: 'PLACERECEIPT', valueField: 'PORTENAME', displayField: 'CODEANDNAME' }); //付费方式 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' }); //运输条款 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' }); //件数包装 this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodePackageModel', proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } }); this.storeCodePackage.load(); this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '包 装', labelWidth: 35, store: this.storeCodePackage, padding: '0 0 0 10', forceSelection: true, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS', 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.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.storeORDERCORP = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/MvcShipping/MsOpRailway/GetCustomRefList' } }); //船公司 this.comboxORDERCORP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托对象', store: this.storeORDERCORP, // forceSelection: true, name: 'ORDERCORP', valueField: 'CustName', displayField: 'CodeAndName' }); this.StorePLACETRANSIT = Ext.create('Ext.data.Store', { fields: ['PORT', 'PORTID'] }); this.StorePLACETRANSIT.add({ "PORT": "Dostyk-eks", "PORTID": "ALASHANKOU" }); this.StorePLACETRANSIT.add({ "PORT": "Grodekovo", "PORTID": "SUIFENHE" }); this.StorePLACETRANSIT.add({ "PORT": "Dzamiin-Üüd", "PORTID": "ERLIAN" }); this.StorePLACETRANSIT.add({ "PORT": "Zabaykal'sk", "PORTID": "MANZHOULI" }); this.StorePLACETRANSIT.add({ "PORT": "Xinuiju", "PORTID": "DANDONG" }); this.StorePLACETRANSIT.add({ "PORT": "Brest-Tsentral'nny(V PNR)", "PORTID": "PINGXIANG" }); this.StorePLACETRANSIT.add({ "PORT": "Altynko-eks", "PORTID": "HORGOS" }); this.comboxPLACETRANSIT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '边境口岸', store: this.StorePLACETRANSIT, forceSelection: true, name: 'PLACETRANSIT', valueField: 'PORTID', displayField: 'PORT' }); this.formHead = Ext.widget('form', { frame: true, bodyPadding: 2, region: 'north', height:110, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ { xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数', name: 'PKGS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '重量', name: 'KGS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '尺码', name: 'CBM', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'JOB NO.', readOnly: true, name: 'CUSTNO' }, { fieldLabel: '客户参考信息', readOnly: true, name: 'ORDERNO' }, { fieldLabel: '箱型', readOnly: true, name: 'CTNALL' }, { fieldLabel: '箱量', readOnly: true, name: 'CTNNUM,' }, { fieldLabel: '箱源', readOnly: true, name: 'CTNSOURCE' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '揽货人', readOnly: true, name: 'SALE' }, { fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '收货地', readOnly: true, name: 'PlACERECEIPT' }, { fieldLabel: '发站', readOnly: true, name: 'PLACELOAD' }, this.comboxPLACETRANSIT ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '中转地', flex: 1, readOnly: true, name: 'FRPLACETRANSIT' }, { fieldLabel: '到达站', flex: 1, readOnly: true, name: 'DESTINATION' }, { fieldLabel: '备注', flex: 3, readOnly: true, name: 'REMARK' } ] } ] }] }); //end this.formEdit //#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: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'INPUTBY', name: 'INPUTBY', hidden: true }, { fieldLabel: 'AS_ID', name: 'AS_ID', hidden: true }, { fieldLabel: 'CUSTNO', name: 'CUSTNO', hidden: true }, { fieldLabel: 'PORTLOADID', name: 'PORTLOADID', hidden: true }, { fieldLabel: 'PORTDISCHARGEID', name: 'PORTDISCHARGEID', hidden: true }, { fieldLabel: 'DESTINATIONID', name: 'DESTINATIONID', hidden: true }, { fieldLabel: 'PLACEDELIVERYID', name: 'PLACEDELIVERYID', hidden: true }, { fieldLabel: '主提单号', name: 'MBLNO' }, { fieldLabel: '分提单号', name: 'HBLNO' }] },this.comboxORDERCORP,{ xtype: 'textareafield', grow: true, fieldLabel: '委托内容', height: 100, name: 'ORDERCONTENT', anchor: '100%' }, { xtype: 'textareafield', grow: true, fieldLabel: '备注', height: 60, name: 'AGENT', anchor: '100%' }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ xtype: 'hiddenfield'}] } ] } ] }, { xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', defaults: { anchor: '99%' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ fieldLabel: '开船日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, { fieldLabel: '预抵日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETA' }, this.comboxVoyVeg, { fieldLabel: '航次', flex: 1, name: 'VOYNO' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxDESTINATION, this.comboxPLACEDELIVERY, { xtype: 'hiddenfield'}] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [{ xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [ { xtype: 'label', html: 'Marks & Nos.(标记与号码) ' }, { xtype: 'textareafield', grow: true, height:280, name: 'MARKS', anchor: '100%' } ] }, { xtype: 'container', layout: 'anchor', flex: 3, defaultType: 'textfield', items: [{ xtype: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '         货物描述' }] }, { xtype: 'textareafield', grow: true, fieldLabel: '  ', labelSeparator: '', labelWidth: 20, height: 290, 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: 60, 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(str_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: '总件数', labelWidth: 70, readOnly: true, name: 'PKGS' }, this.comboxKINDPKGS] }, { xtype: 'label', html: '          Gross Weight 毛重(公斤)' }, { xtype: 'textareafield', grow: true, height: 60, 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: '总重量', name: 'KGS' }, { xtype: 'label', width: 50, text: 'KGS' }] }, { xtype: 'label', html: '          Measurement 尺码(立方米)' }, { xtype: 'textareafield', grow: true, height: 60, 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: '总尺码', name: 'CBM' }, { xtype: 'label', width: 50, text: 'CBM' }] } ] } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数大写', name: 'TOTALNO' }] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxISSUETYPE, { fieldLabel: '签单日期', format: 'Y-m-d', xtype: 'datefield', name: 'ISSUEDATE' }, { fieldLabel: '签单地点', name: 'ISSUEPLACE' }, this.comboxBLNUM] }, { xtype: 'container', defaultType: 'textfield', layout: 'hbox', items: [this.comboxBLFRT, { fieldLabel: '预付地点', name: 'PREPARDAT' }, { fieldLabel: '到付地点', name: 'PAYABLEAT' }, this.comboxSERVICE] }] } ] }); //end this.formEdit //#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.formEdit.getForm(); this.opStatus = 'add'; basicForm.findField('AS_ID').setDisabled(false); var field = basicForm.findField('AS_ID'); field.setValue('*'); basicForm.findField('AS_ID').setDisabled(true); field = basicForm.findField('INPUTBY'); field.setValue(SHOWNAME); // this.GetEditStatus(); }, scope: this }, '-', { id: 'btnEHistryCopy', text: "历史引入", handler: function (button, event) { DsOpenEditWin('/MvcShipping/MsOpSeae/HistryBillIndex', "凭证录入", "600", "940", "10", "10"); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { text: "新建", handler: function (button, event) { this.LoadData('add', ''); }, scope: this }, '-', { 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] }); Ext.apply(this, { items: [this.panelBtn,this.formHead, this.panelpage] }); //#endregion //#region 其他 parentWin = window.parent.opener.me; 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.MainEditRecord = ret[3]; } if (this.opStatus == 'edit') { condition = "AS_ID='" + this.editRecord.get('AS_ID') + "'"; } this.storeORDERCORP.load({ params: { bsno: this.MainEditRecord.BSNO} }); this.LoadData(this.opStatus, condition); this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.MainEditRecord); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; _this = this; if (this.opStatus == 'add') { this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(this.MainEditRecord); this.formEdit.getForm().findField('SHIPPER').setValue('深圳环都国际物流有限公司'); this.LoadInit(this.MainEditRecord); } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpSeae/GetBillData', 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.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.LoadInit(data); // this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, // end LoadDate //#endregion //#region 保存 Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } var data = this.formEdit.getForm().getValues(false, false, false); var bodydatas = []; // var jsonBody = ConvertRecordsToJsonAll(bodydatas); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpSeae/BillSave', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), 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); // if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpBillModel', 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.LoadInit(returnData); } if (type == '0') { this.opStatus = 'edit'; } 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 LoadInit: function (data) { var CUSTOMERNAME = this.MainEditRecord.CUSTOMERNAME; 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 }); }, //#endregion //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; //var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue(); var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue(); var inputby = this.formHead.getForm().findField('INPUTBY').getValue(); var op = this.formHead.getForm().findField('OP').getValue(); _this = this; if (BSSTATUS == '锁定') { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modOrderManagement" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { canedit = true; } else { canedit = false; } } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); } _this = this; Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsBaseInfo/GetRuleEdit', params: { rulename: '委托编号', ruletype: '1' }, callback: function (options, success, response) { if (success) { var custno = _this.formHead.getForm().findField('CUSTNO'); custno.setReadOnly(true); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); Ext.Ajax.request({ waitMsg: '正在查询委托编号状态...', url: '/MvcShipping/MsBaseInfo/GetRuleEdit', params: { rulename: '分提单号', ruletype: '1' }, callback: function (options, success, response) { if (success) { var hblno = _this.formHead.getForm().findField('HBLNO'); hblno.setReadOnly(true); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, GetStringNum: function (str) { var num = 0; if (str == null || str == '') return num; if (str.length == 0) return num; var if_find = false; var str_num = ''; for (var i = 0; i < str.length; i += 1) { var member = str.substr(i, 1); if ((member == '0') || (member == '1') || (member == '2') || (member == '3') || (member == '4') || (member == '5') || (member == '6') || (member == '7') || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { if (!if_find) { str_num = str_num + member; } } else { if_find = true; } } return str_num; }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); 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('AS_ID').value; var bsNo = basicForm.findField('BSNO').value; var ORDERCORP = basicForm.findField('ORDERCORP').value; if (billNo == '*' || billNo == '' || billNo == NaN) { Ext.Msg.show({ title: '错误', msg: '提单还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSRAILWAYOPBILL'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae_billmanage WHERE AS_ID = '" + billNo + "'"; var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_railway WHERE BSNO = '" + bsNo + "'"; var sql3 = "SELECT * FROM CH_FEE WHERE FEETYPE=2 AND CUSTOMERNAME='" + ORDERCORP + "' and BSNO='" + bsNo + "'"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } // #endregion });