Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/GodownEntryTableManager.java =================================================================== diff -u -r13206 -r13290 --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/GodownEntryTableManager.java (.../GodownEntryTableManager.java) (revision 13206) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/GodownEntryTableManager.java (.../GodownEntryTableManager.java) (revision 13290) @@ -290,6 +290,22 @@ public String findAppropriationTableList( Map> parameterMap){ String sql = "where po.type='" + GodownEntry.TYPE_APPROPRIATE + "'"; + + //构造时间查询条件 + Map sqlWhereParamMap = gridManager + .getParamFromView(parameterMap); + String startDate = sqlWhereParamMap.get("startDate"); + String endDate = sqlWhereParamMap.get("endDate"); + + if (StringUtils.isNotBlank(startDate)) { + startDate += " 00:00:00"; + } + + if (StringUtils.isNotBlank(endDate)) { + endDate += " 23:59:59"; + } + sql += " and " + dateQueryAdapter.dateAreaSql("po.time", startDate, endDate); + String ors[] = new String[]{SqlUtils.getNonStringFieldInCollectionsPredicate( "po.warehouseID", wareHouseManager.getCurrentUserOrgUnitWarehouseIds()), SqlUtils.getNonStringFieldInCollectionsPredicate( @@ -299,6 +315,39 @@ GodownEntry.class.getSimpleName(), sql,ors, new String[] { "itemsList" }); } + + /** + * 一次性物品盘盈盘亏单 + * @param parameterMap + * @return + */ + public String findGodownStockTakeTableList( + Map> parameterMap){ + String sql = "where po.subType in ('" + GodownEntry.SUBTYPE_STOCKTAKE_IN + "','" + GodownEntry.SUBTYPE_STOCKTAKE_OUT + "')"; + + //构造时间查询条件 + Map sqlWhereParamMap = gridManager + .getParamFromView(parameterMap); + String startDate = sqlWhereParamMap.get("startDate"); + String endDate = sqlWhereParamMap.get("endDate"); + + if (StringUtils.isNotBlank(startDate)) { + startDate += " 00:00:00"; + } + + if (StringUtils.isNotBlank(endDate)) { + endDate += " 23:59:59"; + } + sql += " and " + dateQueryAdapter.dateAreaSql("po.time", startDate, endDate); + + String ors[] = new String[]{SqlUtils.getNonStringFieldInCollectionsPredicate( + "po.warehouseID", wareHouseManager.getCurrentUserOrgUnitWarehouseIds()) + }; + return gridManager.renderGrid(parameterMap, + GodownEntry.class.getSimpleName(), sql,ors, + new String[] { "itemsList" }); + } + // 获取批次的可以退库的价格数量 public List getDiposableGoodsPriceAmountInfoCanOutEntryByBatchID( String batchID) { Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/appropriationView.jsp =================================================================== diff -u -r12981 -r13290 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/appropriationView.jsp (.../appropriationView.jsp) (revision 12981) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/appropriationView.jsp (.../appropriationView.jsp) (revision 13290) @@ -66,5 +66,11 @@ +
+ + + + +
\ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.js (revision 13290) @@ -0,0 +1,531 @@ +var entityName = "一次性物品盘盈盘亏"; +var grid; +var commonEntry = new commonEntry(); + +//仓库数据源 +var wareHouseStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'}, + {name : 'orgUnitCode',mapping : 'orgUnitCode'}, + ]), + listeners : { + load : function(store,records) { + if(records.length > 0 && (!commonEntry.isOpen())){ + var combo = top.Ext.getCmp("wareHouse1"); + // 触发选中事件 + combo.fireEvent('select', combo,records[0],0); + } + } + } +}); + +var GodownEntryItemRecord = Ext.data.Record.create([ + {name : 'name'}, + {name : 'amount'}, + {name : 'cost'}, + {name : 'batchNumber'}, + {name : 'totalPrice'} +]); + +//时间比较 +function dateCompare(date1,date2){ + date1 = date1.replace(/\-/gi,"/"); + date2 = date2.replace(/\-/gi,"/"); + var time1 = new Date(date1).getTime(); + var time2 = new Date(date2).getTime(); + if(time1 > time2){ + return 1; + }else if(time1 == time2){ + return 2; + }else{ + return 3; + }} + +/** +* 精确计算arg1和arg2的乘积 +* @param arg1 +* @param arg2 +* @return +*/ +function accMul(arg1,arg2) { + var s1=null ,m=0; + if(!arg1){ + s1 = '0.0'; + }else{ + s1=arg1.toString(); + } + if(!arg2){ + s2='0.0'; + }else{ + s2=arg2.toString(); + } + try{m+=s1.split(".")[1].length;}catch(e){s1='0.0';} + try{m+=s2.split(".")[1].length;}catch(e){s2='0.0';} + return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m); +} +/** +* 精确计算arg1和arg2的和 +* @param arg1 +* @param arg2 +* @return +*/ +function accAdd(arg1,arg2){ + var r1=null ,m=0; + if(!arg1){ + r1 = '0.0'; + }else{ + r1=arg1.toString(); + } + if(!arg2){ + r2='0.0'; + }else{ + r2=arg2.toString(); + } + try{r1=arg1.toString().split(".")[1].length;}catch(e){r1=0;} + try{r2=arg2.toString().split(".")[1].length;}catch(e){r2=0;} + m=Math.pow(10,Math.max(r1,r2)); + return round((arg1*m+arg2*m)/m,2); +} +function round(v,e){ + var t=1; + for(;e>0;t*=10,e--); + for(;e<0;t/=10,e++); + return Math.round(v*t)/t; +} + +//设置总金额 +function setTotalMoney(grid) { + var totalMoney = 0.0; + grid.getStore().each(function(record){ + var amount = Ext.num(parseFloat(record.data.amount),0.0); + var cost = Ext.num(parseFloat(record.data.cost),0.0); + var mul = amount*cost*1.00; + totalMoney += mul; + }); + top.Ext.getCmp("totalPrice").setValue(Ext.util.Format.usMoney(totalMoney)); +} +function renderTotalPrice(val,p,record){ + var amount = Ext.num(parseFloat(record.data.amount),0.0); + var cost = Ext.num(parseFloat(record.data.cost),0.0); + var total = Ext.util.Format.usMoney(cost*amount); + return total; +} + +var selectModel = new top.Ext.grid.CheckboxSelectionModel(); +function viewRecordForm() { + wareHouseStore.load(); + var form = new top.Ext.FormPanel({ + id : 'godownEntryForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 750, + autoScroll : true, + labelAlign : 'left', + items:[{ + layout : 'column', + items : [{ + id : 'serialNum', + columnWidth : .15, + layout : 'form', + labelWidth : 30, + hidden:true, + items : [{ + xtype : 'textfield', + fieldLabel : '单号', + maxLength : '41', + id : 'serialNumber', + name : 'serialNumber', + cls : 'fieldReadOnlyNoRemove', + allowBlank : true, + readOnly : true, + anchor : '95%' + }] + },{ + columnWidth : .25, + layout : 'form', + labelWidth : 30, + items:[{ + xtype : 'combo', + fieldLabel : '仓库', + id : 'wareHouse1', + name : 'wareHouse1', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : wareHouseStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 150, + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('wareHouse1').setValue(record.data.id); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + } + } + } + }] + }, { + columnWidth : .15, + layout : 'form', + labelWidth : 45, + items : [{ + xtype : 'textfield', + fieldLabel : '操作员', + maxLength : '16', + id : 'operator', + name : 'operator', + allowBlank : false, + readOnly : true, + cls : 'fieldReadOnlyNoRemove', + value : $Id('userName').value, + anchor : '95%' + }] + }, { + columnWidth : .25, + layout : 'form', + labelWidth : 30, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '时间', + id : 'time', + name : 'time', + format : 'Y-m-d H:i', + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + value : new Date(), + allowBlank : false, + anchor : '95%' + }] + }, { + columnWidth : .20, + layout : 'form', + labelWidth : 30, + items : [{ + xtype : 'textfield', + fieldLabel : '总价', + id : 'totalPrice', + name : 'totalPrice', + readOnly:true, + cls : 'fieldReadOnlyNoRemove', + anchor : '95%' + }] + }] + },new top.Ext.grid.EditorGridPanel({ + id : 'godownEntryItemGrid', + bodyStyle : 'border:1px solid #afd7af', + frame :false, + sm : selectModel, + height : 300, + viewConfig: { + forceFit:true + }, + store : new top.Ext.data.Store({ + proxy : new top.Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!loadGodownEntryItemByid.do', + method : 'POST' + }), + reader : new top.Ext.data.JsonReader({ + fields : [ + {name : 'name'}, + {name : 'amount'}, + {name : 'batchNumber'}, + {name : 'cost'}, + {name : 'totalPrice'} + ] + }) + }), + cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), + {header : "名称",dataIndex : 'name',width : 150,menuDisabled : true}, + {header : "数量",dataIndex : 'amount',width : 40,menuDisabled : true}, + {header : "批次",width : 50,dataIndex : 'batchNumber',menuDisabled : true}, + {header : "单价",dataIndex : 'cost',width : 40,menuDisabled : true}, + {header : "小计",dataIndex : 'totalPrice',width : 40,menuDisabled : true} + ]) + })], + buttons : [{ + text : '取消', + handler : function() { + window.close(); + } + }] + }); + + var window = new top.Ext.Window( { + layout : 'fit', + title : entityName + '信息', + width : 900, + height :425, + modal : true, +// autoHeight : true, + border :false, + plain : true, + items : [ form ] + }); + window.show(); +} + +//查看 +var loadFormData = function(grid) { + var records = grid.getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要查看的盘盈盘亏单!"); + return false; + } + if (records.length > 1) { + showResult("一次只能修改一个盘盈盘亏单!"); + return false; + } + id = records[0].data['id']; + viewRecord(id); +}; + +//查看明细 +function viewRecord(id){ + commonEntry.setId(id); + viewRecordForm(); + top.Ext.getCmp("serialNum").show(); + top.Ext.getCmp('godownEntryForm').form.load({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!loadGodownEntry.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候', + params : {id : id}, + success : function(form, action) { + top.Ext.getCmp("time").setValue(Ext.util.Format.date(new Date(action.result.data.time.time), 'Y-m-d H:i')); + top.Ext.getCmp("wareHouse1").setValue(action.result.data.warehouseID); + + for(var i = 0 ;i < action.result.data.itemsList.length ;i++){ + var specification = action.result.data.itemsList[i].diposableGoods.specification; + var b = true; + if(specification == null || specification.length <= 0){ + b = false; + } + var amount =action.result.data.itemsList[i].amount; + var cost = parseFloat(action.result.data.itemsList[i].cost); + var godownEntryItem = new GodownEntryItemRecord({ + name : action.result.data.itemsList[i].diposableGoods.name + (b == false?"":" ["+specification+"]"), + amount : amount, + cost : cost, + batchNumber : action.result.data.itemsList[i].batchNumber, + totalPrice:parseFloat(amount*cost) + }); + + top.Ext.getCmp('godownEntryItemGrid').getStore().add(godownEntryItem); + } + setTotalMoney(top.Ext.getCmp('godownEntryItemGrid')); + }, + failure : function(form, action) { + } + }); +} + +/** + * 查看与修改记录 + * modifyRecord函数 触发modify函数调用,并传入当前列的值以及record.data对象 + * 页面中需要定义 modify(v,data) 函数 + */ +function modify(v,data){ + viewRecord(data['id']); +} + +Ext.onReady(function() { + Ext.QuickTips.init(); + commonEntry.setCurrentUserName(curUserName); + var columns = [ + {header : "单号",width : 120,dataIndex : 'serialNumber', renderer : modifyRecord}, + {header : "操作员",width : 120,dataIndex : 'operator'}, + {header : "仓库",width : 120,dataIndex : 'warehouseName'}, + {header : "类型",width : 120,dataIndex : 'subType'}, + {header : "时间",width : 120,dataIndex : 'time' , renderer : myDateFormatByMinute}, + {header : "金额",width : 200,dataIndex : 'totalPrice',id:'totalPrice'} + ]; + + var readerDetail = [ + {name : 'id'}, + {name : 'serialNumber'}, + {name : 'warehouseName'}, + {name : 'subType'}, + {name : 'operator'}, + {name : 'time'}, + {name : 'totalPrice'} + ]; + + var filters = new Ext.grid.GridFilters({ + filters:[ + {type: 'string', dataIndex: 'serialNumber'}, + {type: 'string', dataIndex: 'warehouseName'}, + {type: 'string', dataIndex: 'subType'}, + {type: 'string', dataIndex: 'operator'}, + {type: 'date', dataIndex: 'time'}, + {type: 'string', dataIndex: 'totalPrice'} + ]} + ); + + var tbar = [{ + text : '查看', + hidden : SSTS_WarehouseEntry_Update, + iconCls : 'btn_ext_application_edit', + id : 'editTbar', + handler : function() { + loadFormData(grid); + } + }, { + text : '打印', +// hidden : SSTS_WarehouseEntry_Delete, + iconCls : 'icon_print', + handler : function() { + commonEntry.onPrintEntryDetail(grid,entityName); + } + },'-',{ + text : '打印列表', +// hidden : SSTS_WarehouseEntry_Delete, + iconCls : 'icon_print', + handler : function() { + //加载打印数据 + var map = {}; + map["startDate"] = Ext.getCmp('startDate').getRawValue(); + map["endDate"] = Ext.getCmp('endDate').getRawValue(); + map["type"] = entityName; + + commonEntry.onPrintEntryList(map,entityName); + } + }]; + + grid = new Ext.ux.ForgonPageGrid( { + tbar : tbar, + pageSize : 20, + defaultSortField : 'id', + defaultSortDirection : 'DESC', + isCheckboxSelectionModel : true, + rememberSelected : false, + isShowSearchField : true, + columns : columns, + plugins: filters, + autoExpandColumn : 'totalPrice', + renderTo : 'gridDiv', + frame : false + }, readerDetail, + GodownEntryTableManager.findGodownStockTakeTableList, + null + ); + + function initQueryValueAndReload() { + var startDate = Ext.getCmp('startDate').getRawValue(); + var endDate = Ext.getCmp('endDate').getRawValue(); + if(startDate || endDate){ + if(!compareDate(startDate,endDate)){ + showResult("开始时间不能大于结束时间"); + return; + } + } + + $Id('parm_s_startDate').value = startDate; + $Id('parm_s_endDate').value = endDate; + grid.dwrReload(); + } + var dt = new Date(); + var v = dt.getMonth()+1; + if(v < 10){ + v = "0" + (dt.getMonth()+1); + } + var startDayofMonth = dt.getFullYear() + "/" + v + "/01"; + var form = new Ext.Panel({ + id : 'northPanel', + layout : 'table', + frame : true, + region : 'north', + border : false, + bodyBorder : false, + layoutConfig : {columns : 2}, + height : 40, + items : [{ + width :500, + layout : 'column', + items:[{ + columnWidth : .5, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'datefield', + fieldLabel : '开始日期', + name : 'startDate', + id : 'startDate', + readOnly : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + editable : false, + format : 'Y-m-d', + value:new Date(startDayofMonth), + anchor : '98%' + }] + },{ + columnWidth : .5, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'datefield', + fieldLabel : '结束日期', + name : 'endDate', + id : 'endDate', + readOnly : false, + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + editable : false, + format : 'Y-m-d', + value:new Date(), + anchor : '98%' + }] + }] + },{ + width :250, + layout : 'column', + items : [{ + columnWidth : .5, + layout :'form', + items : [{ + xtype : 'button', + text : '查询', + minWidth : 70, + iconCls : 'icon_search', + handler : function() { + initQueryValueAndReload(); + } + }] + },{ + columnWidth : .5, + layout :'form', + items : [{ + xtype : 'button', + text : '重置', + minWidth : 70, + iconCls : 'icon_set', + handler : function() { + Ext.getCmp('startDate').setValue(""); + Ext.getCmp('endDate').setValue(""); + } + }] + }] + }] + }); + + var viewport = new Ext.Viewport( { + layout : 'border', + items : [form,{ + region : 'center', + margins : '0 0 0 0', + layout : 'fit', + items : grid + }] + }); +}); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.jsp (revision 13290) @@ -0,0 +1,81 @@ +<%@page import="com.forgon.disinfectsystem.entity.assestmanagement.GodownEntryItem"%> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier,com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry "%> +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> +<%@ include file="/common/includeExtJsAndCss.jsp"%> +<%@ page import="com.forgon.tools.SpringBeanManger" %> +<% + String userName = AcegiHelper.getLoginUser().getUserFullName(); + request.setAttribute("userName",userName); +%> + + + +一次性物品盘盈盘亏信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +
+ + + \ No newline at end of file Index: ssts-web/src/main/webapp/homepage/menuconfigure.js =================================================================== diff -u -r13268 -r13290 --- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 13268) +++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 13290) @@ -258,6 +258,7 @@ {hidden :SSTS_godownEntryNode_Menu,text:"入库单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/godownEntryView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_WarehouseEntryOut_Menu,text:"退库单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/godownOutView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_WarehouseEntryOut_Menu,text:"调拨单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/appropriationView.jsp',hrefTarget:linkTarget,leaf:true}, + {hidden :SSTS_WarehouseEntryOut_Menu,text:"盘盈盘亏管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/godownStockTakeView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_JJJL_Menu,text:"一次性物品盘点管理",href:WWWROOT+'/disinfectsystem/stocktakerecordmanager/inventoryrecordView.jsp?type=disposableGoods',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_stockTakeInfoNode_Menu,text:"一次性物品结算管理",href:WWWROOT+'/disinfectsystem/reportforms/stocktakeView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_godownEntryNode_Menu,text:"一次性物品采购计划",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.jsp',hrefTarget:linkTarget,leaf:true}