IF(a.warehousing_outbound_type = 1,c.code,m.code) as SAL_ORDER,
IF(a.warehousing_outbound_type = 1,c.code,m.code) as SAL_ORDER,
d.CODE AS CUS_ID,
d.CODE AS CUS_ID,
d.NAME AS CUS_NAME,
d.NAME AS CUS_NAME,
@ -166,8 +166,8 @@
LEFT JOIN base_user k ON a.f_last_modify_user_id = k.f_id AND k.f_delete_mark IS NULL
LEFT JOIN base_user k ON a.f_last_modify_user_id = k.f_id AND k.f_delete_mark IS NULL
LEFT JOIN jg_delivery_order l on a.warehousing_id = l.id and l.f_delete_mark is null
LEFT JOIN jg_delivery_order l on a.warehousing_id = l.id and l.f_delete_mark is null
LEFT JOIN jg_business_order m on l.business_id = m.id and m.f_delete_mark is null
LEFT JOIN jg_business_order m on l.business_id = m.id and m.f_delete_mark is null
LEFT JOIN jg_business_order_product_relational n on c.id = n.business_order_id and n.f_delete_mark is null and aa.product_id = n.product_id and aa.outbound_unit = n.sales_main_unit_id
LEFT JOIN jg_business_order_product_relational n on c.id = n.business_order_id and n.f_delete_mark is null and aa.product_id = n.product_id and aa.outbound_unit = n.sales_main_unit_id and aa.ord_ln = n.ord_ln
LEFT JOIN jg_business_order_product_relational o on m.id = o.business_order_id and o.f_delete_mark is null and aa.product_id = o.product_id and aa.outbound_unit = o.sales_main_unit_id
LEFT JOIN jg_business_order_product_relational o on m.id = o.business_order_id and o.f_delete_mark is null and aa.product_id = o.product_id and aa.outbound_unit = o.sales_main_unit_id and aa.ord_ln = n.ord_ln