change - 销售订单相关SQL添加is_flag = '1'

master
yinq 2 weeks ago
parent 2e77fb0862
commit 2ead57f252

@ -147,10 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mso.order_amount
from mes_order_bind mob left join mes_base_material_info pbmi on mob.product_id=pbmi.material_id
left join mes_base_material_info mbmi on mob.material_id=mbmi.material_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id and mso.is_flag = '1'
<where>
mso.is_flag = '1'
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and mob.bind_amount &gt; mob.barcode_amount</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>

@ -467,10 +467,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from mes_purchase_order mpo left join mes_order_bind mob on mpo.purchase_order_id = mob.purchase_order_id
left join mes_base_material_info pbmi on mob.product_id=pbmi.material_id
left join mes_base_material_info mbmi on mob.material_id=mbmi.material_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id and mso.is_flag = '1'
<where>
mso.is_flag = '1'
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mpo.order_amount=1 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and (mob.bind_amount &gt; mob.barcode_amount or mbmi.always_flag='1')</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>

@ -254,9 +254,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_base_material_info mbmi on mbmi.material_id = wpi.product_id
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_product_plan mpp on mpp.plan_code = wpi.plan_code
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id
where mso.is_flag = '1'
and wpi.product_type = '3'
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id and mso.is_flag = '1'
where wpi.product_type = '3'
and wpi.execute_status = '2'
and (wpi.erp_status is null or wpi.erp_status != '1')
and wpi.instock_amount > if(wpi.erp_amount is null, 0, wpi.erp_amount)

@ -276,9 +276,9 @@
from wms_product_stock wps
left join mes_base_material_info mbmi on wps.product_id=mbmi.material_id
left join wms_base_warehouse wbw on wps.warehouse_id=wbw.warehouse_id
left join mes_sale_order mso on wps.sale_order_id=mso.sale_order_id
left join mes_sale_order mso on wps.sale_order_id=mso.sale_order_id and mso.is_flag = '1'
<where>
mso.is_flag = '1' and wps.total_amount>0 and wps.stock_type='3'
wps.total_amount>0 and wps.stock_type='3'
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code = #{saleorderCode}</if>
<if test="warehouseId != null ">and wps.warehouse_id = #{warehouseId}</if>
<if test="productId != null ">and wps.product_id = #{productId}</if>

@ -146,11 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wpss.total_amount,wpss.apply_amount, wpss.occupy_amount,wpss.frozen_amount,wpss.outstock_amount, wpss.confirm_amount,
mso.order_amount,wbw.warehouse_name,mbmi.material_code,mbmi.material_name
from wms_product_stock_saleorder wpss
left join mes_sale_order mso on wpss.sale_order_id = mso.sale_order_id
left join mes_sale_order mso on wpss.sale_order_id = mso.sale_order_id and mso.is_flag = '1'
left join wms_base_warehouse wbw on wpss.warehouse_id=wbw.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id=wpss.product_id
<where>
mso.is_flag = '1'
<if test="saleorderCode != null and saleorderCode != ''"> and wpss.saleorder_code = #{saleorderCode}</if>
<if test="warehouseId != null ">and wpss.warehouse_id = #{warehouseId}</if>
<if test="productId != null ">and wpss.product_id = #{productId}</if>

@ -390,9 +390,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_base_material_info mbmi on mbmi.material_id = wro.material_id
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_product_plan mpp on mpp.plan_code = wro.plan_code
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id and mso.is_flag = '1'
<where>
mso.is_flag = '1'
and wro.real_outstock_amount > 0
and wro.outstock_amount >= wro.real_outstock_amount
and wro.real_outstock_amount > if(wro.erp_amount is null, 0, wro.erp_amount)

@ -322,10 +322,9 @@
from wms_raw_stock wrs
left join wms_base_warehouse wbw on wbw.warehouse_id = wrs.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wrs.material_id
left join mes_sale_order mso on wrs.sale_order_id = mso.sale_order_id
left join mes_sale_order mso on wrs.sale_order_id = mso.sale_order_id and mso.is_flag = '1'
left join mes_base_unit_info mbui on mbmi.material_unit_id = mbui.erp_id
<where>
mso.is_flag = '1'
<if test="warehouseId != null ">and wrs.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wrs.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wrs.stock_type = #{stockType}</if>

@ -270,10 +270,10 @@
from wms_stock_total wst
left join wms_base_warehouse wbw on wbw.warehouse_id = wst.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id = mso.sale_order_id
left join mes_sale_order mso on wst.sale_order_id = mso.sale_order_id and mso.is_flag = '1'
left join mes_base_unit_info mbui on mbmi.material_unit_id = mbui.erp_id
<where>
mso.is_flag = '1' and wst.total_amount > 0
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>
@ -325,9 +325,8 @@
from wms_stock_total wst
left join wms_base_warehouse wbw on wbw.warehouse_id = wst.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id=mso.sale_order_id
left join mes_sale_order mso on wst.sale_order_id=mso.sale_order_id and mso.is_flag = '1'
<where>
mso.is_flag = '1'
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="warehouseType != null and warehouseType != ''">and wbw.warehouse_type = #{warehouseType}</if>

Loading…
Cancel
Save