diff --git a/WebRoot/WEB-INF/classes/com/jsh/action/basic/AccountAction.class b/WebRoot/WEB-INF/classes/com/jsh/action/basic/AccountAction.class index 2c960157..8cc15d11 100644 Binary files a/WebRoot/WEB-INF/classes/com/jsh/action/basic/AccountAction.class and b/WebRoot/WEB-INF/classes/com/jsh/action/basic/AccountAction.class differ diff --git a/WebRoot/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class b/WebRoot/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class index 40d780ee..f2b34296 100644 Binary files a/WebRoot/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class and b/WebRoot/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class differ diff --git a/WebRoot/WEB-INF/classes/com/jsh/service/basic/AccountService.class b/WebRoot/WEB-INF/classes/com/jsh/service/basic/AccountService.class index 41f58d2f..bf1cba8f 100644 Binary files a/WebRoot/WEB-INF/classes/com/jsh/service/basic/AccountService.class and b/WebRoot/WEB-INF/classes/com/jsh/service/basic/AccountService.class differ diff --git a/WebRoot/WEB-INF/classes/spring/basic-applicationContext.xml b/WebRoot/WEB-INF/classes/spring/basic-applicationContext.xml index ec9d563d..9d1e86fe 100644 --- a/WebRoot/WEB-INF/classes/spring/basic-applicationContext.xml +++ b/WebRoot/WEB-INF/classes/spring/basic-applicationContext.xml @@ -306,6 +306,7 @@ + diff --git a/WebRoot/js/pages/materials/in_out.js b/WebRoot/js/pages/materials/in_out.js index f81d7f6b..6572a552 100644 --- a/WebRoot/js/pages/materials/in_out.js +++ b/WebRoot/js/pages/materials/in_out.js @@ -740,12 +740,19 @@ else { var OrganId = null, AllocationProjectId = null; + var ChangeAmount = $.trim($("#ChangeAmount").val()); + var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text(); if(listSubType !=="调拨"){ OrganId = $('#OrganId').combobox('getValue'); } else { AllocationProjectId = $.trim($("#AllocationProjectId").val()); //收货仓库-对方 } + if(listSubType === "采购"||listSubType === "销售退货"){ + //付款为负数 + ChangeAmount = 0 - ChangeAmount; + TotalPrice = 0 - TotalPrice; + } $.ajax({ type:"post", url: url, @@ -761,8 +768,8 @@ OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()), AccountId: $.trim($("#AccountId").val()), - ChangeAmount: $.trim($("#ChangeAmount").val()), - TotalPrice: $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text(), + ChangeAmount: ChangeAmount, //付款/收款 + TotalPrice: TotalPrice, //合计 Remark: $.trim($("#Remark").val()), clientIp: clientIp }), diff --git a/WebRoot/pages/materials/material.jsp b/WebRoot/pages/materials/material.jsp index c4c0412a..f8139648 100644 --- a/WebRoot/pages/materials/material.jsp +++ b/WebRoot/pages/materials/material.jsp @@ -323,8 +323,8 @@ { title: '最低售价',field: 'LowPrice',width:70}, { title: '预设售价一',field: 'PresetPriceOne',width:70}, { title: '预设售价二',field: 'PresetPriceTwo',width:70}, - { title: '备注',field: 'Remark',width:110}, - { title: '操作',field: 'op',align:"center",width:120,formatter:function(value,rec) + { title: '备注',field: 'Remark',width:90}, + { title: '操作',field: 'op',align:"center",width:150,formatter:function(value,rec) { var str = ''; var rowInfo = rec.Id + 'AaBb' + rec.Name+ 'AaBb' + rec.Model + 'AaBb' + rec.Color + 'AaBb' + rec.Unit + 'AaBb' + rec.RetailPrice + 'AaBb' + rec.LowPrice + 'AaBb' + rec.PresetPriceOne + 'AaBb' + rec.PresetPriceTwo + 'AaBb' + rec.Remark; diff --git a/config/spring/basic-applicationContext.xml b/config/spring/basic-applicationContext.xml index ec9d563d..9d1e86fe 100644 --- a/config/spring/basic-applicationContext.xml +++ b/config/spring/basic-applicationContext.xml @@ -306,6 +306,7 @@ + diff --git a/src/com/jsh/action/basic/AccountAction.java b/src/com/jsh/action/basic/AccountAction.java index 16bf7582..ea7c38d6 100644 --- a/src/com/jsh/action/basic/AccountAction.java +++ b/src/com/jsh/action/basic/AccountAction.java @@ -10,10 +10,12 @@ import net.sf.json.JSONObject; import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; +import com.jsh.model.po.DepotHead; import com.jsh.model.po.Logdetails; import com.jsh.model.po.Account; import com.jsh.model.vo.basic.AccountModel; import com.jsh.service.basic.AccountIService; +import com.jsh.service.materials.DepotHeadIService; import com.jsh.util.PageUtil; /** * 结算账户 @@ -23,7 +25,8 @@ import com.jsh.util.PageUtil; public class AccountAction extends BaseAction { private AccountIService accountService; - private AccountModel model = new AccountModel(); + private DepotHeadIService depotHeadService; + private AccountModel model = new AccountModel(); @SuppressWarnings({ "rawtypes", "unchecked" }) public String getAccount() @@ -290,7 +293,7 @@ public class AccountAction extends BaseAction item.put("name", account.getName()); item.put("serialNo", account.getSerialNo()); item.put("initialAmount", account.getInitialAmount()); - item.put("currentAmount", account.getCurrentAmount()); + item.put("currentAmount", getAccountSum(account.getId()) + account.getInitialAmount()); item.put("remark", account.getRemark()); item.put("op", 1); dataArray.add(item); @@ -309,6 +312,31 @@ public class AccountAction extends BaseAction Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e); } } + /** + * 单个账户的金额求和 + * @param id + * @return + */ + public Double getAccountSum(Long id){ + Double accountSum = 0.0; + try{ + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_getSum(id)); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + if(dataList!= null){ + for(DepotHead depotHead:dataList){ + accountSum = accountSum + depotHead.getChangeAmount(); + } + } + } + catch (DataAccessException e){ + Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e); + } + return accountSum; + } /** * 查找结算账户信息-下拉框 @@ -380,6 +408,20 @@ public class AccountAction extends BaseAction condition.put("id_s_order", "desc"); return condition; } + + /** + * 拼接搜索条件-结算账户当前余额求和 + * @return + */ + private Map getCondition_getSum(Long id) + { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("AccountId_n_eq", id); + return condition; + } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== @Override @@ -391,4 +433,7 @@ public class AccountAction extends BaseAction { this.accountService = accountService; } + public void setDepotHeadService(DepotHeadIService depotHeadService) { + this.depotHeadService = depotHeadService; + } } diff --git a/src/com/jsh/action/materials/DepotHeadAction.java b/src/com/jsh/action/materials/DepotHeadAction.java index c903a0af..427ce27b 100644 --- a/src/com/jsh/action/materials/DepotHeadAction.java +++ b/src/com/jsh/action/materials/DepotHeadAction.java @@ -270,10 +270,10 @@ public class DepotHeadAction extends BaseAction item.put("HandsPersonName", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getName()); item.put("AccountId", depotHead.getAccountId()==null?"":depotHead.getAccountId().getId()); item.put("AccountName", depotHead.getAccountId()==null?"":depotHead.getAccountId().getName()); - item.put("ChangeAmount", depotHead.getChangeAmount()); + item.put("ChangeAmount", depotHead.getChangeAmount()==null?"":Math.abs(depotHead.getChangeAmount())); item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId()); item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName()); - item.put("TotalPrice", depotHead.getTotalPrice()); + item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice())); item.put("Remark", depotHead.getRemark()); item.put("op", 1); dataArray.add(item); diff --git a/src/com/jsh/service/basic/AccountService.java b/src/com/jsh/service/basic/AccountService.java index 982f64b6..8d1d133b 100644 --- a/src/com/jsh/service/basic/AccountService.java +++ b/src/com/jsh/service/basic/AccountService.java @@ -1,5 +1,4 @@ package com.jsh.service.basic; - import com.jsh.base.BaseService; import com.jsh.dao.basic.AccountIDAO; import com.jsh.model.po.Account; @@ -9,11 +8,11 @@ public class AccountService extends BaseService implements AccountIServ @SuppressWarnings("unused") private AccountIDAO accountDao; - public void setAccountDao(AccountIDAO accountDao) + public void setAccountDao(AccountIDAO accountDao) { this.accountDao = accountDao; } - + @Override protected Class getEntityClass() {