用户-人员-员工任岗-业务员-业务组-部门-岗位 关系整理
用户-人员-员工任岗-业务员-业务组-部门-岗位 关系整理
业务组(枚举)
库存组-KCZ
计划组-JHZ
采购组-CGZ
质检组-ZJZ
销售组-XSZ
业务员类型(枚举)
销售员-XSY
采购员-CGY
仓管员-WHY
计划员-JHY
财务人员-CWRY
质检员-ZJY
服务人员-FWRY
驾驶员-JSY
程序员-CXY
业务对象 | FormId | 表 |
查询用户 | SEC_User | T_SEC_USER |
联系对象 | BD_ContactObject | V_BD_CONTACTOBJECT(对象类型:员工-T_BD_PERSON、客户-T_BD_COMMONCONTACT(FCOMPANYTYPE = 'BD_Customer')、供应商-T_BD_COMMONCONTACT(FCOMPANYTYPE = 'BD_Supplier')) |
员工 | BD_Empinfo | T_HR_EMPINFO |
业务组列表 | BD_OPERATORGROUPBILL | T_BD_OPERATORGROUP、T_BD_OPERATORGROUP_L T_BD_OPERATORGROUPENTRY、T_BD_OPERATORGROUPENTRY_L |
业务员列表 | BD_OPERATOR | T_BD_OPERATOR、T_BD_OPERATORENTRY 、T_BD_OPERATORDETAILS |
员工任岗明细 | BD_NEWSTAFF | T_BD_STAFF |
仓管员 | BD_WAREHOUSEWORKERS | V_BD_WAREHOUSEWORKERS(T_BD_OPERATOR) |
岗位信息 | HR_ORG_HRPOST | T_ORG_POST |
部门 | BD_Department | T_BD_DEPARTMENT |
1、仓库负责人是员工任岗信息,仓管员是业务员,如何产生关联 ?
SELECT t0.FENTRYID, t1.FSTAFFID, d.FPRINCIPAL, d.FNUMBER
FROM T_BD_OPERATORENTRY t0
JOIN T_BD_STAFF t1
ON t0.FSTAFFID = t1.FSTAFFID
AND t1.FFORBIDSTATUS = 'A'
AND t1.FDOCUMENTSTATUS = 'C'
JOIN T_SEC_USER t3
ON t1.FPERSONID = t3.FLINKOBJECT
INNER JOIN T_BD_STOCK d ON d.FPRINCIPAL = t1.FSTAFFID
WHERE t0.FOPERATORTYPE = 'WHY'
2、系统操作上业务员、业务组如何和员工任岗关联起来?
先在业务员这列表里面仓管员里面加上这个员工,然后在这个员工下面加上这个岗位,再给这个业务员新增一个业务分组
3、根据当前用户获取业务员(仓管员、销售员等)
SELECT t0.FENTRYID
FROM T_BD_OPERATORENTRY t0
join T_BD_STAFF t1 on t0.FSTAFFID=t1.FSTAFFID and t1.FFORBIDSTATUS = 'A' AND t1.FDOCUMENTSTATUS='C'
JOIN T_SEC_USER t3 on t1.FPERSONID = t3.FLINKOBJECT
WHERE t0.FOPERATORTYPE = 'WHY' AND t0.FISUSE='1' AND t3.FUSERID = 644075 AND t0.FBIZORGID=100003
4、选择员工(BOS绑定基础资料"员工"),加载任岗部门
员工 -- BD_Empinfo -- T_HR_EMPINFO 通过"人员"字段 FPersonId 和 T_BD_PERSON表关联
SELECT d.FDEPTID FROM T_BD_PERSON b
INNER JOIN T_HR_EMPINFO a ON a.FPERSONID = b.FPERSONID
INNER JOIN T_BD_STAFF c ON b.FPERSONID = c.FPERSONID
LEFT JOIN T_BD_DEPARTMENT d ON c.FDEPTID = d.FDEPTID
WHERE c.FFORBIDSTATUS = 'A' AND a.FID = @员工内码
AND c.FUSEORGID = @机构内码
5、根据登录用户名,查询相关员工、任岗、部门、组织等信息
SELECT a.FUSERID AS 用户内码,
a.FNAME 用户名,
b.FPERSONID AS 人员内码,
bl.FNAME AS 人员姓名,
dl.FNAME AS 任岗部门名称,
el.FNAME AS 任岗岗位名称,
st.FISFIRSTPOST AS 是否主任岗
FROM T_SEC_USER a -- 用户表
INNER JOIN T_BD_PERSON b
ON a.FLINKOBJECT = b.FPERSONID -- 人员表
LEFT JOIN T_BD_PERSON_L bl
ON b.FPERSONID = bl.FPERSONID
AND bl.FLOCALEID = 2052
INNER JOIN T_BD_STAFF c
ON b.FPERSONID = c.FPERSONID -- 员工任岗表
LEFT JOIN T_BD_DEPARTMENT d
ON c.FDEPTID = d.FDEPTID -- 部门表
LEFT JOIN T_BD_DEPARTMENT_L dl
ON d.FDEPTID = dl.FDEPTID
AND dl.FLOCALEID = 2052
LEFT JOIN T_ORG_POST e
ON c.FPOSTID = e.FPOSTID -- 岗位表
LEFT JOIN T_ORG_POST_L el
ON e.FPOSTID = el.FPOSTID
AND el.FLOCALEID = 2052
LEFT JOIN T_BD_STAFFTEMP st on st.FPOSTID = el.FPOSTID and st.FSTAFFID = c.FSTAFFID
WHERE a.FNAME = '0918'
【使用案例】
1、出库申请单扩展销售员(基础资料)能默认当前用户,并携带出销售员对应的领用部门
新增审核员工任岗信息,指定了业务员类型,会写入业务员明细表(T_BD_OPERATORENTRY),删除员工任岗,需写删除相关业务员
2、在调拨申请单中新增了采购员字段,想将金蝶系统上的单据的采购员名称回传至第三方系统,但是只能取到id,取不到姓名,想知道应该取哪个字段才能取到采购员的名字
SELECT t.FBASE2, t0.FENTRYID, t1.FSTAFFID, l.FNAME FROM T_STK_STKTRANSFERAPP t JOIN T_BD_OPERATORENTRY t0 ON t.FBASE2 = t0.FENTRYID JOIN T_BD_STAFF t1 ON t0.FSTAFFID = t1.FSTAFFID JOIN T_BD_STAFF_L l ON t1.FSTAFFID = l.FSTAFFID AND l.FLOCALEID = 2052 WHERE t.FID = 110227
3、新增单据自动根据当前用户带出员工和部门
import clr clr.AddReference('Kingdee.BOS.ServiceHelper') from Kingdee.BOS.ServiceHelper import * from System import StringComparison def AfterBindData(e): userId = this.Context.UserId FDOCUMENTSTATUS = this.View.Model.GetValue("FDocumentStatus") sqlText = '''SELECT a.FUSERID,a.FNAME,b.FPERSONID,c.FSTAFFID,d.FDEPTID FROM T_SEC_USER a INNER JOIN T_BD_PERSON b ON a.FLINKOBJECT = b.FPERSONID LEFT JOIN T_BD_PERSON_L bl ON b.FPERSONID = bl.FPERSONID AND bl.FLOCALEID = 2052 INNER JOIN T_BD_STAFF c ON b.FPERSONID = c.FPERSONID LEFT JOIN T_BD_DEPARTMENT d ON c.FDEPTID = d.FDEPTID LEFT JOIN T_BD_DEPARTMENT_L dl ON d.FDEPTID = dl.FDEPTID AND dl.FLOCALEID = 2052 WHERE a.FUSERID = {0}'''.format(str(userId)) dyObjs = DBServiceHelper.ExecuteDynamicObject(this.Context, sqlText) if dyObjs.Count > 0 and FDOCUMENTSTATUS == 'Z': for item in dyObjs: this.View.Model.SetValue("FApplicationDeptId", item["FDEPTID"]) this.View.Model.SetValue("FApplicantId", item["FSTAFFID"])
4、其他出库单"领料人",根据"领料部门"和"库存组织"做过滤
FUseOrgId = CASE WHEN GetValue(FStockOrgId) IS NULL OR GetValue(FStockOrgId)=0 THEN t0.FUseOrgId ELSE GetValue(FStockOrgId) END AND FDeptId=CASE WHEN GetValue(FDeptId) IS NULL OR GetValue(FDeptId)=0 THEN t0.FDeptId ELSE GetValue(FDeptId) END
5、其他出库单新增自动携带当前用户对应的任岗部门到单据中的部门和领料人
import clr clr.AddReference('Kingdee.BOS.ServiceHelper') from Kingdee.BOS.ServiceHelper import * from System import StringComparison def AfterBindData(e): userId = this.Context.UserId FDOCUMENTSTATUS = this.View.Model.GetValue("FDocumentStatus") sqlText = '''SELECT a.FUSERID,a.FNAME,b.FPERSONID,c.FSTAFFID,d.FDEPTID FROM T_SEC_USER a INNER JOIN T_BD_PERSON b ON a.FLINKOBJECT = b.FPERSONID LEFT JOIN T_BD_PERSON_L bl ON b.FPERSONID = bl.FPERSONID AND bl.FLOCALEID = 2052 INNER JOIN T_BD_STAFF c ON b.FPERSONID = c.FPERSONID LEFT JOIN T_BD_DEPARTMENT d ON c.FDEPTID = d.FDEPTID LEFT JOIN T_BD_DEPARTMENT_L dl ON d.FDEPTID = dl.FDEPTID AND dl.FLOCALEID = 2052 WHERE c.FDOCUMENTSTATUS = 'C' AND a.FUSERID = {0}'''.format(str(userId)) dyObjs = DBServiceHelper.ExecuteDynamicObject(this.Context, sqlText) if dyObjs.Count > 0 and FDOCUMENTSTATUS == 'Z': for item in dyObjs: this.View.Model.SetValue("FDeptId", item["FDEPTID"]) this.View.Model.SetValue("FPickerId", item["FSTAFFID"])
以上基于个人理解整理所得,如有错误,还请指正。
根据登录用户名,查询相关员工、任岗、部门、组织等信息.rar
沙发
用户-人员-员工任岗-业务员-业务组-部门-岗位 关系整理
本文2024-09-16 19:06:10发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-26408.html