|
@@ -595,27 +595,51 @@
|
|
|
<select id="getReservesWarehouseListByCondition" parameterType="Map"
|
|
|
resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
|
|
|
SELECT
|
|
|
- wpsi.goods_name AS goodsName,
|
|
|
- sum( wpsi.STORAGE ) AS stockNum,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- ROUND( AVG( wo.avg_cost ), 3 )
|
|
|
- FROM
|
|
|
- warehousing_order wo
|
|
|
- WHERE
|
|
|
- wo.warehouse_name = wbi.warehouse_name
|
|
|
- AND wo.delete_flag = 0
|
|
|
- AND wbi.comp_id = wo.comp_id
|
|
|
- and wo.goods_name = wpsi.goods_name
|
|
|
- ) AS cost
|
|
|
+ wpsi.goods_name AS goodsName,
|
|
|
+ sum( wpsi.STORAGE ) AS stockNum,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ROUND( AVG( wo.avg_cost ), 3 )
|
|
|
+ FROM
|
|
|
+ warehousing_order wo
|
|
|
+ WHERE
|
|
|
+ wo.warehouse_name = wbi.warehouse_name
|
|
|
+ AND wo.delete_flag = 0
|
|
|
+ AND wbi.comp_id = wo.comp_id
|
|
|
+ and wo.goods_name = wpsi.goods_name
|
|
|
+ ) AS cost,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum( wo.surplus_weight ),0)
|
|
|
+ FROM
|
|
|
+ warehousing_order wo
|
|
|
+ WHERE
|
|
|
+ wo.warehouse_name = wbi.warehouse_name
|
|
|
+ AND wo.delete_flag = 0
|
|
|
+ AND wbi.comp_id = wo.comp_id
|
|
|
+ and wo.goods_name = wpsi.goods_name
|
|
|
+ and wo.in_type = '货转'
|
|
|
+ ) AS cargoWeight,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum( wo.transfer_out_weight ),0)
|
|
|
+ FROM
|
|
|
+ warehousing_order wo
|
|
|
+ WHERE
|
|
|
+ wo.warehouse_name = wbi.warehouse_name
|
|
|
+ AND wo.delete_flag = 0
|
|
|
+ AND wbi.comp_id = wo.comp_id
|
|
|
+ and wo.goods_name = wpsi.goods_name
|
|
|
+ and wo.redeem_flag = '赎'
|
|
|
+ ) AS redemptionWeight
|
|
|
FROM
|
|
|
- warehouse_base_info wbi
|
|
|
- LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
|
|
|
- AND wpi.delete_flag = 0
|
|
|
- LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
|
|
|
- AND wpsi.delete_flag = 0
|
|
|
+ warehouse_base_info wbi
|
|
|
+ LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
|
|
|
+ AND wpi.delete_flag = 0
|
|
|
+ LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
|
|
|
+ AND wpsi.delete_flag = 0
|
|
|
WHERE
|
|
|
- wpsi.id IS NOT NULL
|
|
|
+ wpsi.id IS NOT NULL
|
|
|
<if test="compId != null and compId != ''">
|
|
|
AND wbi.comp_id= #{compId}
|
|
|
</if>
|
|
@@ -623,7 +647,7 @@
|
|
|
AND wbi.warehouse_name= #{warehouseName}
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- wpsi.goods_name
|
|
|
+ wpsi.goods_name
|
|
|
|
|
|
</select>
|
|
|
|