//派车管理 良通捷运 Ext.namespace('DsTruck'); DsTruck.MsPcEditIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.MsPcEditIndex.superclass.constructor.call(this); }; Ext.extend(DsTruck.MsPcEditIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, SelectedstoreList: null, SelectPGID: '', fensql: '', initUIComponents: function () { this.formname = "PcHeadEdit_LTJY"; this.fensql = ' 1=2 '; Ext.define('PCmb', { extend: 'Ext.data.Model', idProperty: '', fields: [ { name: 'ywType', type: 'string' }, { name: 'PcBillType', type: 'string' }, { name: 'PcBillTypeREF', type: 'string' }, { name: 'timeMark', type: 'number' }, { name: 'gId', type: 'string' }, { name: 'PGid', type: 'string' }, { name: 'BLTYPE', type: 'string' }, { name: 'RowNumber', type: 'string' }, { name: 'BillNo', type: 'string' }, { name: 'ExpDate', type: 'date', dateFormat: 'Y-m-d H:i:s' }, { name: 'GroupDate', type: 'string' }, { name: 'EndPortDate', type: 'date', dateFormat: 'Y-m-d H:i:s' }, { name: 'EtDate', type: 'date' }, { name: 'VoyVeg', type: 'string' }, { name: 'ArriveDate', type: 'date', dateFormat: 'Y-m-d H:i:s' }, { name: 'ReturnDate', type: 'date', dateFormat: 'Y-m-d H:i:s' }, { name: 'CustomerName', type: 'string' }, { name: 'F_CustomerName', type: 'string' }, { name: 'DrvName', type: 'string' }, { name: 'TruckNo', type: 'string' }, { name: 'MblNo', type: 'string' }, { name: 'LinkMan', type: 'string' }, { name: 'DstArea', type: 'string' }, { name: 'DetiNation', type: 'string' }, { name: 'ContainerQty', type: 'string' }, { name: 'Ton', type: 'string' }, { name: 'LoadCount', type: 'string' }, { name: 'LoadPlace', type: 'string' }, { name: 'TruckSpec', type: 'string' }, { name: 'IsDouble', type: 'string' }, { name: 'Property', type: 'string' }, { name: 'YUNFEI', type: 'string' }, { name: 'HCHJ', type: 'string' }, { name: 'ZXF', type: 'string' }, { name: 'DDF', type: 'string' }, { name: 'QTFee', type: 'string' }, { name: 'TotalFee', type: 'string' }, { name: 'Remark', type: 'string' }, { name: 'FEESTATUS', type: 'string' }, { name: 'UserCode', type: 'string' }, { name: 'UserName', type: 'string' }, { name: 'OrgName', type: 'string' }, { name: 'LrDate', type: 'string' }, { name: 'PCSTATUSREF', type: 'string' }, { name: 'RefBillNo', type: 'string' }, { name: 'RefBillNose', type: 'string' }, { name: 'MblNoSe', type: 'string' }, { name: 'ContainerType', type: 'string' }, { name: 'LinkTel', type: 'string' }, { name: 'YardName', type: 'string' }, { name: 'LinkManSe', type: 'string' }, { name: 'LinkTelSe', type: 'string' }, { name: 'RtnYardName', type: 'string' }, { name: 'BsType', type: 'string' }, { name: 'CustName', type: 'string' }, { name: 'CustLikeManName', type: 'string' }, { name: 'DispatchName', type: 'string' }, { name: 'INVOICENO', type: 'string' }, { name: 'KINDPKGS', type: 'string' }, { name: 'CUSTNO', type: 'string' }, { name: 'SalesName', type: 'string' }, { name: 'DRFEESTATUS', type: 'string' }, { name: 'CRFEESTATUS', type: 'string' }, { name: 'ChangedReson', type: 'string' }, { name: 'BillDate', type: 'string' }, { name: 'RealMil', type: 'string' }, { name: 'ContainerNoSe', type: 'string' }, { name: 'IsLock', type: 'string' }, { name: 'GoodsName', type: 'string' }, { name: 'OverLoadMil', type: 'string' }, { name: 'LinkManSe', type: 'string' }, { name: 'LinkTelSe', type: 'string' } ] }); Ext.define('Tradermb', { extend: 'Ext.data.Model', idProperty: 'gid', fields: [ { name: 'gid', type: 'string' }, { name: 'name', type: 'string' }, { name: 'codename', type: 'string' } ] }); Ext.define('DsShipping.ux.CustomRefModel', { extend: 'Ext.data.Model', fields: [ { name: 'GId', type: 'string' }, { name: 'CustCode', type: 'string' }, { name: 'CustName', type: 'string' }, { name: 'CodeAndName', type: 'string' }, { name: 'SALE', type: 'string' } ] }); //定义数据集 this.storeCustomerName = Ext.create('DsExt.ux.RefTableStore', { model: 'Tradermb', proxy: { url: '/CommMng/BasicDataRef/GetTrader' } }); this.storeCustomerName.load({ params: { condition: ""} }); this.comboxCustomerName = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '客户', id: "CustomerName", //hidden: true, forceSelection: true, store: this.storeCustomerName, name: 'CustomerName', valueField: 'name', displayField: 'codename' }); this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', { model: 'MsWlBsHeadRefMsWlTruck', proxy: { url: '/TruckMng/MsWlPc/GetTruckNoCanUse' }, //params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 )"}, autoLoad: false }); //this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 )"} }); var _this = this; this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '车牌号', //multiSelect:true, store: this.storeTruckNo, //readOnly:true, queryMode: 'remote', name: 'TruckNo', id: "TruckNo", valueField: 'TruckNo', displayField: 'TruckNo' }); // 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: 'DrvName', // valueField: 'DrvName', // displayField: 'CodeAndName', // listeners: { // scope: this, // 'select': function (combo, records, eOpts) { // if (records.length > 0) { // this.setDrvName(records[0].data.DrvCode); // } // } // } // }); //客户加载_车队 this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} }); //车队 this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeTRUCKER, name: 'F_CustomerName', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreBLTYPE = Ext.create('Ext.data.Store', { fields: ['BLTYPE'] }); this.StoreBLTYPE.add({ "BLTYPE": "派车主票" }); this.StoreBLTYPE.add({ "BLTYPE": "派车分票" }); this.StoreBLTYPE.add({ "BLTYPE": "派车单票" }); this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreBLTYPE, forceSelection: true, name: 'BLTYPE', valueField: 'BLTYPE', displayField: 'BLTYPE', value: '派车单票' }); _this = this; ///////////////////////////////////////// this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'PCmb', remoteSort: true, groupField: 'GroupDate', proxy: { type: 'ajax', //url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL', url: '/TruckMng/PcHeadEdit_LTJY/GetDataList', //this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL'; reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.column = [ { sortable: true, hidden: true, dataIndex: 'PcBillType', header: 'PcBillType', width: 80 }, { sortable: true, dataIndex: 'ExpDate', header: '派车时间', width: 160, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s') // , // editor: { // //format: 'Y-m-d H:i:s', // xtype: 'datetimefield' // /*, // labelWidth: 60, // width: 220, // name: 'STARTDATETIME'*/ // } }, { sortable: true, dataIndex: 'PcBillTypeREF', header: '派车类型', width: 80 }, { sortable: true, hidden: true, dataIndex: 'UserCode', header: 'UserCode', width: 80 }, { sortable: true, dataIndex: 'UserName', header: '派车申请人', width: 80 }, { sortable: true, dataIndex: 'PCSTATUSREF', header: '状态', width: 50, renderer: function (value) { if (value == "接单") { return "" + value + ""; } else if (value == "派车") { return "" + value + ""; } else if (value == "完成") { return "" + value + ""; } } }, { sortable: true, dataIndex: 'BLTYPE', header: '派车单类型', width: 80, hidden: true }, { sortable: true, hidden: true, dataIndex: 'timeMark', header: 'timeMark', width: 80 }, { sortable: true, hidden: true, dataIndex: 'gId', header: 'gId', width: 80 }, { sortable: true, hidden: true, dataIndex: 'PGid', header: 'PGid', width: 80 }, { sortable: true, hidden: true, dataIndex: 'FEESTATUS', header: '费用锁定', width: 80 }, { sortable: true, id: '', dataIndex: 'DRFEESTATUS', header: '应收费用', //'应收费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, id: '', dataIndex: 'CRFEESTATUS', header: '应付费用', //'应付费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, dataIndex: 'RowNumber', header: '日序号', width: 60, align: 'center' }, { sortable: true, dataIndex: 'BillNo', header: '委托编号', width: 160 }, { sortable: true, dataIndex: 'MblNoSe', header: 'MblNoSe',hidden:true, width: 160 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'GroupDate', header: '派车日期', width: 80 }, { sortable: true, dataIndex: 'ArriveDate', header: '发货日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s') // , // editor: { // xtype: 'datefield' // } }, { sortable: true, dataIndex: 'ReturnDate', header: '卸货日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s') // , // editor: { // xtype: 'datefield' // } }, { sortable: true, dataIndex: 'CustomerName', header: '客户名称(公司)', width: 80 // , // editor: this.comboxCustomerName }, { sortable: true, dataIndex: 'LinkMan', header: '客户联系人', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'CustName', header: '货站', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'DispatchName', header: '收货人', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'F_CustomerName', header: '车队', width: 80 // , // editor: this.comboxTRUCKER }, { sortable: true, dataIndex: 'TruckNo', header: '车牌号', width: 80 // , // editor: this.comboxTruckNo }, { sortable: true, dataIndex: 'MblNo', header: 'Marstar业务号', width: 120, hidden: true // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'BsType', header: '业务类型', width: 110 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'DstArea', header: '到达地', width: 120 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'DetiNation', header: '目的地址', width: 120 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'ContainerQty', header: '件数', width: 80 // , // editor: { // xtype: 'numberfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'Ton', header: '重量', width: 80 // , // editor: { // xtype: 'numberfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'LoadCount', header: '体积', width: 80 // , // editor: { // xtype: 'numberfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'LoadPlace', header: '装货地址', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'TruckSpec', header: '车型', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'ContainerType', header: '箱型箱量', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'YardName', header: '提箱场站', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'CustLikeManName', header: '工厂联系人', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'INVOICENO', header: '发票号', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'KINDPKGS', header: '包装', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'CUSTNO', header: '运单号', width: 80 // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'IsDouble', header: '是否包车', width: 60, hidden: true, renderer: function (value) { if (value == "0") { return ""; } else if (value == "1") { return ""; } } }, { sortable: true, dataIndex: 'Property', header: '车辆类别', width: 80, hidden: true // , // editor: { // xtype: 'textfield', // selectOnFocus: true // } }, { sortable: true, dataIndex: 'YUNFEI', header: '运费', width: 80 }, { sortable: true, dataIndex: 'HCHJ', header: '回程合计', width: 80 }, { sortable: true, dataIndex: 'ZXF', header: '装卸费', width: 80 }, { sortable: true, dataIndex: 'DDF', header: '代垫费', width: 80 }, { sortable: true, dataIndex: 'QTFee', header: '其他', width: 80 }, { sortable: true, dataIndex: 'TotalFee', header: '合计运费', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '备注', width: 160 , editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'ChangedReson', header: '注意事项', width: 160 , editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, hidden: true, dataIndex: 'OrgName', header: '分公司', width: 80 }, { sortable: true, dataIndex: 'LrDate', header: '录入日期', width: 110 }, { sortable: true, dataIndex: 'GoodsName', header: '品名', width: 200 }, { sortable: true, hidden: true, dataIndex: 'RefBillNo', header: 'RefBillNo', width: 110 }, { sortable: true, hidden: true, dataIndex: 'RefBillNose', header: 'RefBillNose', width: 110 }, { sortable: true, hidden: true, dataIndex: 'IsLock', header: '是否包含已锁定的出入库信息', width: 110 }, { sortable: true, dataIndex: 'ContainerNoSe', header: '附件文件名', width: 200, //return '' + value + ''; renderer: function (value, p, record) { if (value == '') { //return ' 已有附件 '; } } ]; this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 40 }); this.gridList = new Ext.grid.GridPanel({ id:"gridList", store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.MainCB, columns: this.column, // plugins: [this.cellEditing], features: [{ id: 'group', ftype: 'grouping', groupHeaderTpl: '{name}', hideGroupedHeader: true, enableGroupingMenu: true }], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) , enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { alert("enter"); } } } }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; this.SelectedstoreList = this.storeList; this.SelectPGID = ''; DsOpenEditWinAll('/TruckMng/PcHeadEdit_LTJY/Edit'); }, this); this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) { if (record.data.BLTYPE == '派车主票') { this.SelectedRecord = record; var SelectGridtext = Ext.getCmp('SelectCustNo'); SelectGridtext.setText('所选主票:' + record.data.BillNo); var Selectid = Ext.getCmp('Selectid'); Selectid.setText(record.data.gId); this.fensql = " t.PGID='" + record.data.gId + "' AND t.GID<>'" + record.data.gId + "' "; this.storeListfen.load({ params: { start: 0, limit: this.PageSize, condition: this.fensql }, waitMsg: "正在查询数据...", scope: this }); this.storeListNofen.load({ params: { start: 0, limit: this.PageSize, condition: " t.BLTYPE='派车分票' AND (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) " }, waitMsg: "正在查询数据...", scope: this }); this.paneldetail.setVisible(true); } else { this.paneldetail.setVisible(false); } }, this); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column); //使用者id,表名 ,中间column数组 this.column.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.column); //////////////////////////// ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// //#region formSearch //#region formSearch枚举参照相关 this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.FeeTypeRefModel', proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' } }); this.storeFeeNameRef.load({ params: { condition: " ISTRUCKING='1' "} }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '不含此费用', store: this.storeFeeNameRef, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户', typeAhead: true, store: this.storeCustCode, name: 'CustName', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.comboxCustCode.addListener('select', function (combo, record, index) { var s = " countryid='" + combo.value + "'"; //alert(s); //this.storeCargoinfo.removeAll(); this.storeCargoinfo.load({ params: { condition: s} }); //this.comboxCargoinfo.clearValue(); }, this); // this.storeF_CustCode = Ext.create('DsExt.ux.RefTableStore', { // model: 'DsTruckMng.ux.CustomRefModel', // proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } // }); // this.storeF_CustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); // this.comboxF_CustCode = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '最终客户', // typeAhead: true, // store: this.storeF_CustCode, // name: 'F_CustName', // valueField: 'CustName', // displayField: 'CodeAndName' // }); Ext.define('PCSTATUSmd', { extend: 'Ext.data.Model', fields: [ { name: 'ID', type: 'string' }, { name: 'STATUSNAME', type: 'string' } ] }); var PCSTATUSData = [{ "ID": "0", "STATUSNAME": "接单" }, { "ID": "1", "STATUSNAME": "派车" }, { "ID": "2", "STATUSNAME": "完成"}]; this.storePCSTATUS = Ext.create('Ext.data.Store', { model: 'PCSTATUSmd', data: PCSTATUSData }); this.comboxPCSTATUS = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: '状态', autosize: true, bodyPadding: 5, // flex: 2, //width: 500, labelWidth: 85, store: this.storePCSTATUS, queryMode: 'local', triggerOnClick: false, valueField: 'ID', displayField: 'STATUSNAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.comboxTRUCKERQ = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeTRUCKER, fieldLabel: '车队', name: 'F_CustomerName', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StorePcBillType = Ext.create('DsExt.ux.RefEnumStore', {}); this.StorePcBillType.load({ params: { enumTypeId: 99046} }); this.comboxPcBillType = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '派车类型', store: this.StorePcBillType, name: 'PcBillType', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#endregion this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 85, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '运单号', name: 'PS_BILLNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { fieldLabel: '司机姓名', name: 'PS_DRVNAME', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '车牌', name: 'TruckNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '目的地/工厂', name: 'DstArea', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, { fieldLabel: '发/收货人', name: 'F_CustName', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , this.comboxPCSTATUS , { fieldLabel: '备注中包含', name: 'REMARK', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '从派车日期', format: 'Y-m-d', xtype: 'datefield', name: 'PS_EXPDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到派车日期', format: 'Y-m-d', xtype: 'datefield', name: 'PS_EXPDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxTRUCKERQ //, this.comboxFeeNameRef , this.comboxPcBillType ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch var menu1 = new Ext.menu.Menu({ id: 'basicMenu', items: [{ text: '批量设为完成', handler: clickEnd }, { text: '批量设为未完成', handler: clickNotEnd }] }); function clickEnd() { panelTest.SetEnd("1"); }; function clickNotEnd() { panelTest.SetEnd("0"); }; this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "新建", id: "btnadd", //hidden: true, iconCls: "btnadd", handler: function (button, event) { this.SelectedstoreList = this.storeList; this.OprationStatus = 'add'; this.SelectPGID = ''; DsOpenEditWinAll('/TruckMng/PcHeadEdit_LTJY/Edit'); // this.onAddPCClick(); }, scope: this }, { text: "删除", id: "btndelete", //hidden: true, iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', /*{ id: "btnFeeAuditReject", text: '驳回提交费用业务', tooltip: '驳回提交费用业务', iconCls: "btnrefuse", handler: function (button, event) { this.onAuditRefuseClick(button, event); }, scope: this },*/ {text: "批量设置完成", menu: menu1, scope: this }, { text: "保存列表样式", id: "btntest", handler: function (button, event) { var formname = this.formname; var tempcolumns = this.gridList.columns; DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 0, false); }, scope: this }, // { // text: "保存修改", id: "SaveBtn", // iconCls: "btnsave", // handler: function (button, event) { // this.onSaveClick(button, event); // }, // scope: this // }, '-', { text: "业务信息", iconCls: "btnrefresh", handler: function (button, event) { this.onBsViewClick(button, event); }, scope: this }, '-', { text: "打印派车单", iconCls: "btnprint", handler: function (button, event) { this.Print(); }, scope: this } // , '-', // { // text: "派车通知", // iconCls: "btnrefresh", // handler: function (button, event) { // this.onBsTruckViewClick(button, event); // }, // scope: this // } //,this.CB_EditMode ] }); //#region 分票列表 this.storeListfen = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'PCmb', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/PcHeadEdit_LTJY/GetDataFenList', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.MainCBFen = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); this.cellEditingfen = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListFen = new Ext.grid.GridPanel({ store: this.storeListfen, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.MainCBFen, // plugins: [this.cellEditingfen], columns: this.column, tbar: [{ text: '添加分票', tooltip: '添加分票', iconCls: "btnadd", handler: function (button, event) { this.SelectedstoreList = this.storeListfen; this.OprationStatus = 'add'; var Selectid = Ext.getCmp('Selectid'); this.SelectPGID = Selectid.text; DsOpenEditWinAll('/TruckMng/PcHeadEdit_LTJY/Edit'); // this.onAddPCClick(button, event, 1); }, scope: this }, // '-', { // text: '保存分票', // tooltip: '保存分票', // iconCls: "btnsave", // handler: function (button, event) { // this.onSaveClick(button, event, 1); // }, // scope: this // }, '-', { text: '删除分票', tooltip: '删除分票', iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event, 1); }, scope: this }, '-', { text: '取消分配', tooltip: '取消分配', iconCls: "btncancel", handler: function (button, event) { this.SetPGID(button, event, 1); }, scope: this }, '-', { xtype: 'label', id: 'SelectCustNo', text: '所选主票' }, { xtype: 'label', width: 220, id: 'Selectid', hidden: true, text: '' }], plugins: [this.cellEditingfen], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeListfen, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridListFen.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; this.SelectedstoreList = this.storeListfen; var Selectid = Ext.getCmp('Selectid'); this.SelectPGID = Selectid.text; DsOpenEditWinAll('/TruckMng/PcHeadEdit_LTJY/Edit'); // DsOpenEditWin('/TruckMng/PcHeadEdit_WFSD/FeeEdit'); }, this); this.storeListNofen = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'PCmb', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/PcHeadEdit_LTJY/GetDataList', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.MainCBNoFen = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); this.cellEditingnofen = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListNoFen = new Ext.grid.GridPanel({ store: this.storeListNofen, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.MainCBNoFen, columns: this.column, tbar: [ { xtype: 'textfield', fieldLabel: '委托编号', name: 'BillNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.storeListNofen.load({ params: { start: 0, limit: this.PageSize, condition: " t.BLTYPE='派车分票' AND (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) and t.BillNo like '%" + field.value + "%'" }, waitMsg: "正在查询数据...", scope: this }); } } } } , { text: '添加至主票', tooltip: '添加至主票', iconCls: "btnadd", handler: function (button, event) { this.SetPGID(button, event, 2); }, scope: this }], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeListNofen, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.panelfen = new Ext.Panel({ title: '派车分票', layout: "border", region: 'north', height: 280, items: [ this.gridListFen ] }); // this.formSearchnofen = Ext.widget('form', { // region: 'north', // bodyPadding: 5, // height:20, // fieldDefaults: { // margins: '2 2 2 2', // labelAlign: 'right', // flex: 1, // labelWidth: 85, // msgTarget: 'qtip' // }, // items: [ // {//fieldset 1 // xtype: 'container', // defaultType: 'textfield', // layout: 'anchor', // defaults: { // anchor: '100%' // }, // items: [{ // xtype: 'container', // layout: 'hbox', // defaultType: 'textfield', // items: [ {xtype: 'textfield', // fieldLabel: '委托编号', // name: 'PS_CUSTNO', // enableKeyEvents: true, // listeners: { // specialkey: function (field, e) { // if (e.getKey() == e.ENTER) { // _this.storeListNofen.load({ // params: { start: 0, limit: this.PageSize, condition: " t.BLTYPE='派车分票' AND (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) and t.BillNo like '%"++"%'" }, // waitMsg: "正在查询数据...", // scope: this // }); // } // } // } //] // } // ]//end items(fieldset 1) // }//end fieldset 1 // ]//end root items // }); this.panelnofen = new Ext.Panel({ title: '未分配派车分票', layout: "border", region: "center", items: [ this.gridListNoFen ] }); this.paneldetail = new Ext.Panel({ layout: "border", region: 'east', hidden: true, split: true, width: 600, items: [this.panelfen, this.panelnofen] }); this.panelgrid = new Ext.Panel({ layout: "border", region: "center", items: [ this.gridList ] }); // this.panelcenter = new Ext.Panel({ // layout: "border", // region: 'center', // items: [this.gridList, this.paneldetail] // }); // //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", id: "panelTop", height: 125, items: [this.formSearch, this.panelBtn] }); this.panelMain = new Ext.Panel({ layout: "border", region: "center", id: "panelMain", height: 125, items: [this.panelgrid, this.paneldetail] }); Ext.apply(this, { items: [this.panelTop, this.panelMain] }); ///以下集中绑定事件 this.storeList.on('beforeload', function (store) { if (!this.checkSearchCondition()) return; var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeListfen.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: this.fensql }); }, this); this.storeListNofen.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: " t.BLTYPE='派车分票' AND (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) " }); }, this); this.gridList.on('edit', function (editor, e, eOpts) { this.PCAfterEdit(editor, e, eOpts); }, this); this.gridListFen.on('edit', function (editor, e, eOpts) { this.PCAfterEdit(editor, e, eOpts); }, this); this.gridListNoFen.on('edit', function (editor, e, eOpts) { this.PCAfterEdit(editor, e, eOpts); }, this); this.cellEditing.on('beforeedit', function (editor, e) { return this.PCBeforeEdit(editor, e); }, this); this.gridList.addListener('itemcontextmenu', this.itemcontextmenu); this.LoadInitData(); }, //end initUIComponents LoadInitData: function () { //this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} }); var sql = " (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) and (datediff(month,ExpDate,getdate())=0 or ExpDate is null or ExpDate='1900-01-01 00:00:00.000' ) "; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onAuditRefuseClick: function (button, event) { var sql = " A.GID in (select bsno from ch_fee where FEESTATUS=6)"; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onRefreshClick: function (button, event) { if (!this.checkSearchCondition()) return; var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.storeListNofen.load({ params: { start: 0, limit: this.PageSize, condition: " t.BLTYPE='派车分票' AND (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) and (isend=0 or isend is null) " }, waitMsg: "正在查询数据...", scope: this }); //} }, onDeleteClick: function (button, event, type) { if (type == 1) { var selections = this.gridListFen.getSelectionModel().getSelection(); } else var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.IsLock == "1") { Ext.Msg.show({ title: '提示', msg: '包含已锁定的入库或出库 不能删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/TruckMng/PcHeadEdit_LTJY/Delete', params: { data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (type == 1) this.storeListfen.remove(record); else this.storeList.remove(record); 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 }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick onBsViewClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.RefBillNo == '') { Ext.Msg.show({ title: '警告', msg: '此票无法查看业务信息!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var oplb = record.data.MblNoSe; var bsno = record.data.RefBillNo; var openSet = "height=1000, 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 = ""; if (oplb == '海运出口') { openUrl = "../MvcShipping/MsOpSeae/EditView?handle=check&bsno=" + bsno; window.open(openUrl, openType, openSet); } else if (oplb == '海运进口') { openUrl = "../MvcShipping/MsOpSeai/EditView?handle=check&bsno=" + bsno; window.open(openUrl, openType, openSet); } else if (oplb == '空运出口') { openUrl = "../MvcShipping/MsOpAire/EditView?handle=check&bsno=" + bsno; window.open(openUrl, openType, openSet); } else if (oplb == '空运进口') { openUrl = "../MvcShipping/MsOpAiri/EditView?handle=check&bsno=" + bsno; window.open(openUrl, openType, openSet); } }, onBsTruckViewClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.RefBillNo == '') { Ext.Msg.show({ title: '警告', msg: '此票无法查看业务信息!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var oplb = record.data.MblNoSe; var bsno = record.data.RefBillNo; var le_id = record.data.RefBillNose; var openSet = "height=600, 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/MsOpLetter/TruckView?handle=check&bsno=" + bsno + "&oplb=" + oplb + "&le_id=" + le_id; window.open(openUrl, openType, openSet); }, getCondition: function () { var form = this.formSearch.getForm(); // var sql = " t.PcBillType=1 "; // var sql = " (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) "; // var sql = " (t.GID=t.PGID OR t.PGID='' OR t.PGID IS NULL) "; var sql = ""; /* var sqldata = form.getValues(); sql = Ext.JSON.encode(sqldata); */ //var mblNo = form.findField('PS_MBLNO').getValue(); //sql = sql + getAndConSql(sql, mblNo, " (MblNo like '%" + mblNo + "%' or MBLNOse like '%" + mblNo + "%') "); var drvName = form.findField('PS_DRVNAME').getValue(); sql = sql + getAndConSql(sql, drvName, " (DrvName like '%" + drvName + "%' or TruckNo='" + drvName + "') "); var DstArea = form.findField('DstArea').getValue(); sql = sql + getAndConSql(sql, DstArea, " (DstArea like '%" + DstArea + "%' or DetiNation like '%" + DstArea + "%') "); // var VoyVeg = form.findField('VoyVeg').getValue(); // sql = sql + getAndConSql(sql, VoyVeg, " (VoyVeg like '%" + VoyVeg + "%' ) "); var pcBillNo = form.findField('PS_BILLNO').getValue(); sql = sql + getAndConSql(sql, pcBillNo, " MblNoSe like '%" + pcBillNo + "%' "); // var billNo = form.findField('PS_REFBILLNO').getValue(); // sql = sql + getAndConSql(sql, billNo, " (RefBillNo like '%" + billNo + "%' or RefBillNose like '%" + billNo + "%')"); var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, expDate_Min, " ExpDate>='" + expDate_Min + "'"); var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue(); sql = sql + getAndConSql(sql, expDate_Max, " ExpDate<='" + expDate_Max + " 23:59:59'"); // var orgCode = form.findField('OrgCode').getValue(); // sql = sql + getAndConSql(sql, orgCode, "OrgCode like '%" + orgCode + "%'"); var CustName = form.findField('CustName').getValue(); sql = sql + getAndConSql(sql, CustName, " customername like '%" + CustName + "%' "); var F_CustName = form.findField('F_CustName').getValue(); sql = sql + getAndConSql(sql, F_CustName, " (CustName like '%" + F_CustName + "%' or DispatchName like '%" + F_CustName + "%')"); var F_CustomerName = form.findField('F_CustomerName').getValue(); sql = sql + getAndConSql(sql, F_CustomerName, " F_CustomerName like '%" + F_CustomerName + "%' "); var PcBillType = form.findField('PcBillType').getValue(); sql = sql + getAndConSql(sql, PcBillType, " PcBillType='" + PcBillType + "' "); /* var FEENAME = form.findField('FeeName').getValue(); sql = sql + getAndConSql(sql, FEENAME, " GID not in( select distinct BSNO from ch_fee where feename='" + FEENAME + "')"); */ var PCSTATUS = this.comboxPCSTATUS.getValue(); if (PCSTATUS != "") { //sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")"); //alert(PCSTATUS); if (PCSTATUS == "0") { sql = sql + getAndConSql(sql, PCSTATUS, "TruckNo=''"); } if (PCSTATUS == "1") { sql = sql + getAndConSql(sql, PCSTATUS, "(TruckNo<>'' and isend=0)"); } if (PCSTATUS == "2") { sql = sql + getAndConSql(sql, PCSTATUS, "isend=1"); } if (PCSTATUS == "0,1") { sql = sql + getAndConSql(sql, PCSTATUS, "isend=0"); } if (PCSTATUS == "1,2") { sql = sql + getAndConSql(sql, PCSTATUS, "TruckNo<>''"); } if (PCSTATUS == "0,2") { sql = sql + getAndConSql(sql, PCSTATUS, "(TruckNo='' or isend=1)"); } } var REMARK = form.findField('REMARK').getValue(); sql = sql + getAndConSql(sql, REMARK, " REMARK like '%" + REMARK + "%' "); return sql; }, checkSearchCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return false; } return true; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.SelectedstoreList; ret[2] = this.SelectedRecord; ret[3] = this.SelectPGID; ret[4] = 'tMsWlPcHead'; return ret; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, SetEnd: function (isEnd) { selectedRecords = this.gridList.selModel.getSelection(); var GIDList = ""; var needalert = false; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.get('TruckNo') != "") { if (GIDList == "") { GIDList = "'" + rec.get('gId') + "'"; } else { GIDList = GIDList + ",'" + rec.get('gId') + "'"; } } else { needalert = true; } } if (needalert == true) { alert("不能将接单状态的业务设置为完成"); } if (GIDList == "") { return; } Ext.Ajax.request({ waitMsg: '正在查询数据...', url: '/TruckMng/MsWlPc/SetEnd', async: false, params: { GIDList: GIDList, isEnd: isEnd }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var _count = result.data; this.onRefreshClick(); if (needalert == true) { alert("注意,未派车(未选择车号)的业务不能设置为完成。"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //request over }, SetPGID: function (button, event, type) { if (type == 1) { var selectedRecords = this.gridListFen.selModel.getSelection(); var pgid = ''; } else { var selectedRecords = this.gridListNoFen.selModel.getSelection(); var Selectid = Ext.getCmp('Selectid'); var pgid = Selectid.text; } var GIDList = ""; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (GIDList == "") { GIDList = "'" + rec.get('gId') + "'"; } else { GIDList = GIDList + ",'" + rec.get('gId') + "'"; } } if (GIDList == "") { return; } Ext.Ajax.request({ waitMsg: '正在查询数据...', url: '/TruckMng/MsWlPc/SetPGID', async: false, params: { GIDList: GIDList, PGID: pgid }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var _count = result.data; this.storeListfen.load({ params: { start: 0, limit: this.PageSize, condition: this.fensql }, waitMsg: "正在查询数据...", scope: this }); this.onRefreshClick(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //request over }, onSaveClick: function (button, event, type) { var bodyList = []; if (type == 1) { for (i = 0; i < this.storeListfen.getCount(); i += 1) { var member = this.storeListfen.getAt(i); bodyList.push(member); }; } else { for (i = 0; i < this.storeList.getCount(); i += 1) { var member = this.storeList.getAt(i); bodyList.push(member); }; } var jsonBody = ConvertRecordsToJson(bodyList); if (jsonBody == '') { return; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/PcHeadEdit_LTJY/SaveLTJYList', scope: this, params: { data: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //this.storeEditList.commitChanges(); if (type == 1) { this.storeListfen.load({ params: { start: 0, limit: this.PageSize, condition: this.fensql }, waitMsg: "正在查询数据...", scope: this }); this.onRefreshClick(); } else { this.onRefreshClick(); } } 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 }); } //alert('03'); } }); } , onAddPCClick: function (button, event, type) { if (type == 1) { var Selectid = Ext.getCmp('Selectid'); var pgid = Selectid.text; var record = Ext.create('PCmb', { 'PcBillType': '1', 'PcBillTypeREF': '散货派车单', 'gId': '', 'PGid': pgid, 'RowNumber': '', 'BillNo': '', 'ExpDate': '', 'GroupDate': '', 'ArriveDate': '', 'ReturnDate': '', 'CustomerNam': '', 'F_CustomerName': '', 'LinkMan': '', 'DrvName': '', 'TruckNo': '', 'MblNo': '', 'DstArea': '', 'DetiNation': '', 'ContainerQty': '0', 'Ton': '0', 'LoadCount': '0', 'LoadPlace': '', 'TruckSpec': '', 'IsDouble': '', 'Property': '', 'BsType': '海运出口', 'BLTYPE': '派车分票', 'YUNFEI': '', 'HCHJ': '', 'ZXF': '', 'DDF': '', 'QTFee': '', 'TotalFee': '', 'Remark': '', 'timeMark': '0', 'RoadFee': '0', 'UserCode': usercode, 'UserName': SHOWNAME, 'OrgName': '', 'LrDate': '' }); this.storeListfen.add(record); var n = this.storeListfen.getCount(); this.cellEditingfen.startEditByPosition({ row: n - 1, column: 2 }); } else { var record = Ext.create('PCmb', { 'PcBillType': '1', 'PcBillTypeREF': '散货派车单', 'gId': '', 'RowNumber': '', 'BillNo': '', 'ExpDate': '', 'GroupDate': '', 'ArriveDate': '', 'ReturnDate': '', 'CustomerNam': '', 'F_CustomerName': '', 'LinkMan': '', 'DrvName': '', 'TruckNo': '', 'MblNo': '', 'DstArea': '', 'DetiNation': '', 'ContainerQty': '0', 'Ton': '0', 'LoadCount': '0', 'LoadPlace': '', 'TruckSpec': '', 'IsDouble': '', 'Property': '', 'BsType': '海运出口', 'BLTYPE': '派车单票', 'YUNFEI': '', 'HCHJ': '', 'ZXF': '', 'DDF': '', 'QTFee': '', 'TotalFee': '', 'Remark': '', 'timeMark': '0', 'RoadFee': '0', 'UserCode': usercode, 'UserName': SHOWNAME, 'OrgName': '', 'LrDate': '' }); this.storeList.add(record); var n = this.storeList.getCount(); this.cellEditing.startEditByPosition({ row: n - 1, column: 2 }); } } , PCAfterEdit: function (editor, e, eOpts) { //if (e.value == e.originalValue) { return; } if (e.field == 'ContainerType') {//箱号 var CTNrecords = DsStoreQueryBy(this.storeContainerType, 'CtnCode', e.value); if (CTNrecords.getCount() > 0) { var CTNdata = CTNrecords.getAt(0).data; e.record.set('ContainerType_Ref', CTNdata.CtnName); } else { e.record.set('ContainerType_Ref', ''); } } if (e.field == 'YardCode') { var Yardrecords = DsStoreQueryBy(this.storeYardCode, 'CustCode', e.value); if (Yardrecords.getCount() > 0) { var Yarddata = Yardrecords.getAt(0).data; e.record.set('YardCode_Ref', Yarddata.CodeAndName); } else { e.record.set('YardCode_Ref', ''); } } if (e.field == 'RtnYardCode') { var Yardrecords = DsStoreQueryBy(this.storeRtnYardCode, 'CustCode', e.value); if (Yardrecords.getCount() > 0) { var Yarddata = Yardrecords.getAt(0).data; e.record.set('RtnYardCode_Ref', Yarddata.CodeAndName); } else { e.record.set('RtnYardCode_Ref', ''); } } if (e.field == 'DrvName') { /* var Yardrecords = DsStoreQueryBy(this.storeRtnYardCode, 'CustCode', e.value); if (Yardrecords.getCount() > 0) { var Yarddata = Yardrecords.getAt(0).data; e.record.set('RtnYardCode_Ref', Yarddata.CodeAndName); } else { e.record.set('RtnYardCode_Ref', ''); }*/ } if (e.field == 'TruckNo') { var _datas = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', e.value); if (_datas.getCount() > 0) { var _t = _datas.getAt(0).data; e.record.set('DrvName', _t.DrvName); e.record.set('Mobile', _t.Mobile); } else { e.record.set('DrvName', ""); e.record.set('Mobile', ""); } } if (e.field == 'F_CustomerName') { var _datas = DsStoreQueryBy(this.storeF_CustomerName, 'name', e.value); if (_datas.getCount() > 0) { var _t = _datas.getAt(0).data; e.record.set('DetiNation', _t.ADDR); } else { e.record.set('DrvName', ""); } } } , PCBeforeEdit: function (editor, e, eOpts) { if (e.field == 'TruckNo') {//箱号 this.SetTruckNo(); } } , SetTruckNo: function () { var TruckNoList = ""; for (i = 0; i < this.storeList.getCount(); i += 1) { var member = this.storeList.getAt(i); if (member.data.PCSTATUSREF != "完成" && member.data.TruckNo != "") { if (TruckNoList == "") { TruckNoList = "('" + member.data.TruckNo + "'"; } else { TruckNoList = TruckNoList + ",'" + member.data.TruckNo + "'"; } } }; if (TruckNoList != "") { TruckNoList = TruckNoList + ")"; this.storeTruckNo.load({ params: { condition: " and A.truckno not in " + TruckNoList} }); } else { //this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} }); } }, //#region 打印 Print: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.RefBillNo == '') { Ext.Msg.show({ title: '警告', msg: '此票无法查看业务信息!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var oplb = record.data.MblNoSe; var bsNo = record.data.RefBillNo; var le_id = record.data.RefBillNose; var billNo = record.data.BillNo; var printType = 'MSOPLETTERTRUCKLS'; if (oplb == "海运进口") { printType = 'MSOPLETTERTRUCKSEAILS' } else if (oplb == "空运进口") { printType = 'MSOPLETTERTRUCKAIRILS' } else if (oplb == "空运出口") { printType = 'MSOPLETTERTRUCKAIRELS' } var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_letter WHERE LE_ID = '" + le_id + "'"; var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM tMsWlPcHead WHERE billNo = '" + billNo + "'"; var sql3 = ""; if (this.oplb == "海运进口") sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seai WHERE BSNO = '" + bsNo + "'"; else if (this.oplb == "空运进口") sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_airi WHERE BSNO = '" + bsNo + "'"; else if (this.oplb == "空运出口") sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire WHERE BSNO = '" + bsNo + "'"; else sql3 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + bsNo + "'"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, // #endregion UploadFile: function (billno) { alert(billno); }, // gridList_Edit的右键菜单 itemcontextmenu: function (his, record, item, index, e) { // itemcontextmenu( Ext.view.View this, Ext.data.Model record, // HTMLElement item, Number index, Ext.EventObject e, Object eOpts ) // 分类代码表的右键菜单 e.preventDefault(); e.stopEvent(); // 取消浏览器默认事件 _this = this; var array = [ { text: '上传附件', handler: function () { this.SelectedRecord = record; //BillNo , ShipCompanyRef var BillNo = record.data.BillNo; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, bodyStyle: 'padding:5px 5px 0', autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/TruckMng/PcHeadEdit_LTJY/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { BillNo: BillNo }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); } } ]; var nodemenu = new Ext.menu.Menu({ items: array }); nodemenu.showAt(e.getXY()); // 菜单打开的位置 } });