Ext.namespace('Shipping'); Shipping.ReceiptEditGrid = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.ReceiptEditGrid.superclass.constructor.call(this); }; Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; } Ext.extend(Shipping.ReceiptEditGrid, Ext.Panel, { ParentWin: null, //弹出式 ParentPanel: null, //Tab页编辑模式 OpStatus: 'add', StoreBill: null, StoreCustType: null, EditRecord: null, RefBillNo: '*', DataLoading: true, stroplb: '', strBSNO: '', strMBLNO: '', _First: true, OprationSwap: function () { var ret = new Array(); ret[0] = this.stroplb; ret[1] = this.storeDrOpReceipt; return ret; }, initUIComponents: function () { this.formname = "formRptOpReceiptIndex"; //页面名称 this.ReceiptDrSerialNo = 0; this.ReceiptDrBodyDel = []; this.Loading = true; this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsReceiptOP', proxy: { url: '/MvcShipping/MsOpReceipt/GetReceiptOpRang' } }); //明细表-数据集 this.storeDrOpReceipt = Ext.create('Ext.data.Store', { model: 'MsOpReceiptEntity', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsOpReceipt/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeOpCode, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); this.cellEditingDrOpReceipt = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.ReceiptDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _this = this; //键值维护表_贸易方式 this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='单据类型'"} }); this.comboxRECEIPTTYPE = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '单据类型', store: this.storeCrmKeyCodeCode, forceSelection: true, name: 'RECEIPTTYPE', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); // this.columns = [{ sortable: true, dataIndex: 'GID', header: '惟一编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'RECEIPTNO', header: Zi.LAN.RECEIPTNO, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 100 }, { sortable: true, dataIndex: 'RECEIPTTYPE', header: Zi.LAN.RECEIPTTYPE, editor: this.comboxRECEIPTTYPE, width: 80 }, { sortable: true, dataIndex: 'DOCNUM', header: Zi.LAN.DOCNUM, //'件数', width: 60, editor: { xtype: 'numberfield', allowBlank: false, selectOnFocus: true } }, { sortable: true, dataIndex: 'RECEIVE_MAN', header: Zi.LAN.RECEIVE_MAN, //editor: SHOWNAME, editor: this.comboxCUSTSERVICE, width: 80 }, { sortable: true, dataIndex: 'RECEIVE_DATE', header: Zi.LAN.RECEIVE_DATE, renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y',结果是”09/24/2008” editor: { //dateFormat: Ext.util.Format.dateRenderer('Y-m-d'), format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'SEND_MAN', header: Zi.LAN.SEND_MAN, //editor: SHOWNAME, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 80 }, { sortable: true, dataIndex: 'SEND_DATE', header: Zi.LAN.SEND_DATE, renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y',结果是”09/24/2008” editor: { //dateFormat: Ext.util.Format.dateRenderer('Y-m-d'), format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'TRANCER', header: Zi.LAN.TRANCER, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 80 }, { sortable: true, dataIndex: 'TRANCNO', header: Zi.LAN.TRANCNO, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 80 }, { sortable: true, dataIndex: 'ISREPEAT', header: Zi.LAN.ISREPEAT, //xtype: "checkboxfield", //xtype:"booleancolumn", //trueText: "是", //falseText: " ", editor: { xtype: 'checkboxfield' }, width: 60 }, { sortable: true, dataIndex: 'REPEAT_MAN', header: Zi.LAN.REPEAT_MAN, //editor: SHOWNAME, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 80 }, { sortable: true, dataIndex: 'REPEAT_DATE', header: Zi.LAN.REPEAT_DATE, renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y',结果是”09/24/2008” editor: { //dateFormat: Ext.util.Format.dateRenderer('Y-m-d'), format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'ISRECEIVE', header: Zi.LAN.ISRECEIVE, editor: { xtype: 'checkboxfield' }, width: 60 }, { sortable: true, dataIndex: 'RETURN_MAN', header: Zi.LAN.RETURN_MAN , //editor: SHOWNAME, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 80 }, { sortable: true, dataIndex: 'RETURN_DATE', header: Zi.LAN.RETURN_DATE, renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y',结果是”09/24/2008” editor: { //dateFormat: Ext.util.Format.dateRenderer('Y-m-d'), format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'RETURN_TRANCER', header: Zi.LAN.RETURN_TRANCER, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 100 }, { sortable: true, dataIndex: 'RETURN_TRANCNO', header: Zi.LAN.RETURN_TRANCNO, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 100 }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.REMARK, editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { _this.onNextKeyClick(17) } } } }, width: 200 }, { sortable: true, dataIndex: 'CORPID', header: '分公司代码', hidden: true, width: 0 }, { sortable: true, dataIndex: 'CREATEUSER', header: Zi.LAN.CREATEUSER, width: 0 }, { sortable: true, dataIndex: 'CREATETIME', header: Zi.LAN.CREATETIME, width: 0 }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: Zi.LAN.MODIFIEDUSER, width: 0 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: Zi.LAN.MODIFIEDTIME, width: 0 }]; this.gridDrOpReceipt = new Ext.grid.GridPanel({ store: this.storeDrOpReceipt, enableHdMenu: false, region: 'center', id: 'gridDrOpReceipt', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditingDrOpReceipt], selModel: this.ReceiptDrGridCheckBoxModel, selType: 'cellmodel', viewConfig: { autoFill: true // getRowClass: function (record, rowIndex, rowParams, store) { // var ReceiptStatus = record.get('ReceiptStatus'); // return Shipping.ReceiptGetRowClass(ReceiptStatus);//判断行颜色 // } }, tbar: [{ text: '', tooltip: Zi.LAN.XinJian, iconCls: "btnadd", handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, '-', { text: '', tooltip: Zi.LAN.BaoCun, iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(button, event); }, scope: this }, '-', { text: '', tooltip: Zi.LAN.ShanChu, iconCls: "btndelete", handler: function (button, event) { this.onDelDetailClick(button, event); }, scope: this }, '-', { text: '', tooltip: Zi.LAN.CheXiao, iconCls: "btncancel", handler: function (button, event) { this.onCancelDetailClick(button, event); }, scope: this }, '-', { text: '', tooltip: Zi.LAN.ShuaXin, iconCls: "btnrefresh", handler: function (button, event) { this.storeDrOpReceipt.load({ params: { billno: this.strBSNO, optype: this.stroplb} }); }, scope: this }, '-', { text: '', tooltip: Zi.LAN.btnprint, iconCls: "btnprint", menu: [{ text: Zi.LAN.btnprint, menu: [{ text: Zi.LAN.PrintSelect, handler: function (menu, event) { _this.onPrintSelectDetailClick(menu, event); } }, { text: Zi.LAN.Print, handler: function (menu, event) { _this.onPrintAllDetailClick(menu, event); } }] }, '-', ], scope: this }, '-', { text: Zi.LAN.QueRenSongDan, //iconCls: "btnreset", handler: function (button, event) { this.onSetRECEIPT("SEND"); }, scope: this }, { text: Zi.LAN.QueRenHuiDan, //iconCls: "btnreset", handler: function (button, event) { this.onSetRECEIPT("REPEAT"); }, scope: this }, { text: Zi.LAN.QueRenHuanDan, //iconCls: "btnreset", handler: function (button, event) { this.onSetRECEIPT("RETURN"); }, scope: this }, '-', { text: Zi.LAN.btntest, id: "btntest", handler: function (button, event) { var formname = this.formname; var tempcolumns = this.gridDrOpReceipt.columns; DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.columns, 0, true); }, scope: this }], columns: this.columns }); _this = this; /////////////以下部分为获取存储的gridpanel显示样式 this.columns = DsTruck.GetGridPanel(USERID, this.formname, this.columns); //使用者id,表名 ,中间column数组,跳过一开始的几列 //this.girdcolums.unshift(new Ext.grid.RowNumberer()); this.gridDrOpReceipt.reconfigure(this.storeDrOpReceipt, this.columns); //////////////////////////// this.cellEditingDrOpReceipt.on('beforeedit', function (editor, e) { return this.cellEditingOpReceiptBeforeEdit(editor, e); }, this); this.gridDrOpReceipt.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { billno: _this.strBSNO, optype: _this.stroplb }); }, this); //#endregion //#region 明细表-单据图片档案管理 this.storeISOPEN = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeISOPEN.add({ "FSTATUS": "1", "NAME": "公开" }); this.storeISOPEN.add({ "FSTATUS": "0", "NAME": "不公开" }); this.comboxISOPEN = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '海运费', store: this.storeISOPEN, valueField: 'FSTATUS', displayField: 'NAME', // flex: 0.7, // labelWidth: 55, forceSelection: true, name: 'ISPUBLIC' }); this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: true, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.DocCM = Ext.create('Ext.selection.CheckboxModel'); this.gridDocList = new Ext.grid.GridPanel({ store: this.storeDocList, enableHdMenu: false, region: 'center', // width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: Zi.LAN.ShanChu, tooltip: Zi.LAN.ShanChu, iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: Zi.LAN.SHANGCHUANFUJIAN, tooltip: Zi.LAN.SHANGCHUANFUJIAN, iconCls: "btnadddetail", handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }, '-', { text: Zi.LAN.PLUPLOAD, tooltip: Zi.LAN.PLUPLOAD, iconCls: "btnadddetail", handler: function (button, event) { this.UploadFile("", ""); }, scope: this }, '-', { text: Zi.LAN.BaoCun, tooltip: Zi.LAN.BaoCun, // iconCls: "btnadddetail", handler: function (button, event) { this.onPostFileClick(button, event); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'R_GID', header: 'R_GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, dataIndex: 'URL', header: Zi.LAN.WENJIANMINGCHENG, width: 200, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'RECEIPTTYPE', header: Zi.LAN.FUJIANLEIXING , width: 135 }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERRef', header: Zi.LAN.SHANGCHUANREN, width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: Zi.LAN.SHANGCHUANSHIJIAN , width: 135 }, { sortable: true, dataIndex: 'DOCUMENTATTACHEDCODE', header: Zi.LAN.SUIFUDANZHENGDAIM, //需求编号:SR2017081100003 width: 120 }, { sortable: true, dataIndex: 'DOCUMENTATTACHEDNO', header: Zi.LAN.SUIFUDANZHENGBIANHAO, //需求编号:SR2017081100003 width: 120 }, { sortable: true, dataIndex: 'ISPUBLIC', header: Zi.LAN.ISPUBLIC, editor: this.comboxISOPEN, width: 80, renderer: function (value, cellmeta) { if (value == '1') { return Zi.LAN.GONGKAI; } else return Zi.LAN.BUGONGKAI; } } ] }); this.storeDocList.on('beforeload', function (store) { var condition = _this.strBSNO; var condition2 = " BSNO='" + condition + "' "; Ext.apply(store.proxy.extraParams, { condition: condition2 }); }, this); // this.gridDocList.getSelectionModel().on('select', function (model, record, index) { // if (this.Loading == true) { // return; // } // var PICURL = record.data.Driect_URL; // if ((PICURL!=undefined)&&(PICURL!='')) // Ext.getCmp('panelPic').body.update(' '); // }, this); // this.panelPic = new Ext.Panel({ // id: "panelPic", // layout: "fit", // region: "center", // autoScroll: true, // frame: false, // html: ' '//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg // }); this.panelDoc = new Ext.Panel({ id: "panelDoc", layout: "border", region: "center", //autoScroll: true, frame: false, split: true, items: [this.gridDocList] }); //#endregion this.panelReceipt = new Ext.Panel({ //layout: "anchor", layout: "border", anchor: '100% 50%', height: 350, region: 'north', items: [ this.gridDrOpReceipt ] }); //#region 布局 Ext.apply(this, { items: [this.panelReceipt, this.panelDoc, this.formtotal] }); //#endregion this.opStatus = 'add'; this.InitData(); }, //end initUIComponents //#region 加载数据 InitData: function () { var condition = ''; this.LoadData(this.opStatus, condition, this.RefBillNo); }, //end InitData LoadData: function (opstatus, condition, refbillno) { this.opStatus = opstatus; }, // end LoadDate //#endregion //#region 明细操作 onNextKeyClick: function (col) { var rows = this.gridDrOpReceipt.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridDrOpReceipt.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridDrOpReceipt.getStore().getCount()) { this.onAddDetailClick(s, event); } else { this.cellEditingDrOpReceipt.startEditByPosition({ row: number, column: col }); } }, onAddDetailClick: function (button, event) { var store = this.storeDrOpReceipt; var newSerialno = this.GetHandleSerialNo(store); var newsort = store.getCount() + 1; var myDate = new Date(); //myDate = this.GetDateStr(0); var record = null; record = Ext.create('MsOpReceiptEntity', { GID: NewGuid(), // 惟一编号 BSNO: '*', // 关联编号/业务编号BSNO RECEIPTNO: '', // 单据编号 RECEIPTTYPE: '', // 单据类型 RECEIVE_MAN: SHOWNAME, // 接单人 RECEIVE_DATE: myDate, // 接单日期 DOCNUM:0, SEND_MAN: '', // 送单人 SEND_DATE: null, // 送单日期 TRANCER: '', // 送单的快递公司 TRANCNO: '', // 送单的快递单号 ISREPEAT: 'false', // 是否回单 REPEAT_MAN: '', // 回单人 REPEAT_DATE: null, // 回单日期 ISRECEIVE: 'false', // 是否还单 RETURN_MAN: '', // 还单人 RETURN_DATE: null, // 还单日期 RETURN_TRANCER: '', // 还单的快递公司 RETURN_TRANCNO: '', // 还单的快递单号 REMARK: '', // 备注 CORPID: '', // 分公司代码 CREATEUSER: USERID, // 创建人GID CREATETIME: null, // 创建时间 MODIFIEDUSER: USERID, // 更改操作人GID MODIFIEDTIME: null // 更改操作时间 //Sort: newSerialno, }); store.add(record); var editColumnIndex = 1; var cellediting = this.cellEditingDrOpReceipt; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex }); }, onCancelDetailClick: function (menu, event) { var store = this.storeDrOpReceipt; for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); member.reject(); } }, GetHandleSerialNo: function (store) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (member.data.Sort > result) { result = member.data.Sort; } } } result = parseInt(result) + 1; return result; }, //获取日期 GetDateStr: function (AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; }, //#endregion //#region 单据确认 onSetRECEIPT: function (onSetType) { var ReceiptGIDSql = ''; var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items; var candelete = this.CheckOpReceiptDelete(selectedRecords); if (candelete == false) { return; } if (selectedRecords.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingYaoCaoZuoXuanZhongDeShuJuMa, function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BSNO == "*") {//如果是新增但没有保存的数据,没有必要提交到后台 this.storeDrOpReceipt.remove(selectedRecords[i]); } else { var ReceiptGID = "'" + rec.data.GID + "'"; if (ReceiptGIDSql == '') { ReceiptGIDSql = ReceiptGID; } else { ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID; } } } } _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiChaXunShuJu); if (ReceiptGIDSql != '') { Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsOpReceipt/onSetRECEIPT', params: { BSNO: _this.strBSNO, gids: ReceiptGIDSql, onSetType: onSetType }, callback: function (options, success, response) { if (success) { //Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { } this.storeDrOpReceipt.reload(); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); }, //#endregion //#region 删除 onDelDetailClick: function (button, event) { var ReceiptGIDSql = ''; var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items; var candelete = this.CheckOpReceiptDelete(selectedRecords); if (candelete == false) { return; } if (selectedRecords.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYaoShanChuDeJiLu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.BSNO == "*") {//如果是新增但没有保存的数据,没有必要提交到后台 this.storeDrOpReceipt.remove(selectedRecords[i]); } else { var ReceiptGID = "'" + rec.data.GID + "'"; if (ReceiptGIDSql == '') { ReceiptGIDSql = ReceiptGID; } else { ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID; } } } } _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); if (ReceiptGIDSql != '') { Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsOpReceipt/Delete', params: { BSNO: _this.strBSNO, data: ReceiptGIDSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeDrOpReceipt.remove(selectedRecords[i]); } Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message.replace("删除成功", Zi.LAN.DeleteSuccess), icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message.replace("删除错误", Zi.LAN.DeleteErro), icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); }, //#endregion //#region 操作权限判断 CheckOpReceiptDelete: function (records) { for (var i = 0; i < records.length; i++) { var rec = records[i]; var MODIFIEDUSER = rec.data.MODIFIEDUSER; var recop = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', MODIFIEDUSER); if (recop.getCount() > 0) { } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MEIYOUQUANXIAN, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canDelete = false; } } return true; }, //#endregion //#region 保存 onPostDetailClick: function (button, event) { var bodyDrOpReceiptDatas = []; for (var i = 0; i < this.storeDrOpReceipt.getCount(); i += 1) { var memberyf = this.storeDrOpReceipt.getAt(i); bodyDrOpReceiptDatas.push(memberyf); }; var jsonOpReceiptBody = ConvertFeeRecordsToJson(bodyDrOpReceiptDatas); // _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsOpReceipt/Save', scope: this, params: { BSNO: _this.strBSNO, OpReceiptbody: jsonOpReceiptBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < this.storeDrOpReceipt.getCount(); i += 1) { var member = this.storeDrOpReceipt.getAt(i); member.set("BSNO", _this.strBSNO); member.commit(); } } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save //#endregion //#region 表格的AfterEdit setHeadFieldValue: function (fieldName, value) { var field = this.formtotal.getForm().findField(fieldName); field.setValue(value); }, //#endregion //#region 修改权限判断 cellEditingOpReceiptBeforeEdit: function (editor, e) { var MODIFIEDUSER = e.record.get('MODIFIEDUSER'); var records = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', MODIFIEDUSER); if (records.getCount() > 0) { } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.MEIYOUQUANXIAN, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); canedit = false; } return true; }, //#endregion //#region 其他 refBillNoSeChange: function (field, newValue, oldValue) { // if (newValue != oldValue) { // alert(newValue + "," + oldValue); // } }, getBillStatus: function () { // var basicForm = this.formEdit.getForm(); // var billStatus = basicForm.findField('BillStatus').value; // return billStatus; }, getCustName: function () { // var custName = this.formEdit.getForm().findField('RefCustomerName'); //return custName.getValue(); }, //#endregion //#region 保存 setSaveBtnStatus: function (enable) { var bsbtnSave = Ext.getCmp('pcbtnSave'); var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose'); var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew'); var pcbtnNew = Ext.getCmp('pcbtnNew'); if (enable) { bsbtnSave.enable(); bsbtnSaveAndClose.enable(); bsbtnSaveAndNew.enable(); pcbtnNew.enable(); } else { bsbtnSaveAndNew.disable(); pcbtnNew.disable(); } }, //#endregion //#region 上传图片 onAddFileClick: function (button, event) { var myDate = new Date(); var record = Ext.create('ReceiptDocmb', { GID: NewGuid(), RECEIPTTYPE: '', R_GID: '', BSNO: '', //ContractNo URL: '', Driect_URL: '', ISPUBLIC: '0', MODIFIEDUSER: SHOWNAME, MODIFIEDTIME: myDate.format('yyyy-MM-dd hh:mm:ss') }); this.storeDocList.add(record); var n = this.storeDocList.getCount(); this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 }); } , onPostFileClick: function (button, event) { if (USERID == "") { alert(Zi.LAN.DengLuXinXiBuQuan); return; } var billno = this.strBSNO; var bodyDatas = []; var i; for (var i = 0; i < this.storeDocList.getCount(); i += 1) { var member = this.storeDocList.getAt(i); bodyDatas.push(member); } var DocBody = ConvertRecordsToJsonAll(bodyDatas); _this = this; //var Docdatas = []; //var DocBody = ConvertRecordsToJson(Docdatas); //var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel); var _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiBaoCunShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiBaoCunShuJu, url: '/MvcShipping/MsOpReceipt/SaveUploadFile', scope: this, params: { data: DocBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var condition = _this.strBSNO; var condition2 = " BSNO='" + condition + "' "; _this.Loading = true; _this.storeDocList.load({ params: { condition: condition2 }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this, callback: function () { _this.Loading = false; } }); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } //alert('03'); } }); } //end save , onDelFileClick: function (button, event) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.DocCM.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYaoShanChuDeJiLu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeDocList.remove(selectedRecords[i]); } else { var feeGId = "'" + rec.data.GID + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsOpReceipt/DeleteUploadFile', params: { data: feeGidSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeDocList.remove(selectedRecords[i]); } Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message.replace("删除成功", Zi.LAN.DeleteSuccess), icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message.replace("删除错误", Zi.LAN.DeleteErro), icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); } , onUpLoadFileClick: function (button, event) { var billno = this.EditRecord.get("CUSTNO"); //枚举维护表tSysEnumValue_附件类型97048 //需求编号:SR2017081100003 this.storeFileType = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.TSysEnumValueDataModel', proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } }); this.storeFileType.load({ params: { condition: " and EnumTypeID=97048"} }); var comboxFileType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.FUJIANLEIXING, store: this.storeFileType, forceSelection: true, id: 'FILETYPE', name: 'FILETYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); 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: Zi.LAN.QingXuanZeWeiJian, fieldLabel: Zi.LAN.WenJiAN, buttonText: Zi.LAN.QingXuanZeWeiJian, allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }, comboxFileType, { xtype: 'textfield', id: 'DOCUMENTATTACHEDCODE', name: 'DOCUMENTATTACHEDCODE', fieldLabel: Zi.LAN.SUIFUDANZHENGDAIM//需求编号:SR2017081100003 }, { xtype: 'textfield', id: 'DOCUMENTATTACHEDNO', name: 'DOCUMENTATTACHEDNO', fieldLabel: Zi.LAN.SUIFUDANZHENGBIANHAO//需求编号:SR2017081100003 }], buttons: [{ text: Zi.LAN.ShangChuan , type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); // if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) { // Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpReceipt/UploadFile', waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, method: 'POST', submitEmptyText: false, async: false, params: { CUSTNO: billno, BSNO: _this.strBSNO, MBLNO: _this.strMBLNO, TYPE: comboxFileType.getRawValue(), DOCUMENTATTACHEDCODE: Ext.getCmp('DOCUMENTATTACHEDCODE').getValue(), //需求编号:SR2017081100003 DOCUMENTATTACHEDNO: Ext.getCmp('DOCUMENTATTACHEDNO').getValue() //需求编号:SR2017081100003 }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var condition = _this.strBSNO; var condition2 = " BSNO='" + condition + "' "; me.Loading = true; me.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { me.Loading = false; } }); }, failure: function (form, action) { form.reset(); // if (action.failureType == Ext.form.Action.SERVER_INVALID) { // Ext.MessageBox.alert('警告', action.result.errors.msg); // } } }); } }, { text: Zi.LAN.GuanBi, type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: Zi.LAN.ShangChuan, width: 360, height: 200, modal: true, resizable: false, border: false, items: imgform }); win.show(); } , UploadFile: function (uploadFileType, title) { var billno = this.EditRecord.get("CUSTNO"); var BSNO = this.strBSNO; var MBLNO = this.strMBLNO var winUpload = Ext.create('Ext.window.Window', { layout: 'fit', title: Zi.LAN.ShangChuan + title, width: 600, height: 500, modal: true, plain: true, autoScroll: true, bodyStyle: "padding:5px 0 0 5px", items: { xtype: "panel", layout: 'fit', border: false, frame: false, autoScroll: true, html: "" }, buttonAlign: "center", buttons: [{ text: Zi.LAN.GuanBi, handler: function () { winUpload.close(); } }] }); _UploadFileStore = this.storeDocList; _condition = " BSNO='" + BSNO + "' "; _BSNO = BSNO; _CUSTNO = billno; _MBLNO = MBLNO; winFXTZModifyShow = _this.winFXTZModifyShow; extParentWinFrame = winUpload; winUpload.show(); } , //#endregion //#region 打印 onPrintSelectDetailClick: function (button, event) { var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYaoDaYinDeShuJu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (this.stroplb == 'op_Seae') { var printType = 'SEAEDRReceipt'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_seae WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Apply') { var printType = 'APPLYDRReceipt'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_apply WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Seai') { var printType = 'SEAIDRReceipt'; var sql1 = /*"SET LANGUAGE 'us_english' " + */" select * from op_seai WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Bulk') { var printType = 'BULKDRReceipt'; var sql1 = /*"SET LANGUAGE 'us_english' " + */" select * from op_bulk WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_other') { var printType = 'OpOtherReceipt'; var sql1 = /*"SET LANGUAGE 'us_english' " + */" select * from op_other WHERE BSNO = '" + this.strBSNO + "'"; }; var ReceiptGIDSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var ReceiptGID = "''" + record.get('GID') + "''"; if (ReceiptGIDSql == '') { ReceiptGIDSql = ReceiptGID; } else { ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID; } }; var sql2 = ""; if (ReceiptGIDSql != '') { sql2 = sql2 + "select GID as 惟一编号,BSNO as 业务编号,RECEIPTNO as 单据编号,RECEIPTTYPE as 单据类型,RECEIVE_MAN as 接单人,convert(char(10),RECEIVE_DATE,20) as 接单日期,SEND_MAN as 送单人,convert(char(10),SEND_DATE,20) as 送单日期,TRANCER as 送单快递公司,TRANCNO as 送单快递单号,ISREPEAT as 是否回单,REPEAT_MAN as 回单人,convert(char(10),REPEAT_DATE,20) as 回单日期,ISRECEIVE as 是否还单,RETURN_MAN as 还单人,convert(char(10),RETURN_DATE,20) as 还单日期,RETURN_TRANCER as 还单快递公司,RETURN_TRANCNO as 还单快递单号,REMARK as 备注,(select top 1 [NAME] from [company] where gid=op_receipt.CORPID) as 分公司,(select top 1 SHOWNAME from [user] where gid=op_receipt.CREATEUSER) as 创建人,CREATETIME as 创建时间,(select top 1 SHOWNAME from [user] where gid=op_receipt.MODIFIEDUSER) as 最后更改人,MODIFIEDTIME as 最后更改时间 from op_receipt where GID in (" + ReceiptGIDSql + ") order by bsno,MODIFIEDTIME"; } var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, onPrintAllDetailClick: function (button, event) { if (this.stroplb == 'op_Seae') { var printType = 'SEAEDRReceiptALL'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_seae WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Apply') { var printType = 'APPLYDRReceiptALL'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_apply WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Seai') { var printType = 'SEAIDRReceiptALL'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_seai WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_Bulk') { var printType = 'BULKDRReceiptALL'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_bulk WHERE BSNO = '" + this.strBSNO + "'"; } else if (this.stroplb == 'op_other') { var printType = 'OpOtherReceipt'; var sql1 = "SET LANGUAGE 'us_english' " + "select * from op_other WHERE BSNO = '" + this.strBSNO + "'"; }; var sql2 = "SET LANGUAGE 'us_english' select GID as 惟一编号,BSNO as 业务编号,RECEIPTNO as 单据编号,RECEIPTTYPE as 单据类型,RECEIVE_MAN as 接单人,convert(char(10),RECEIVE_DATE,20) as 接单日期,SEND_MAN as 送单人,convert(char(10),SEND_DATE,20) as 送单日期,TRANCER as 送单快递公司,TRANCNO as 送单快递单号,ISREPEAT as 是否回单,REPEAT_MAN as 回单人,convert(char(10),REPEAT_DATE,20) as 回单日期,ISRECEIVE as 是否还单,RETURN_MAN as 还单人,convert(char(10),RETURN_DATE,20) as 还单日期,RETURN_TRANCER as 还单快递公司,RETURN_TRANCNO as 还单快递单号,REMARK as 备注,(select top 1 [NAME] from [company] where gid=op_receipt.CORPID) as 分公司,(select top 1 SHOWNAME from [user] where gid=op_receipt.CREATEUSER) as 创建人,CREATETIME as 创建时间,(select top 1 SHOWNAME from [user] where gid=op_receipt.MODIFIEDUSER) as 最后更改人,MODIFIEDTIME as 最后更改时间 from op_receipt where BSNO='" + this.strBSNO + "' order by bsno,MODIFIEDTIME"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } //#endregion });