解决采购入库统计的计算bug
This commit is contained in:
		
							parent
							
								
									3f3fb59059
								
							
						
					
					
						commit
						ecd62dcfb0
					
				| @ -537,10 +537,10 @@ public class DepotItemController { | ||||
|             if (null != dataList) { | ||||
|                 for (DepotItemVo4WithInfoEx diEx : dataList) { | ||||
|                     JSONObject item = new JSONObject(); | ||||
|                     BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InOutSumPrice = InSumPrice.subtract(OutSumPrice); | ||||
|                     item.put("barCode", diEx.getBarCode()); | ||||
|                     item.put("materialName", diEx.getMName()); | ||||
| @ -630,10 +630,10 @@ public class DepotItemController { | ||||
|             if (null != dataList) { | ||||
|                 for (DepotItemVo4WithInfoEx diEx : dataList) { | ||||
|                     JSONObject item = new JSONObject(); | ||||
|                     BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutInSumPrice = OutSumRetailPrice.subtract(InSumRetailPrice); | ||||
|                     item.put("barCode", diEx.getBarCode()); | ||||
|                     item.put("materialName", diEx.getMName()); | ||||
| @ -724,10 +724,10 @@ public class DepotItemController { | ||||
|             if (null != dataList) { | ||||
|                 for (DepotItemVo4WithInfoEx diEx : dataList) { | ||||
|                     JSONObject item = new JSONObject(); | ||||
|                     BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number"); | ||||
|                     BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMaterialExtendId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price"); | ||||
|                     BigDecimal OutInSumPrice = OutSumPrice.subtract(InSumPrice); | ||||
|                     item.put("barCode", diEx.getBarCode()); | ||||
|                     item.put("materialName", diEx.getMName()); | ||||
|  | ||||
| @ -101,7 +101,7 @@ public interface DepotItemMapperEx { | ||||
|     BigDecimal buyOrSaleNumber( | ||||
|             @Param("type") String type, | ||||
|             @Param("subType") String subType, | ||||
|             @Param("MId") Long MId, | ||||
|             @Param("meId") Long meId, | ||||
|             @Param("beginTime") String beginTime, | ||||
|             @Param("endTime") String endTime, | ||||
|             @Param("creatorArray") String[] creatorArray, | ||||
| @ -114,7 +114,7 @@ public interface DepotItemMapperEx { | ||||
|     BigDecimal buyOrSalePrice( | ||||
|             @Param("type") String type, | ||||
|             @Param("subType") String subType, | ||||
|             @Param("MId") Long MId, | ||||
|             @Param("meId") Long meId, | ||||
|             @Param("beginTime") String beginTime, | ||||
|             @Param("endTime") String endTime, | ||||
|             @Param("creatorArray") String[] creatorArray, | ||||
|  | ||||
| @ -334,14 +334,14 @@ public class DepotItemService { | ||||
|         return result; | ||||
|     } | ||||
| 
 | ||||
|     public BigDecimal buyOrSale(String type, String subType, Long MId, String beginTime, String endTime, | ||||
|     public BigDecimal buyOrSale(String type, String subType, Long meId, String beginTime, String endTime, | ||||
|                                 String[] creatorArray, Long organId, String [] organArray, List<Long> depotList, Boolean forceFlag, String sumType) throws Exception{ | ||||
|         BigDecimal result= BigDecimal.ZERO; | ||||
|         try{ | ||||
|             if (SUM_TYPE.equals(sumType)) { | ||||
|                 result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType); | ||||
|                 result= depotItemMapperEx.buyOrSaleNumber(type, subType, meId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType); | ||||
|             } else { | ||||
|                 result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType); | ||||
|                 result= depotItemMapperEx.buyOrSalePrice(type, subType, meId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType); | ||||
|             } | ||||
|         }catch(Exception e){ | ||||
|             JshException.readFail(logger, e); | ||||
|  | ||||
| @ -412,7 +412,7 @@ | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="getListWithBuyOrSale" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultByMaterial"> | ||||
|         select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard, | ||||
|         select m.id MId, di.material_extend_id, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard, | ||||
|         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3, | ||||
|         concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, m.brand, u.name unit_name | ||||
|         from jsh_material m | ||||
| @ -475,7 +475,7 @@ | ||||
|             and (dh.status = '1' or dh.status = '2' or dh.status = '3') | ||||
|         </if> | ||||
|         and ifnull(m.delete_flag,'0') !='1' | ||||
|         group by m.id, me.bar_code, m.name, m.mfrs, m.model, m.standard, | ||||
|         group by m.id, di.material_extend_id, me.bar_code, m.name, m.mfrs, m.model, m.standard, | ||||
|         m.other_field1,m.other_field2,m.other_field3, m.unit, u.basic_unit, m.color, m.brand, u.name | ||||
|         order by m.id desc | ||||
|         <if test="offset != null and rows != null"> | ||||
| @ -484,7 +484,7 @@ | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="getListWithBuyOrSaleCount" resultType="java.lang.Integer"> | ||||
|         select count(1) from (select m.id | ||||
|         select count(1) from (select m.id, di.material_extend_id | ||||
|         from jsh_material m | ||||
|         left join jsh_depot_item di on di.material_id=m.id  and ifnull(m.delete_Flag,'0') !='1' | ||||
|         left join jsh_material_extend me on me.id=di.material_extend_id  and ifnull(me.delete_Flag,'0') !='1' | ||||
| @ -544,7 +544,7 @@ | ||||
|             and (dh.status = '1' or dh.status = '2' or dh.status = '3') | ||||
|         </if> | ||||
|         and ifnull(di.delete_flag,'0') !='1' | ||||
|         group by m.id) cc | ||||
|         group by m.id, di.material_extend_id) cc | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="buyOrSaleNumber" resultType="java.math.BigDecimal"> | ||||
| @ -553,7 +553,7 @@ | ||||
|         and dh.type=#{type} and dh.sub_type=#{subType} | ||||
|         and dh.oper_time >= #{beginTime} | ||||
|         and dh.oper_time <= #{endTime} | ||||
|         and di.material_id =#{MId} | ||||
|         and di.material_extend_id =#{meId} | ||||
|         <if test="creatorArray != null"> | ||||
|             and dh.creator in ( | ||||
|             <foreach collection="creatorArray" item="creator" separator=","> | ||||
| @ -590,8 +590,8 @@ | ||||
|         and dh.type=#{type} and dh.sub_type=#{subType} | ||||
|         and dh.oper_time >= #{beginTime} | ||||
|         and dh.oper_time <= #{endTime} | ||||
|         <if test="MId != null"> | ||||
|             and di.material_id =#{MId} | ||||
|         <if test="meId != null"> | ||||
|             and di.material_extend_id =#{meId} | ||||
|         </if> | ||||
|         <if test="creatorArray != null"> | ||||
|             and dh.creator in ( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 jishenghua
						jishenghua