Ext.namespace('Shipping'); Shipping.WMSOUTIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.WMSOUTIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.WMSOUTIndex, Ext.Panel, { PageSize: 500, sqlcontext: '', OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, modWmsList: null, modWmsFeeLock: null, modWmsFeeRejected: null, EditRecord: null, //用于从主界面获取 YWType: "PT", BsNo: '', initUIComponents: function () { _this = this; var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit'); if (typeof (mainform.editRecord) == "undefined") { //this.BsNo = getUrlParam('id'); this.OPLBNAME = "WMSMAIN"; } 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: 'WMSOUTImportmb', remoteSort: true, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/MvcShipping/WMS/GetWMSOUTList_Import', reader: { id: 'GID', 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 = "WMSOUT_Import"; //this.InWorkFlow=false; _this = this; this.column = [ { sortable: true, hidden: true, dataIndex: 'GID', header: '惟一编号', width: 80 }, { dataIndex: 'BSSTATUS', header: '出库管理状态', width: 80, renderer: function (value, cellmeta) { if (value == '0' || value == '6') { return ""; } if (value == '1') { return ""; } if (value == '2') { return ""; } } }, { dataIndex: 'ISLOCK', header: '是否入账', width: 60, renderer: function (value, cellmeta) { if (value == 'True') { return ""; } } }, { dataIndex: 'ISCHANGE', header: '是否是货权转移', width: 92, renderer: function (value, cellmeta) { if (value == 'True') { return ""; } } }, { sortable: true, hidden: true, dataIndex: 'ASSOCIATEDNO', header: '关联号', width: 80 }, { sortable: true, dataIndex: 'BSNO', header: '仓单明细号', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CLIENTGID', header: '客户GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CLIENTCODE', header: '客户编码', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '客户名称', width: 80 }, { sortable: true, dataIndex: 'DODATE', header: '出库时间', width: 80 }, { sortable: true, hidden: true, dataIndex: 'STORAGECODE', header: '仓库编码', width: 80 }, { sortable: true, dataIndex: 'STORAGENAME', header: '仓库名称', width: 80 }, { sortable: true, hidden: true, dataIndex: 'AREACODE', header: '库位编码', width: 80 }, { sortable: true, dataIndex: 'AREANAME', header: '库位名称', width: 80 }, { sortable: true, hidden: true, dataIndex: 'GOODSCODE', header: '货物编号', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '货物名称/品名', width: 80 }, { sortable: true, dataIndex: 'GOODSTYPE', header: '货物类型', width: 80 }, { sortable: true, dataIndex: 'GOODSMODEL', header: '型号', width: 80 }, { sortable: true, dataIndex: 'GOODSSTANDARD', header: '规格', width: 80 }, { sortable: true, dataIndex: 'GOODSPACK', header: '包装', width: 80 }, { sortable: true, dataIndex: 'CHARGEUNIT', header: '计费单位', width: 80 }, // { // sortable: true, // dataIndex: 'GOODSPACKSTOCK', // header: '剩余件数', // width: 80 // }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.000000'), renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 6, '', true); return value; }, dataIndex: 'GOODSPFSL', header: '出库量', width: 80 }, { sortable: true, summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'GOODSOUTFEE', header: '应收仓储费', width: 80 }, { sortable: true, summaryType: 'sum', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'GOODSOUTFEEAP', header: '应付仓储费', width: 80 }, { sortable: true, dataIndex: 'TRUCKNO', header: '车号', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 80 }, { sortable: true, hidden: true, dataIndex: 'ISDELETE', header: '是否废除', width: 80 }, { sortable: true, hidden: true, dataIndex: 'DELETETIME', header: '废除时间', width: 80 }, { sortable: true, hidden: true, dataIndex: 'DELETEUSER', header: '废除操作人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CREATEUSER', header: '创建人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CREATETIME', header: '创建时间', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: '最后一次更新操作人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: '最后一次更新操作时间', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, dataIndex: 'GOODSPACKPFSL', header: '出库件数', width: 80 }, { sortable: true, dataIndex: 'TRUCKNAME', header: '装卸队名称', width: 80 }, { sortable: true, hidden: true, dataIndex: 'WMSOP', header: '制表人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'STOREMAN', header: '保管人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LOCKTIME', header: '锁定时间', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LOCKUSER', header: '锁定操作人', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'ARFEE', header: '出库费应收', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'APFEE', header: '出库费应付', width: 80 }, { sortable: true, hidden: true, dataIndex: 'INSPECTIONNO', header: '审批单号', width: 80 }, { sortable: true, dataIndex: 'CUSTOMNO', header: '报关单号/备案清单号', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CORPID', header: '分公司代码', width: 80 }, { sortable: true, dataIndex: 'CLIENTNAMEOLD', header: '转移对象', width: 80 }, { sortable: true, dataIndex: 'OLDCUSTFEEDATE', header: '上家承担仓储期', width: 80 }, { sortable: true, dataIndex: 'CLIENTBSNO', header: '不同客户的重复的出库单/客户出库仓单号', width: 80 }, { sortable: true, dataIndex: 'ARCLIENT', header: '应收账款客户', width: 80 }, { sortable: true, hidden: true, dataIndex: 'INGIDNEW', header: '货权入库wmsgid', width: 80 }, { sortable: true, hidden: true, dataIndex: 'VALIDDATE', header: '有效期', width: 80 }, { sortable: true, dataIndex: 'TOTALNO', header: '件数大写', width: 80 }, { sortable: true, dataIndex: 'REMARK2', header: '备注2/发货须知', width: 80 }, { sortable: true, dataIndex: 'MBLNONEW', header: '货权转移的分单', width: 80 }, { sortable: true, dataIndex: 'ARCLIENTWMSOUT', header: '仓储费应收客户', width: 80 }, { sortable: true, dataIndex: 'BZTCHNO', header: '批次号', width: 80 }, { sortable: true, dataIndex: 'ISCOLLECTING', header: '是否代收费', width: 80 }, { sortable: true, dataIndex: 'HTH', header: '合同号', width: 80 }, { sortable: true, dataIndex: 'SUPPLIER_BILLNO', header: '供应商合同号', width: 80 }, { sortable: true, dataIndex: 'CONTAINERNO', header: '箱号', width: 80 }, { sortable: true, dataIndex: 'FACTORYNO', header: '厂号', width: 80 }, { sortable: true, dataIndex: 'COUNTRY', header: '国家', width: 80 }, { sortable: true, dataIndex: 'CARGOTYPE', header: '货物类型', width: 80 }, { sortable: true, dataIndex: 'SALER', header: '销售员', width: 80 }, { sortable: true, dataIndex: 'OP', header: '出库操作员', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.000000'), renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { //value = usMoney(Mul(value,1000,2), 2, '', true); value = usMoney(value, 2, '', true); return value; }, dataIndex: 'WEIGHT_EX', header: '预计出库重量', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, dataIndex: 'BOXCOUNT_EX', header: '预计出库件数', width: 80 }, { sortable: true, //hidden: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.000000'), renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { //value = usMoney(value, 6, '', true); value = usMoney(Mul(value, 1000, 2), 2, '', true); return value; }, dataIndex: 'GOODSPFSL_ACT', header: '实际出库重量', width: 80 }, { sortable: true, //hidden: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'GOODSPACKPFSL_ACT', header: '实际出库件数', width: 80 }, { sortable: true, dataIndex: 'SFCM', header: '是否抄码', width: 80, renderer: function (value, cellmeta) { if (value == '0' || value == '') { return ""; } if (value == '1') { return ""; } } }, { sortable: true, align: 'right', dataIndex: 'COSTPRICE', header: '入库成本', width: 80 }, { sortable: true, align: 'right', dataIndex: 'PRICERMB', header: '单价', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'TOTALCOST', header: '总成本', width: 80 }, { sortable: true, summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), dataIndex: 'PAYMONEY', header: '回款金额', width: 80 }, { sortable: true, dataIndex: 'ML', summaryType: 'sum', align: 'right', summaryRenderer: Ext.util.Format.numberRenderer('00.00'), header: '毛利', width: 80 }, { sortable: true, dataIndex: 'MLRATE', header: '毛利率', width: 80, summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { //var _count = getStoreFieldCount(_this.storeList, 'HTH'); //return _count; var ML = 0; var HKJE = 0; for (var i = 0; i < _this.storeList.getCount(); i += 1) { var member = _this.storeList.getAt(i); ML = Add(ML, member.data.ML); HKJE = Add(HKJE, member.data.PAYMONEY); } if (HKJE != 0) { return Mul(Div(ML, HKJE, 6), 100, 4) + "%"; } else { return 0; } } }, { sortable: true, dataIndex: 'OUTRECEIPT', header: '是否有出库回执', width: 80, renderer: function (value, cellmeta) { if (value == '0' || value == '') { return ""; } if (value == '1') { return ""; } } }, { sortable: true, dataIndex: 'Sales_OP', header: '销售助理', width: 80 }, { sortable: true, dataIndex: 'Delivery_OP', header: '出库操作人', width: 80 }, { sortable: true, dataIndex: 'CONTACT', header: '出库联系人', width: 80 }, { sortable: true, dataIndex: 'TEL', 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 }, stateful: true, selModel: this.WMSCB, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], 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); //////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; //alert(record.data.ISCHANGE); if (record.data.ISCHANGE == "False") { this.YWType = "PT"; //普通 } else this.YWType = "HZ"; //货转 DsOpenEditWin("/MvcShipping/MsOpSeai/WMSOUTEdit", "", "650", "1250"); //alert(this.SelectedRecord.get('BSNO')); }, this); //#region formSearch //#region 枚举类型 _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.storeSale = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeSale.load({ params: { condition: ""} }); this.comboxSale = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '销售员', store: this.storeSale, name: 'SALER', 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(); } } } }); //#endregion 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: [{ fieldLabel: '单号/合同号', name: 'WMSNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '提单号/箱号', name: 'MBLNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxUser//WMSOP , this.comboxSale// , { fieldLabel: '不包含货转入库', xtype: 'checkbox', hidden: true, name: 'ISCHANGE', value: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'hiddenfield' }] }] } , {//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: 'DODATEbgn', flex: 1, enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { fieldLabel: '到..出库日期', format: 'Y-m-d', xtype: 'datefield', name: 'DODATEend', 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 = this; // this.CBMWorkFlow = new Ext.form.Checkbox({ // fieldLabel: '只显示待处理业务', // labelwidth:200, // }); //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "新建出库单", hidden: true, iconCls: "btnadd", id: "NEW", handler: function (button, event) { this.OprationStatus = 'add'; this.YWType = "PT"; DsOpenEditWin("/MvcShipping/MsOpSeai/WMSOUTEdit", "", "650", "1250"); }, scope: this }, { text: "新建货转", hidden: true, iconCls: "btncompany", id: "HZ", handler: function (button, event) { this.OprationStatus = 'add'; this.YWType = "HZ"; DsOpenEditWin("/MvcShipping/MsOpSeai/WMSOUTEdit", "", "650", "1250"); }, scope: this }, { text: "删除出库单", hidden: true, 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: "打印选中", id: "btnprint", iconCls: 'btnprint', handler: function (button, event) { this.onPrintClick(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.LockWMSOUT("1"); }, scope: this }, { text: "取消入账", id: "btnUnLock", handler: function (button, event) { this.LockWMSOUT("0"); }, 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) { this.PageSize = this.Pagenum.getValue(); var sql = this.getCondition(); this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); //alert(this.storeList.getCount()); }, onDsQuery: function () { this.PageSize = this.Pagenum.getValue(); 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 = " EXISTS (select 1 from Import_Delivery where DELIVERYNO= wo.bsno) and wo.dodate>='" + mydatestr + "' "; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext, load: 'true' }, waitMsg: "正在查询数据...", scope: this }); //#endregion if (this.BsNo != undefined && this.BsNo != "") { //this.formSearch.hidden = true; this.formSearch.hide(); this.panelTop.height = 30; } else { this.formSearch.show(); this.panelTop.height = 100; } }, //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]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/WMS/DeleteOUT', 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 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 = ''; sql = " EXISTS (select 1 from Import_Delivery where DELIVERYNO= wo.bsno) "; var WMSNO = form.findField("WMSNO").getValue(); sql = sql + getAndConSql(sql, WMSNO, " ( wo.ASSOCIATEDNO in(select contractno from import_main where HTH like '%" + WMSNO + "%') or wo.BSNO like '%" + WMSNO + "%')"); var MBLNO = form.findField("MBLNO").getValue(); sql = sql + getAndConSql(sql, MBLNO, " ( wo.ASSOCIATEDNO in(select contractno from import_main where Billno like '%" + MBLNO + "%' or ContainerNo like '%" + MBLNO + "%'))"); var WMSOP = form.findField("WMSOP").getValue(); sql = sql + getAndConSql(sql, WMSOP, " ( wo.WMSOP= '" + WMSOP + "')"); var SALER = form.findField("SALER").getValue(); sql = sql + getAndConSql(sql, SALER, " wo.BSNO in (select OUTBSNO from wms_out_detail where BSNO in( select gid from Import_DeliveryDetail where SALEDETAIL_GID in(select gid from Import_Saledetail where salesno in(select salesno from Import_Sales where SALER= '" + SALER + "'))))"); var CUSTOMERNAME = form.findField("CUSTOMERNAME").getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, " ( wo.CUSTOMERNAME= '" + CUSTOMERNAME + "')"); var GOODSNAME = form.findField("GOODSNAME").getValue(); sql = sql + getAndConSql(sql, GOODSNAME, " ( wo.BSNO in (select outbsno from wms_out_detail where GOODSNAME like '%" + GOODSNAME + "%')) "); /* var CUSTOMERNAME = form.findField("CUSTOMERNAME").getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, " ( wo.CUSTOMERNAME= '" + CUSTOMERNAME + "')"); */ var STORAGENAME = form.findField("STORAGENAME").getValue(); sql = sql + getAndConSql(sql, STORAGENAME, " ( wo.STORAGENAME= '" + STORAGENAME + "')"); var DODATEbgn = form.findField('DODATEbgn').getRawValue(); sql = sql + getAndConSql(sql, DODATEbgn, " wo.DODATE >= '" + DODATEbgn + "'"); var DODATEend = form.findField('DODATEend').getRawValue(); sql = sql + getAndConSql(sql, DODATEend, " wo.DODATE <= '" + DODATEend + " 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; if (this.OPLBNAME == "WMSMAIN") { ret[3] = this.SelectedRecord; } else { ret[3] = this.EditRecord; } ret[4] = this.YWType; ret[5] = OPLBNAME; return ret; }, LockWMSOUT: 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 = []; 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.ISLOCK == "True" && Value == "1") { alert("已经入账,请勿重复操作"); return; } if (rec.ISLOCK == "False" && Value == "0") { alert("已经是未入账状态,请勿重复操作"); return; } if (rec.data.ASSOCIATEDNO != "") //没有保存的数据无法锁定 { LockWMS.push(rec); } } } var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS); _this = this; Ext.Ajax.request({// waitMsg: '正在处理数据...', url: '/MvcShipping/WMS/LockOut_Import', params: { data: 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 , onPrintClick: function (button, event) { var printType = 'WmsOutList_opseai'; //海运进口 出库仓储费明细 var BSNOList = ""; var selectedRecords = this.gridList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (BSNOList == "") { BSNOList = "'" + rec.get('BSNO') + "'"; } else { BSNOList = BSNOList + ",'" + rec.get('BSNO') + "'"; } } var sql1 = " SELECT BLNO as 提单号,convert(char(10),WMSDATE,20) as 入库日期, WMSNO as 入库单号, OUTBSNO as 出库单号 "; sql1 = sql1 + " , BSNO as 出库单明细号, CUSTOMERNAME as 货主,ARCLIENTWMSOUT as 仓储费应收客户名称, convert(char(10),DODATE,20) as 出库日期 "; sql1 = sql1 + " , STORAGENAME as 仓库,STORAGENAME_FULL as 仓库全称, AREANAME as 库位名称, GOODSNAME as 货物名称, GOODSTYPE as 货物类型 "; sql1 = sql1 + " , GOODSMODEL as 型号, GOODSSTANDARD as 规格, GOODSPACK as 包装, GOODSPFSL as 出库量, GOODSOUTFEE as 应收仓储费, TRUCKNO as 车号 "; sql1 = sql1 + " , REMARK as 出库明细备注, CREATEUSER as 出库创建人, CREATETIME as 出库创建时间, GOODSPACKPFSL as 出库件数 "; sql1 = sql1 + " , (case when ISLOCK=1 then '是' else '否' end) as 是否锁定, LOCKUSER as 锁定操作人, LOCKTIME as 锁定时间, GOODSOUTFEEAP as 应付仓储费 "; sql1 = sql1 + " , ARFEE as 应收账款, APFEE as 应付账款, INSPECTIONNO as 审批单号, CUSTOMNO as 备案清单号, CLIENTNAMEOLD as 货权转移的客户名称 "; sql1 = sql1 + " , OLDCUSTFEEDATE as 上家承担仓储期限,STARTBILLINGDATE as 应收开始计费日期,ENDBILLINGDATE as 应收结束计费日期, wmsdays as 应收仓储天数 "; sql1 = sql1 + " , FEEDAYS as 应收计费天数, FREESTORAGEPERIOD as 应收免仓储期, DESCRIPTION as 仓储费应收客户全称, EnFullName as 仓储费应收客户英文全称 "; sql1 = sql1 + " , NAME as 仓储费应收客户英文简称, ADDR as 仓储费应收客户地址, EMAIL as 仓储费应收客户邮箱, WEB as 仓储费应收客户网址 "; sql1 = sql1 + " , TEL AS 仓储费应收客户电话, FAX AS 仓储费应收客户传真, CHIEF as 仓储费应收客户负责人, TOTALNO as 件数大写 "; sql1 = sql1 + " , REMARK2_OUT AS [出库备注2/发货须知第一条], VALIDDATE as 有效期, REMARK AS [出库备注1], GOODSGRADE as 品名的等级 "; sql1 = sql1 + " , GOODSSLICE as [片数/件], MBLNONEW as [货权转移的分单的提单号], CONTRACTNO as 合同号 , CORPID, GID AS OUTGID, GID "; sql1 = sql1 + " , ASSOCIATEDNO,BZTCHNO as 批次号 FROM VW_WmsOutList_Print as a WHERE BSNO in(" + BSNOList + ") order by OUTBSNO,WMSNO,DODATE "; var sql2 = " SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称 "; sql2 = sql2 + " ,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页 "; sql2 = sql2 + " ,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话 "; sql2 = sql2 + " ,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作 "; sql2 = sql2 + " ,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位 "; sql2 = sql2 + " ,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司 "; sql2 = sql2 + " ,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司 "; sql2 = sql2 + " ,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州 "; sql2 = sql2 + " ,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2 "; sql2 = sql2 + " ,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头 "; sql2 = sql2 + " ,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2 "; sql2 = sql2 + " ,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式 "; sql2 = sql2 + " ,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间 "; sql2 = sql2 + " ,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN "; sql2 = sql2 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间 "; sql2 = sql2 + " ,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client "; sql2 = sql2 + " where SHORTNAME in (select a.CUSTOMERNAME from VW_WmsOutList_Print as a WHERE BSNO in(" + BSNOList + ") ) and ISSTOP=0 "; var sql3 = " SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称 "; sql3 = sql3 + " ,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页 "; sql3 = sql3 + " ,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话 "; sql3 = sql3 + " ,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人 "; sql3 = sql3 + " ,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队 "; sql3 = sql3 + " ,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司 "; sql3 = sql3 + " ,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库 "; sql3 = sql3 + " ,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家 "; sql3 = sql3 + " ,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1 "; sql3 = sql3 + " ,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号 "; sql3 = sql3 + " ,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1 "; sql3 = sql3 + " ,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额 "; sql3 = sql3 + " ,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率 "; sql3 = sql3 + " ,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别 "; sql3 = sql3 + " ,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN "; sql3 = sql3 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间 "; sql3 = sql3 + " ,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client "; sql3 = sql3 + " where SHORTNAME in (select a.STORAGENAME from VW_WmsOutList_Print as a WHERE BSNO in(" + BSNOList + ") ) and ISSTOP=0 "; var sql4 = " SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名 "; sql4 = sql4 + " ,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人 "; sql4 = sql4 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间 "; sql4 = sql4 + " ,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN "; sql4 = sql4 + " ,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码 "; sql4 = sql4 + " ,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码 "; sql4 = sql4 + " ,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址 "; sql4 = sql4 + " ,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息 "; sql4 = sql4 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间 "; sql4 = sql4 + " ,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人 "; sql4 = sql4 + " ,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话 "; sql4 = sql4 + " ,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url "; sql4 = sql4 + " ,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'"; var sql5 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址 "; sql5 = sql5 + " ,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码 "; sql5 = sql5 + " ,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话 "; sql5 = sql5 + " ,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱 "; sql5 = sql5 + " ,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头 "; sql5 = sql5 + " ,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5 "; sql5 = sql5 + " ,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除 "; sql5 = sql5 + " ,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'"; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });