完善库存统计接口,增加移动平均价的逻辑
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
||||
<result column="MColor" jdbcType="VARCHAR" property="MColor" />
|
||||
<result column="purchase_decimal" jdbcType="DECIMAL" property="purchaseDecimal" />
|
||||
<result column="currentUnitPrice" jdbcType="DECIMAL" property="currentUnitPrice" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ResultStockWarningCount" type="com.jsh.erp.datasource.vo.DepotItemStockWarningCount">
|
||||
@@ -345,9 +346,11 @@
|
||||
<select id="findByAll" 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,
|
||||
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
|
||||
concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, m.unit_id, u.name unit_name, ifnull(me.purchase_decimal,0) purchase_decimal
|
||||
concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, m.unit_id, u.name unit_name,
|
||||
ifnull(me.purchase_decimal,0) purchase_decimal, ifnull(mcs.current_unit_price,0) currentUnitPrice
|
||||
from jsh_material m
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
|
||||
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
||||
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||
<result column="mBarCode" jdbcType="VARCHAR" property="mBarCode" />
|
||||
<result column="purchaseDecimal" jdbcType="VARCHAR" property="purchaseDecimal" />
|
||||
<result column="currentUnitPrice" jdbcType="VARCHAR" property="currentUnitPrice" />
|
||||
<result column="initialStock" jdbcType="DECIMAL" property="initialStock" />
|
||||
<result column="currentStock" jdbcType="DECIMAL" property="currentStock" />
|
||||
<result column="currentStockPrice" jdbcType="DECIMAL" property="currentStockPrice" />
|
||||
<result column="currentStockMovePrice" jdbcType="DECIMAL" property="currentStockMovePrice" />
|
||||
<result column="currentWeight" jdbcType="DECIMAL" property="currentWeight" />
|
||||
</resultMap>
|
||||
|
||||
@@ -604,8 +606,10 @@
|
||||
<select id="getListWithStock" resultMap="ResultMapListWithStock">
|
||||
select m.*, me.commodity_unit unitName, mc.name categoryName, me.bar_code mBarCode,
|
||||
ifnull(me.purchase_decimal,0) purchaseDecimal,
|
||||
ifnull(mcs.current_unit_price,0) currentUnitPrice,
|
||||
ifnull(sum(mcs.current_number),0) currentStock,
|
||||
sum(ifnull(me.purchase_decimal, 0) * ifnull(mcs.current_number, 0)) currentStockPrice,
|
||||
sum(ifnull(mcs.current_unit_price, 0) * ifnull(mcs.current_number, 0)) currentStockMovePrice,
|
||||
sum(ifnull(m.weight, 0) * ifnull(mcs.current_number, 0)) currentWeight
|
||||
FROM jsh_material m
|
||||
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
@@ -691,6 +695,7 @@
|
||||
select
|
||||
ifnull(sum(mcs.current_number),0) currentStock,
|
||||
sum(ifnull(me.purchase_decimal,0)*ifnull(mcs.current_number,0)) currentStockPrice,
|
||||
sum(ifnull(mcs.current_unit_price,0)*ifnull(mcs.current_number,0)) currentStockMovePrice,
|
||||
sum(ifnull(m.weight,0)*ifnull(mcs.current_number,0)) currentWeight
|
||||
from jsh_material m
|
||||
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
|
||||
Reference in New Issue
Block a user