|
|
|
@ -29,6 +29,8 @@
|
|
|
|
|
<result property="saleorderCode" column="saleorder_code"/>
|
|
|
|
|
<result property="materialClassfication" column="material_classfication"/>
|
|
|
|
|
<result property="unitName" column="unit_name"/>
|
|
|
|
|
<result property="standardAmount" column="standard_amount"/>
|
|
|
|
|
<result property="realOutstockAmount" column="real_outstock_amount"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="WmsStockTotal" id="WmsStockTotal4ApplyResult">
|
|
|
|
@ -186,15 +188,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectWmsStockTotalJoinListBySaleOrder" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
|
|
|
|
|
select wst.stock_total_id, wst.warehouse_id, wst.warehouse_floor, wst.stock_type, wst.material_id,
|
|
|
|
|
wst.total_amount, wst.frozen_amount, wst.occupy_amount,wst.safe_flag,wst.sale_order_id,
|
|
|
|
|
mbmi.material_code,mbmi.material_name,mbmi.material_spec,
|
|
|
|
|
(select sum(wro.outstock_amount) from wms_raw_outstock wro where wro.stock_total_id=wst.stock_total_id and
|
|
|
|
|
wro.plan_code=#{planCode} and wro.plan_detail_code=#{planDetailCode} and wro.audit_status!='2' and wro.execute_status!='2') outstock_amount
|
|
|
|
|
from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id
|
|
|
|
|
|
|
|
|
|
select wst.stock_total_id,
|
|
|
|
|
wst.warehouse_id,
|
|
|
|
|
wst.warehouse_floor,
|
|
|
|
|
wst.stock_type,
|
|
|
|
|
wst.material_id,
|
|
|
|
|
wst.total_amount,
|
|
|
|
|
wst.frozen_amount,
|
|
|
|
|
wst.occupy_amount,
|
|
|
|
|
wst.safe_flag,
|
|
|
|
|
wst.sale_order_id,
|
|
|
|
|
mbmi.material_code,
|
|
|
|
|
mbmi.material_name,
|
|
|
|
|
mbmi.material_spec,
|
|
|
|
|
(select sum(wro.outstock_amount)
|
|
|
|
|
from wms_raw_outstock wro
|
|
|
|
|
where wro.stock_total_id = wst.stock_total_id
|
|
|
|
|
and wro.plan_code=#{planCode}
|
|
|
|
|
and wro.plan_detail_code=#{planDetailCode}
|
|
|
|
|
and wro.audit_status != '2'
|
|
|
|
|
and wro.execute_status != '2') outstock_amount,
|
|
|
|
|
(select sum(wro.real_outstock_amount)
|
|
|
|
|
from wms_raw_outstock wro
|
|
|
|
|
where wro.stock_total_id = wst.stock_total_id
|
|
|
|
|
and wro.plan_code=#{planCode}
|
|
|
|
|
and wro.plan_detail_code=#{planDetailCode}
|
|
|
|
|
and wro.audit_status != '2') real_outstock_amount,
|
|
|
|
|
mmb.standard_amount
|
|
|
|
|
from mes_material_bom mmb
|
|
|
|
|
left join wms_stock_total wst on wst.material_id = mmb.material_id
|
|
|
|
|
left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id
|
|
|
|
|
<where>
|
|
|
|
|
and wst.total_amount>0
|
|
|
|
|
mmb.ancestors like concat(#{ancestors},'%') and wst.total_amount > 0
|
|
|
|
|
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
|
|
|
|
|
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
|
|
|
|
|
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
|
|
|
|
@ -211,8 +236,8 @@
|
|
|
|
|
or mbmi.material_spec like concat('%',#{materialCodeNameSpec},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="accessoriesFlag != null and accessoriesFlag != ''">and mbmi.accessories_flag='0'</if>
|
|
|
|
|
<if test="ancestors != null and ancestors != ''">and exists (select 1 from mes_material_bom mmb where
|
|
|
|
|
mmb.material_id=wst.material_id and mmb.ancestors like concat(#{ancestors},'%'))</if>
|
|
|
|
|
<!-- <if test="ancestors != null and ancestors != ''">and exists (select 1 from mes_material_bom mmb where-->
|
|
|
|
|
<!-- mmb.material_id=wst.material_id and mmb.ancestors like concat(#{ancestors},'%'))</if>-->
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|