Commit e6aa6586 by wuwenlong

产副品制造成本核算;

parent 36abee8b
...@@ -686,28 +686,30 @@ public class HGCBTools { ...@@ -686,28 +686,30 @@ public class HGCBTools {
kc003ParamMap.put(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START,hgcw001.getAccountPeriodDateStart()); kc003ParamMap.put(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START,hgcw001.getAccountPeriodDateStart());
kc003ParamMap.put(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_END,hgcw001.getAccountPeriodDateEnd()); kc003ParamMap.put(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_END,hgcw001.getAccountPeriodDateEnd());
List<HGKC003> hgkc003List = HGKCTools.HgKc003.list(kc003ParamMap); List<HGKC003> hgkc003List = HGKCTools.HgKc003.list(kc003ParamMap);
//入库单按项目编码、产品编码、存货工序ID、规格、单重分组,分别取正向入库单数量、重量和退回数量 if(CollectionUtils.isNotEmpty(hgkc003List)) {
//生成制造成本基础数据 //入库单按项目编码、产品编码、存货工序ID、规格、单重分组,分别取正向入库单数量、重量和退回数量
List<HGCB005> hgcb005List = constractHGCB005(hgcw001,hgkc003List); //生成制造成本基础数据
//设置权重 List<HGCB005> hgcb005List = constractHGCB005(hgcw001, hgkc003List);
setingCostWeight(hgcb005List); //设置权重
//计算项目总成本 setingCostWeight(hgcb005List);
Map<String,BigDecimal> totalAmoutMap = calculateProjAmout(hgcw001); //计算项目总成本
//计算产副品成本:权重值*项目总费用=产副品制造总成本;总成本/数量=单位成本 Map<String, BigDecimal> totalAmoutMap = calculateProjAmout(hgcw001);
Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().forEach( o -> { //计算产副品成本:权重值*项目总费用=产副品制造总成本;总成本/数量=单位成本
BigDecimal totalAmout = totalAmoutMap.get(o.getProjCode()); Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().forEach(o -> {
o.setTotalCost(totalAmout.multiply(o.getCostWeightValue()).setScale(6,RoundingMode.HALF_UP)); BigDecimal totalAmout = totalAmoutMap.get(o.getProjCode());
o.setUnitCost(o.getTotalCost().divide(o.getQuantity(),6,RoundingMode.HALF_UP)); o.setTotalCost(totalAmout.multiply(o.getCostWeightValue()).setScale(6, RoundingMode.HALF_UP));
}); o.setUnitCost(o.getTotalCost().divide(o.getQuantity(), 6, RoundingMode.HALF_UP));
//按公司删除当前会计起的成本核算数据 });
Map cb005DeleteParam = new HashMap(); //按公司删除当前会计起的成本核算数据
cb005DeleteParam.put(HGCB005.FIELD_company_code,hgcw001.getCompanyCode()); Map cb005DeleteParam = new HashMap();
cb005DeleteParam.put(HGCB005.FIELD_account_year,hgcw001.getAccountYear()); cb005DeleteParam.put(HGCB005.FIELD_company_code, hgcw001.getCompanyCode());
cb005DeleteParam.put(HGCB005.FIELD_account_month,hgcw001.getAccountPeriod().substring(4)); cb005DeleteParam.put(HGCB005.FIELD_account_year, hgcw001.getAccountYear());
deleteByCondition(cb005DeleteParam); cb005DeleteParam.put(HGCB005.FIELD_account_month, hgcw001.getAccountPeriod().substring(4));
//保存新的成本核算数据 deleteByCondition(cb005DeleteParam);
if(CollectionUtils.isNotEmpty(hgcb005List)){ //保存新的成本核算数据
DaoBase.getInstance().insertBatch(HGCB005.INSERT, hgcb005List); if (CollectionUtils.isNotEmpty(hgcb005List)) {
DaoBase.getInstance().insertBatch(HGCB005.INSERT, hgcb005List);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment