Ext.namespace('Shipping'); Shipping.MsOpTruckBulkCtnPcEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpTruckBulkCtnPcEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpTruckBulkCtnPcEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, stroplb: '陆运普货派车', PageSize:30, initUIComponents: function () { this.bodyDel = []; this.itemindex = 1; this.myDate = new Date(); this.accdatesameetd = 0; this.MsPeriod = null; this.selectfeesql = ""; this.canedit = false; this.sqlcontext = ""; this.bsnosql = getUrlParam('bsno'); this.Audit = false; _this = this; this.storeDefValue = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpDef/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeMustBe = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpMustField/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListFeeTemplate = Ext.create('Ext.data.Store', { fields: [ { name: 'GID', type: 'string' }, { name: 'LINKID', type: 'string' }, { name: 'CONTRACTNO', type: 'string' }, { name: 'TEMPLATENAME', type: 'string' }, { name: 'CUSTOMERNAME', type: 'string' }, { name: 'GOODNAME', type: 'string' }, { name: 'FEEUNIT', type: 'string' }, { name: 'PRICEUNIT', type: 'string' }, { name: 'TRANTYPE', type: 'string' }, { name: 'LOADPORT', type: 'string' }, { name: 'DISTPORT', type: 'string' }, { name: 'CREATEUSER', type: 'string' }, { name: 'CREATEUSERREF', type: 'string' }, { name: 'CREATETIME', type: 'string' }, { name: 'CORPID', type: 'string' }, { name: 'REMARK', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCustTruckFeeTemplate/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeFeeTemplateDetail = Ext.create('Ext.data.Store', { fields: [ { name: 'GID', type: 'string' }, { name: 'TEMPLATEID', type: 'string' }, { name: 'UNIT', type: 'string' }, { name: 'UNITTYPE', type: 'string' }, { name: 'UNITPRICE', type: 'number' }, { name: 'STARTWEIGHT', type: 'number' }, { name: 'ENDWEIGHT', type: 'number' }, { name: 'CREATEUSER', type: 'string' }, { name: 'CREATETIME', type: 'string' }, { name: 'REMARK', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCustTruckFeeTemplate/GetBodyList', reader: { root: 'data', totalProperty: 'totalCount' } } }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //操 作 this.comboxDDOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '调 度', store: this.storeOpCode, forceSelection: true, name: 'DDOP', valueField: 'UserName', displayField: 'CodeAndName' }); //委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); this.storeCustCode.load(); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndFull' }); //客服 this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运营经理', store: this.storeOpCode, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName' }); //揽货人 this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户经理', store: this.storeOpCode, forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName' }); //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); // this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserBaseModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' } }); this.storeUserBase.load(); this.storeListTruckList = Ext.create('Ext.data.Store', { fields: [ { name: 'TRUCKNO', type: 'string' }, { name: 'DRIVER', type: 'string' }, { name: 'DRIVERTEL', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCustTruckConsignee/GetTruckList', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListTruckList.load(); this.comboxTruckList = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '车号', //'费用类型', store: this.storeListTruckList, valueField: 'TRUCKNO', displayField: 'TRUCKNO', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', // forceSelection: true, name: 'TRUCKNO', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formHead.getForm().findField('DRIVER').setValue(records[0].data.DRIVER); this.formHead.getForm().findField('DRIVERTEL').setValue(records[0].data.DRIVERTEL); } } } }); this.storeListConsigneeName = Ext.create('Ext.data.Store', { fields: [ { name: 'CONSIGNEENAME', type: 'string' }, { name: 'CONSIGNEETEL', type: 'string' }, { name: 'CONSIGNEEATTN', type: 'string' }, { name: 'CONSIGNEEADDR', type: 'string' }, { name: 'DISTPORT', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCustTruckConsignee/GetDataListRm', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListConsigneeName.load(); this.comboxConsigneeName = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '收货方', //'费用类型', store: this.storeListConsigneeName, valueField: 'CONSIGNEENAME', displayField: 'CONSIGNEENAME', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', // forceSelection: true, name: 'CONSIGNEENAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formHead.getForm().findField('CONSIGNEEADDR').setValue(records[0].data.CONSIGNEEADDR); this.formHead.getForm().findField('CONSIGNEEATTN').setValue(records[0].data.CONSIGNEEATTN); this.formHead.getForm().findField('CONSIGNEETEL').setValue(records[0].data.CONSIGNEETEL); } }, 'focus': function (combo, records, eOpts) { var PORTDISCHARGE = this.formHead.getForm().findField('PORTDISCHARGE').getValue(); if (PORTDISCHARGE != '') { var sql = " DISTPORT='" + PORTDISCHARGE + "' "; this.storeListConsigneeName.load({ params: { start: 0, limit: 5000, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } } } }); this.storeListConsigneeName.on('beforeload', function (store) { var PORTDISCHARGE = this.formHead.getForm().findField('PORTDISCHARGE').getValue(); var sql = " DISTPORT='" + PORTDISCHARGE + "' "; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeListTruckLoadPort = Ext.create('Ext.data.Store', { fields: [ { name: 'PORTID', type: 'string' }, { name: 'PORTCODE', type: 'string' }, { name: 'PORT', type: 'string' }, { name: 'CODEANDNAME', type: 'string' }, { name: 'PROVINCE', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCodeTruckPort/GetDataListRm', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListTruckLoadPort.load(); this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运地', //'费用类型', store: this.storeListTruckLoadPort, valueField: 'PORT', displayField: 'PORT', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'PORTLOAD', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); this.storeListTruckDistPort = Ext.create('Ext.data.Store', { fields: [ { name: 'PORTID', type: 'string' }, { name: 'PORTCODE', type: 'string' }, { name: 'PORT', type: 'string' }, { name: 'CODEANDNAME', type: 'string' }, { name: 'PROVINCE', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCodeTruckPort/GetDataListRm', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListTruckDistPort.load(); this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的地', //'费用类型', store: this.storeListTruckDistPort, valueField: 'PORT', displayField: 'PORT', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'PORTDISCHARGE', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); //客户加载_车队 this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListTRUCK' } }); this.storeTRUCKER.load(); //车队 this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '承运商', //'车队', store: this.storeTRUCKER, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'TRUCKER', valueField: 'CustName', displayField: 'CodeAndFull', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); // this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', { // model: 'MsWlBsHeadRefMsWlDriver', // proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' } // }); // this.storeDrvName.load({ params: { condition: "" } }); // this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '司机', // store: this.storeDrvName, // name: 'DRIVER', // valueField: 'DrvName', // displayField: 'CodeAndName', // listeners: { // scope: this, // 'select': function (combo, records, eOpts) { // if (records.length > 0) { //// this.setDrvName(records[0].data.Mobile); // this.formHead.getForm().findField('DRIVERTEL').setValue(records[0].data.Mobile); // } // } // } // }); this.StoreTRADETYPE = Ext.create('Ext.data.Store', { fields: ['TRADETYPE'] }); this.StoreTRADETYPE.add({ "TRADETYPE": "出口" }); this.StoreTRADETYPE.add({ "TRADETYPE": "进口" }); this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreTRADETYPE, fieldLabel: '托运类型', forceSelection: true, name: 'TRADETYPE', valueField: 'TRADETYPE', displayField: 'TRADETYPE' }); //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' } }); this.storeYARD.load(); // this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '提箱场站', //'场站', store: this.storeYARD, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'YARD', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeISFEE = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeISFEE.add({ "FSTATUS": "1", "NAME": "是" }); this.storeISFEE.add({ "FSTATUS": "0", "NAME": "否" }); this.comboxISFEE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '是否生成费用', //是否开垫付 store: this.storeISFEE, valueField: 'FSTATUS', displayField: 'NAME', forceSelection: true, name: 'ISFEE', readOnly: true, labelWidth: 80, value: '', enableKeyEvents: true }); //箱型_集装箱列表中的下拉框加载 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, flex: 0.5, forceSelection: true, name: 'CTNALL', valueField: 'CTN', displayField: 'CTN', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); //品名 this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeGoodsModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsListRm' } }); this.storeCodeGoodsList.load(); this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '品名', store: this.storeCodeGoodsList, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'GOODSNAME', valueField: 'GOODNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); this.StoreTRADETYPE = Ext.create('Ext.data.Store', { fields: ['TRADETYPE'] }); this.StoreTRADETYPE.add({ "TRADETYPE": "出口" }); this.StoreTRADETYPE.add({ "TRADETYPE": "进口" }); this.comboxTRADETYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreTRADETYPE, fieldLabel: '托运类型', forceSelection: true, name: 'TRADETYPE', valueField: 'TRADETYPE', displayField: 'TRADETYPE' }); this.formHead = Ext.widget('form', { region: 'north', frame: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth:70, msgTarget: 'qtip' }, items: [{ xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'ORUNITPRICE', value:0, name: 'ORUNITPRICE', hidden: true }, { fieldLabel: 'ORFREIGHT', value: 0, name: 'ORFREIGHT', hidden: true }, { fieldLabel: 'CUSTATTN', name: 'CUSTATTN', hidden: true }, { fieldLabel: 'CUSTTEL', name: 'CUSTTEL', hidden: true }, { fieldLabel: 'CUSTOMERNAMEREF', name: 'CUSTOMERNAMEREF', hidden: true }, { fieldLabel: 'TRUCKERREF', name: 'TRUCKERREF', hidden: true }, { fieldLabel: 'TRANSTYPE', value: '集装箱', name: 'TRANSTYPE', hidden: true }, { fieldLabel: '派车单号', readOnly: false, name: 'CUSTNO' }, { fieldLabel: '派车状态', readOnly: true, // flex: 0.8, name: 'TRANSSTATUS', value: '新建' }, { fieldLabel: '合同号', readOnly: true, name: 'CONTRACTNO' }, { fieldLabel: '费用模板', readOnly: false, name: 'TEMPLATENAME' }, { fieldLabel: '创建日期', //format: 'Y-m-d', //xtype: 'datefield', readOnly: true, name: 'CREATETIME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSALE, this.comboxCUSTSERVICE, { fieldLabel: '操作员', readOnly: true, name: 'OP' }, { fieldLabel: '会计期间', xtype: 'monthfield', editable: false, name: 'ACCDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m") }, { fieldLabel: '接单日期', format: 'Y-m-d', xtype: 'datefield', // allowBlank: false, name: 'BSDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d") }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '客户订单号', name: 'ORDERNO' }, this.comboxCustCode, this.comboxTRADETYPE, { fieldLabel: '业务锁定', readOnly: true, // flex: 0.5, name: 'BSSTATUSREF', value: '未锁定' }, { fieldLabel: '费用状态', readOnly: true, // flex: 0.5, //labelWidth: 60, name: 'FEESTATUSREF', value: '未锁定' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '要求派车日期', format: 'Y-m-d', labelWidth: 110, xtype: 'datefield', // allowBlank: false, name: 'ETA', value: this.myDate }, { fieldLabel: '实际到货日期', format: 'Y-m-d', labelWidth: 110, xtype: 'datefield', name: 'ETD' }, this.comboxGOODSNAME, { fieldLabel: '提单号', name: 'MBLNO' }, { xtype: 'hiddenfield' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxLoadPort, this.comboxDistPort, this.comboxCTNALL, { fieldLabel: '箱量', readOnly: true, flex: 0.5, value: '0', name: 'CTNNUM' }, { fieldLabel: '截港日期', //'截港日期', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'CLOSINGDATE', listeners: { scope: this, 'select': function (combo, mdate) { var mydate = new Date(mdate); var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00'); combo.setValue(mydatestr); } } }, this.comboxYARD] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRUCKER, this.comboxTruckList, { fieldLabel: '司机', readOnly: false, name: 'DRIVER' }, { fieldLabel: '司机电话', readOnly: false, name: 'DRIVERTEL' }, { xtype: 'hiddenfield' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxConsigneeName, { fieldLabel: '收货地址', flex: 2, name: 'CONSIGNEEADDR' }, { fieldLabel: '联系人', name: 'CONSIGNEEATTN' }, { fieldLabel: '电话', name: 'CONSIGNEETEL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '单价', name: 'UNITPRICE', value: '0', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值类型!', listeners: { scope: this, blur: function (field, The, eOpts) { this.GetUnitPriceChange(); } } }, { fieldLabel: '应付税前运费', name: 'FREIGHT', labelWidth: 80, value: '0', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值类型!', listeners: { scope: this, blur: function (field, The, eOpts) { var FREIGHT = this.formHead.getForm().findField('FREIGHT').getValue(); var TAXRATE = this.formHead.getForm().findField('TAXRATE').getValue(); if (TAXRATE == 0) { this.formHead.getForm().findField('TTLFREIGHT').setValue(FREIGHT); } else { var tax = Div(Mul(FREIGHT, TAXRATE), 100); var amount = Add(FREIGHT, tax); this.formHead.getForm().findField('TTLFREIGHT').setValue(amount); var TTLOTDR = this.formHead.getForm().findField('TTLOTDR').getValue(); var ttldr = Add(amount, TTLOTDR); this.formHead.getForm().findField('TTLDR').setValue(ttldr); } } } }, { fieldLabel: '税率', name: 'TAXRATE', value: '0', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值类型!', listeners: { scope: this, blur: function (field, The, eOpts) { var FREIGHT = this.formHead.getForm().findField('FREIGHT').getValue(); var TAXRATE = this.formHead.getForm().findField('TAXRATE').getValue(); if (TAXRATE == 0) { this.formHead.getForm().findField('TTLFREIGHT').setValue(FREIGHT); } else { var tax = Div(Mul(FREIGHT, TAXRATE), 100); var amount = Add(FREIGHT, tax); this.formHead.getForm().findField('TTLFREIGHT').setValue(amount); var TTLOTDR = this.formHead.getForm().findField('TTLOTDR').getValue(); var ttldr = Add(amount, TTLOTDR); this.formHead.getForm().findField('TTLDR').setValue(ttldr); } } } }, { fieldLabel: '应付税后运费', name: 'TTLFREIGHT', labelWidth: 80, value: '0', blankText: '请填写数值!', allowBlank: false, regex: /^\d+(\.\d{1,4})?$/, regexText: '请输入正确的数值类型!' }, { fieldLabel: '应付杂费', readOnly: true, name: 'TTLOTDR' }, { fieldLabel: '应付合计', readOnly: true, name: 'TTLDR' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'PKGS', hidden: true, value: 0, readOnly: true, name: 'PKGS' }, { fieldLabel: 'KGS', hidden: true, value: 0, readOnly: true, name: 'KGS' }, { fieldLabel: 'NETWEIGHT', hidden: true, value: 0, readOnly: true, name: 'NETWEIGHT' }, { fieldLabel: 'CBM', hidden: true, value: 0, readOnly: true, name: 'CBM' }, { fieldLabel: 'TRUCKNUM', hidden: true, value: 0, readOnly: true, name: 'TRUCKNUM' }, { fieldLabel: 'FEEUNIT', name: 'FEEUNIT', hidden: true }, { fieldLabel: 'PRICEUNIT', name: 'PRICEUNIT', hidden: true }, { fieldLabel: '最后一次更改人', name: 'MODIFIEDUSER', hidden: true }, { fieldLabel: 'ISFEE', name: 'ISFEE', hidden: true }, { fieldLabel: '备注', height:30, name: 'REMARK', xtype: "textarea" }, { fieldLabel: '异常信息', height: 30, readOnly: true, name: 'ARRIVEREMARK', xtype: "textarea" }] }]//end items(fieldset 1) }]//end root items }); //end this.formHead //明细表表格相关 //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpTruckBulkPcDetail', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsOpTruckBulkPc/GetBodyList', reader: { root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAMEREF', header: '委托单位', width: 80 }, { sortable: true, dataIndex: 'CTNALL', header: '箱型', width: 80 }, { sortable: true, dataIndex: 'CTNNUM', header: '已派车箱量', width: 80 }, { sortable: true, dataIndex: 'ORDERNO', header: '客户订单号', width: 100 }, { sortable: true, dataIndex: 'CUSTNO', header: '订单编号', width: 80 }, { sortable: true, dataIndex: 'CONTRACTNO', header: '合同号', width: 80 }, { sortable: true, dataIndex: 'BSDATE', header: '接单日期', width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'ETD', header: '要求装货(卸货)日期', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 }, { sortable: true, dataIndex: 'SALE', header: '客户经理', width: 80 }, { sortable: true, dataIndex: 'CUSTSERVICE', header: '运营经理', width: 80 }, { sortable: true, dataIndex: 'CUSTATTN', header: '客户联系人', width: 80 }, { sortable: true, dataIndex: 'CUSTTEL', header: '客户联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEENAME', header: '收货方', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEATTN', header: '收货联系人', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEETEL', header: '收货联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEADDR', header: '收货地址', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运地', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 80 }, { sortable: true, dataIndex: 'MBLNO', header: '提单号', width: 80 }, { sortable: true, dataIndex: 'YARD', header: '提箱场站', width: 80 }, { sortable: true, dataIndex: 'CLOSINGDATE', header: '截港日期', width: 80 }, { sortable: true, dataIndex: 'TRADETYPE', header: '托运类型', width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: '箱型箱量', width: 80 }, { sortable: true, dataIndex: 'VOUNO', header: '凭证号', width: 80 }, { sortable: true, dataIndex: 'CREATEUSER', header: '创建人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '创建日期', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: '修改人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '修改日期', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 200 }, { sortable: true, dataIndex: 'TTLDR', header: '合计应收', width: 80 }, { sortable: true, dataIndex: 'ISPRINTPR', header: '打印核算单', width: 100, renderer: function (value, meta, record) { if (value == '1') return '√'; else return ''; } }]; this.girdcolums = this.initgirdcolums; //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'north', height:150, loadMask: { msg:'数据加载中...'}, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', tbar: [{ text: '删除明细', //'删除费用明细', tooltip: '删除明细', //'删除费用明细', id:'btndeletedetail', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(button, event, 1); }, scope: this }, '-', { text: '保存列表样式', //保存列表样式 menu: [ { text: '保存', //保存 handler: function (button, event) { _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: '初始化', //初始化 handler: function (menu, event) { _this.gridList.reconfigure(_this.storeBodyList, _this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }], columns: this.girdcolums }); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdcolums.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeBodyList, this.girdcolums); //绑定事件 this.storeBodyList.on('beforeload', function (store) { var cargoid = 0; if (this.opStatus == 'edit') { cargoid = this.editRecord.get('BSNO'); } var sql = " op_truck_bulk_pc_detail.BSNO='" + cargoid + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); //#region 添加业务列表 this.storeBodyAddList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpTruckBulk', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsOpTruckBulk/GetDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', //每页记录数 labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }); this.initgirdbilladdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAMEREF', header: '委托单位', width: 80 }, { sortable: true, dataIndex: 'NOPCCNTRTOTAL', header: '待派车箱型箱量', width: 160 }, { sortable: true, dataIndex: 'ORDERNO', header: '客户订单号', width: 80 }, { sortable: true, dataIndex: 'CUSTNO', header: '订单编号', width: 80 }, { sortable: true, dataIndex: 'CONTRACTNO', header: '合同号', width: 80 }, { sortable: true, dataIndex: 'BSDATE', header: '接单日期', width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'ETD', header: '要求装货(卸货)日期', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 }, { sortable: true, dataIndex: 'SALE', header: '客户经理', width: 80 }, { sortable: true, dataIndex: 'CUSTSERVICE', header: '运营经理', width: 80 }, { sortable: true, dataIndex: 'CUSTATTN', header: '客户联系人', width: 80 }, { sortable: true, dataIndex: 'CUSTTEL', header: '客户联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEENAME', header: '收货单位', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEATTN', header: '收货联系人', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEETEL', header: '收货联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEADDR', header: '收货地址', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运地', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 80 }, { sortable: true, dataIndex: 'KINDPKGS', header: '包装', width: 80 }, { sortable: true, dataIndex: 'VOUNO', header: '凭证号', width: 80 }, { sortable: true, dataIndex: 'CREATEUSER', header: '创建人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '创建日期', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: '修改人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '修改日期', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 200 }, { sortable: true, dataIndex: 'ISPRINTPR', header: '打印核算单', width: 100, renderer: function (value, meta, record) { if (value == '1') return '√'; else return ''; } }]; this.girdbilladdcolums = this.initgirdbilladdcolums; //使用者id,表名,中间column数组,跳过一开始的几列 this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridAddList = new Ext.grid.GridPanel({ store: this.storeBodyAddList, enableHdMenu: false, region: 'center', loadMask: { msg: '数据加载中,请稍等...' }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, selModel: this.AddGridCheckBoxModel, viewConfig: { enableTextSelection: true }, tbar: [{ text: '添加派车', //添加结算明细 tooltip: '添加派车', id: 'btnaddbill', iconCls: "btnadddetail", handler: function (button, event) { this.onAddClick(button, event); }, scope: this }, '-', { text: '保存列表样式', //保存列表样式 menu: [ { text: '保存', //保存 handler: function (button, event) { _this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.girdbilladdcolums, 1, true); } }, { text: '初始化', //初始化 handler: function (menu, event) { _this.gridAddList.reconfigure(_this.storeBodyAddList, _this.initgirdbilladdcolums); _this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.initgirdbilladdcolums, 1, true); } }], scope: this }], columns: this.girdbilladdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeBodyAddList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', //当前显示 {0} - {1}条记录 /共 {2}条记录 emptyMsg: '没有数据'//没有数据 }), this.Pagenum] }); this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; // openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; window.open(openUrl, openType, openSet); }, this); this.girdbilladdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'billadd', this.girdbilladdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdbilladdcolums.unshift(new Ext.grid.RowNumberer()); this.gridAddList.reconfigure(this.storeBodyAddList, this.girdbilladdcolums); this.gridAddList.addListener('sortchange', function (ct, column, direction, eOpts) { this.addsortfield = column.dataIndex; this.addsortdire = direction; }, this); var isloadfee = true; this.gridAddList.getSelectionModel().on('select', function (model, record, index) { if (!isloadfee) return; var bsno = record.data.BSNO; var sql = ""; sql = " op_truck_bulk_detail.BSNO='" + bsno + "'"; isloadfee = false; this.selectfeesql = sql; this.storeBodyAddDetailList.load({ params: { condition: sql }, callback: function (r, options, success) { if (success) { isloadfee = true; } } }); // this.onSelectFee(button, event); }, this); this.storeBodyAddList.on('load', function (store, records) { if (store.getCount() > 0) { // this.gridAddList.getSelectionModel().select(0); var btnEAddbill = Ext.getCmp('btnaddbill'); if (this.canedit) btnEAddbill.enable(); } else { this.storeBodyAddDetailList.removeAll(); } }, this); this.storeBodyAddList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext }); }, this); this.storeBodyAddDetailList = Ext.create('Ext.data.Store', { model: 'MsOpTruckBulkDetail', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsOpTruckBulk/GetBodyList', reader: { root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListDetailCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.GridAddDetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.initgridAddDetailColumn=[{ sortable: true, dataIndex: 'GID', header: 'GID', //'GID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', //'TEMPLATEID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CTNALL', header: '箱型', //'费用名称', width: 80 }, { sortable: true, dataIndex: 'NPCCTNNUM', header: '代派箱量', //'汇率', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '商品名称', //'费用名称', width: 100 }, { sortable: true, dataIndex: 'CTNNUM', header: '箱量', //'单价', align: 'right', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', //'备注', width: 150 } ]; this.gridAddDetailColumn=this.initgridAddDetailColumn; this.gridAddDetailList = new Ext.grid.GridPanel({ store: this.storeBodyAddDetailList, enableHdMenu: false, region: 'center', loadMask: { msg: '数据加载中...' }, trackMouseOver: true, disableSelection: false, selModel: this.GridAddDetailCheckBoxModel, plugins: [this.gridListDetailCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', //'增加费用明细', tooltip: '增加明细', //'增加费用明细', iconCls: "btnadddetail", id: 'btnadddetail', handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { text: '保存列表样式', //保存列表样式 menu: [ { text: '保存', //保存 handler: function (button, event) { _this.gridAddDetailColumn = DsTruck.SaveGridPanel(USERID, _this.formname + 'adddetail', _this.gridAddDetailList.columns, _this.gridAddDetailColumn, 1, true); } }, { text: '初始化', //初始化 handler: function (menu, event) { _this.gridAddDetailList.reconfigure(_this.storeBodyAddDetailList, _this.initgridAddDetailColumn); _this.gridAddDetailColumn = DsTruck.SaveGridPanel(USERID, _this.formname + 'adddetail', _this.gridAddDetailList.columns, _this.initgridAddDetailColumn, 1, true); } }], scope: this }], columns: this.gridAddDetailColumn }); this.gridAddDetailColumn = DsTruck.GetGridPanel(USERID, this.formname + 'adddetail', this.gridAddDetailColumn, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridAddDetailColumn.unshift(new Ext.grid.RowNumberer()); this.gridAddDetailList.reconfigure(this.storeBodyAddDetailList, this.gridAddDetailColumn); this.gridAddDetailList.on('edit', function (editor, e, eOpts) { this.gridAddDetailListAfterEdit(editor, e, eOpts); }, this); this.storeBodyAddDetailList.on('load', function (store, records) { if (store.getCount() > 0) { var btnEAddDetail = Ext.getCmp('btnadddetail'); if (this.canedit) btnEAddDetail.enable(); } else { } }, this); this.storeBodyAddDetailList.on('beforeload', function (store) { var sql = ''; if (this.selectfeesql == '') sql = '1=2 '; else sql = this.selectfeesql; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.panelAddDetail = new Ext.Panel({ layout: "border", region: 'east', width: 550, split: true, margin: '2 2', items: [this.gridAddDetailList] }); //客户加载_委托单位 this.storeCustCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); // this.storeCustCode2.load(); //委托单位 this.comboxCustCode2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode2, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { //specialkey: function (field, e) { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }); this.storeTransStatus2 = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeTransStatus2.add({ "DC": "接单", "NAME": "接单" }); this.storeTransStatus2.add({ "DC": "提交审核", "NAME": "提交审核" }); this.storeTransStatus2.add({ "DC": "审核通过", "NAME": "审核通过" }); this.storeTransStatus2.add({ "DC": "驳回提交", "NAME": "驳回提交" }); this.storeTransStatus2.add({ "DC": "已派车", "NAME": "已派车" }); this.storeTransStatus2.add({ "DC": "未派车", "NAME": "未派车" }); this.comboxTransStatus2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订单状态', //'费用类型', store: this.storeTransStatus2, valueField: 'DC', value: '审核通过', readOnly: true, displayField: 'NAME', forceSelection: true, name: 'TRANSSTATUS' }); this.storeListTruckLoadPort = Ext.create('Ext.data.Store', { fields: [ { name: 'PORTID', type: 'string' }, { name: 'PORTCODE', type: 'string' }, { name: 'PORT', type: 'string' }, { name: 'CODEANDNAME', type: 'string' }, { name: 'PROVINCE', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCodeTruckPort/GetDataListRm', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListTruckLoadPort.load(); this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '起运地', //'费用类型', store: this.storeListTruckLoadPort, valueField: 'PORT', displayField: 'CODEANDNAME', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'PORTLOAD', listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }); this.storeListTruckDistPort = Ext.create('Ext.data.Store', { fields: [ { name: 'PORTID', type: 'string' }, { name: 'PORTCODE', type: 'string' }, { name: 'PORT', type: 'string' }, { name: 'CODEANDNAME', type: 'string' }, { name: 'PROVINCE', type: 'string' } ], pageSize: 5000, remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsCodeTruckPort/GetDataListRm', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.storeListTruckDistPort.load(); this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '目的地', //'费用类型', store: this.storeListTruckDistPort, valueField: 'PORT', displayField: 'CODEANDNAME', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'PORTDISCHARGE', listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }); this.formSearch2 = Ext.widget('form', { frame: true, region: 'north', height:70, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode2, { fieldLabel: '合同号', name: 'CONTRACTNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '客户订单号', name: 'ORDERNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '订单编号', name: 'CUSTNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '接单日期', format: 'Y-m-d', xtype: 'datefield', name: 'BSDATEBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '-', format: 'Y-m-d', xtype: 'datefield', name: 'BSDATEEnd', labelSeparator: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, this.comboxLoadPort, { xtype: 'button', width: 100, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefresh2Click(button, event); }, scope: this }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTransStatus2, { fieldLabel: '要求装货(卸货)日期', format: 'Y-m-d', xtype: 'datefield', labelWidth: 90, name: 'ETDBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '-', format: 'Y-m-d', xtype: 'datefield', name: 'ETDEnd', labelSeparator: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '要求卸车日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETABgn', labelWidth: 90, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '-', format: 'Y-m-d', xtype: 'datefield', name: 'ETAEnd', labelSeparator: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, { fieldLabel: '数量', name: 'PKGS', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefresh2Click(); } } } }, this.comboxDistPort, { text: "重置", width: 100, xtype: 'button', iconCls: "btnreset", handler: function (button, event) { this.onClearSql2(button, event); }, scope: this }] }] }] }); this.paneladdAll = new Ext.Panel({ layout: "border", region: 'center', height: 300, items: [this.gridAddList, this.panelAddDetail ] }); this.paneladd = new Ext.Panel({ title: '添加派车明细', //添加支付结算明细 layout: "border", // region: 'south', region: "center", // height: 420, items: [ this.formSearch2, this.paneladdAll ] }); //#endregion //按钮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('CUSTNO'); //field.setValue(''); //field = basicForm.findField('OP'); //field.setValue(SHOWNAME); //field = basicForm.findField('TRANSSTATUS'); //field.setValue('新建'); //var field = basicForm.findField('BSSTATUSREF'); //field.setValue('未锁定'); //var field = basicForm.findField('FEESTATUSREF'); //field.setValue('未锁定'); //var myDate = new Date(); //var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); //field = basicForm.findField('BSDATE'); //field.setValue(mydatestr); //var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); //field = basicForm.findField('ACCDATE'); //field.setValue(mydatestr); //this.storeBodyList.removeAll(); //this.GetEditStatus(); //this.LoadPeriodStatus(this.opStatus); this.LoadData('copy', ''); var children = this.tabOtherPanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodOpTruckBulkInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabOtherPanel.doLayout(); }, scope: this }, { text: "新建", handler: function (button, event) { this.LoadData('add', ''); }, 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 }, '-', { id: 'btnAudit', text: '审核通过', tooltip: '审核通过', handler: function (button, event) { this.onAudit(); }, scope: this }, { text: "驳回提交", id: 'btnAuditBack', iconCls: "btndelete", handler: function (button, event) { var billstatus = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if ((billstatus != "提交审核") && (billstatus != "审核通过")) { Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.winAuditBackShow.show(); }, scope: this }, '-', { text: "状态更新", menu: [ { text: "配载完成", handler: function (menu, event) { _this.onUpTransStatusClick('在途'); } }, { text: "已到货", handler: function (menu, event) { _this.onUpTransStatusClick('已到货'); } } //, { // text: "已回单", // handler: function (menu, event) { // _this.onUpTransStatusClick('已回单'); // } //} ], scope: this }, '-', { text: "打印", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }] }); //end 按钮Toolbar this.treestore = new Ext.data.TreeStore({ model: 'DsShipping.ux.ModuleModel', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } }, autoLoad: true, root: { name: '根节点', expanded: true, //id: '5E301DAB-1DC4-4635-85FC-711F3FD94D39' id: '817A9BFF-6E33-4B86-A37F-65DF5F39720B' } }); this.tabtree = new Ext.tree.Panel({ region: 'west', title: '陆运普货派车单', split: true, width: 180, collapsible: true, margins: '0 0 0 0', store: this.treestore, rootVisible: false, hideHeaders: true, animate: false, lines: false, columns: [{ xtype: 'treecolumn', text: '模块名称', width: 178, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (_this, record, item, index, e, eOpts) { if (record.data.MODULEURL == '@') { this.tabOtherPanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { if (Ext.getCmp('pnl' + record.data.NAME)) { var children = this.tabOtherPanel.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { if (children.items[i].id) { if (children.items[i].id == 'pnl' + record.data.NAME) { this.tabOtherPanel.setActiveTab(i); } } } } } else { if (this.formHead.getForm().findField('BSNO').getValue() == "") { Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } else { if (record.data.NAME == 'modOpTruckBulkAllFee') { var paneltabitems = new Shipping.TruckBulkPcFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else if (record.data.NAME == 'modOpTruckBulkAmendFee') { var paneltabitems = new Shipping.TruckBulkPcAmendFee({ id: 'pnl' + record.data.NAME, layout: "border", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION }); } else { var paneltabitems = new Ext.Panel({ id: 'pnl' + record.data.NAME, layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION, html: ' ' }); } this.tabOtherPanel.add(paneltabitems); this.tabOtherPanel.setActiveTab(paneltabitems); this.tabOtherPanel.doLayout(); } } } } } }); this.panelOther = new Ext.Panel({ title: '派车单信息', id: 'pnlmodOpTruckBulkInfo', //pnlmodOpOtherOpwt layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, items: [this.panelBtn, this.formHead, this.gridList, this.paneladd] }); this.tabOtherPanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "tabTruckBulkPcPanel", enableTabScroll: true, items: [ this.panelOther ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard != null && oldCard.id == "pnlmodOpTruckBulkAllFee") { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } if (oldCard != null && oldCard.id == "pnlmodOpTruckBulkAmendFee") { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: '警告', msg: '更改单未保存,请先保存更改单!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return false; } } } } }); Ext.apply(this, { items: [this.tabtree, this.tabOtherPanel] }); parentWin = window.parent.opener; this.InitData(); this.LoadMustBe(); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='ACCDATESAMEETD'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { this.accdatesameetd = 1; } else { } } } else { } }, scope: this }); 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.onAuditBack(ORREASON); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditBackShow.close(); } }] }); this.formStatusChange = 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: [ { fieldLabel: 'TRANSSTATUS', xtype: 'textfield', name: 'TRANSSTATUS', hidden: true },{ fieldLabel: '日期', format: 'Y-m-d', xtype: 'datefield', name: 'STATUSDATE' }, { xtype: 'textareafield', grow: true, fieldLabel: '异常信息', labelSeparator: '', // labelWidth: 0, height: 50, name: 'ARRIVEREMARK', anchor: '100%' } ]//end root items }); me = this; this.winStatusChangeShow = Ext.create('Ext.window.Window', { title: "状态更新", width: 350, //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.formStatusChange], buttons: [{ text: "确认", minWidth: 70, handler: function () { var form = me.formStatusChange.getForm(); var STATUSDATE = form.findField('STATUSDATE').getRawValue(); if (STATUSDATE == '' || STATUSDATE == null || STATUSDATE == undefined) { Ext.Msg.show({ title: '提示', msg: '状态日期为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var TRANSSTATUS = form.findField('TRANSSTATUS').getValue(); var ARRIVEREMARK = form.findField('ARRIVEREMARK').getValue(); me.UpTransStatus(TRANSSTATUS, STATUSDATE, ARRIVEREMARK); } }, { text: "关闭", minWidth: 70, handler: function () { me.winStatusChangeShow.close(); } }] }); }, //end initUIComponents 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.Audit = ret[6]; } // if (this.opStatus == 'edit') { // condition = " op_truck_bulk_pc.BSNO='" + this.editRecord.get('BSNO') + "'"; } else if (this.opStatus == 'add') { this.LoadData('add', ''); } if (this.opStatus == 'edit') this.LoadData(this.opStatus, condition); if (this.opStatus == 'add') { this.LoadPeriod('add'); } }, //end InitData LoadData: function (opstatus, condition) { this.bodyDel = []; if (opstatus == 'copy') this.opStatus = 'add'; else this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/TruckMng/MsOpTruckBulkPc/GetData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } data = result.data; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); if (data.PORTLOAD != '' && data.PORTDISCHARGE != '' && data.CONTRACTNO != '' && data.TEMPLATENAME != '') { var s = " LOADPORT='" + data.PORTLOAD + "' and DISTPORT='" + data.PORTDISCHARGE + "' AND TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + data.TEMPLATENAME + "' and CONTRACTNO='" + data.CONTRACTNO + "')"; this.storeFeeTemplateDetail.load({ params: { condition: s }, scope: this }); } if (this.opStatus == 'add') { var basicForm = this.formHead.getForm(); basicForm.findField('BSNO').setDisabled(false); var field = basicForm.findField('BSNO'); field.setValue(NewGuid()); basicForm.findField('BSNO').setDisabled(true); field = basicForm.findField('CUSTNO'); field.setValue(''); field = basicForm.findField('OP'); field.setValue(SHOWNAME); field = basicForm.findField('TRANSSTATUS'); field.setValue('新建'); var field = basicForm.findField('BSSTATUSREF'); field.setValue('未锁定'); var field = basicForm.findField('FEESTATUSREF'); field.setValue('未锁定'); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); field = basicForm.findField('BSDATE'); field.setValue(mydatestr); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = basicForm.findField('ACCDATE'); field.setValue(mydatestr); if (opstatus == 'copy') this.LoadMustBeCopy(); } this.GetEditStatus(); this.LoadPeriod(this.opStatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var billno = '*'; var gid = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('BSNO'); this.storeBodyList.load({ params: { condition: " d.BSNO='" + billno + "'" } }); } else { this.storeBodyList.removeAll(); } }, LoadPeriod: function (opstatus) { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; this.MsPeriod = data; this.LoadPeriodStatus(opstatus); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, LoadPeriodStatus: function (opstatus) { var ETD = this.formHead.getForm().findField('ETD').getRawValue(); var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue(); if (ETD == '') { this.formHead.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY); this.formHead.getForm().findField('ETD').setReadOnly(false); } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { this.formHead.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY); this.formHead.getForm().findField('ETD').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formHead.getForm().findField('ETD').setValue(this.MsPeriod.FDAY); this.formHead.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY); this.formHead.getForm().findField('ETD').setReadOnly(false); } else { this.formHead.getForm().findField('ETD').setMinValue(''); this.formHead.getForm().findField('ETD').setReadOnly(true); } } } var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(this.MsPeriod.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { if (opstatus == 'add' || opstatus == 'copyadd') { this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setValue(this.MsPeriod.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { this.formHead.getForm().findField('ACCDATE').setMinValue(''); this.formHead.getForm().findField('ACCDATE').setReadOnly(true); } } }, // end LoadDate Save: function (type) { var basicForm = this.formHead.getForm(); if (!basicForm.isValid()) { return; } if (this.accdatesameetd == 1) { var ETD = this.formHead.getForm().findField('ETD').getRawValue(); if (ETD == '') { } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { var mydatestr = Ext.util.Format.date(ETD, 'Y-m'); if (this.MsPeriod.CLOSEDAY != 0) { var myday = Ext.util.Format.date(ETD, 'd'); if (myday > this.MsPeriod.CLOSEDAY) { var mymonth = Ext.util.Format.date(ETD, 'm'); var myyear = Ext.util.Format.date(ETD, 'Y'); mymonth = parseInt(mymonth) + 1; var mymonthstr = mymonth.toString(); if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr; mydatestr = myyear.toString() + '-' + mymonthstr; } } else { } var field = this.formHead.getForm().findField('ACCDATE'); field.setValue(mydatestr); } } } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); data.TRANSTYPE = '集装箱'; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', 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('BSNO').setDisabled(true); this.LoadPeriodStatus(this.opStatus); } else if (type == '1') { this.opStatus = 'edit'; window.close(); } else if (type == '2') { this.LoadData('add', ''); var children = this.tabOtherPanel.items; if (children) { for (var i = children.length - 1, len = 0; i >= len; i--) { if (children.items[i].id) { if (children.items[i].id == 'pnlmodOpTruckBulkInfo') { // this.tabSeaepanel.setActiveTab(i); } else { children.items[i].close(); } } } } this.tabOtherPanel.doLayout(); } } 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 onDelDetailClick: function (button, event, type) { 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('提示','确定要删除计费明细吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', //'正在删除数据...', url: '/TruckMng/MsOpTruckBulkPc/DeletetruckBulkPcDetail', 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); data = jsonresult.data; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); 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]); } }, gridAddDetailListAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 if (e.value == e.originalValue) return; if (e.field == 'NPCCTNNUM') { var PCCTNNUM = e.record.data['PCCTNNUM']; var CTNNUM = e.record.data['CTNNUM']; var NPCCTNNUM = e.record.data['NPCCTNNUM']; if (NPCCTNNUM > (CTNNUM - PCCTNNUM)) { e.record.set('NPCCTNNUM', CTNNUM - PCCTNNUM); //提示', msg: '申请金额不能大于未申金额! Ext.Msg.show({ title: '提示', msg: '派车箱量不能大于未派车箱量', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, onAddClick: function (button, event) { var btnEAddbill = Ext.getCmp('btnaddbill'); btnEAddbill.disable(); var selectedRecords = this.gridAddList.selModel.getSelection(); if (selectedRecords.length == 0) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var form = this.formHead.getForm(); var rec = selectedRecords[0]; var CUSTOMERNAME = form.findField('CUSTOMERNAME').getRawValue(); if (CUSTOMERNAME == '') { var sCUSTOMERNAME = rec.data.CUSTOMERNAME; var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: sCUSTOMERNAME, CustName: sCUSTOMERNAME, CodeAndName: sCUSTOMERNAME, DESCRIPTION: sCUSTOMERNAME }); this.storeCustCode.add(recordCustCode); form.findField('CUSTOMERNAME').setValue(sCUSTOMERNAME); } var CUSTTEL = this.formHead.getForm().findField('CUSTTEL').getValue(); if (CUSTTEL == '') { CUSTTEL = rec.data.CUSTTEL; this.formHead.getForm().findField('CUSTTEL').setValue(CUSTTEL); } var CUSTATTN = this.formHead.getForm().findField('CUSTATTN').getRawValue(); if (CUSTATTN == '') { CUSTATTN = rec.data.CUSTATTN; this.formHead.getForm().findField('CUSTATTN').setValue(CUSTATTN); } //var CONSIGNEENAME = this.formHead.getForm().findField('CONSIGNEENAME').getValue(); //if (CONSIGNEENAME == '') { var CONSIGNEENAME = rec.data.CONSIGNEENAME; this.formHead.getForm().findField('CONSIGNEENAME').setValue(CONSIGNEENAME); //} //var CONSIGNEETEL = this.formHead.getForm().findField('CONSIGNEETEL').getValue(); //if (CONSIGNEETEL == '') { var CONSIGNEETEL = rec.data.CONSIGNEETEL; this.formHead.getForm().findField('CONSIGNEETEL').setValue(CONSIGNEETEL); //} //var CONSIGNEEATTN = this.formHead.getForm().findField('CONSIGNEEATTN').getValue(); //if (CONSIGNEEATTN == '') { var CONSIGNEEATTN = rec.data.CONSIGNEEATTN; this.formHead.getForm().findField('CONSIGNEEATTN').setValue(CONSIGNEEATTN); //} //var CONSIGNEEADDR = this.formHead.getForm().findField('CONSIGNEEADDR').getValue(); //if (CONSIGNEEADDR == '') { var CONSIGNEEADDR = rec.data.CONSIGNEEADDR; this.formHead.getForm().findField('CONSIGNEEADDR').setValue(CONSIGNEEADDR); //} var PORTLOAD = this.formHead.getForm().findField('PORTLOAD').getRawValue(); if (PORTLOAD == '') { PORTLOAD = rec.data.PORTLOAD; this.formHead.getForm().findField('PORTLOAD').setValue(PORTLOAD); } var PORTDISCHARGE = this.formHead.getForm().findField('PORTDISCHARGE').getRawValue(); if (PORTDISCHARGE == '') { PORTDISCHARGE = rec.data.PORTDISCHARGE; this.formHead.getForm().findField('PORTDISCHARGE').setValue(PORTDISCHARGE); } var SALE = this.formHead.getForm().findField('SALE').getRawValue(); if (SALE == '') { SALE = rec.data.SALE; this.formHead.getForm().findField('SALE').setValue(SALE); } var MBLNO = this.formHead.getForm().findField('MBLNO').getValue(); if (MBLNO == '') { MBLNO = rec.data.MBLNO; this.formHead.getForm().findField('MBLNO').setValue(MBLNO); } var YARD = this.formHead.getForm().findField('YARD').getValue(); if (YARD == '') { YARD = rec.data.YARD; this.formHead.getForm().findField('YARD').setValue(YARD); } var TRADETYPE = this.formHead.getForm().findField('TRADETYPE').getRawValue(); if (TRADETYPE == '' || TRADETYPE ==null) { TRADETYPE = rec.data.TRADETYPE; this.formHead.getForm().findField('TRADETYPE').setValue(TRADETYPE); } var CLOSINGDATE = this.formHead.getForm().findField('CLOSINGDATE').getRawValue(); if (CLOSINGDATE == '') { CLOSINGDATE = rec.data.CLOSINGDATE; this.formHead.getForm().findField('CLOSINGDATE').setValue(CLOSINGDATE); } var CUSTSERVICE = this.formHead.getForm().findField('CUSTSERVICE').getRawValue(); if (CUSTSERVICE == '') { CUSTSERVICE = rec.data.CUSTSERVICE; this.formHead.getForm().findField('CUSTSERVICE').setValue(CUSTSERVICE); } var GOODSNAME = this.formHead.getForm().findField('GOODSNAME').getRawValue(); if (GOODSNAME == '') { GOODSNAME = rec.data.GOODSNAME; this.formHead.getForm().findField('GOODSNAME').setValue(GOODSNAME); } var ETA = this.formHead.getForm().findField('ETA').getRawValue(); if (ETA == '') { ETA = rec.data.ETD; this.formHead.getForm().findField('ETA').setValue(ETA); } var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.PORTLOAD == PORTLOAD && rec.data.PORTDISCHARGE == PORTDISCHARGE) bodyAddDatas.push(rec); } var jsonBody = ConvertRecordsToJsonAll(bodyAddDatas); var basicForm = this.formHead.getForm(); if (!basicForm.isValid()) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! return; } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); data.TRANSTYPE = '集装箱'; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/AddBill', 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } this.opStatus = 'edit'; this.storeBodyList.load({ params: { condition: " d.BSNO='" + returnData.BSNO + "'" } }); this.storeBodyAddList.reload(); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! if (returnData.PORTLOAD != '' && returnData.PORTDISCHARGE != '' && returnData.CONTRACTNO != '' && returnData.TEMPLATENAME != '') { var s = " LOADPORT='" + returnData.PORTLOAD + "' and DISTPORT='" + returnData.PORTDISCHARGE + "' AND TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + returnData.TEMPLATENAME + "' and CONTRACTNO='" + returnData.CONTRACTNO + "')"; this.storeFeeTemplateDetail.load({ params: { condition: s }, callback: function (options, success, response) { if (success) { _this.GetUnitPrice(); } else { } }, scope: this }); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } } }); }, onAddDetailClick: function (button, event) { var btnEAddbill = Ext.getCmp('btnadddetail'); btnEAddbill.disable(); var selectedRecords = this.gridAddDetailList.selModel.getSelection(); if (selectedRecords.length == 0) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var selected= this.gridAddList.selModel.getSelection(); var rec = selected[0]; var CUSTOMERNAME = this.formHead.getForm().findField('CUSTOMERNAME').getRawValue(); if (CUSTOMERNAME == '') { CUSTOMERNAME = rec.data.CUSTOMERNAME; var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: CUSTOMERNAME, CustName: CUSTOMERNAME, CodeAndName: CUSTOMERNAME, DESCRIPTION: CUSTOMERNAME }); this.storeCustCode.add(recordCustCode); this.formHead.getForm().findField('CUSTOMERNAME').setValue(CUSTOMERNAME); } var CUSTTEL = this.formHead.getForm().findField('CUSTTEL').getValue(); if (CUSTTEL == '') { CUSTTEL = rec.data.CUSTTEL; this.formHead.getForm().findField('CUSTTEL').setValue(CUSTTEL); } var CUSTATTN = this.formHead.getForm().findField('CUSTATTN').getRawValue(); if (CUSTATTN == '') { CUSTATTN = rec.data.CUSTATTN; this.formHead.getForm().findField('CUSTATTN').setValue(CUSTATTN); } //var CONSIGNEENAME = this.formHead.getForm().findField('CONSIGNEENAME').getValue(); //if (CONSIGNEENAME == '') { var CONSIGNEENAME = rec.data.CONSIGNEENAME; this.formHead.getForm().findField('CONSIGNEENAME').setValue(CONSIGNEENAME); //} //var CONSIGNEETEL = this.formHead.getForm().findField('CONSIGNEETEL').getValue(); //if (CONSIGNEETEL == '') { var CONSIGNEETEL = rec.data.CONSIGNEETEL; this.formHead.getForm().findField('CONSIGNEETEL').setValue(CONSIGNEETEL); //} //var CONSIGNEEATTN = this.formHead.getForm().findField('CONSIGNEEATTN').getValue(); //if (CONSIGNEEATTN == '') { var CONSIGNEEATTN = rec.data.CONSIGNEEATTN; this.formHead.getForm().findField('CONSIGNEEATTN').setValue(CONSIGNEEATTN); //} //var CONSIGNEEADDR = this.formHead.getForm().findField('CONSIGNEEADDR').getValue(); //if (CONSIGNEEADDR == '') { var CONSIGNEEADDR = rec.data.CONSIGNEEADDR; this.formHead.getForm().findField('CONSIGNEEADDR').setValue(CONSIGNEEADDR); //} var PORTLOAD = this.formHead.getForm().findField('PORTLOAD').getRawValue(); if (PORTLOAD == '') { PORTLOAD = rec.data.PORTLOAD; this.formHead.getForm().findField('PORTLOAD').setValue(PORTLOAD); } var PORTDISCHARGE = this.formHead.getForm().findField('PORTDISCHARGE').getRawValue(); if (PORTDISCHARGE == '') { PORTDISCHARGE = rec.data.PORTDISCHARGE; this.formHead.getForm().findField('PORTDISCHARGE').setValue(PORTDISCHARGE); } var CUSTSERVICE = this.formHead.getForm().findField('CUSTSERVICE').getRawValue(); if (CUSTSERVICE == '') { CUSTSERVICE = rec.data.CUSTSERVICE; this.formHead.getForm().findField('CUSTSERVICE').setValue(CUSTSERVICE); } var SALE = this.formHead.getForm().findField('SALE').getRawValue(); if (SALE == '') { SALE = rec.data.SALE; this.formHead.getForm().findField('SALE').setValue(SALE); } var MBLNO = this.formHead.getForm().findField('MBLNO').getValue(); if (MBLNO == '') { MBLNO = rec.data.MBLNO; this.formHead.getForm().findField('MBLNO').setValue(MBLNO); } var YARD = this.formHead.getForm().findField('YARD').getValue(); if (YARD == '') { YARD = rec.data.YARD; this.formHead.getForm().findField('YARD').setValue(YARD); } var TRADETYPE = this.formHead.getForm().findField('TRADETYPE').getRawValue(); if (TRADETYPE == '' || TRADETYPE == null) { TRADETYPE = rec.data.TRADETYPE; this.formHead.getForm().findField('TRADETYPE').setValue(TRADETYPE); } var CLOSINGDATE = this.formHead.getForm().findField('CLOSINGDATE').getRawValue(); if (CLOSINGDATE == '') { CLOSINGDATE = rec.data.CLOSINGDATE; this.formHead.getForm().findField('CLOSINGDATE').setValue(CLOSINGDATE); } var CUSTSERVICE = this.formHead.getForm().findField('CUSTSERVICE').getRawValue(); if (CUSTSERVICE == '') { CUSTSERVICE = rec.data.CUSTSERVICE; this.formHead.getForm().findField('CUSTSERVICE').setValue(CUSTSERVICE); } var GOODSNAME = this.formHead.getForm().findField('GOODSNAME').getRawValue(); if (GOODSNAME == '') { GOODSNAME = rec.data.GOODSNAME; this.formHead.getForm().findField('GOODSNAME').setValue(GOODSNAME); } var ETA = this.formHead.getForm().findField('ETA').getRawValue(); if (ETA == '') { ETA = rec.data.ETD; this.formHead.getForm().findField('ETA').setValue(ETA); } if (rec.data.PORTLOAD != PORTLOAD ||rec.data.PORTDISCHARGE != PORTDISCHARGE) { Ext.Msg.show({ title: '提示', msg: '起运地和目的地一致才能添加!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var CTNALL = this.formHead.getForm().findField('CTNALL').getValue(); var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; // if (CTNALL != '' && CTNALL != NaN && CTNALL !=null && rec.data.CTNALL == CTNALL) bodyAddDatas.push(rec); } var jsonBody = ConvertRecordsToJsonAll(bodyAddDatas); var basicForm = this.formHead.getForm(); if (!basicForm.isValid()) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! return; } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); data.TRANSTYPE = '集装箱'; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/AddDetail', 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } this.opStatus = 'edit'; this.storeBodyList.load({ params: { condition: " d.BSNO='" + returnData.BSNO + "'" } }); this.storeBodyAddDetailList.reload(); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! if (returnData.PORTLOAD != '' && returnData.PORTDISCHARGE != '' && returnData.CONTRACTNO != '' && returnData.TEMPLATENAME != '') { var s = " LOADPORT='" + returnData.PORTLOAD + "' and DISTPORT='" + returnData.PORTDISCHARGE + "' AND TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + returnData.TEMPLATENAME + "' and CONTRACTNO='" + returnData.CONTRACTNO + "')"; this.storeFeeTemplateDetail.load({ params: { condition: s }, callback: function (options, success, response) { if (success) { _this.GetUnitPrice(); } else { } }, scope: this }); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } } }); }, //#region 提交 审核 撤销审核 onSubmitAuditClick: function () { var basicForm2 = this.formHead.getForm(); if (!basicForm2.isValid()) { return; } var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if (BSSTATUSREF != '新建' && BSSTATUSREF != '' && BSSTATUSREF != '驳回提交') { Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (this.accdatesameetd == 1) { var ETD = this.formHead.getForm().findField('ETD').getRawValue(); if (ETD == '') { } else { var oDate1 = new Date(ETD); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() >= oDate2.getTime()) { var mydatestr = Ext.util.Format.date(ETD, 'Y-m'); if (this.MsPeriod.CLOSEDAY != 0) { var myday = Ext.util.Format.date(ETD, 'd'); if (myday > this.MsPeriod.CLOSEDAY) { var mymonth = Ext.util.Format.date(ETD, 'm'); var myyear = Ext.util.Format.date(ETD, 'Y'); mymonth = parseInt(mymonth) + 1; var mymonthstr = mymonth.toString(); if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr; mydatestr = myyear.toString() + '-' + mymonthstr; } } else { } var field = this.formHead.getForm().findField('ACCDATE'); field.setValue(mydatestr); } } } 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('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); data.TRANSTYPE = '集装箱'; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/SubmitAudit', 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount() ; j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("BSNO", returnData.BSNO); memberbody.commit(); }; this.LoadPeriodStatus(this.opStatus); this.GetEditStatus(); } 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 onSubmitAuditBackClick: function () { var basicForm2 = this.formHead.getForm(); if (!basicForm2.isValid()) { return; } var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if (BSSTATUSREF != '提交审核') { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/SubmitAuditBack', scope: this, params: { data: Ext.JSON.encode(data) }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); this.LoadPeriodStatus(this.opStatus); this.GetEditStatus(); } 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 onAudit: function () { var basicForm2 = this.formHead.getForm(); if (!basicForm2.isValid()) { return; } var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if (BSSTATUSREF != '提交审核' && BSSTATUSREF != '驳回提交') { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/Audit', scope: this, params: { data: Ext.JSON.encode(data) }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); this.LoadPeriodStatus(this.opStatus); } 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 onAuditBack: function (reason) { var basicForm2 = this.formHead.getForm(); if (!basicForm2.isValid()) { return; } var BSSTATUSREF = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if (BSSTATUSREF != '审核通过' && BSSTATUSREF != '提交审核') { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } //var ISFEE = this.formHead.getForm().findField('ISFEE').getValue(); //if (ISFEE == '1') { // Ext.Msg.show({ title: '提示', msg: '已生成费用不能驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); this.formHead.getForm().findField('BSNO').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/AuditBack', scope: this, params: { data: Ext.JSON.encode(data), reason: reason }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); this.opStatus = 'edit'; basicForm2.findField('BSNO').setDisabled(true); this.LoadPeriodStatus(this.opStatus); this.winAuditBackShow.close(); } 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 onUpTransStatusClick: function (transstatus) { var BSSTATUSREF = this.formHead.getForm().findField('BSSTATUSREF').getValue(); var TRANSSTATUS = this.formHead.getForm().findField('TRANSSTATUS').getValue(); if (BSSTATUSREF == "锁定") { Ext.Msg.show({ title: '提示', msg: '业务已锁定不允许更新状态!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if ((transstatus == '在途' && (TRANSSTATUS == '审核通过' || TRANSSTATUS == '已到货')) || (transstatus == '已到货' && (TRANSSTATUS == '在途' || TRANSSTATUS == '已回单')) || (transstatus == '已回单' && TRANSSTATUS == '已到货') || (transstatus == '审核通过' && TRANSSTATUS == '在途')) { } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许更新状态为' + transstatus + '!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (transstatus == '已到货' || transstatus == '已回单') { var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); this.formStatusChange.getForm().findField('TRANSSTATUS').setValue(transstatus); this.formStatusChange.getForm().findField('STATUSDATE').setFieldLabel(transstatus + '日期'); this.formStatusChange.getForm().findField('STATUSDATE').setValue(mydatestr); this.winStatusChangeShow.show(); } else { this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/UpTransStatus', scope: this, params: { data: Ext.JSON.encode(data), transstatus: transstatus }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } this.opStatus = 'edit'; _this.winStatusChangeShow.close(); } 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 }); } } }); } }, UpTransStatus: function (transstatus, transdate,remark) { this.formHead.getForm().findField('BSNO').setDisabled(false); var data = this.formHead.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsOpTruckBulkPc/UpTransStatus', scope: this, params: { data: Ext.JSON.encode(data), transstatus: transstatus, statusdate: transdate, arriverremark:remark }, 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.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpTruckBulkPc', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } this.opStatus = 'edit'; this.winStatusChangeShow.close(); } 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 }); } } }); }, onRefresh2Click: function (button, event) { var sql = this.getCondition2(); this.PageSize = this.Pagenum.getValue(); this.sqlcontext = sql; this.storeBodyAddList.pageSize = this.PageSize; this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); // this.onRefreshSumClick(sql); }, getCondition2: function () { var form = this.formSearch2.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = " TRANSTYPE='集装箱' "; var CUSTNO = form.findField('CUSTNO').getValue(); sql = sql + getAndConSql(sql, CUSTNO, "CUSTNO like '%" + CUSTNO + "%'"); var TRANSSTATUS = form.findField('TRANSSTATUS').getValue(); sql = sql + getAndConSql(sql, TRANSSTATUS, "TRANSSTATUS='" + TRANSSTATUS + "'"); var CONTRACTNO = form.findField('CONTRACTNO').getValue(); sql = sql + getAndConSql(sql, CONTRACTNO, "CONTRACTNO like '%" + CONTRACTNO + "%'"); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); var ORDERNO = form.findField('ORDERNO').getValue(); sql = sql + getAndConSql(sql, ORDERNO, "ORDERNO like '%" + ORDERNO + "%'"); var PORTLOAD = form.findField('PORTLOAD').getValue(); sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD= '" + PORTLOAD + "'"); var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue(); sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE= '" + PORTDISCHARGE + "'"); var PKGS = form.findField('PKGS').getValue(); sql = sql + getAndConSql(sql, PKGS, "PKGS=" + PKGS + ""); var ETDBgn = form.findField('ETDBgn').getRawValue(); sql = sql + getAndConSql(sql, ETDBgn, "CONVERT(char(10), ETD, 20) >='" + ETDBgn + "'"); var ETDEnd = form.findField('ETDEnd').getRawValue(); sql = sql + getAndConSql(sql, ETDEnd, "CONVERT(char(10), ETD, 20) <='" + ETDEnd + "'"); var ETABgn = form.findField('ETABgn').getRawValue(); sql = sql + getAndConSql(sql, ETABgn, "CONVERT(char(10), ETD, 20) >='" + ETABgn + "'"); var ETAEnd = form.findField('ETAEnd').getRawValue(); sql = sql + getAndConSql(sql, ETAEnd, "CONVERT(char(10), ETD, 20) <='" + ETAEnd + "'"); var BSDATEBgn = form.findField('BSDATEBgn').getRawValue(); sql = sql + getAndConSql(sql, BSDATEBgn, "CONVERT(char(10), BSDATE, 20) >='" + BSDATEBgn + "'"); var BSDATEEnd = form.findField('BSDATEEnd').getRawValue(); sql = sql + getAndConSql(sql, BSDATEEnd, "CONVERT(char(10), BSDATE, 20) <='" + BSDATEEnd + "'"); return sql; }, getContractNo: function () { var CUSTOMERNAME = this.formHead.getForm().findField('TRUCKER').getValue(); var PORTLOAD = this.formHead.getForm().findField('PORTLOAD').getValue(); var PORTDISCHARGE = this.formHead.getForm().findField('PORTDISCHARGE').getValue(); var GOODSNAME = this.formHead.getForm().findField('GOODSNAME').getValue(); this.formHead.getForm().findField('CONTRACTNO').setValue(''); this.formHead.getForm().findField('TEMPLATENAME').setValue(''); this.formHead.getForm().findField('UNITPRICE').setValue(0); this.formHead.getForm().findField('FREIGHT').setValue(0); this.formHead.getForm().findField('ORUNITPRICE').setValue(0); this.formHead.getForm().findField('ORFREIGHT').setValue(0); if (CUSTOMERNAME != '' && PORTLOAD != '' && PORTDISCHARGE != '' && GOODSNAME != '') { var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); var sql = " CUSTOMERNAME='" + CUSTOMERNAME + "' and GOODNAME='" + GOODSNAME + "' and TRANTYPE='集装箱' and BSSTATUS='审核通过' and GID IN (SELECT TEMPLATEID FROM Cust_Truck_feetemplatedetail WHERE LOADPORT='" + PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "') and CONTRACTNO not in (select CONTRACTNO from info_client_contract where CANCELDATE<'" + mydatestr + "')"; this.storeListFeeTemplate.load({ params: { start: 0, limit: 5000, sort: '', condition: sql }, callback: function (r, options, success) { if (success) { if (this.storeListFeeTemplate.getCount() > 0) { var member = this.storeListFeeTemplate.getAt(0); this.formHead.getForm().findField('CONTRACTNO').setValue(member.data.CONTRACTNO); this.formHead.getForm().findField('TEMPLATENAME').setValue(member.data.TEMPLATENAME); if (member.data.CONTRACTNO != '' && member.data.TEMPLATENAME != '') { var s = " LOADPORT='" + PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "' AND TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + member.data.TEMPLATENAME + "' and CONTRACTNO='" + member.data.CONTRACTNO + "')"; this.storeFeeTemplateDetail.load({ params: { condition: s }, callback: function (r, options, success) { if (success) { if (this.storeFeeTemplateDetail.getCount() > 0) { var member = this.storeFeeTemplateDetail.getAt(0); this.GetUnitPrice(); } } else { } }, scope: this }); } else { } } else { } } }, waitMsg: "正在查询数据...", scope: this }); } }, GetUnitPrice: function () { this.formHead.getForm().findField('UNITPRICE').setValue(0); this.formHead.getForm().findField('FREIGHT').setValue(0); this.formHead.getForm().findField('ORUNITPRICE').setValue(0); this.formHead.getForm().findField('ORFREIGHT').setValue(0); if (this.storeFeeTemplateDetail.getCount() == 0) return 0; var CTNALL = this.formHead.getForm().findField('CTNALL').getValue(); var CTNNUM = this.formHead.getForm().findField('CTNNUM').getValue(); if (CTNNUM == '') CTNNUM = 0; if (CTNALL == "") return 0; for (var j = 0; j < this.storeFeeTemplateDetail.getCount() ; j += 1) { var memberbody = this.storeFeeTemplateDetail.getAt(j); if (memberbody.data.UNIT == CTNALL) { var freight = Mul(memberbody.data.UNITPRICE, CTNNUM); this.formHead.getForm().findField('UNITPRICE').setValue(memberbody.data.UNITPRICE); this.formHead.getForm().findField('FREIGHT').setValue(freight); this.formHead.getForm().findField('ORUNITPRICE').setValue(memberbody.data.UNITPRICE); this.formHead.getForm().findField('ORFREIGHT').setValue(freight); } }; var FREIGHT = this.formHead.getForm().findField('FREIGHT').getValue(); var TAXRATE = this.formHead.getForm().findField('TAXRATE').getValue(); if (TAXRATE == 0) { this.formHead.getForm().findField('TTLFREIGHT').setValue(FREIGHT); } else { var tax = Div(Mul(FREIGHT, TAXRATE), 100); var amount = Add(FREIGHT, tax); this.formHead.getForm().findField('TTLFREIGHT').setValue(amount); var TTLOTDR = this.formHead.getForm().findField('TTLOTDR').getValue(); var ttldr = Add(amount, TTLOTDR); this.formHead.getForm().findField('TTLDR').setValue(ttldr); } }, GetUnitPriceChange: function () { var CTNNUM = this.formHead.getForm().findField('CTNNUM').getValue(); if (CTNNUM == '') CTNNUM = 0; if (CTNALL == "" || CTNNUM == 0) return 0; var UNITPRICE = this.formHead.getForm().findField('UNITPRICE').getValue(); var freight = Mul(UNITPRICE, CTNNUM); this.formHead.getForm().findField('FREIGHT').setValue(freight); var FREIGHT = this.formHead.getForm().findField('FREIGHT').getValue(); var TAXRATE = this.formHead.getForm().findField('TAXRATE').getValue(); if (TAXRATE == 0) { this.formHead.getForm().findField('TTLFREIGHT').setValue(FREIGHT); } else { var tax = Div(Mul(FREIGHT, TAXRATE), 100); var amount = Add(FREIGHT, tax); this.formHead.getForm().findField('TTLFREIGHT').setValue(amount); var TTLOTDR = this.formHead.getForm().findField('TTLOTDR').getValue(); var ttldr = Add(amount, TTLOTDR); this.formHead.getForm().findField('TTLDR').setValue(ttldr); } }, onClearSql2: function () { var form = this.formSearch2.getForm(); form.reset(); }, //onDeleteClick GetEditStatus: function () { var canedit = false; var BSSTATUSREF = this.formHead.getForm().findField('BSSTATUSREF').getValue(); var op = this.formHead.getForm().findField('OP').getValue(); var MODIFIEDUSER = this.formHead.getForm().findField('MODIFIEDUSER').getValue(); var TRANSSTATUS = this.formHead.getForm().findField('TRANSSTATUS').getValue(); // _this = this; if (BSSTATUSREF == "锁定" || (TRANSSTATUS != '新建' && TRANSSTATUS != '驳回提交')) { canedit = false; this.setSaveBtnStatus(canedit); } else { this.StoreOpRange.load({ params: { optype: "modOpTruckBulkPcList" }, 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', MODIFIEDUSER); if (recordins.getCount() > 0) { canedit = true; } else { canedit = false; } } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); } // }, LoadDefValue: function () { this.storeDefValue.load({ params: { condition: "BSTYPE='陆运集运派车'" }, callback: function (r, options, success) { if (success) { if (this.storeDefValue.getCount() > 0) { for (var j = 0; j < this.storeDefValue.getCount(); j += 1) { var member = this.storeDefValue.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); this.GetEditStatus(); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='陆运集运派车'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } }; } else { } } }, scope: this }); }, LoadMustBeCopy: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='陆运集运派车'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount() ; j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.setValue(this.editRecord.get(member.data.FIELDNAME)); } }; } else { } } }, scope: this }); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); //var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); //var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btndeletedetail = Ext.getCmp('btndeletedetail'); var btnaddbill = Ext.getCmp('btnaddbill'); var btnadddetail = Ext.getCmp('btnadddetail'); var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditBack = Ext.getCmp('btnAuditBack'); if (this.Audit) { btnSubmitAudit.disable(); btnSubmitAuditBack.disable(); btnAudit.enable(); btnAuditBack.enable(); enable = false; } else { btnSubmitAudit.enable(); btnSubmitAuditBack.enable(); btnAudit.disable(); btnAuditBack.disable(); } if (enable) { btnESave.enable(); //btnESaveAndClose.enable(); //btnESaveAndNew.enable(); btndeletedetail.enable(); btnaddbill.enable(); btnadddetail.enable(); } else { btnESave.disable(); //btnESaveAndClose.disable(); //btnESaveAndNew.disable(); btndeletedetail.disable(); btnaddbill.disable(); btnadddetail.disable(); } }, Print: function () { var basicForm = this.formHead.getForm(); var billNo = basicForm.findField('BSNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPOHTER'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_other WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, getIsModify: function () { var feepanel = Ext.getCmp('pnlmodOpOtherAllFee'); if (feepanel != NaN && feepanel != null) { var feemodify = feepanel.panelFee.getModifyStatus(); if (feemodify) { return '费用信息'; } } var feeamendpanel = Ext.getCmp('pnlmodOpOtherAmendFee'); if (feeamendpanel != NaN && feeamendpanel != null) { var feemodify = feeamendpanel.panelFee.getModifyStatus(); if (feemodify) { return '更改单信息'; } } if (this.formHead.getForm().isDirty() == true) { return '业务信息'; } else return ''; } });