--修正发货单累计出库数
update Sale_DeliveryOrders set
acc_out_quantity=isnull(t.quantity,0),
acc_out_num=isnull(t.num,0)
from(
    select dos_id,sum(d.quantity) as quantity,sum(d.num) as num
    from Stock_InOuts d 
    left join Stock_InOut t on t.io_id=d.io_id
    where isnull(dos_id,0)!=0
    and isnull(t.verify_user,'')<>''
    group by dos_id 
)t where Sale_DeliveryOrders.dos_id=t.dos_id
and Sale_DeliveryOrders.dos_id=t.dos_id
