知识分享 - 仓位相关表格
金蝶云社区-天冥异
天冥异
7人赞赏了该文章 3,000次浏览 未经作者许可,禁止转载编辑于2018年08月09日 20:13:09
summary-icon摘要由AI智能服务提供

本文详细介绍了K/3 Cloud系统中仓位的弹性域管理机制,包括仓位值集类型的定义、仓位值集选择、仓库基础资料配置及与仓位的关联。通过多张物理表格(如T_BAS_FLEX、t_BAS_FlexValues等)记录了弹性域与基础资料的关系、仓位值集及其明细、仓库与仓位的关联。还提供了多个SQL查询示例,展示了如何读取仓库启用的仓位值集类型及其可选值、仓库可选的仓位内码以及业务单据上仓位字段值及其各维度值。

仓位是维度关联字段类型,即弹性域:仓位的维度支持动态扩展。

K/3 Cloud支持的弹性域

T_BAS_FLEX : 记录各弹性域与父项基础资料的关系,通过此表,可以找到各弹性域对象的FormId
select FID,FNUMBER,FBASEINFO AS '父基础资料FormId', FFORMID as '弹性域业务数据Form' from T_BAS_FLEX;


仓位值集类型(弹性域维度定义)

定义仓位维度,如栋、楼、层等不同维度

业务对象FormId : BOS_FLEXVALUE
物理表格: t_BAS_FlexValues

仓位值集选择(各仓位维度可选值)

明确各仓位可以选择的值,如栋,可以维护好1栋、2栋作为可选值
业务对象FormId : BOS_FLEXVALUE_SELECT
物理表格:  t_BAS_FlexValuesEntry

仓库基础资料(启用哪些仓位值集)

记录启用了哪些仓位维度,可以选择哪些仓位值

业务对象FormId :BD_Stock
物理表格:
t_BD_Stock : 主表
t_BD_StockFlexItem : 仓库启用的仓位值集类型(启用的仓位维度)
t_BD_StockFlexDetail : 仓库所选仓位值集类型下,可选的仓位值集明细资料(可选的仓位值)



仓库与仓位之间的关联

物理表格
T_BD_FlexValuesCom:记录了仓库FStockId与仓位FStockLocId之间的关系。
应用:根据仓库,搜索可用的仓位


仓位数据


业务单据上,填写好各仓位维度的值之后,会向仓位数据表,插入一条数据,并生成一个流水主键值;
单据上仓位字段,存储此表的流水主键值;
单据通过关联此表,可以读取各个仓位维度值;

业务对象FormId :  BD_FLEXVALUESDETAIL
物理表格: T_BAS_FLEXVALUESDETAIL

业务单据

业务单据上使用的仓位字段,是维度关联字段,需要与仓库字段绑定;存储的仓位字段值,是仓位数据表主键值;
如:
select t1.FSTOCKLOCID as '仓位'
       ,loc.FF100001 as '维度1的值'
from T_STK_INSTOCKENTRY t1

  left join T_BAS_FlexValuesDetail loc on t1.FStockLocId = loc.FId

应用场景1:

读取仓库及其启用的仓位值集类型、每种值集的可选值:

select t0.FStockId as '仓库内码'
      ,t0.FNumber as '仓库编码'
      ,t0_L.FName as '仓库名称'
      ,t1.FFlexId as '值集类型内码(维度)'
      ,colType.FNumber as '值集类型编码(维度)'
      ,colType_L.FName as '值集类型名称(维度)'
      ,colType.FFlexNumber as '维度字段名'
      ,t2.FFlexEntryId as '值集选项内码(可选项)'
      ,colItem.FNumber as '值集选项编码(可选项)'
      ,colItem_L.FName as '值集选项名称(可选项)'
  from T_BD_Stock t0
  left join T_BD_STOCK_L t0_l on (t0.FStockId = t0_L.FStockId and t0_L.FLocaleId = 2052)
  left join t_BD_StockFlexItem t1 on (t0.FStockId = t1.FStockId)
left join t_BAS_FlexValues colType on (t1.FFlexId = colType.FId)
  left join t_BAS_FlexValues_L colType_L on (colType.FId = colType_L.FId and colType_L.FLocaleId = 2052)
  left join t_BD_StockFlexDetail t2 on (t1.FEntryId = t2.FEntryId)
left join t_BAS_FlexValuesEntry colItem on (t2.FFlexEntryId = colItem.FEntryId)
left join t_BAS_FlexValuesEntry_L colItem_L on (colItem.FEntryId = colItem_L.FENtryId and colItem_L.FLocaleId = 2052)







应用场景2:
读取仓库,可以选用的仓位内码;这个仓位内码,可以直接填写到单据的仓位字段上


SELECT S1.FSTOCKID
      ,S1.FNUMBER
      ,S2.FNAME
      ,S3.FSTOCKLOCID 
FROM T_BD_STOCK AS S1
INNER JOIN T_BD_STOCK_L AS S2 ON S2.FSTOCKID = S1.FSTOCKID AND S2.FLOCALEID = 2052
INNER JOIN T_BD_FLEXVALUESCOM S3 ON S3.FSTOCKID =S1.FSTOCKID






应用场景3:

读取业务单据上,仓位字段值,以及仓位各维度值

select t0.FID as '单据内码'
       ,t0.FBILLNO as '单据编号'
       ,t1.FStockId as '仓库内码'
       ,t10_L.FName as '仓库名称'
       ,t1.FStockLocId as '仓位内码'
       ,loc.FF100001 as '维度1的内码'
       ,locCol1.FNumber as '维度1的编码'
       --,loc.FF100002 as '维度2的内码'
       --,locCol2.FNumber as '维度2的编码'
from T_STK_Instock t0
left join T_STK_INSTOCKENTRY t1 on (t0.FId = t1.FId)
left join t_BD_Stock t10 on (t1.FStockId = t10.FStockId)
left join T_BD_STOCK_L t10_L on (t10.FStockId = t10_L.FStockId and t10_L.FLocaleId = 2052)
left join T_BAS_FlexValuesDetail loc on t1.FStockLocId = loc.FId
left join T_BAS_FLEXVALUESENTRY locCol1 on (loc.FF100001 = locCol1.FENTRYID)
left join T_BAS_FLEXVALUESENTRY_L locCol1_L on (locCol1_L.FEntryId = locCol1.FENTRYID and locCol1_L.FLocaleId = 2052)
--left join T_BAS_FLEXVALUESENTRY locCol2 on (loc.FF100002 = locCol1.FENTRYID)
--left join T_BAS_FLEXVALUESENTRY_L locCol2_L on (locCol2_L.FEntryId = locCol2.FENTRYID and locCol2_L.FLocaleId = 2052)




图标赞 7
7人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!