Ext.namespace('Shipping'); Shipping.WMSIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.WMSIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.WMSIndex, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, modWmsList: null, modWmsFeeLock: null, modWmsFeeRejected: null, EditRecord: null, //用于从主界面获取 BsNo: '', OPLBNAME: "", initUIComponents: function () { var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit'); if (typeof (mainform.editRecord) == "undefined") { } else { this.EditRecord = mainform.editRecord; //this.BSNO = EditRecord.get('BSNO'); this.BsNo = this.EditRecord.data.BSNO; this.OPLBNAME = this.EditRecord.data.OPLBNAME; if (this.OPLBNAME == "" || this.OPLBNAME == 'undefined') { this.OPLBNAME = "海运进口"; } } //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'WMSmb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/MvcShipping/WMS/GetDataList_Import', reader: { idProperty: 'Feeid', root: 'data', totalProperty: 'totalCount' } } }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.PageSize = field.lastValue; _this.onRefreshClick(); } } } }); this.formname = "WMS_Import"; //this.InWorkFlow=false; //枚举参照 this.column = [{ dataIndex: 'GID', hidden: true, header: '惟一编号', width: 80 }, { dataIndex: 'ISLOCK', header: '是否入账', width: 60, renderer: function (value, cellmeta) { if (value == "1" || value == "True") { return ""; } if (value == "2") { return ""; } if (value == "6") { return ""; } } }, { dataIndex: 'ISCHANGE', header: '是否是货权转移', width: 92, renderer: function (value, cellmeta) { if (value == 'True') { return ""; } } }, { dataIndex: 'WMSNO', header: '入库单号', width: 110 }, { dataIndex: 'WMSDATE', header: '入库日期', width: 80 }, { dataIndex: 'CUSTOMERNAME', header: '货主', width: 80 }, { dataIndex: 'WMSOP', header: '制表人', width: 80 }, { dataIndex: 'STOREMAN', hidden: true, header: '保管人', width: 80 }, { dataIndex: 'CREATEUSER', hidden: true, header: '创建人', width: 80 }, { dataIndex: 'MODIFIEDUSER', hidden: true, header: '最后一次更新操作人', width: 80 }, { dataIndex: 'MODIFIEDTIME', hidden: true, header: '最后一次更新操作时间', width: 80 }, { dataIndex: 'ISDELETE', hidden: true, header: '是否废除', width: 80 }, { dataIndex: 'DELETEUSER', hidden: true, header: '废除人', width: 80 }, { dataIndex: 'DELETETIME', hidden: true, header: '废除时间', width: 80 }, { dataIndex: 'ARCLIENT', header: '应收账款客户名称', width: 80 }, { dataIndex: 'TRUCKNAME', hidden: true, header: '装卸队名称/应付账款客户名称', width: 80 }, { dataIndex: 'LOCKTIME', hidden: true, header: '锁定时间', width: 80 }, { dataIndex: 'LOCKUSER', hidden: true, header: '锁定操作人', width: 80 }, { dataIndex: 'GOODSNAME', header: '货物名称/品名', width: 80 }, { dataIndex: 'GOODSMODEL', hidden: true, header: '型号', width: 80 }, { dataIndex: 'CHARGEUNIT', header: '计费单位', width: 80 }, { dataIndex: 'PUTINTYPE', header: '入库类型', width: 80 }, { dataIndex: 'GOODSPACK', summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '入库件数', width: 80 }, { dataIndex: 'GOODSPACKSTOCK', summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '剩余件数', width: 80 }, { dataIndex: 'GOODSRKSL', summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '入库量', width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 5, '', true); return value; } }, { dataIndex: 'GOODSSTOCK', summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '库存量', width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 5, '', true); return value; } }, { dataIndex: 'ARFEE', hidden: true, summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '应收账款', width: 80 }, { dataIndex: 'APFEE', hidden: true, summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '应付账款', width: 80 }, { dataIndex: 'FREESTORAGEPERIOD', hidden: true, header: '应收免仓储期', width: 80 }, { dataIndex: 'ASSOCIATEDNO', hidden: true, header: '关联号', width: 80 }, { dataIndex: 'BLNO', //hidden: true, header: '提单号', width: 80 }, { dataIndex: 'CONTRACTNO', hidden: true, header: '货代合同号', width: 80 }, { dataIndex: 'CLIENTCODEOLD', hidden: true, header: '原客户编码', width: 80 }, { dataIndex: 'CLIENTNAMEOLD', hidden: true, header: '原客户名称', width: 80 }, { dataIndex: 'STORAGENAME', header: '仓库名称', width: 80 }, { dataIndex: 'CORPID', hidden: true, header: '分公司代码', width: 80 }, { dataIndex: 'STARTBILLINGDATE', header: '应收开始计费日', width: 80 }, { dataIndex: 'CUSTOMNO', //hidden: true, header: '备案清单号', width: 80 }, { dataIndex: 'CLIENTBSNO', //hidden: true, header: '检疫证号', width: 80 }, { dataIndex: 'GOODSSTANDARD', header: '规格', width: 80 }/*, { dataIndex: 'GOODSPACKACTUAL', hidden: true, header: '实际件数(备注类)', width: 80 }, { dataIndex: 'GOODSRKSLACTUAL', hidden: true, header: '实际数量(备注类)', width: 80 }*/, { dataIndex: 'FREESTORAGEPERIODAP', hidden: true, header: '应付免仓储期', width: 80 }, { dataIndex: 'STARTBILLINGDATEAP', header: '应付开始计费日', width: 80 }, { dataIndex: 'AREANAME', header: '库位名称', width: 80 }, { dataIndex: 'MARKETVALUE', header: '市场货值', width: 80 }, { dataIndex: 'BANKVALUE', header: '银行货值', width: 80 }, { dataIndex: 'REMARK', header: '备注', width: 200 }, { dataIndex: 'BZTCHNO', hidden: true, header: '批次号', width: 80 }, { sortable: true, dataIndex: 'Inspection_Storage', header: '是否商检慢检', width: 80, renderer: function (value, cellmeta) { if (value == "1" || value == "True") { return ""; } } }, { sortable: true, dataIndex: 'inspection_date', header: '慢检验货时间', width: 80, renderer: function (value, cellmeta, record) { if (record.data.Inspection_Storage == "1" || record.data.Inspection_Storage == "True") { return value; } else { return ""; } } }, { sortable: true, dataIndex: 'Unsealdate', header: '放行时间', width: 80 }, { sortable: true, dataIndex: 'Productiondate_min', header: '生产日期起', width: 80 }, { sortable: true, dataIndex: 'Productiondate_max', header: '生产日期止', width: 80 }, { sortable: true, dataIndex: 'Overfilled', header: '溢短装', width: 80 }, //{ // sortable: true, // dataIndex: 'SALEINFO', // header: '销售摘要', // width: 80 //}, { sortable: true, dataIndex: 'AGENT', header: '代理', width: 80 }, { sortable: true, dataIndex: 'COUNTRY', header: '进口国', width: 80 }, { sortable: true, dataIndex: 'FACTORYNO', header: '厂号', width: 80 }, { sortable: true, dataIndex: 'CNTRNO', header: '箱号', width: 80 }, { sortable: true, dataIndex: 'DECLARENUMBER', header: '报关单', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '检疫证正本日期', width: 80 }, { sortable: true, dataIndex: 'SALER', header: '销售员', width: 80 }, { sortable: true, dataIndex: 'COSTPRICE', header: '成本价(货款税金代理费)', width: 80 }, { sortable: true, summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'WMSINCOST', header: '入库时总成本', width: 80 }, { sortable: true, dataIndex: 'HTH', header: '合同号', width: 80 }]; //定义Grid this.WMSCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 45 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, stripeRows: true, viewConfig: { enableTextSelection: true }, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], stateful: true, selModel: this.WMSCB, columns: [new Ext.grid.RowNumberer()], bbar: [Ext.create('Ext.PagingToolbar', { id: "bbar", store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column, 0, true); //使用者id,表名 ,中间column数组,跳过一开始的几列 this.column.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.column); //////////////////////////// /*OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.EditRecord; return r*/ this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin("/MvcShipping/WMSImportMain/WMSINEdit", "", "650", "1250"); //alert("双击"); }, this); //#region formSearch _this = this; this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DeptModel', proxy: { url: '/CommMng/BasicDataRef/GetDeptList' } }); this.storeDEPT.load({ params: { condition: ""} }); this.comboxDEPT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务部门', store: this.storeDEPT, name: 'DeptName', valueField: 'DeptName', displayField: 'DeptName' }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '库存操作人', store: this.storeUser, name: 'WMSOP', valueField: 'UserName', displayField: 'CodeAndName' //,value: SHOWNAME }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load(); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '货主', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeSTORAGENAME = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeSTORAGENAME.load({ params: { condition: " ISWAREHOUSE=1 "} }); this.comboxSTORAGENAME = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '仓库名称', store: this.storeSTORAGENAME, //allowBlank: false, forceSelection: true, name: 'STORAGENAME', //id: "STORAGENAME", valueField: 'CustName', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.formSearch = Ext.widget('form', { frame: true, //height: 100, 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: [{ labelWidth: 110, fieldLabel: '入库单号/合同号', name: 'WMSNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { labelWidth: 120, fieldLabel: '提单号/供应商合同号', name: 'MBLNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxUser, this.comboxDEPT , { fieldLabel: '不包含货转入库', xtype: 'checkbox', name: 'ISCHANGE', value: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }] }] } , {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode , { fieldLabel: '货物名称', name: 'GOODSNAME', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , this.comboxSTORAGENAME , { labelWidth: 100, fieldLabel: '从..入库日期', format: 'Y-m-d', xtype: 'datefield', name: 'WMSDATEbgn', flex: 1, enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { fieldLabel: '到..入库日期', format: 'Y-m-d', xtype: 'datefield', name: 'WMSDATEend', flex: 1, enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }] }] } , {//fieldset 3 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] }] } , {//fieldset 5 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [] } //end items(fieldset 5) ]//end root items }); //#endregion formSearch this.formWMSDateShow = 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: '新的入库日期', format: 'Y-m-d', xtype: 'datefield', name: 'WMSDATE' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '新的应收开始计费日期', format: 'Y-m-d', xtype: 'datefield', name: 'STARTBILLINGDATEDATE' }, { fieldLabel: '新的应付开始计费日期', format: 'Y-m-d', xtype: 'datefield', name: 'STARTBILLINGDATEDATEAP' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); me = this; this.winSetWMSDateShow = Ext.create('Ext.window.Window', { title: "设定新的 入库时间/开始计费时间", width: 450, //height : 120, //plain : true, iconCls: "addcomm", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formWMSDateShow], buttons: [{ text: "设定新的 入库时间/开始计费时间", minWidth: 70, handler: function () { var selectedRecords = me.gridList.selModel.getSelection(); if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有选择要生成凭证的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var form = me.formWMSDateShow.getForm(); var WMSDATE = form.findField('WMSDATE').getRawValue(); if (WMSDATE == '' || WMSDATE == null || WMSDATE == undefined) { Ext.Msg.show({ title: '提示', msg: '必须填新的入库日期!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.onSetWMSDateClick(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winSetWMSDateShow.close(); } }] }); this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "新建", iconCls: "btnadd", id: "NEW", handler: function (button, event) { this.OprationStatus = 'add'; //DsOpenEditWin("/MvcShipping/WMS/Edit", "新建", "550", "1250"); DsOpenEditWin("/MvcShipping/WMSImportMain/WMSINMAKE", "", "550", "1250"); }, scope: this }, { text: "删除", iconCls: "btndelete", id: "DEL", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { var form = this.formSearch.getForm(); form.reset(); }, scope: this }, { xtype: 'button', width: 90, text: "高级查询", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); if (this.winAccess == '' || typeof (this.winAccess) == "undefined") { this.winAccess = new Shipping.DsQuery({}); } else { this.winAccess.destroy(); this.winAccess = new Shipping.DsQuery({}); } this.winAccess.StoreList = this.storeList; this.winAccess.formname = this.formname; this.winAccess.condition = sql; this.winAccess.LoadQueryData_self(this.formname); this.winAccess.show(); return; }, scope: this }, '-', { text: "打开", iconCls: "btnright", id: "OPEN", handler: function (button, event) { this.onOpenClick(button, event); }, scope: this }, { text: "保存列表样式", id: "btntest", handler: function (button, event) { DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true); }, scope: this }, '-', { text: "提交费用入账申请", id: "btnLock", handler: function (button, event) { this.LockWMS("2"); }, scope: this }/*, { text: "取消入账", hidden: true, //id: "btnUnLock", handler: function (button, event) { this.LockWMS("0"); }, scope: this }*/, { text: "取消入账", id: "btnUnLock", handler: function (button, event) { this.LockWMS("0"); }, scope: this }, '-', { text: "设定入库日期", iconCls: "btncomm", handler: function (button, event) { var form = this.formWMSDateShow.getForm(); var WMSDATE = form.findField('WMSDATE'); var STARTBILLINGDATE = form.findField('STARTBILLINGDATE'); var STARTBILLINGDATEAP = form.findField('STARTBILLINGDATEAP'); this.winSetWMSDateShow.show(); }, scope: this }, '-' , { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { GridExportExcelPage(this.gridList); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 125, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.InitData(); //集中绑定事件 this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents checkHandler: function () { alert('Checked a menu item'); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); //alert(this.storeList.getCount()); }, onDsQuery: function () { var sql = this.sqlcontext; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); //this.onRefreshSumClick(sql); }, InitData: function () { Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "modWmsList", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; this.VISIBLERANGE = rec.VISIBLERANGE; this.OPERATERANGE = rec.OPERATERANGE; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //request over //var STEPNO=this.storeWorkFlowStep.getAt(index).get("STEPNO"); //this.onRefreshClick(); //#region 打开时载入当天业务 var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d'); this.sqlcontext = " isnull(cargo_gid,'')<>'' and w.modifiedtime>='" + mydatestr + "' "; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext, load: 'true' }, waitMsg: "正在查询数据...", scope: this }); //#endregion if (OPLBNAME == "WMSMAIN" || this.OPLBNAME == "WMSMAIN") { this.formSearch.show(); this.panelTop.height = 100; } else { //this.formSearch.hidden = true; this.formSearch.hide(); this.panelTop.height = 30; } }, //end InitData onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var selectedRecords = []; selectedRecords = this.gridList.selModel.getSelection(); var record = selections[0]; if (record.data.ISLOCK == "True" || record.data.ISLOCK == "1") { alert("不能删除已入账的入库信息"); return; } if (record.data.ISCHANGE == "True") { alert("来源于货权转移的入库信息不能删除。请前往出库记录页面删除相应的货转出库记录。"); return; } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/WMS/Delete', params: { data: Ext.JSON.encode(record.data), USERID: USERID }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); InitData(); }, //onDeleteClick LockWMS: function (Value) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var LockWMS = []; /*if (Value == "2") { var selectedRecords = this.WMSCB.selected.items; for (var i = 0; i < selectedRecords.length; i++) { rec = selectedRecords[i]; if (rec.data.GOODSPACK != rec.data.GOODSPACKSTOCK || rec.data.GOODSRKSL != rec.data.GOODSSTOCK) { alert("已出库的入库信息不能取消入账"); return; } if (rec.data.ISLOCK == "1" && Value == "2") { alert("已经入账,不能重复操作"); return; } if (rec.data.ISLOCK != "1" && Value == "0") { alert("目前没有入账,不能重复操作"); return; } } }*/ //提交审核 if (Value == "2") { Ext.MessageBox.confirm('提示', '确定要操作选中的入库信息吗?', function (btn) { if (btn == 'yes') { var selectedRecords = this.WMSCB.selected.items; if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ASSOCIATEDNO != "") //没有保存的数据无法锁定 { LockWMS.push(rec); } } } var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS); var _this = this; Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMS/SubmitAudit', params: { WMSList: LockWMSJSNO, LOCK: Value }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { alert(jsonresult.Message); } else { alert("操作失败" + jsonresult.Message); } var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, scope: this }); //request over } }, this); } //审核撤回 if (Value == "0") { Ext.MessageBox.confirm('提示', '确定要操作选中的入库信息吗?', function (btn) { if (btn == 'yes') { var selectedRecords = this.WMSCB.selected.items; if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ASSOCIATEDNO != "") //没有保存的数据无法锁定 { LockWMS.push(rec); } } } var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS); var _this = this; Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMS/CancelAudit', params: { WMSList: LockWMSJSNO, LOCK: Value }, callback: function (options, success, response) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { alert(jsonresult.Message); } else { alert("操作失败" + jsonresult.Message); } var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, scope: this }); //request over } }, this); } }, //onDeleteClick onOpenClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (selections.length > 1) { Ext.Msg.show({ title: '提示', msg: '请注意,将打开所选内容的第一条!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } var selectedRecords = []; selectedRecords = this.gridList.selModel.getSelection(); this.SelectedRecord = selectedRecords[0]; this.OprationStatus = 'edit'; DsOpenEditWin("/OA/Baoxiao/Edit", "", "620", "1000"); }, //onDeleteClick getToday: function () { var now = new Date(); var year = now.getFullYear(); //年 var month = now.getMonth() + 1; //月 var day = now.getDate(); //日 var clock = year + "-"; if (month < 10) clock += "0"; clock += month + "-"; if (day < 10) clock += "0"; clock += day + " "; return (clock); }, onResetClick: function (button, event) { this.formSearch.getForm().reset(); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; //if (this.BsNo != undefined && this.BsNo != "") { // sql = " ASSOCIATEDNO='" + this.BsNo + "' "; //只显示该业务下的 //} else { sql = " isnull(cargo_gid,'')<>'' "; //只显示进口贸易业务的入库信息 //} var WMSNO = form.findField("WMSNO").getValue(); sql = sql + getAndConSql(sql, WMSNO, " (w.WMSNO like '%" + WMSNO + "%' or M.HTH like '%" + WMSNO + "%') "); var MBLNO = form.findField("MBLNO").getValue(); sql = sql + getAndConSql(sql, MBLNO, " (w.BLNO like '%" + MBLNO + "%' or M.Supplier_Billno like '%" + MBLNO + "%' ) "); var DeptName = form.findField("DeptName").getValue(); sql = sql + getAndConSql(sql, DeptName, " w.WMSOP in( select showname from vw_user where deptname='" + DeptName + "')"); var WMSOP = form.findField("WMSOP").getValue(); sql = sql + getAndConSql(sql, WMSOP, "w.WMSOP = '" + WMSOP + "'"); var ISCHANGE = form.findField("ISCHANGE").getValue() ? 1 : 0; if (ISCHANGE == 1) { sql = sql + getAndConSql(sql, ISCHANGE, " w.ISCHANGE = 0 "); } var CUSTOMERNAME = form.findField("CUSTOMERNAME").getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, " w.CUSTOMERNAME = '" + CUSTOMERNAME + "' "); var GOODSNAME = form.findField("GOODSNAME").getValue(); sql = sql + getAndConSql(sql, GOODSNAME, " w.GOODSNAME like '%" + GOODSNAME + "%' "); var STORAGENAME = form.findField("STORAGENAME").getValue(); sql = sql + getAndConSql(sql, STORAGENAME, " w.STORAGENAME like '%" + STORAGENAME + "%' "); var WMSDATEbgn = form.findField('WMSDATEbgn').getRawValue(); sql = sql + getAndConSql(sql, WMSDATEbgn, " w.WMSDATE >= '" + WMSDATEbgn + "'"); var WMSDATEend = form.findField('WMSDATEend').getRawValue(); sql = sql + getAndConSql(sql, WMSDATEend, " w.WMSDATE <= '" + WMSDATEend + " 23:59:59'"); return sql; }, onGetremind: function (field, newValue, oldValue) { if (newValue != null) { this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: newValue }, waitMsg: "正在查询数据...", scope: this }); } }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.EditRecord; ret[4] = OPLBNAME; return ret; }, onSubmitAuditClick: function (button, event) { //提交审核 var records = this.gridList.selModel.getSelection(); DsTruck.BaoxiaoAudit(records, 2, "BaoxiaoMod", '正在审核数据, 请稍侯..'); InitData(); }, onCallBackClick: function (button, event) { //提交审核 var records = this.gridList.selModel.getSelection(); DsTruck.BaoxiaoAudit(records, 1, "BaoxiaoMod", '正在审核数据, 请稍侯..'); InitData(); }, onAuditPassClick: function (button, event) { //审核通过 //var records = this.MainCB.selected.items; var records = this.gridList.selModel.getSelection(); DsTruck.BaoxiaoAudit(records, 0, "BaoxiaoMod", '正在审核数据, 请稍侯..'); this.onRefreshClick(button, event); }, onAuditRefuseClick: function (button, event) { //驳回提交 var records = this.gridList.selModel.getSelection(); DsTruck.BaoxiaoAudit(records, 6, "BaoxiaoMod", '正在审核数据, 请稍侯..'); this.onRefreshClick(button, event); }, onSetWMSDateClick: function (button, event) { var feeGIdSql = ''; var selectedRecords = this.gridList.selModel.getSelection(); var form = this.formWMSDateShow.getForm(); var WMSGID = ""; if (selectedRecords.length != 1) { alert("只能选择一个入库单"); } else { var rec = selectedRecords[0]; WMSGID = rec.data.GID; } var WMSDATE = form.findField('WMSDATE').getValue(); var STARTBILLINGDATE = form.findField('STARTBILLINGDATE').getValue(); var STARTBILLINGDATEAP = form.findField('STARTBILLINGDATEAP').getValue(); Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcShippingWeb/WMS/SetNewWMSBillingDate', params: { WMSGID: WMSGID, WMSDATE: WMSDATE, STARTBILLINGDATE: STARTBILLINGDATE, STARTBILLINGDATEAP: STARTBILLINGDATEAP }, 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 { this.winSetWMSDateShow.close(); this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } });