K3CLOUD常用資料表
一、資料庫查詢常用表
--查詢資料表
select * from
(
select convert(varchar(4000),t1.FKERNELXML.query('//TableName')) as 'Item',t1.FKERNELXML,t2.FNAME, t1.*
from T_META_OBJECTTYPE t1
left join T_META_OBJECTTYPE_L t2 on t1.FID=t2.FID
--where t1.fid='SAL_SaleOrder'
) t
where Item<>'' and FNAME like '%收料通知單%'
通過表T_META_OBJECTTYPE的FKERNNELXML欄位進行xml查詢
庫存狀態列表
select t1.FSTOCKSTATUSID,t1.FNUMBER,t2.FNAME from T_BD_STOCKSTATUS t1
left join T_BD_STOCKSTATUS_L t2 on t1.FSTOCKSTATUSID=t2.FSTOCKSTATUSID
單據型別
select t1.FBILLTYPEID,t1.FNUMBER,t2.FNAME from T_BAS_BILLTYPE t1
left join T_BAS_BILLTYPE_L t2 on t1.FBILLTYPEID=t2.FBILLTYPEID
where t1.FBILLFORMID='QM_InspectBill' --單據型別--檢驗單
基礎資料
T_ORG_ORGANIZATIONS 組織表
T_ORG_ORGANIZATIONS_L 組織表
T_BAS_ASSISTANTDATA_L 輔助資料分類
T_BAS_ASSISTANTDATAENTRY 輔助資料列表
T_BAS_ASSISTANTDATAENTRY_L 輔助資料列表
t_bd_accountbook_l(賬簿多語言)
t_bd_accountbook(賬簿)
t_bd_material(物料)
t_bd_material_l(物料多語言)
T_BD_OPERATOR(業務員)
T_BD_OPERATOR_L(業務員多語言)
T_BD_STAFF(員工表)
t_BD_Stock(倉庫)
t_bd_supplier(供應商)
財務
t_AP_payable(應付單表頭)
T_AP_PAYBILL(付款單)
t_AR_receivable(應收單表頭)
t_AR_receivable(應收單表頭)
t_gl_voucher(憑證)
T_IV_PURCHASEIC(採購發票)
T_IV_SALESIC(銷售發票)
供應鏈
T_PUR_POORDER(採購訂單)
T_PUR_PRICELIST (價目表)
T_PUR_RECEIVE(採購收料單)
T_PUR_REQUISITION(採購申請)
T_SAL_DELIVERYNOTICE(銷售發貨通知單)
T_SAL_ORDER(銷售訂單)
T_SAL_OUTSTOCK(銷售出庫單)
T_SAL_RETURNSTOCK(銷售退貨單)
T_STK_INSTOCK(入庫單)
T_STK_InvBal(庫存餘額表)
T_STK_INVENTORY(即時庫存表)
4.製造
T_ENG_BOM(物料清單)
T_PRD_INSTOCK(生產入庫單)
T_PRD_MO(生產訂單)
T_PRD_MORPT(生產彙報單)
T_PRD_PICKMTRL(生產領料單)
T_PRD_PPBOM(生產用料清單)
T_PRD_PREPAREMTRL(生產備料單據頭)
T_PRD_RETURNMTRL(生產退料單)
T_SUB_FEEDMTRL(委外補料單)
T_SUB_PICKMTRL(委外領料單)
T_SUB_PPBOM(委外用料清單)
T_SUB_REQORDER(委外訂單)
T_SUB_RETURNMTRL(委外退料單)
--物料名稱
select m.fmaterialid,m.fmasterid, fname,m.fnumber from t_bd_material m join t_bd_material_l l on
l.fmaterialid=m.fmaterialid
where 1=1
--and m.fmaterialid=147002
and m.fnumber='XACPWM0067'
--and l.fname like '%扯麵%'
order by m.fmaterialid desc
--組織
select V_SCM_OWNERORG_L.FNAME,* from V_SCM_OWNERORG left join V_SCM_OWNERORG_L on
V_SCM_OWNERORG.FORGID=V_SCM_OWNERORG_L.FORGID
select l.FNAME,* from T_ORG_ORGANIZATIONS o
join T_ORG_ORGANIZATIONS_L l
on l.FORGID=o.FORGID
--元資料
select * from t_meta_objecttype_l ml,t_meta_objecttype m where fname like '%工序彙報%' and ml.fid=m.fid
--部門
select b.FNAME,* from T_BD_DEPARTMENT a join T_BD_DEPARTMENT_L b on a.FDEPTID=b.FDEPTID
--單據轉換
select * from T_META_CONVERTRULE where fid='PlanOrder_PPBom'
--通過元資料唯一id查詢選單
select * from T_META_CONSOLEDETAIL where FOBJECTID like '%stk_%'
--反寫規則
select rl.FNAME, * from T_BF_WRITEBACKRULE r
left join T_BF_WRITEBACKRULE_L rl on rl.FID=r.FID and rl.FLOCALEID=2052
left join T_BF_WRITEBACKRULECUST rc on r.FID=rc.FID
where (rl.FNAME like '%生產線生產%' or rl.FID like '%sfc_%') and rc.FFORBIDSTATUS='A'
--轉換規則
select * from T_META_CONVERTRULE where FID like '%rem_%'
select * from T_META_CONVERTRULE_L
--反寫規則
select * from T_BF_WRITEBACKRULE where fsourceformid like '%SFC_%' and ftargetformid like '%SFC_%'
--引數
select * from t_bas_sysparameter
--列舉值
select * from T_META_FORMENUM e
join T_META_FORMENUM_L el on el.FID=e.FID
where FNAME like '%生產線領料單%'
--單據型別
select * from T_BAS_BILLTYPE where FBILLFORMID like '%REM_INSTOCK%'
--選單操作對應類名
select * from T_MDL_FORMOPERATIONTYPE
--操作裡面的服務
select * from T_MDL_FORMBUSINESS_L where FDESC like '%更新即時庫存%'
select * from T_MDL_FORMBUSINESS where FACTIONID=45
--儲存介面佈局
select * from T_BAS_FormParameter
where FPARAOBJID like '%SFC_OperationPlanning%'
--使用者
select * from T_SEC_USER
--使用者引數
select * FROM T_BAS_UserParameter where FPARAMETEROBJID like '%rem_%'
--IDE函式
select fl.FNAME,f.FAPPEARANCECLASS,f.FELEMENTCLASS, * from T_MDL_ELEMENTTYPE f join T_MDL_ELEMENTTYPE_L fl on f.FID=fl.FID
where FELEMENTCLASS like '%OPERATIONSTATUS%' or FAPPEARANCECLASS like '%OPERATIONSTATUS%'
--列舉
select * from T_META_FORMENUM_L where fname ='REM_業務型別'
select * from t_Meta_Formenumitem where fid='c4a9508f-7af8-4edb-bb2f-fc21c866ee41'
--許可權物件,許可權項
select * from T_SEC_PERMISSIONOBJECT
select * from T_SEC_PERMISSIONOBJECTENTRY
--通過選單查詢元資料物件,查詢表名(在xml中搜t_)
select * from T_META_OBJECTTYPE h join T_META_OBJECTTYPE_L l on l.FID=h.FID where FNAME like '%運算日誌%'
--單位
select l.FNAME, * from T_BD_UNIT h join T_BD_UNIT_L l on h.FUNITID=l.FUNITID where l.FNAME like '%千克%'
--單據轉換、業務流程、反寫規則
SELECT * FROM T_BF_DEFVERSION
SELECT * FROM T_BF_DEFVERSION_L
SELECT * FROM T_BF_DEFVERSIONLOOKUP
SELECT * FROM T_BF_INSTANCE
SELECT * FROM T_BF_INSTANCEAMOUNT
SELECT * FROM T_BF_INSTANCEAMOUNTHIS
SELECT * FROM T_BF_INSTANCEENTRY
SELECT * FROM T_BF_INSTANCEENTRYHIS
SELECT * FROM T_BF_INSTANCEHIS
SELECT * FROM T_BF_INSTANCESNAP
SELECT * FROM T_BF_INSTANCESNAPHIS
SELECT * FROM T_BF_INSTANCETRACK
SELECT * FROM T_BF_MYFAVOURITE
SELECT * FROM T_BF_PROCDEF
SELECT * FROM T_BF_PROCDEF_L
SELECT * FROM T_BF_PROCESSTYPE
SELECT * FROM T_BF_PROCESSTYPE_L
SELECT * FROM T_BF_PUBLISH
SELECT * FROM T_BF_PUBLISH_L
SELECT * FROM T_BF_PUBLISHENTRY
SELECT * FROM T_BF_TABLEDEFINE
SELECT * FROM T_BF_TRACKBACKUPLOG
SELECT * FROM T_BF_WRITEBACKRULE
SELECT * FROM T_BF_WRITEBACKRULE_L
SELECT * FROM T_BF_WRITEBACKRULECUST
SELECT * FROM T_META_CONVERTRULE
SELECT * FROM T_META_CONVERTRULE_L
--SQL SERVER單據轉換、業務流程、反寫規則
CREATE TABLE TMP_COSTCALTABLE
(FTABLENAME VARCHAR(30));</P>
<P>INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_DEFVERSION');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_DEFVERSION_L');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_DEFVERSIONLOOKUP');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCEAMOUNT');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCEAMOUNTHIS');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCEENTRY');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCEENTRYHIS');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCEHIS');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCESNAP');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCESNAPHIS');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_INSTANCETRACK');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_MYFAVOURITE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PROCDEF');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PROCDEF_L');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PROCESSTYPE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PROCESSTYPE_L');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PUBLISH');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PUBLISH_L');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_PUBLISHENTRY');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_TABLEDEFINE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_TRACKBACKUPLOG');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_WRITEBACKRULE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_WRITEBACKRULE_L');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_BF_WRITEBACKRULECUST');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_META_CONVERTRULE');
INSERT INTO TMP_COSTCALTABLE(FTABLENAME) VALUES('T_META_CONVERTRULE_L'
SELECT * FROM TMP_COSTCALTABLE
--檢視系統所有表佔用的空間情況
create table tmpspace (Fname varchar(50),
Frows int,
Freserved varchar(50),
Fdata varchar(50),
Findex_size varchar(50),
Funused varchar(50));
--插入所有表資料大小
insert into tmpspace (Fname,Frows,Freserved, Fdata,Findex_size,Funused)
exec sp_msforeachTable @Command1="sp_spaceused '?'
--查詢
WITH FCBCOSTSPACE AS (
select CONVERT(DECIMAL,replace(sp.fdata,'KB',''))/1024 SPACE_MB,sp.* from tmpspace sp
inner join TMP_COSTCALTABLE cb on cb.FTABLENAME=sp.Fname)
SELECT * FROM FCBCOSTSPACE
ORDER BY SPACE_MB DESC
--臨時表佔用的總大小(M)
select SUM(CONVERT(DECIMAL,replace(sp.fdata,'KB','')))/1024 M from tmpspace sp
inner join TMP_COSTCALTABLE cb on cb.FTABLENAME=sp.Fname;
--drop table tmpspace;
--DROP TABLE TMP_COSTCALTABLE;</P>