Ext.namespace('Shipping'); Shipping.MsOpCtnBsCardRepairAudit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnBsCardRepairAudit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnBsCardRepairAudit, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', PageSize: 100, sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formMsOpCtnBsCardAuditIndex"; //页面名称 //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'MsOpCtnBsCard', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.initgirdcolums = [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'COMPANYID', header: 'COMPANYID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 200 }, { sortable: true, dataIndex: 'CTNPROP', header: '箱属', width: 200 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 200 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 200 }, { sortable: true, dataIndex: 'GOODSNAME', header: '货物名称', width: 100 }, { sortable: true, dataIndex: 'PREGOODSNAME', header: '前装货品名', width: 100 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 100 }, { sortable: true, dataIndex: 'ETA', header: '到港日期', width: 100 }, { sortable: true, dataIndex: 'AGENTNAME', header: '目的港代码', width: 100 }, { sortable: true, dataIndex: 'CUR_PORT', header: '当前位置', width: 100 }, { sortable: true, dataIndex: 'CYCLE_DAY', header: '周期', width: 100 }, { sortable: true, dataIndex: 'IS_RETURE_EMPTY', header: '是否返空', width: 100 }, { sortable: true, dataIndex: 'IS_BOOKING', header: '是否订舱', width: 200 }, { sortable: true, dataIndex: 'I_CUSTNO', header: '返空委托编号', width: 100 }, { sortable: true, dataIndex: 'I_ETD', header: '返空开船日期', width: 200 }, { sortable: true, dataIndex: 'I_ETA', header: '返空进口日期', width: 200 }, { sortable: true, dataIndex: 'I_MBLNO', header: '返空提单号', width: 200 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 200 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 200 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 200 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 200 }, { sortable: true, dataIndex: 'LOADPORT_STATOIN', header: '起运港场站', width: 200 }, { sortable: true, dataIndex: 'LOADPORT_CNT_TIME', header: '起运港提箱日期', width: 200 }, { sortable: true, dataIndex: 'LOADFACTORY', header: '装货工厂', width: 200 }, { sortable: true, dataIndex: 'LOADPORT', header: '起运港', width: 200 }, { sortable: true, dataIndex: 'ARRIVALDATE', header: '到港日期', width: 200 }, { sortable: true, dataIndex: 'DEST_CNT_TIME', header: '目的港提箱日期', width: 200 }, { sortable: true, dataIndex: 'DEST_RTCNT_TIME', header: '目的港还箱日期', width: 200 }, { sortable: true, dataIndex: 'DESTPORT_STATOIN', header: '目的港场站', width: 200 }, { sortable: true, dataIndex: 'DETAIN_CTN_DAYS', header: '滞箱天数', width: 200 }, { sortable: true, dataIndex: 'PRE_CNT_TIME', header: '预计提箱日期', width: 200 }, { sortable: true, dataIndex: 'I_ETD', header: '返空开船日期', width: 200 }, { sortable: true, dataIndex: 'INPUTBYREF', header: '录入人', width: 100 }, { sortable: true, dataIndex: 'INPUTTIME', header: '录入时间', width: 100 } ]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _this = this; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: this.girdcolums , // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { }, this); this.gridList.columns[1] = new Ext.grid.RowNumberer(); //#region 维修 this.storeListRepair = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepair', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListRepairCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.RepairGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListRepair = new Ext.grid.GridPanel({ store: this.storeListRepair, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListRepairCellEditing], selModel: this.RepairGridCheckBoxModel, selType: 'cellmodel', tbar: [{ text: "审核通过", iconCls: "btnadd", handler: function (button, event) { this.onAuditPassClick(); }, scope: this }, '-', { text: "驳回提交", iconCls: "btndelete", handler: function (button, event) { this.onAuditBackClick(); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 150 }, { sortable: true, dataIndex: 'REPAIRITEMS', header: '维修改装项目', width: 150 }, { sortable: true, dataIndex: 'REPAIRTIME', header: '维修改装日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 150 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', width: 150 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 150 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 150 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 150 }, { sortable: true, dataIndex: 'IMAGE1', header: '改装照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', header: '清洁证照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }] }); this.panelRepair = new Ext.Panel({ title: '改装信息', layout: "border", region: 'south', height: 300, animate: true, split: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepair] }); //#endregion //#region formSearch 查询面板 _this = this; //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 _this = this; this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeAddDCType = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeAddDCType.add({ "DC": "", "NAME": "全部" }); this.storeAddDCType.add({ "DC": "1", "NAME": "未审核" }); this.storeAddDCType.add({ "DC": "2", "NAME": "已审核" }); this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审核状态', store: this.storeAddDCType, valueField: 'DC', displayField: 'NAME', forceSelection: true, name: 'DC', value: '1', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', 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: [{ fieldLabel: '箱号', name: 'CTNNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '编号', name: 'BSNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } },this.comboxaddDCType,{ xtype: 'button', width: 90, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { xtype: 'button', width: 90, text: "高级查询", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this }] } ]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { }, scope: this }, '-', { text: "打印", iconCls: 'btnprint', menu: [ { text: "全部", handler: function (menu, event) { _this.Print(); } }, { text: "选择打印", handler: function (menu, event) { _this.PrintSelect(); } }], scope: this }, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: "初始化", handler: function (menu, event) { _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 75, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList, this.panelRepair] }); this.sqlcontext =''; this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); this.storeList.on('load', function (store, records) { if (store.getCount() > 0) { this.gridList.getSelectionModel().select(0); } else { this.storeListRepair.removeAll(); } }, this); this.gridList.getSelectionModel().on('select', function (model, record, index) { var billno = record.data.GID; var sql = ""; sql = " LINKGID='" + billno + "'"; _this.storeListRepair.load({ params: { condition: sql} }); }, this); this.storeListRepair.on('beforeload', function (store) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { this.gridList.getSelectionModel().select(0); } selections = this.gridList.getSelectionModel().getSelection(); var rec = selections[0]; var acondition = " LINKGID='" + rec.data.GID + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.onRefreshClick(); }, //end initUIComponents InitGrid: function (grid) { var agirdcolums = grid; this.gridList.reconfigure(this.storeList, agirdcolums); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onDsQuery: function () { var sql = this.sqlcontext; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onAuditPassClick: function () { var selections = this.gridListRepair.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择需审核的改装信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.AUDITSTATUS; if (BILLSTATUS == '提交审核' || BILLSTATUS == '申请修改') { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnRepair', params: { data: jsonbodyAddDatas, type:'0' }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '审核成功!', 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); }, onAuditBackClick: function () { var selections = this.gridListRepair.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择需驳回的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.AUDITSTATUS; if ((BILLSTATUS == '审核通过' || BILLSTATUS == '提交审核')) { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回数据...'); Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnRepair', params: { data: jsonbodyAddDatas, type: '4' }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '驳回成功!', 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); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var BSNO = form.findField('BSNO').getValue(); sql = sql + getAndConSql(sql, BSNO, " (BSNO like '%" + BSNO + "%' or CUSTNO like '%" + BSNO + "%' or I_CUSTNO like '%" + BSNO + "%' or MBLNO like '%" + BSNO + "%' ) "); var CTNNO = form.findField('CTNNO').getValue(); sql = sql + getAndConSql(sql, CTNNO, "CTNNO='" + CTNNO + "'"); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); var expDateBgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "ETD>='" + expDateBgn + "'"); var expDateEnd = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "ETD<='" + expDateEnd + " 23:59:59'"); var DC = form.findField('DC').getValue(); if (DC != '') { if (DC == '1') { sql = sql + getAndConSql(sql, DC, " EXISTS (select 1 from op_ctnrepair where b.GID=op_ctnrepair.LINKGID AND (AUDITSTATUS='提交审核' OR AUDITSTATUS='申请修改') ) "); } else if (DC == '2') { sql = sql + getAndConSql(sql, DC, " EXISTS (select 1 from op_ctnrepair where b.GID=op_ctnrepair.LINKGID AND AUDITSTATUS='审核通过' ) "); } } return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.GID; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcContainer/MsOpCtnBsCard/GetDataListStr', scope: this, params: { condition: _this.sqlcontext, printstr: 'true', sort: sortstr }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.data; var printType = 'MSOPCTNBSCARD'; var sql1 = returnstr; var sql2 = "select * from op_ctnbscard where GID='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } } }); }, PrintSelect: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var selectedRecords = []; var storeadd = null; selectedRecords = this.GridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('GID') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.GID; } var printType = 'MSOPCTNBSCARDSELECT'; var sql1 = "select * from op_ctnbscard WHERE GID IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select * from op_ctnbscard where GID='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });