34,590
社区成员
发帖
与我相关
我的任务
分享
??
as current_location ===>as current_location ,
select dbo.usf_get_wh_name(parentHUM.wh_id) as wh_name,parentHUM.hu_id,hud.item_number,
hud.lot_number,sum(hud.actual_qty) as actual_qty,parentHUM.location_id as current_location, --这里加上个逗号。
(select top 1 l.location_id from t_location_relation l where l.relation_location_id = hud.status and l.wh_id =hud.wh_id) as supposed_zone
from t_hu_detail hud,t_hu_master parentHUM,t_location_relation LOR,t_location LOC
where hud.serial_number = parentHUM.hu_id
and LOR.relation_type='ITEM_STATUS'
and hud.status <> LOR.related_location_id
and LOR.location_id = parentHUM.location_id
and LOR.wh_id = parentHUM.wh_id
and LOC .location_id = LOR.location_id
and LOR.wh_id = LOR.wh_id
and LOC.type in ('M','R','U','P','C','V')
and hud.wh_id like '01'
and hud.item_number like '~item_number~'
and hud.lot_number like '~lot_number~'
group by parentHUM.wh_id,parentHUM.hu_id,hud.item_number,hud.lot_number,parentHUM.location_id,LOR.relation_location_id