K/3 Cloud 单据关联查询

销售出库单 下推 销售退货单,如何获知他们的关联关系?
T_SAL_OUTSTOCKENTRY
是销售出库单分录
T_SAL_RETURNSTOCKENTRY 是销售退货单分录
T_SAL_RETURNSTOCKENTRY_LK
是销售退货单单据关联配置表(关系表)

FSBILLID是源单ID,FSID是源分录ID
select T_SAL_OUTSTOCKENTRY.FREALQTY 
,isnull(T_SAL_RETURNSTOCKENTRY.FREALQTY,0)
 from T_SAL_OUTSTOCKENTRY  
    left join T_SAL_RETURNSTOCKENTRY_LK
      on T_SAL_OUTSTOCKENTRY.FID  = T_SAL_RETURNSTOCKENTRY_LK.FSBILLID
      and T_SAL_OUTSTOCKENTRY.FENTRYID = T_SAL_RETURNSTOCKENTRY_LK.FSID
    left join T_SAL_RETURNSTOCKENTRY
      on T_SAL_RETURNSTOCKENTRY.FENTRYID = T_SAL_RETURNSTOCKENTRY_LK.FENTRYID
    where  T_SAL_OUTSTOCKENTRY.FID = 173384

 

posted on 2019-11-29 18:12  Neo0820  阅读(528)  评论(0编辑  收藏  举报

导航