//2013-03-15 删除固定费用 Ext.namespace('DsTruck'); DsTruck.MsWlBsCtnPcEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.MsWlBsCtnPcEdit.superclass.constructor.call(this); }; Ext.extend(DsTruck.MsWlBsCtnPcEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, selectPGID: '', pageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { Ext.define('DsShipping.ux.OpDefValue', { extend: 'Ext.data.Model', fields: [ { name: 'FIELDNAME', type: 'string' }, { name: 'DEFVALUE', type: 'string' }, { name: 'ISMUST', type: 'string' }, { name: 'ISCOLOR', type: 'string' }, { name: 'ISREADONLY', type: 'string' } ] }); 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' } } }); Ext.define('PCmb', { extend: 'Ext.data.Model', idProperty: '', fields: [ { name: 'ywType', type: 'string' }, { name: 'PcBillType', type: 'string' }, { name: 'PcBillTypeREF', type: 'string' }, { name: 'timeMark', type: 'string' }, { name: 'gId', type: 'string' }, { name: 'PGid', type: 'string' }, { name: 'BLTYPE', type: 'string' }, { name: 'TRANSSTATUS', 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'}, { name: 'EtDate', type: 'date' }, { name: 'VoyVeg', type: 'string' }, { name: 'ArriveDate', type: 'date' }, { name: 'ReturnDate', type: 'date' }, { 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: 'ChangedReson', 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' } ] }); //#region 编辑Form 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', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; this.storeInfoClientContact.load({ params: { condition: s} }); } } } }); //客户加载_车队 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', { fieldLabel: '车队', store: this.storeTRUCKER, name: 'F_CustomerName', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); this.StoreTruckTypeProp = Ext.create('DsExt.ux.RefEnumStore', {}); this.StoreTruckTypeProp.load({ params: { enumTypeId: 97043} }); this.comboxTruckTypeProp = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '车辆类别', store: this.StoreTruckTypeProp, flex: 0.5, // forceSelection: true, name: 'Property' }); this.StoreTruckType = Ext.create('DsExt.ux.RefEnumStore', {}); this.StoreTruckType.load({ params: { enumTypeId: 99019} }); this.comboxTruckType = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '车型', store: this.StoreTruckType, flex: 0.5, labelWidth: 60, // forceSelection: true, name: 'TruckSpec' }); this.StoreBsType = Ext.create('Ext.data.Store', { fields: ['BLTYPE'] }); this.StoreBsType.add({ "BLTYPE": "海运出口" }); this.StoreBsType.add({ "BLTYPE": "海运进口" }); this.StoreBsType.add({ "BLTYPE": "空运出口" }); this.StoreBsType.add({ "BLTYPE": "空运进口" }); this.comboxBsType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务类型', store: this.StoreBsType, forceSelection: true, name: 'BsType', valueField: 'BLTYPE', displayField: 'BLTYPE' }); Ext.define('DsShipping.ux.CodePackageModel', { extend: 'Ext.data.Model', fields: [ { name: 'PKGS', type: 'string' } ] }); //件数包装 this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodePackageModel', proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' } }); this.storeCodePackage.load(); this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '包 装', store: this.storeCodePackage, name: 'KINDPKGS', valueField: 'PKGS', displayField: 'PKGS' }); Ext.define('MsWlBsHeadRefMsWlTruck', { extend: 'Ext.data.Model', fields: [ { name: 'TruckNo', type: 'string' }, { name: 'DrvCode', type: 'string' }, { name: 'DrvName', type: 'string' }, { name: 'Mobile', type: 'string' } ] }); this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', { model: 'MsWlBsHeadRefMsWlTruck', proxy: { url: '/TruckMng/MsWlPc/GetTruckNoList' } }); this.storeTruckNo.load({ params: { condition: ""} }); this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '车牌号', store: this.storeTruckNo, name: 'TruckNo', valueField: 'TruckNo', displayField: 'TruckNo', matchFieldWidth: true, listeners: { change: function (field, newValue, oldValue) { // this.tonAndTruckNoChange(field, newValue, oldValue); }, scope: this } }); //委托单位_联系人 this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' } }); this.comboxInfoClientContactYard = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户联系人', store: this.storeInfoClientContact, name: 'LinkMan', valueField: 'SHOWNAME', displayField: 'SHOWNAME', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { // this.formEdit.getForm().findField('Tel').setValue(records[0].data.TEL); } } } }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load({ params: { condition: ""} }); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', //'揽货人', store: this.storeOpCode, forceSelection: true, name: 'SalesName', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); 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: { 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: 'CODEANDNAME', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', forceSelection: true, name: 'DstArea', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.getContractNo(); } } } }); //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, autoScroll: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '记账日期', name: 'JzDate', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '用户编码', name: 'UserCode', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '组织编码', name: 'OrgCode', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '组织名称', name: 'OrgName', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'RoadFee', name: 'RoadFee', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'gId', name: 'gId', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'PGid', name: 'PGid', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'RefBillNo', name: 'RefBillNo', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'RefBillNose', name: 'RefBillNose', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'FEESTATUS', name: 'FEESTATUS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '时间戳', name: 'timeMark', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '委托编号', allowBlank: false, disabled: true, name: 'BillNo' }, { fieldLabel: '提单号', name: 'MblNoSe' }, { fieldLabel: '业务编号', name: 'MblNo' }, this.comboxBsType, { fieldLabel: '状态', readOnly: true, name: 'TRANSSTATUS' }, { fieldLabel: '录入日期', format: 'Y-m-d', readOnly:true, xtype: 'datefield', allowBlank: false, name: 'LrDate', 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: [this.comboxCustomerName, this.comboxInfoClientContactYard, { fieldLabel: '发货人', name: 'CustName' }, { fieldLabel: '收货人', name: 'DispatchName' }, { fieldLabel: '派车时间', xtype: 'datetimefield', format: 'Y-m-d', name: 'ExpDate' }, { fieldLabel: '派车人', name: 'UserName' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRUCKER, this.comboxTruckNo,{ fieldLabel: '装货日期', format: 'Y-m-d', xtype: 'datetimefield', name: 'ArriveDate' }, { fieldLabel: '卸货日期', format: 'Y-m-d', xtype: 'datetimefield', name: 'ReturnDate' }, this.comboxLoadPort, this.comboxDistPort] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '装货地址', name: 'LoadPlace' },{ fieldLabel: '件数', name: 'ContainerQty' }, this.comboxKINDPKGS, { fieldLabel: '重量', name: 'Ton' }, { fieldLabel: '体积', name: 'LoadCount' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '运单号', name: 'CUSTNO' }, { fieldLabel: '发票号', name: 'INVOICENO' }, { fieldLabel: '提箱场站', name: 'YardName' }, this.comboxTruckTypeProp, this.comboxTruckType, this.comboxSALE ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '工厂联系人', name: 'CustLikeManName' }, { fieldLabel: '船名航次', name: 'VoyVeg' }, { fieldLabel: '开船日期', xtype: 'datefield', format: 'Y-m-d', name: 'EtDate' }, { fieldLabel: '截港日期', xtype: 'datetimefield', format: 'Y-m-d', name: 'EndPortDate' }, { fieldLabel: '注意事项', flex: 1, name: 'ChangedReson' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textarea', items: [{ fieldLabel: '备注', height: 30, name: 'Remark' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnEPrev', text: "上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: "下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this }, { id: 'bsbtnSave', text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'bsbtnSaveAndClose', text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { id: 'bsbtnSaveAndNew', text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { text: "关闭", handler: function (button, event) { window.close(); }, scope: this }, { id: 'bsbtnNew', text: "新建", handler: function (button, event) { this.LoadData('add', ''); var basicForm = this.formEdit.getForm(); basicForm.findField('BillNo').setDisabled(false); }, scope: this }, '-', { id: 'bsbtnCopyAndNew', text: "复制新建", handler: function (button, event) { var basicForm = this.formEdit.getForm(); this.opStatus = 'add'; basicForm.findField('gId').setDisabled(false); var field = basicForm.findField('gId'); var BSNO = 'PC' + NewGuid(); var oldbsno = field.getValue(); var oldmasterno = basicForm.findField('PGid').getValue(); field.setValue(BSNO); if (oldbsno == "" || oldbsno == oldmasterno) { field = basicForm.findField('PGid'); field.setValue(BSNO); } field = basicForm.findField('BillNo'); field.setValue(''); }, 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 } ] }); //end 按钮Toolbar //#endregion //#region 布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 265, items: [this.panelBtn, this.formEdit] }); this.panelFee = new Shipping.FeeEditGrid({ region: 'center', title:'费用信息', layout: 'border' }); this.panelFee.stroplb = 'tMsWlPcHead'; this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "F_CustomerName" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} }); this.panelFee.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' "} }); //#region 添加待派车 //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsWlBsHead', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsWlBsCtn/GetPcBodyList', reader: { root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums = [{ sortable: true, dataIndex: 'BillNo', header: '物流号', width: 150 }, { sortable: true, dataIndex: 'ContainerType', header: '箱型', width: 80 }, { sortable: true, dataIndex: 'ContainerQty', header: '箱量', width: 40 }, { sortable: true, dataIndex: 'TRANSSTATUS', header: '订单状态', width: 80 }, { sortable: true, dataIndex: 'UserCode', header: '用户编码', width: 60 }, { sortable: true, dataIndex: 'UserName', header: '用户姓名', width: 80 }, { sortable: true, dataIndex: 'CustName', header: '委托单位', //renderer: function (value, p, record) { return value + '-' + record.data.CustName_Ref; }, width: 80 }, { sortable: true, dataIndex: 'CustDate', header: '委托日期', width: 80 }, { sortable: true, dataIndex: 'VoyVeg', header: '船名航次', renderer: function (value, p, record) { return value + '-' + record.data.VoyVeg_Ref; }, width: 80 }, { sortable: true, dataIndex: 'EtDate', header: '开船(到港)日期', width: 80 }, { sortable: true, dataIndex: 'EndPortDate', header: '截港日期', width: 80 }, { sortable: true, dataIndex: 'MblNo', header: '提单号', width: 120 }, { sortable: true, dataIndex: 'SalesCode', header: '揽货人', renderer: function (value, p, record) { return value + '-' + record.data.SalesCode_Ref; }, width: 80 }, { sortable: true, dataIndex: 'SalesName', header: '揽货人姓名', width: 80 }, { sortable: true, dataIndex: 'DispatchCode', header: '调度员编码', renderer: function (value, p, record) { return value + '-' + record.data.DispatchCode_Ref; }, width: 60 }, { sortable: true, dataIndex: 'DispatchName', header: '调度员姓名', width: 80 }, { sortable: true, dataIndex: 'SendYardCode', header: '拖箱场站编码', renderer: function (value, p, record) { return value + '-' + record.data.SendYardCode_Ref; }, width: 80 }, { sortable: true, dataIndex: 'SendYardName', header: '拖箱场站', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运地', width: 80 }, { sortable: true, dataIndex: 'DstArea', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'DetiNation', header: '工厂地址', width: 200 }, { sortable: true, dataIndex: 'DetiLinkTel', header: '工厂联系电话', width: 200 }, { sortable: true, dataIndex: 'DetiLinkMan', header: '工厂联系人', width: 200 }, { sortable: true, dataIndex: 'Remark', header: '备注', width: 200 }, { sortable: true, hidden: true, dataIndex: 'PcType', header: 'PcType', width: 20 }, { sortable: true, dataIndex: 'TruckNo', header: '车牌号(派车单内)', width: 180 }, { sortable: true, dataIndex: 'CtnInfo', header: '集装箱信息', width: 180 }]; 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 }], columns: this.girdcolums }); //绑定事件 this.storeBodyList.on('beforeload', function (store) { var cargoid = 0; if (this.opStatus == 'edit') { cargoid = this.editRecord.get('BillNo'); } var sql = " d.BSNO='" + cargoid + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); //#region 添加业务列表 this.storeBodyAddList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsWlBsHead', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsWlBs/GetDataList', reader: { id: 'BillNo', root: 'data', totalProperty: 'totalCount' } } }); this.PageSize = 100; 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.onRefreshClick(); } } } }); this.initgirdbilladdcolums = [{ sortable: true, dataIndex: 'BillNo', header: '物流号', width: 150 }, { sortable: true, dataIndex: 'TRANSSTATUS', header: '订单状态', width: 80 }, { sortable: true, dataIndex: 'LrDate', header: '录入日期', width: 80 }, { sortable: true, dataIndex: 'JzDate', header: '记账日期', width: 80 }, { sortable: true, dataIndex: 'UserCode', header: '用户编码', width: 60 }, { sortable: true, dataIndex: 'UserName', header: '用户姓名', width: 80 }, { sortable: true, dataIndex: 'OrgCode', header: '组织编码', width: 80 }, { sortable: true, dataIndex: 'OrgName', header: '组织名称', hidden: true, width: 200 }, { sortable: true, dataIndex: 'BsType', header: '托单类型', renderer: function (value, p, record) { return value + '-' + record.data.BsType_Ref; }, width: 60 }, { sortable: true, dataIndex: 'CustCode', header: '委托单位代码', width: 80 }, { sortable: true, dataIndex: 'CustName', header: '委托单位', //renderer: function (value, p, record) { return value + '-' + record.data.CustName_Ref; }, width: 80 }, { sortable: true, dataIndex: 'CustDate', header: '委托日期', width: 80 }, /* { sortable: true, dataIndex: 'FeeOpStatus', header: '费用操作状态', renderer: function (value, p, record) { return value + '-' + record.data.FeeOpStatus_Ref; }, width: 85 }, */ { sortable: true, dataIndex: 'VoyVeg', header: '船名航次', renderer: function (value, p, record) { return value + '-' + record.data.VoyVeg_Ref; }, width: 80 }, { sortable: true, dataIndex: 'EtDate', header: '开船(到港)日期', width: 80 }, { sortable: true, dataIndex: 'EndPortDate', header: '截港日期', width: 80 }, { sortable: true, dataIndex: 'MblNo', header: '提单号', width: 120 }, { sortable: true, dataIndex: 'SalesCode', header: '揽货人', renderer: function (value, p, record) { return value + '-' + record.data.SalesCode_Ref; }, width: 80 }, { sortable: true, dataIndex: 'SalesName', header: '揽货人姓名', width: 80 }, { sortable: true, dataIndex: 'DispatchCode', header: '调度员编码', renderer: function (value, p, record) { return value + '-' + record.data.DispatchCode_Ref; }, width: 60 }, { sortable: true, dataIndex: 'DispatchName', header: '调度员姓名', width: 80 }, { sortable: true, dataIndex: 'SendYardCode', header: '拖箱场站编码', renderer: function (value, p, record) { return value + '-' + record.data.SendYardCode_Ref; }, width: 80 }, { sortable: true, dataIndex: 'SendYardName', header: '拖箱场站', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '起运地', width: 80 }, { sortable: true, dataIndex: 'DstArea', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'DetiNation', header: '工厂地址', width: 200 }, { sortable: true, dataIndex: 'DetiLinkTel', header: '工厂联系电话', width: 200 }, { sortable: true, dataIndex: 'DetiLinkMan', header: '工厂联系人', width: 200 }, { sortable: true, dataIndex: 'Remark', header: '备注', width: 200 }, { sortable: true, hidden: true, dataIndex: 'PcType', header: 'PcType', width: 20 }, { sortable: true, dataIndex: 'TruckNo', header: '车牌号(派车单内)', width: 180 }, { sortable: true, dataIndex: 'CtnInfo', header: '集装箱信息', width: 180 }]; 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: '保存列表样式', //保存列表样式 id: "btntest", 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.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; this.OprationStatus = 'edit'; 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 = "/TruckMng/MsWlBsCtn/Edit"; // 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.GId; var sql = "billno='" + bsno + "' and ContainerQty<>isnull(PCQTY,0)"; 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: sql }); }, this); this.storeBodyAddDetailList = Ext.create('Ext.data.Store', { model: 'MsWlBsCtn', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsWlBs/GetCtnBodyList2', reader: { id: 'BillNo,SerialNo', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListDetailCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.GridAddDetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); 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 }], columns: [{ sortable: true, dataIndex: 'BillNo', header: '单据号', hidden: true, width: 120 }, { dataIndex: "SerialNo", header: "序号", width: 40 }, { sortable: true, dataIndex: 'ContainerType', header: '箱型', width: 60 }, { sortable: true, dataIndex: 'NPCQTY', header: '派车箱量', editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true }, width: 60 }, { sortable: true, dataIndex: 'ContainerQty', header: '箱量', width: 60 } ] }); 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 bsno = '1111'; if (this.selectfeesql != '') bsno = this.selectfeesql; Ext.apply(store.proxy.extraParams, { condition: this.selectfeesql }); }, this); this.panelAddDetail = new Ext.Panel({ layout: "border", region: 'east', width: 550, split: true, margin: '2 2', items: [this.gridAddDetailList] }); 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: 'CustCode', valueField: 'CustCode', displayField: 'CodeAndName' }); this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.CtnRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCtnRefList' } }); this.storeContainerType.load({ params: { condition: "" } }); this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '箱型', store: this.storeContainerType, name: 'ContainerType', valueField: 'CtnCode', displayField: 'CodeAndName' }); 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.comboxTransStatus2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订单状态', //'费用类型', store: this.storeTransStatus2, valueField: 'DC', value: '审核通过', readOnly: true, displayField: 'NAME', forceSelection: true, name: 'TRANSSTATUS' }); this.formSearch = Ext.widget('form', { frame: true, region: 'north', height:70, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTransStatus2,{ fieldLabel: '物流号', name: 'BillNo' }, { fieldLabel: '船名航次', name: 'VoyVeg' }, { fieldLabel: '提单号', name: 'MblNo' }, this.comboxCustCode, { fieldLabel: '目的地', name: 'DstArea' }, { xtype: 'button', width: 100, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '从委托日期', format: 'Y-m-d', xtype: 'datefield', name: 'CustDate_Min' }, { fieldLabel: '至委托日期', format: 'Y-m-d', xtype: 'datefield', name: 'CustDate_Max' }, { fieldLabel: '从起运日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDate_Min' }, { fieldLabel: '到起运日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDate_Max' }, { fieldLabel: '从到达日期', format: 'Y-m-d', xtype: 'datefield', name: 'NeedArriveDate_Min' }, { fieldLabel: '到到达日期', format: 'Y-m-d', xtype: 'datefield', name: 'NeedArriveDate_Max' }, { text: "重置", width: 100, xtype: 'button', iconCls: "btnreset", handler: function (button, event) { this.onClearSql2(button, event); }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); 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.gridList,this.formSearch, this.paneladdAll ] }); //#endregion this.tabWlBsCtnPc = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', id: "tabWlBsCtnPcEditPanel", enableTabScroll: true, items: [ this.paneladd, this.panelFee ] }); Ext.apply(this, { items: [this.panelTop, this.tabWlBsCtnPc] }); //#endregion parentWin = window.parent.opener; this.InitData(); this.LoadMustBe(); }, //end initUIComponents //#region 加载数据 InitData: function () { this.opStatus = 'add'; var condition = ''; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; this.selectPGID = ret[3]; } if (this.opStatus == 'edit') condition = " BillNo='" + this.editRecord.get('BillNo') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/TruckMng/PcHeadEdit_WFSD/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; } var data = result.data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); if (this.opStatus == 'add') { var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); field = this.formEdit.getForm().findField('LrDate'); field.setValue(mydatestr); } if (this.selectPGID != '') { var PGid = this.formEdit.getForm().findField('PGid'); PGid.setValue(this.selectPGID); if (this.editRecord != NaN && this.editRecord != null) { this.formEdit.getForm().findField('CustomerName').setValue(this.editRecord.get('CustomerName')); this.formEdit.getForm().findField('F_CustomerName').setValue(this.editRecord.get('F_CustomerName')); this.formEdit.getForm().findField('LinkMan').setValue(this.editRecord.get('LinkMan')); this.formEdit.getForm().findField('CustName').setValue(this.editRecord.get('CustName')); this.formEdit.getForm().findField('DispatchName').setValue(this.editRecord.get('DispatchName')); this.formEdit.getForm().findField('BLTYPE').setValue('派车分票'); this.formEdit.getForm().findField('DstArea').setValue(this.editRecord.get('DstArea')); this.formEdit.getForm().findField('DetiNation').setValue(this.editRecord.get('DetiNation')); this.formEdit.getForm().findField('LoadPlace').setValue(this.editRecord.get('LoadPlace')); this.formEdit.getForm().findField('PcBillType').setValue(this.editRecord.get('PcBillType')); this.formEdit.getForm().findField('ExpDate').setValue(this.editRecord.get('ExpDate')); this.formEdit.getForm().findField('ArriveDate').setValue(this.editRecord.get('ArriveDate')); this.formEdit.getForm().findField('ReturnDate').setValue(this.editRecord.get('ReturnDate')); this.formEdit.getForm().findField('TruckNo').setValue(this.editRecord.get('TruckNo')); } } if (data.PCSTATUSREF != '完成') { this.setSaveBtnStatus(true); } else { this.setSaveBtnStatus(false); } var editp = Ext.create('PCmb', data); // if (this.opStatus == 'add') { // var arrNewRecords = this.StoreList.insert(0, data); // this.editRecord = arrNewRecords[0]; // } // else if (this.opStatus == 'edit') { // var editp = Ext.create('PCmb', data); // this.editRecord.fields.each(function (field) { // if (field.persist) { // name = field.name; // if (name != 'id') // this.editRecord.set(name, editp.get(name)); // } // }, this); // this.editRecord.commit(); // } this.LoadFeeData(editp); this.storeBodyList.load({ params: { condition: " d.BSNO='" + data.BillNo + "'" } }); if (data.CustomerName != '') { var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + data.CustomerName + "')"; this.storeInfoClientContact.load({ params: { condition: s} }); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate LoadFeeData: function (EditRecord) { this.panelFee.EditRecord = EditRecord; var bsno = EditRecord.get('gId'); this.panelFee.strBSNO = bsno; this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: bsno} }); this.panelFee.StoreUnit.load({ params: { bsno: bsno, bstype: "tMsWlPcHead"} }); this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: "tMsWlPcHead"} }); this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "tMsWlPcHead"} }); this.panelFee.storeBodySum.load({ params: { bsno: bsno, optype: "tMsWlPcHead" }, callback: function (r, options, success) { if (success) { _thisfee.setTotalHead(); } } }); this.panelFee.storeChFeeGain.load({ params: { bsno: bsno, optype: "tMsWlPcHead"} }); }, // end LoadDate getContractNo: function () { var CUSTOMERNAME = this.formEdit.getForm().findField('CustName').getValue(); var GOODSNAME = this.formEdit.getForm().findField('GoodsName').getValue(); var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').getValue(); var PORTDISCHARGE = this.formEdit.getForm().findField('DstArea').getValue(); if (CUSTOMERNAME != '' && GOODSNAME != '' && PORTLOAD != '' && PORTDISCHARGE != '') { var sql = " CUSTOMERNAME='" + CUSTOMERNAME + "' and TRANTYPE='集装箱' and BSSTATUS='审核通过' and GID IN (SELECT TEMPLATEID FROM Cust_Truck_feetemplatedetail WHERE LOADPORT='" + PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "')"; 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.formEdit.getForm().findField('CONTRACTNO').setValue(member.data.CONTRACTNO); this.formEdit.getForm().findField('TEMPLATENAME').setValue(member.data.TEMPLATENAME); if (member.data.CONTRACTNO != '' && member.data.TEMPLATENAME != '') { var s = " TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + member.data.TEMPLATENAME + "' and CONTRACTNO='" + member.data.CONTRACTNO + "' and TRANTYPE='集装箱')"; this.storeFeeTemplateDetail.load({ params: { condition: s }, scope: this }); } } else { this.formEdit.getForm().findField('CONTRACTNO').setValue(''); this.formEdit.getForm().findField('TEMPLATENAME').setValue(''); } } }, waitMsg: "正在查询数据...", scope: this }); } }, //#endregion Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } basicForm.findField('BillNo').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('BillNo').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/PcHeadEdit_WFSD/SaveWFSD', 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.formEdit.getForm().setValues(returnData); if (returnData.PCSTATUSREF != '完成') { this.setSaveBtnStatus(true); } else { this.setSaveBtnStatus(false); } 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('PCmb', 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'; basicForm.findField('BillNo').setDisabled(true); } else if (type == '1') { window.close(); } else { this.LoadData('add', ''); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onRefreshClick: function (button, event) { var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, 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 rec = selectedRecords[0]; var CustomerName = this.formEdit.getForm().findField('CustomerName').getRawValue(); if (CustomerName == '') { CustomerName = rec.data.CustName; this.formEdit.getForm().findField('CustomerName').setValue(CustomerName); } var LinkMan = this.formEdit.getForm().findField('LinkMan').getValue(); if (LinkMan == '') { LinkMan = rec.data.CustLikeManName; this.formEdit.getForm().findField('LinkMan').setValue(LinkMan); } var MblNoSe = this.formEdit.getForm().findField('MblNoSe').getValue(); if (MblNoSe == '') { MblNoSe = rec.data.MblNo; this.formEdit.getForm().findField('MblNoSe').setValue(MblNoSe); } var LoadPlace = this.formEdit.getForm().findField('LoadPlace').getRawValue(); if (LoadPlace == '') { LoadPlace = rec.data.PORTLOAD; this.formEdit.getForm().findField('LoadPlace').setValue(LoadPlace); } var DstArea = this.formEdit.getForm().findField('DstArea').getRawValue(); if (DstArea == '') { DstArea = rec.data.DstArea; this.formEdit.getForm().findField('DstArea').setValue(DstArea); } var CustLikeManName = this.formEdit.getForm().findField('CustLikeManName').getValue(); if (CustLikeManName == '') { CustLikeManName = rec.data.DetiLinkMan; this.formEdit.getForm().findField('CustLikeManName').setValue(CustLikeManName); } var VoyVeg = this.formEdit.getForm().findField('VoyVeg').getValue(); if (VoyVeg == '') { VoyVeg = rec.data.VoyVeg; this.formEdit.getForm().findField('VoyVeg').setValue(VoyVeg); } var EtDate = this.formEdit.getForm().findField('EtDate').getRawValue(); if (EtDate == '') { EtDate = rec.data.EtDate; this.formEdit.getForm().findField('EtDate').setValue(EtDate); } var EndPortDate = this.formEdit.getForm().findField('EndPortDate').getRawValue(); if (EndPortDate == '') { EndPortDate = rec.data.EndPortDate; this.formEdit.getForm().findField('EndPortDate').setValue(EndPortDate); } var YardName = this.formEdit.getForm().findField('YardName').getValue(); if (YardName == '') { YardName = rec.data.SendYardName; this.formEdit.getForm().findField('YardName').setValue(YardName); } var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; // if (rec.data.CUSTOMERNAME == CUSTOMERNAME) bodyAddDatas.push(rec); } var jsonBody = ConvertRecordsToJsonAll(bodyAddDatas); var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! return; } //this.formEdit.getForm().findField('BSNO').setDisabled(false); var data = this.formEdit.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWlBsCtn/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.formEdit.getForm().reset(); this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('PCmb', 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.BillNo + "'" } }); this.storeBodyAddList.reload(); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } 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.formEdit.getForm().findField('CustomerName').getRawValue(); if (CustomerName == '') { CustomerName = rec.data.CustName; this.formEdit.getForm().findField('CustomerName').setValue(CustomerName); } var LinkMan = this.formEdit.getForm().findField('LinkMan').getValue(); if (LinkMan == '') { LinkMan = rec.data.CustLikeManName; this.formEdit.getForm().findField('LinkMan').setValue(LinkMan); } var MblNoSe = this.formEdit.getForm().findField('MblNoSe').getValue(); if (MblNoSe == '') { MblNoSe = rec.data.MblNo; this.formEdit.getForm().findField('MblNoSe').setValue(MblNoSe); } var LoadPlace = this.formEdit.getForm().findField('LoadPlace').getRawValue(); if (LoadPlace == '') { LoadPlace = rec.data.DetiNation; this.formEdit.getForm().findField('LoadPlace').setValue(LoadPlace); } var CustLikeManName = this.formEdit.getForm().findField('CustLikeManName').getValue(); if (CustLikeManName == '') { CustLikeManName = rec.data.DetiLinkMan; this.formEdit.getForm().findField('CustLikeManName').setValue(CustLikeManName); } var VoyVeg = this.formEdit.getForm().findField('VoyVeg').getValue(); if (VoyVeg == '') { VoyVeg = rec.data.VoyVeg; this.formEdit.getForm().findField('VoyVeg').setValue(VoyVeg); } var EtDate = this.formEdit.getForm().findField('EtDate').getRawValue(); if (EtDate == '') { EtDate = rec.data.EtDate; this.formEdit.getForm().findField('EtDate').setValue(EtDate); } var EndPortDate = this.formEdit.getForm().findField('EndPortDate').getRawValue(); if (EndPortDate == '') { EndPortDate = rec.data.EndPortDate; this.formEdit.getForm().findField('EndPortDate').setValue(EndPortDate); } var YardName = this.formEdit.getForm().findField('YardName').getValue(); if (YardName == '') { YardName = rec.data.SendYardName; this.formEdit.getForm().findField('YardName').setValue(YardName); } var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; // if (rec.data.CUSTOMERNAME == CUSTOMERNAME) bodyAddDatas.push(rec); } var jsonBody = ConvertRecordsToJsonAll(bodyAddDatas); var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! return; } //this.formEdit.getForm().findField('BSNO').setDisabled(false); var data = this.formEdit.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWlBsCtn/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.formEdit.getForm().reset(); this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('PCmb', 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.BillNo + "'" } }); this.storeBodyAddDetailList.reload(); btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务! } 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: '没有选择要添加的业务! } } }); }, 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/MsWlBsCtn/DeletetruckDetail', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeBodyList.remove(rec); Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, onUpTransStatusClick: function (transstatus) { //var BSSTATUSREF = this.formHead.getForm().findField('BSSTATUSREF').getValue(); //if (BSSTATUSREF == "锁定") { // Ext.Msg.show({ title: '提示', msg: '业务已锁定不允许更新状态!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} var data = this.formEdit.getForm().getValues(false, false, false); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWlBsCtn/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.formEdit.getForm().reset(); this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('PCmb', 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.BillNo + "'" } }); this.storeBodyAddDetailList.reload(); } 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 }); } } }); }, getCustName: function () { var custName = this.formEdit.getForm().findField('CustName'); return custName.getValue(); }, onSubmitAuditClick: function (button, event) { var records = this.feeGridCheckBoxModel.selected.items; DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..'); }, 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.formEdit.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 }); }, PrevRecord: function () { var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (j == this.StoreList.count) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } j = j - 1; this.editRecord = this.StoreList.getAt(j); // this.BsNo = this.editRecord.get('BSNO'); this.opStatus = 'edit'; var condition = " BillNo='" + this.editRecord.get('BillNo') + "'"; this.LoadData(this.opStatus, condition); }, NextRecord: function () { var j = this.StoreList.indexOf(this.editRecord); if (j == (this.StoreList.count - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } j = j + 1; this.editRecord = this.StoreList.getAt(j); // this.BsNo = this.editRecord.get('BSNO'); this.opStatus = 'edit'; var condition = " BillNo='" + this.editRecord.get('BillNo') + "'"; this.LoadData(this.opStatus, condition); }, setSaveBtnStatus: function (enable) { var bsbtnSave = Ext.getCmp('bsbtnSave'); var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose'); var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew'); if (enable) { bsbtnSave.enable(); bsbtnSaveAndClose.enable(); bsbtnSaveAndNew.enable(); } else { bsbtnSave.disable(); bsbtnSaveAndClose.disable(); bsbtnSaveAndNew.disable(); } }, getFeeStatus: function () { var basicForm = this.formEdit.getForm(); var feeStatus = basicForm.findField('FeeStatus').value; return feeStatus; } , getBillStatus: function () { var basicForm = this.formEdit.getForm(); var billStatus = basicForm.findField('BillStatus').value; return billStatus; }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ""; var TRANSSTATUS = form.findField('TRANSSTATUS').getValue(); sql = sql + getAndConSql(sql, TRANSSTATUS, "TRANSSTATUS='" + TRANSSTATUS + "'"); var billNo = form.findField('BillNo').getValue(); sql = sql + getAndConSql(sql, billNo, "BillNo like '%" + billNo + "%'"); var custDate_Min = form.findField('CustDate_Min').getRawValue(); sql = sql + getAndConSql(sql, custDate_Min, "CustDate >= '" + custDate_Min + "'"); var custDate_Max = form.findField('CustDate_Max').getRawValue(); sql = sql + getAndConSql(sql, custDate_Max, "CustDate <= '" + custDate_Max + " 23:59:59'"); var CustCode = form.findField('CustCode').getValue(); sql = sql + getAndConSql(sql, CustCode, "CustCode like '%" + CustCode + "%'"); var mblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, mblNo, "MblNo like '%" + mblNo + "%'"); var expDate_Min = form.findField('ExpDate_Min').getRawValue(); sql = sql + getAndConSql(sql, expDate_Min, " BillNo in (select BS_BILLNO from v_BSPCList where PC_BILLNO in (select BILLNO from tMsWlPcHead where ExpDate>='" + expDate_Min + "'))"); var expDate_Max = form.findField('ExpDate_Max').getRawValue(); sql = sql + getAndConSql(sql, expDate_Max, " BillNo in (select BS_BILLNO from v_BSPCList where PC_BILLNO in (select BILLNO from tMsWlPcHead where ExpDate<='" + expDate_Min + " 23:59:59'))"); var voyVeg = form.findField('VoyVeg').getValue(); sql = sql + getAndConSql(sql, voyVeg, "VoyVeg like '%" + voyVeg + "%'"); sql = sql + getAndConSql(sql, voyVeg, "VoyVegSe like '%" + voyVeg + "%'"); var NeedArriveDate_Min = form.findField('NeedArriveDate_Min').getRawValue(); sql = sql + getAndConSql(sql, NeedArriveDate_Min, " NeedArriveDate>='" + NeedArriveDate_Min + "'"); var NeedArriveDate_Max = form.findField('NeedArriveDate_Max').getRawValue(); sql = sql + getAndConSql(sql, NeedArriveDate_Max, " NeedArriveDate<='" + NeedArriveDate_Max + " 23:59:59'"); var ExpDate_Min = form.findField('ExpDate_Min').getRawValue(); sql = sql + getAndConSql(sql, ExpDate_Min, " NeadLoadDate>='" + ExpDate_Min + "'"); var ExpDate_Max = form.findField('ExpDate_Max').getRawValue(); sql = sql + getAndConSql(sql, ExpDate_Max, " NeadLoadDate<='" + ExpDate_Max + " 23:59:59'"); var DstArea = form.findField('DstArea').getValue(); sql = sql + getAndConSql(sql, DstArea, " DstArea like '%" + DstArea + "%' "); return sql; }, Print: function () { var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('BillNo').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var gid = basicForm.findField('GId').value; Ext.Ajax.request({ waitMsg: '正在查询数据...', url: '/TruckMng/MsWlBs/GetIsPrint', async: false, params: { billno: billNo, Gid: gid }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { var printType = 'MSWLBS'; var sql1 = "SET LANGUAGE 'us_english ' " + " select * from vMsWlBsHeadPrint WHERE BillNo = '" + billNo + "' order by BillNo"; var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'"; //var sql3 = "SET LANGUAGE 'us_english' " // + " select * from vMsWlPcHeadPrint where RefBillNo='" + billNo + "' order by RefBillNo"; //var sql4 = "SET LANGUAGE 'us_english' select * from ch_fee where BSNO in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BsNo"; var sql3 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A, ch_fee B where A.Gid=B.BsNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo"; //var sql4 = "SET LANGUAGE 'us_english' select * from tMsWlPcFixed where BillNo in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BillNo"; var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo"; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, DispatchTruck: function () { }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeBodyAddList; ret[2] = this.SelectedRecord; ret[3] = false; return ret; }, setBtnOnlyQuery: function () { var bsbtnSave = Ext.getCmp('bsbtnSave'); var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose'); var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew'); var bsbtnNew = Ext.getCmp('bsbtnNew'); bsbtnSave.setVisible(false); bsbtnSaveAndClose.setVisible(false); bsbtnSaveAndNew.setVisible(false); bsbtnNew.setVisible(false); } });