张庆宇 1 月之前
父節點
當前提交
22daa3a253

+ 13
- 0
imp更改合同类型的sql.txt 查看文件

@@ -0,0 +1,13 @@
1
+SELECT * FROM SGGMIIP."purchaseContract" pc WHERE pc."pono" ='POS52050250017' AND IFNULL(pc."del_flag",0) <> 1;
2
+SELECT * FROM SGGMIIP."purchaseOrder" po WHERE po."pono" ='POS52050250017' AND IFNULL(po."del_flag",0) <> 1;
3
+SELECT * FROM SGGMIIP."contrRegLedger" crl WHERE crl."contrNo" ='POS52050250017' AND ifnull(crl."del_flag",0) <> 1;
4
+SELECT * FROM SGGMIIP."purMultiSettle" pms WHERE pms."pono" ='POS52050250017' AND ifnull(pms."del_flag",0) <> 1;
5
+
6
+UPDATE SGGMIIP."purchaseContract" pc SET "bizType" ='进口采购' 
7
+WHERE "pono" ='POS52050250017' AND IFNULL(pc."del_flag",0) <> 1;
8
+UPDATE SGGMIIP."purchaseOrder" po SET "bizType" ='进口采购' 
9
+WHERE "pono" ='POS52050250017' AND IFNULL(po."del_flag",0) <> 1;
10
+UPDATE SGGMIIP."contrRegLedger" crl SET "bizType" ='进口采购' 
11
+WHERE "contrNo" ='POS52050250017' AND IFNULL(crl."del_flag",0) <> 1;
12
+UPDATE SGGMIIP."purMultiSettle" pms SET "bizType" ='进口采购' 
13
+WHERE "pono" ='POS52050250017' AND IFNULL(pms."del_flag",0) <> 1;

+ 11
- 0
印花税查询.txt 查看文件

@@ -0,0 +1,11 @@
1
+印花税查询
2
+
3
+select 
4
+a.foursname 我方名称 ,  a.ctName 客商名称 ,a.fno 销售合同号 , a.create_by_name  制单人 ,
5
+IFNULL(a.stampTaxAmt,0)  印花税金额 
6
+
7
+from  salesContract a 
8
+
9
+where ifnull(a.del_flag,0)<>1
10
+and ifnull(a.isinitDate,'')<>'是'
11
+and a.placed='2'

+ 46
- 0
合同跳过审批生成订单的sql.txt 查看文件

@@ -0,0 +1,46 @@
1
+销售合同
2
+-- 此SQL是准备生成订单使用的sql,将结果复制出来即可
3
+SELECT 'call pro_contractPushToOrder_SO(' || a.id || ');', *
4
+FROM SGGMIIP.salesContract a
5
+WHERE 1 = 1
6
+AND "sono" ='RIIXX25RE-012YZ-03'
7
+AND IFNULL("del_flag", 0) <> 1;
8
+
9
+
10
+SELECT 'call pro_contractPushToOrder_PO('||a.id||');',* 
11
+FROM purchaseContract A
12
+WHERE 1 = 1
13
+AND "pono" ='RIIXX25RE-012YZ-03'
14
+AND IFNULL("del_flag", 0) <> 1;
15
+
16
+
17
+-- PS:此处只准备了销售和采购两类合同的,其他合同根据情况使用
18
+
19
+
20
+-- 修改状态能够使用备案程序生成数据
21
+UPDATE SGGMIIP.salesContract a
22
+SET placed =2
23
+WHERE 1 = 1
24
+  AND "sono" ='RIIXX25RE-012YZ-03'
25
+  AND IFNULL("del_flag", 0) <> 1;
26
+
27
+UPDATE SGGMIIP.purchaseContract a
28
+SET placed =2
29
+WHERE 1 = 1
30
+  AND "pono" ='RIIXX25RE-012YZ-03'
31
+  AND IFNULL("del_flag", 0) <> 1;
32
+
33
+UPDATE SGGMIIP.otherTContract a
34
+SET placed =2
35
+WHERE 1 = 1
36
+  AND "fno" ='RIIXX25RE-012YZ-03'
37
+  AND IFNULL("del_flag", 0) <> 1;
38
+
39
+
40
+
41
+-- 修改完状态之后使用下面的程序生成备案信息(传的值不重要什么都可以)
42
+call pro_contrRegLedger205_update(2004431899797127170);
43
+
44
+-- 生成备案信息之后给挂一个审批流,这个审批流的id是做起初的时候使用的,此处可在后续根据审批人员进行数据扩充
45
+UPDATE contrRegLedger A SET "sourceContractApprovalId" ='2003749389394382848' 
46
+WHERE "contrNo" IN ('RIIXX25RE-012YZ-03');

+ 5
- 0
接口查询.txt 查看文件

@@ -0,0 +1,5 @@
1
+接口查询
2
+select * from SGGMINFT.inf_cust_ctrl where create_time         >'20251223'  -- 客商新增/变更申请 opCode N是新增 R是变更
3
+select * from SGGMINFT.inf_cust_add where create_time          >'20251223'  -- 客商新增变更反馈信息 return_Code Y是成功 N是失败
4
+select * from SGGMINFT.inf_cust_bank where create_time         >'20251223'  -- 银行新增申请
5
+select * from SGGMINFT.inf_custbank_add where create_time      >'20251223'; -- 银行新增反馈 return_Code 1是驳回 0是成功

+ 6
- 0
数据字典使用到的sql.txt 查看文件

@@ -0,0 +1,6 @@
1
+使用说明:在使用的时候请修改sql中标红的内容,修改内容为属性为select的列所对应的名称内容
2
+SELECT dd."dic_name",di."item_value" FROM SGGMIIP."data_dic" dd ,SGGMIIP."data_item" di  
3
+WHERE di."dic_id" = dd."id"  
4
+AND dd."dic_name" IN ('收款方式') 
5
+AND di."status" = 0 AND dd."status" = 0 
6
+ORDER BY dd."dic_name" ,di."item_order" ;

+ 108
- 0
期初合同数据统计sql.txt 查看文件

@@ -0,0 +1,108 @@
1
+期初合同数据统计sql
2
+SELECT CASE WHEN "placed" = 0 THEN '未确认' WHEN  "placed" = 3 THEN '已确认' END placed,
3
+sd2.DEPT_NAME  ,COUNT("sono") 
4
+FROM "salesContract" a
5
+LEFT JOIN SYS_DEPARTMENT sd ON a.DEPT_ID = sd.ID 
6
+LEFT JOIN SYS_DEPARTMENT sd2 ON sd2.DEPT_CODE = sd.f_id
7
+WHERE "remark" LIKE '期初%' 
8
+AND ifnull(a.del_flag, 0) <> 1
9
+AND a."dept_id" not IN ('6EEC827642F611B296968E9A54163B68',
10
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
11
+GROUP BY "placed",sd2.DEPT_NAME
12
+ORDER BY sd2.DEPT_NAME,placed;
13
+
14
+SELECT CASE WHEN "placed" = 0 THEN '未确认' WHEN  "placed" = 3 THEN '已确认' END placed,
15
+sd.DEPT_NAME ,COUNT(sono) 
16
+FROM salesContract a
17
+LEFT JOIN SYS_DEPARTMENT sd ON a.DEPT_ID = sd.ID 
18
+WHERE "remark" LIKE '期初%' 
19
+AND ifnull(a.del_flag, 0) <> 1
20
+AND a."dept_id" IN ('6EEC827642F611B296968E9A54163B68',
21
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
22
+GROUP BY "placed",sd.DEPT_NAME 
23
+ORDER BY sd.DEPT_NAME,placed;
24
+
25
+SELECT CASE WHEN "placed" = 0 THEN '未确认' WHEN  "placed" = 3 THEN '已确认' END placed,
26
+sd2.DEPT_NAME  ,COUNT("pono") 
27
+FROM "purchaseContract" a
28
+LEFT JOIN SYS_DEPARTMENT sd ON a.DEPT_ID = sd.ID 
29
+LEFT JOIN SYS_DEPARTMENT sd2 ON sd2.DEPT_CODE = sd.f_id
30
+WHERE "remark" LIKE '期初%' 
31
+AND ifnull(a.del_flag, 0) <> 1
32
+AND a."dept_id" not IN ('6EEC827642F611B296968E9A54163B68',
33
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
34
+GROUP BY "placed",sd2.DEPT_NAME
35
+ORDER BY sd2.DEPT_NAME,placed;
36
+
37
+SELECT CASE WHEN "placed" = 0 THEN '未确认' WHEN  "placed" = 3 THEN '已确认' END placed,
38
+sd.DEPT_NAME ,COUNT(pono) 
39
+FROM purchaseContract a
40
+LEFT JOIN SYS_DEPARTMENT sd ON a.DEPT_ID = sd.ID 
41
+WHERE "remark" LIKE '期初%' 
42
+AND ifnull(a.del_flag, 0) <> 1
43
+AND a."dept_id" IN ('6EEC827642F611B296968E9A54163B68',
44
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
45
+GROUP BY "placed",sd.DEPT_NAME 
46
+ORDER BY sd.DEPT_NAME,placed;
47
+期初合同统计sql 2.0
48
+SELECT '采购合同' AS 合同类型,sd2.DEPT_NAME AS "部门名称",
49
+    SUM(CASE WHEN pc."placed" = 0 THEN 1 ELSE 0 END) AS "未确认",
50
+    SUM(CASE WHEN PC."placed" = 3 THEN 1 ELSE 0 END) AS "已确认",
51
+    SUM(CASE WHEN pc."placed" = 2 THEN 1 ELSE 0 END) AS "已提交",
52
+    SUM(CASE WHEN crl."ifFiling" = '已备案' THEN 1 ELSE 0 END) AS "已备案",
53
+    SUM(CASE WHEN crl."ifFiling" = '未备案' THEN 1 ELSE 0 END) AS "未备案"
54
+FROM SGGMIIP."purchaseContract" pc 
55
+LEFT JOIN SYS_DEPARTMENT sd ON PC."dept_id" = sd.ID 
56
+LEFT JOIN SYS_DEPARTMENT sd2 ON sd2.DEPT_CODE = sd.f_id
57
+LEFT JOIN (SELECT * FROM SGGMIIP."contrRegLedger" WHERE ifnull("del_flag", 0)<>1) crl ON CRL."sourceid" = pc."id" 
58
+WHERE pc."remark" LIKE '期初%' 
59
+AND ifnull(pc."del_flag" , 0) <> 1
60
+AND pc."dept_id" not IN ('6EEC827642F611B296968E9A54163B68',
61
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
62
+GROUP BY sd2.DEPT_NAME
63
+UNION 
64
+SELECT '采购合同' AS 合同类型,sd.DEPT_NAME AS "部门名称",
65
+    SUM(CASE WHEN pc."placed" = 0 THEN 1 ELSE 0 END) AS "未确认",
66
+    SUM(CASE WHEN PC."placed" = 3 THEN 1 ELSE 0 END) AS "已确认",
67
+    SUM(CASE WHEN pc."placed" = 2 THEN 1 ELSE 0 END) AS "已提交",
68
+    SUM(CASE WHEN crl."ifFiling" = '已备案' THEN 1 ELSE 0 END) AS "已备案",
69
+    SUM(CASE WHEN crl."ifFiling" = '未备案' THEN 1 ELSE 0 END) AS "未备案"
70
+FROM SGGMIIP."purchaseContract" pc 
71
+LEFT JOIN SYS_DEPARTMENT sd ON PC."dept_id" = sd.ID 
72
+LEFT JOIN (SELECT * FROM SGGMIIP."contrRegLedger" WHERE ifnull("del_flag", 0)<>1 ) crl ON CRL."sourceid" = pc."id" 
73
+WHERE pc."remark" LIKE '期初%' 
74
+AND ifnull(pc."del_flag" , 0) <> 1
75
+AND pc."dept_id" IN ('6EEC827642F611B296968E9A54163B68',
76
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
77
+GROUP BY sd.DEPT_NAME
78
+UNION 
79
+SELECT '销售合同' AS 合同类型,sd2.DEPT_NAME AS "部门名称",
80
+    SUM(CASE WHEN sc."placed" = 0 THEN 1 ELSE 0 END) AS "未确认",
81
+    SUM(CASE WHEN sc."placed" = 3 THEN 1 ELSE 0 END) AS "已确认",
82
+    SUM(CASE WHEN sc."placed" = 2 THEN 1 ELSE 0 END) AS "已提交",
83
+    SUM(CASE WHEN crl."ifFiling" = '已备案' THEN 1 ELSE 0 END) AS "已备案",
84
+    SUM(CASE WHEN crl."ifFiling" = '未备案' THEN 1 ELSE 0 END) AS "未备案"
85
+FROM SGGMIIP."salesContract" sc 
86
+LEFT JOIN SYS_DEPARTMENT sd ON sc."dept_id" = sd.ID 
87
+LEFT JOIN SYS_DEPARTMENT sd2 ON sd2.DEPT_CODE = sd.f_id
88
+LEFT JOIN (SELECT * FROM SGGMIIP."contrRegLedger" WHERE ifnull("del_flag", 0)<>1 ) crl ON CRL."sourceid" = sc."id" 
89
+WHERE sc."remark" LIKE '期初%' 
90
+AND ifnull(sc."del_flag" , 0) <> 1
91
+AND sc."dept_id" not IN ('6EEC827642F611B296968E9A54163B68',
92
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
93
+GROUP BY sd2.DEPT_NAME
94
+UNION 
95
+SELECT '销售合同' AS 合同类型,sd.DEPT_NAME AS "部门名称",
96
+    SUM(CASE WHEN sc."placed" = 0 THEN 1 ELSE 0 END) AS "未确认",
97
+    SUM(CASE WHEN sc."placed" = 3 THEN 1 ELSE 0 END) AS "已确认",
98
+    SUM(CASE WHEN sc."placed" = 2 THEN 1 ELSE 0 END) AS "已提交",
99
+    SUM(CASE WHEN crl."ifFiling" = '已备案' THEN 1 ELSE 0 END) AS "已备案",
100
+    SUM(CASE WHEN crl."ifFiling" = '未备案' THEN 1 ELSE 0 END) AS "未备案"
101
+FROM SGGMIIP."salesContract" sc 
102
+LEFT JOIN SYS_DEPARTMENT sd ON sc."dept_id" = sd.ID 
103
+LEFT JOIN (SELECT * FROM SGGMIIP."contrRegLedger" WHERE ifnull("del_flag", 0)<>1 ) crl ON CRL."sourceid" = sc."id" 
104
+WHERE sc."remark" LIKE '期初%' 
105
+AND ifnull(sc."del_flag" , 0) <> 1
106
+AND sc."dept_id" IN ('6EEC827642F611B296968E9A54163B68',
107
+'8B9C826D42F611B2B4F446F64BAA7F44','EA0D828442F611B2B323708DAB1348AE')
108
+GROUP BY sd.DEPT_NAME;

+ 2
- 0
查看是否共享,共享人是谁的相关问题sql.txt 查看文件

@@ -0,0 +1,2 @@
1
+查看是否共享,共享人是谁的相关问题SQL
2
+select rptg as 共享人,contrExecCd as 执行人,* from salesOrder

+ 98
- 0
查询库存的sql.txt 查看文件

@@ -0,0 +1,98 @@
1
+
2
+SELECT 
3
+    t1.pono AS 采购合同号,
4
+    t2.sono AS 销售合同号,
5
+    t1.foursname AS 我方,
6
+    t2.ctname AS 客户,
7
+    t1.stockname AS 仓库名称,
8
+    t1.sdesc AS 中文品名,
9
+    t1.arrDt AS 到港时间,
10
+    pp.dPort AS 目的港,
11
+    pp.chnShipName AS 船名,
12
+    t1.ut AS 单位,
13
+    t1.total_qty AS 库存量,
14
+    ABS(nvl(t2.total_qty_out, 0)) AS 出库量,
15
+    ABS(nvl(t3.total_qty_in, 0)) AS 入库量,
16
+    t1.poamt AS 采购金额,
17
+    t1.soamt AS 销售金额,
18
+  
19
+    pp.create_by_name AS 制单人代码
20
+FROM (
21
+    SELECT 
22
+        IFNULL(b.pono, '') AS pono,
23
+        a.foursname,
24
+        b.ctname,
25
+        b.stockname, 
26
+        b.sdesc,
27
+        b.ut, 
28
+        b.fcat, 
29
+        b.qty, 
30
+        b.poamt,
31
+        b.soamt,
32
+        b.sono, 
33
+        b.id,
34
+        b.create_by,
35
+        a.arrDt,
36
+        -- 计算该合同的总数量
37
+        SUM(nvl(b.fcat, 0) * nvl(b.qty, 0)) OVER (PARTITION BY IFNULL(b.pono, '')) AS total_qty,
38
+        -- 为每个合同的行编号,取第一条
39
+        ROW_NUMBER() OVER (PARTITION BY IFNULL(b.pono, '') ORDER BY b.id) AS rn
40
+    FROM mdkcdtl b
41
+    LEFT JOIN mdkcctrl a ON a.id = b.rid
42
+    WHERE a.placed = '2' 
43
+        AND IFNULL(a.del_flag, 0) <> 1
44
+        AND IFNULL(b.del_flag, 0) <> 1
45
+        AND a.fmodalid NOT IN ('922', '923')
46
+) t1
47
+LEFT JOIN (
48
+    SELECT 
49
+        b.ctname as ctname,
50
+        b.sono as sono,
51
+        IFNULL(b.pono, '') AS pono,
52
+        -- 计算fcat=-1的总数量
53
+        SUM(nvl(b.fcat, 0) * nvl(b.qty, 0)) AS total_qty_out,
54
+        -- 统计fcat=-1的记录数
55
+        COUNT(*) AS count_minus1
56
+    FROM mdkcdtl b
57
+    LEFT JOIN mdkcctrl a ON a.id = b.rid
58
+    WHERE a.placed = '2' 
59
+        AND b.fcat = '-1'
60
+        AND IFNULL(a.del_flag, 0) <> 1
61
+        AND IFNULL(b.del_flag, 0) <> 1
62
+        AND a.fmodalid NOT IN ('922', '923')
63
+    GROUP BY IFNULL(b.pono, ''),b.ctname,b.sono
64
+) t2 ON t1.pono = t2.pono
65
+LEFT JOIN (
66
+    SELECT 
67
+        IFNULL(b.pono, '') AS pono,
68
+        -- 计算fcat=-1的总数量
69
+        SUM(nvl(b.fcat, 0) * nvl(b.qty, 0)) AS total_qty_in,
70
+        -- 统计fcat=-1的记录数
71
+        COUNT(*) AS count_minus1
72
+    FROM mdkcdtl b
73
+    LEFT JOIN mdkcctrl a ON a.id = b.rid
74
+    WHERE a.placed = '2' 
75
+        AND b.fcat = '1'
76
+        AND IFNULL(a.del_flag, 0) <> 1
77
+        AND IFNULL(b.del_flag, 0) <> 1
78
+        AND a.fmodalid NOT IN ('922', '923')
79
+    GROUP BY IFNULL(b.pono, '')
80
+) t3 ON t1.pono = t3.pono
81
+LEFT JOIN (
82
+    SELECT 
83
+        a1.pono,
84
+        a1.dPort,
85
+        a1.chnShipName,
86
+        a1.totalQty,
87
+        a1.create_by_name
88
+     --  a2.sdesc
89
+    FROM purchaseOrder a1 
90
+  --  LEFT JOIN pOrderDtl a2 ON a1.id = a2.rid
91
+    WHERE IFNULL(a1.del_flag, 0) <> 1   
92
+    --   AND IFNULL(a2.del_flag, 0) <> 1
93
+    AND a1.placed = '2'
94
+) pp
95
+ ON t1.pono = pp.pono
96
+WHERE t1.rn = 1  -- 只取每个合同的第一行
97
+    AND t1.stockname <> '直运库'
98
+ORDER BY t1.pono;

+ 414
- 0
查询当天各模块录入情况的sql.txt 查看文件

@@ -0,0 +1,414 @@
1
+当天各模块数据录入
2
+--select * from  SGGMIIP.v_user_model;
3
+select a.user_desc 用户名,bm.fdn 单位,bm.dn 部门,d.serviceType 采购合同类型,
4
+(NVL(b.ks,0) + NVL(c.zyh,0) + NVL(d.cg,0) + NVL(e.xs,0) + NVL(f.CGDD,0) + NVL(g.XSDD,0) + NVL(h.ps,0) + NVL(i.kzh,0) + NVL(j.KZJH,0) 
5
++ NVL(k.KZSQ,0) + NVL(l.KZDJ,0) + NVL(m.DD,0) + NVL(n.SZDJ,0) + NVL(o.XM,0) + NVL(p.KSSX,0) + NVL(q.XSXY,0) + NVL(r.CGXY,0) 
6
++ NVL(s.ZC,0) + NVL(t.CC,0) + NVL(u.JG,0) + NVL(v.QT,0) + NVL(w.GB,0) + NVL(x.GD,0) + NVL(y.QZ,0) + NVL(z.HH,0) + NVL(a1.TD,0) 
7
++ NVL(a2.DZ,0) + NVL(a3.BG,0) + NVL(a4.ZJJH,0) + NVL(a5.SK,0) + NVL(a6.SKTZ,0) + NVL(a7.FK,0) + NVL(a8.FM,0) + NVL(a9.FY,0) 
8
++ NVL(a10.RZSQ,0) + NVL(a11.RZFK,0) + NVL(a12.RZHK,0) + NVL(a13.DHTZ,0) + NVL(a14.CGRK,0) + NVL(a15.QTRK,0) + NVL(a16.RKTH,0) 
9
++ NVL(a17.FH,0) + NVL(a18.XSCK,0) + NVL(a19.QTCK,0) + NVL(a20.JKDP,0) + NVL(a21.KPTZ,0) + NVL(a22.JXFP,0) + NVL(a23.FYFP,0) 
10
++ NVL(a24.XSJS,0) + NVL(a25.XSFYKP,0) + NVL(a26.HZZG,0) + NVL(a27.FYZG,0) + NVL(a28.SPBMSQ,0)+ NVL(a30.zyjh,0) + NVL(a31.kcjg,0))合计录入,
11
+b.ks 客商管理,c.ZYH 资源号,d.cg 采购合同,e.xs 销售合同,
12
+f.CGDD 采购订单,g.XSDD 销售订单,h.ps 合同评审,i.kzh 开证行,j.KZJH 开证计划,k.KZSQ 开证申请,
13
+l.KZDJ 开证登记,m.DD 信用证到单,n.SZDJ 收证登记,o.XM 项目计划书,p.KSSX 客商授信评审,q.XSXY 代理销售协议,
14
+r.CGXY 代理采购协议,s.ZC 租船合同,t.CC 仓储合同,u.JG 加工合同,v.QT 其他合同,w.GB 合同关闭申请 ,x.GD 合同归档,y.QZ 合同签章工作台
15
+,z.HH 换货合同,a1.TD 提单登记,a2.DZ 单证制作,a3.BG 报关单,a4.ZJJH 资金计划,a5.SK 收款,a6.SKTZ 收款调整,
16
+a7.FK 货款付款,a8.FM 非贸付款,a9.FY 费用付款,a10.RZSQ 融资申请,a11.RZFK 融资放款,a12.RZHK 融资还款,a13.DHTZ 到货通知,
17
+a14.CGRK 采购入库,a15.QTRK 其他入库,a16.RKTH 入库退回,a17.FH 放货申请,a18.XSCK 销售出库,a19.QTCK 其他出库,
18
+a20.JKDP 进口到票,a21.KPTZ 开票通知,a22.JXFP 进项发票登记,a23.FYFP 费用发票登记,a24.XSJS 销售结算开票,a25.XSFYKP 销售费用结算开票
19
+,a26.HZZG 货值暂估,a27.FYZG 费用暂估,a28.SPBMSQ 商品编码申请,a30.zyjh 作业计划,a31.kcjg 库存加工
20
+  from SGGMIIP.sys_user a 
21
+  LEFT JOIN SGGMIIP.SYS_USER_DEPARTMENT sud on a.id = sud.user_id
22
+  LEFT JOIN (select fsd.dept_name as fdn,fsd.dept_code as fdc,sd.dept_name as dn,sd.dept_code as dc,sd.id from SGGMIIP.SYS_DEPARTMENT sd LEFT JOIN SGGMIIP.SYS_DEPARTMENT fsd
23
+on sd.f_id = fsd.dept_code)bm on bm.id = sud.dept_id
24
+ left join  
25
+(select create_by,count(*)ks from SGGMIIP.custctrl  --客商
26
+where nvl(del_flag,0)<>1
27
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
28
+group by create_by ) b on a.USER_CODE=b.create_by
29
+
30
+left join  
31
+(select create_by,count(*) zyh from SGGMIIP.resourcectrl  --资源号
32
+where nvl(del_flag,0)<>1
33
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
34
+group by create_by ) c on a.USER_CODE=c.create_by
35
+
36
+left join  
37
+(select create_by,serviceType,count(*)cg from SGGMIIP.purchaseContract --采购合同
38
+where nvl(del_flag,0)<>1
39
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
40
+and nvl(remark,'') != '期初导入-采购'
41
+group by create_by ,serviceType) d on a.USER_CODE=d.create_by
42
+
43
+left join  
44
+(select create_by,count(*)xs from SGGMIIP.salesContract --销售合同
45
+where nvl(del_flag,0)<>1
46
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
47
+and nvl(remark,'') != '期初'
48
+group by create_by ) e on a.USER_CODE=e.create_by
49
+
50
+left join  
51
+(select create_by,count(*)cgdd from SGGMIIP.purchaseOrder  --采购订单
52
+where nvl(del_flag,0)<>1
53
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
54
+group by create_by ) f on a.USER_CODE=f.create_by
55
+
56
+left join  
57
+(select create_by,count(*) xsdd from SGGMIIP.salesOrder  --销售订单
58
+where nvl(del_flag,0)<>1
59
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
60
+group by create_by ) g on a.USER_CODE=g.create_by
61
+
62
+left join  
63
+(select create_by,count(*)ps from SGGMIIP.ContractReview --合同评审
64
+where nvl(del_flag,0)<>1
65
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
66
+group by create_by ) h on a.USER_CODE=h.create_by
67
+
68
+left join  
69
+(select create_by,count(*)kzh from SGGMIIP.LcBank --开证行
70
+where nvl(del_flag,0)<>1
71
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
72
+group by create_by ) i on a.USER_CODE=i.create_by
73
+
74
+left join  
75
+(select create_by,count(*)kzjh from SGGMIIP.lcplan --开证计划
76
+where nvl(del_flag,0)<>1
77
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
78
+group by create_by ) j on a.USER_CODE=j.create_by
79
+
80
+left join  
81
+(select create_by,count(*)kzsq from SGGMIIP.lcApplication --开证申请
82
+where nvl(del_flag,0)<>1
83
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
84
+group by create_by ) k on a.USER_CODE=k.create_by
85
+
86
+left join  
87
+(select create_by,count(*)kzdj from SGGMIIP.Lcctrl --开证登记
88
+where nvl(del_flag,0)<>1
89
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
90
+group by create_by ) l on a.USER_CODE=l.create_by
91
+
92
+left join  
93
+(select create_by,count(*)dd from SGGMIIP.lcrctrl --信用证到单
94
+where nvl(del_flag,0)<>1
95
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
96
+group by create_by ) m on a.USER_CODE=M.create_by
97
+
98
+left join  
99
+(select create_by,count(*)szdj from SGGMIIP.breceiptctrl--收证登记
100
+where nvl(del_flag,0)<>1
101
+and nvl(create_by,'')<>'' and fmodalid =20 and create_time>='2025-12-04 17:00:01'
102
+group by create_by ) N on a.USER_CODE=n.create_by
103
+
104
+left join  
105
+(select create_by,count(*)xm from SGGMIIP.ProjectPlan --项目计划书
106
+where nvl(del_flag,0)<>1
107
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
108
+group by create_by ) o on a.USER_CODE=o.create_by
109
+
110
+left join  
111
+(select create_by,count(*)kssx from 	SGGMIIP.CtCredReview--客商授信评审
112
+where nvl(del_flag,0)<>1
113
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
114
+group by create_by ) p on a.USER_CODE=p.create_by
115
+
116
+left join  
117
+(select create_by,count(*)xsxy from SGGMIIP.ExpAgencyAgt --代理销售协议
118
+where nvl(del_flag,0)<>1
119
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
120
+group by create_by ) q on a.USER_CODE=q.create_by
121
+
122
+left join  
123
+(select create_by,count(*)cgxy from 	SGGMIIP.ImpAgencyAgt--代理采购协议
124
+where nvl(del_flag,0)<>1
125
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
126
+group by create_by ) r on a.USER_CODE=r.create_by
127
+
128
+left join  
129
+(select create_by,count(*)zc from SGGMIIP.shippingContract --租船合同
130
+where nvl(del_flag,0)<>1
131
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
132
+group by create_by ) s on a.USER_CODE=s.create_by
133
+
134
+left join  
135
+(select create_by,count(*)cc from 	SGGMIIP.whosContract--仓储合同
136
+where nvl(del_flag,0)<>1
137
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
138
+group by create_by ) t on a.USER_CODE=t.create_by
139
+
140
+left join  
141
+(select create_by,count(*)jg from 	SGGMIIP.processContract --加工合同
142
+where nvl(del_flag,0)<>1
143
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
144
+group by create_by ) u on a.USER_CODE=u.create_by
145
+
146
+left join  
147
+(select create_by,count(*)qt from 	SGGMIIP.otherTContract--其他合同
148
+where nvl(del_flag,0)<>1
149
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
150
+group by create_by ) v on a.USER_CODE=v.create_by
151
+
152
+left join  
153
+(select create_by,count(*)gb from 	SGGMIIP.contrCloseReq --合同关闭
154
+where nvl(del_flag,0)<>1
155
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
156
+group by create_by ) w on a.USER_CODE=w.create_by
157
+
158
+left join  
159
+(select create_by,count(*)gd from 	SGGMIIP.contractArchiving--合同归档
160
+where nvl(del_flag,0)<>1
161
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
162
+group by create_by ) x on a.USER_CODE=x.create_by
163
+
164
+left join  
165
+(select create_by,count(*)qz from 	SGGMIIP.contractSignature --合同签章
166
+where nvl(del_flag,0)<>1
167
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
168
+group by create_by ) y on a.USER_CODE=y.create_by
169
+
170
+left join  
171
+(select create_by,count(*)hh from 	SGGMIIP.exchangeContract--换货合同
172
+where nvl(del_flag,0)<>1
173
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
174
+group by create_by ) z on a.USER_CODE=z.create_by
175
+
176
+left join  
177
+(select create_by,count(*)td from 	SGGMIIP.blReg --提单登记
178
+where nvl(del_flag,0)<>1
179
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
180
+group by create_by ) a1 on a.USER_CODE=a1.create_by
181
+
182
+left join  
183
+(select create_by,count(*)dz from 	SGGMIIP.invList--单证制作
184
+where nvl(del_flag,0)<>1
185
+and nvl(create_by,'')<>'' and fmodalid='11' and create_time>='2025-12-04 17:00:01'
186
+group by create_by ) a2 on a.USER_CODE=a2.create_by
187
+
188
+left join  
189
+(select create_by,count(*)bg from 	SGGMIIP.invList --报关
190
+where nvl(del_flag,0)<>1
191
+and nvl(create_by,'')<>'' and fmodalid='130' and create_time>='2025-12-04 17:00:01'
192
+group by create_by ) a3 on a.USER_CODE=a3.create_by
193
+
194
+left join  
195
+(select create_by,count(*)zjjh from 	SGGMIIP.FundPlan--资金计划
196
+where nvl(del_flag,0)<>1
197
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
198
+group by create_by ) a4 on a.USER_CODE=a4.create_by
199
+
200
+left join  
201
+(select create_by,count(*)sk from 	SGGMIIP.breceiptctrl --收款
202
+where nvl(del_flag,0)<>1
203
+and nvl(create_by,'')<>'' and fmodalid='19' and create_time>='2025-12-04 17:00:01'
204
+group by create_by ) a5 on a.USER_CODE=a5.create_by
205
+
206
+left join  
207
+(select create_by,count(*)sktz from SGGMIIP.ReceiptAdjustLog --收款调整申请
208
+where nvl(del_flag,0)<>1
209
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
210
+group by create_by ) a6 on a.USER_CODE=a6.create_by
211
+
212
+left join  
213
+(select create_by,count(*)fk from 	SGGMIIP.paymgrctrl --货款付款
214
+where nvl(del_flag,0)<>1
215
+and nvl(create_by,'')<>'' and fmodalid='15' and create_time>='2025-12-04 17:00:01'
216
+group by create_by ) a7 on a.USER_CODE=a7.create_by
217
+
218
+left join  
219
+(select create_by,count(*)fm from SGGMIIP.paymgrctrl --非贸货款
220
+where nvl(del_flag,0)<>1
221
+and nvl(create_by,'')<>''  and fmodalid='17' and create_time>='2025-12-04 17:00:01'
222
+group by create_by ) a8 on a.USER_CODE=a8.create_by
223
+
224
+left join  
225
+(select create_by,count(*)fy from 	SGGMIIP.paymgrctrl --费用付款
226
+where nvl(del_flag,0)<>1
227
+and nvl(create_by,'')<>'' and fmodalid='16' and create_time>='2025-12-04 17:00:01'
228
+group by create_by ) a9 on a.USER_CODE=a9.create_by
229
+
230
+left join  
231
+(select create_by,count(*)rzsq from SGGMIIP.financingReq --融资申请
232
+where nvl(del_flag,0)<>1
233
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
234
+group by create_by ) a10 on a.USER_CODE=a10.create_by
235
+
236
+left join  
237
+(select create_by,count(*)rzfk from 	SGGMIIP.loanReg --融资放款登记
238
+where nvl(del_flag,0)<>1
239
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
240
+group by create_by ) a11 on a.USER_CODE=a11.create_by
241
+
242
+left join  
243
+(select create_by,count(*)rzhk from SGGMIIP.repayReq --融资还款申请
244
+where nvl(del_flag,0)<>1
245
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
246
+group by create_by ) a12 on a.USER_CODE=a12.create_by
247
+
248
+left join  
249
+(select create_by,count(*)dhtz from 	SGGMIIP.grnctrl --到货通知
250
+where nvl(del_flag,0)<>1
251
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
252
+group by create_by ) a13 on a.USER_CODE=a13.create_by
253
+
254
+left join  
255
+(select create_by,count(*)cgrk from SGGMIIP.mdkcctrl --采购入库
256
+where nvl(del_flag,0)<>1
257
+and nvl(create_by,'')<>'' and fmodalid='22' and create_time>='2025-12-04 17:00:01'
258
+group by create_by ) a14 on a.USER_CODE=a14.create_by
259
+
260
+left join  
261
+(select create_by,count(*)qtrk from 	SGGMIIP.mdkcctrl --其他入库
262
+where nvl(del_flag,0)<>1
263
+and nvl(create_by,'')<>'' and fmodalid='27' and create_time>='2025-12-04 17:00:01'
264
+group by create_by ) a15 on a.USER_CODE=a15.create_by
265
+
266
+left join  
267
+(select create_by,count(*)rkth from SGGMIIP.mdkcctrl --入库退回
268
+where nvl(del_flag,0)<>1
269
+and nvl(create_by,'')<>'' and fmodalid='86' and create_time>='2025-12-04 17:00:01'
270
+group by create_by ) a16 on a.USER_CODE=a16.create_by
271
+
272
+left join  
273
+(select create_by,count(*)fh from 	SGGMIIP.delivNotiReq --放货申请
274
+where nvl(del_flag,0)<>1
275
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
276
+group by create_by ) a17 on a.USER_CODE=a17.create_by
277
+
278
+left join  
279
+(select create_by,count(*)xsck from SGGMIIP.mdkcctrl --销售出库
280
+where nvl(del_flag,0)<>1
281
+and nvl(create_by,'')<>'' and fmodalid='24' and create_time>='2025-12-04 17:00:01'
282
+group by create_by ) a18 on a.USER_CODE=a18.create_by
283
+
284
+left join  
285
+(select create_by,count(*)qtck from 	SGGMIIP.mdkcctrl --其他出库
286
+where nvl(del_flag,0)<>1
287
+and nvl(create_by,'')<>'' and fmodalid='28' and create_time>='2025-12-04 17:00:01'
288
+group by create_by ) a19 on a.USER_CODE=a19.create_by
289
+
290
+left join  
291
+(select create_by,count(*)jkdp from SGGMIIP.purMultiSettle --进口到票
292
+where nvl(del_flag,0)<>1
293
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
294
+group by create_by ) a20 on a.USER_CODE=a20.create_by
295
+
296
+left join  
297
+(select create_by,count(*)kptz from 	SGGMIIP.expPurInvNoti --开票通知
298
+where nvl(del_flag,0)<>1
299
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
300
+group by create_by ) a21 on a.USER_CODE=a21.create_by
301
+
302
+left join  
303
+(select create_by,count(*)jxfp from SGGMIIP.inputInvReg --进项发票登记
304
+where nvl(del_flag,0)<>1
305
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
306
+group by create_by ) a22 on a.USER_CODE=a22.create_by
307
+
308
+left join  
309
+(select create_by,count(*)fyfp from 	SGGMIIP.feelInvReq --费用发票登记
310
+where nvl(del_flag,0)<>1
311
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
312
+group by create_by ) a23 on a.USER_CODE=a23.create_by
313
+
314
+left join  
315
+(select create_by,count(*)xsjs from SGGMIIP.saleSettle --销售结算开票
316
+where nvl(del_flag,0)<>1
317
+and nvl(create_by,'')<>'' and fmodalid='36' and create_time>='2025-12-04 17:00:01'
318
+group by create_by ) a24 on a.USER_CODE=a24.create_by
319
+
320
+left join  
321
+(select create_by,count(*)xsfykp from 	SGGMIIP.saleSettle --销售费用结算开票
322
+where nvl(del_flag,0)<>1
323
+and nvl(create_by,'')<>'' and fmodalid='333' and create_time>='2025-12-04 17:00:01'
324
+group by create_by ) a25 on a.USER_CODE=a25.create_by
325
+
326
+left join  
327
+(select create_by,count(*)hzzg from SGGMIIP.provIn --货值暂估
328
+where nvl(del_flag,0)<>1
329
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
330
+group by create_by ) a26 on a.USER_CODE=a26.create_by
331
+
332
+left join  
333
+(select create_by,count(*)fyzg from 	SGGMIIP.estFeeInv --费用暂估
334
+where nvl(del_flag,0)<>1
335
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
336
+group by create_by ) a27 on a.USER_CODE=a27.create_by
337
+
338
+left join  
339
+(select create_by,count(*)spbmsq from SGGMIIP.prodNoReq --商品编码申请
340
+where nvl(del_flag,0)<>1
341
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
342
+group by create_by ) a28 on a.USER_CODE=a28.create_by
343
+
344
+left join 
345
+(select create_by,count(*)zyjh from SGGMIIP.mdkcctrl	--作业计划
346
+where nvl(del_flag,0)<>1
347
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
348
+and fmodalid='155'
349
+group by create_by) a30 on a.USER_CODE=a30.create_by
350
+
351
+left join 
352
+(select create_by,count(*)kcjg from SGGMIIP.mdkcctrl	--库存加工
353
+where nvl(del_flag,0)<>1
354
+and nvl(create_by,'')<>'' and create_time>='2025-12-04 17:00:01'
355
+and fmodalid='168'
356
+group by create_by) a31 on a.USER_CODE=a31.create_by
357
+
358
+where (NVL(b.ks,0)+
359
+NVL(c.zyh,0)+
360
+NVL(d.cg,0)+
361
+NVL(e.xs,0)+
362
+NVL(f.cgdd,0)+
363
+NVL(g.xsdd,0)+
364
+NVL(h.ps,0)+
365
+NVL(i.kzh,0)+
366
+NVL(j.kzjh,0)+
367
+NVL(k.kzsq,0)+
368
+NVL(l.kzdj,0)+
369
+NVL(m.dd,0)+
370
+NVL(n.szdj,0)+
371
+NVL(o.xm,0)+
372
+NVL(p.kssx,0)+
373
+NVL(q.xsxy,0)+
374
+NVL(r.cgxy,0)+
375
+NVL(s.zc,0)+
376
+NVL(t.cc,0)+
377
+NVL(u.jg,0)+
378
+NVL(v.qt,0)+
379
+NVL(w.gb,0)+
380
+NVL(x.gd,0)+
381
+NVL(y.qz,0)+
382
+NVL(z.hh,0)+
383
+NVL(a1.td,0)+
384
+NVL(a2.dz,0)+
385
+NVL(a3.bg,0)+
386
+NVL(a4.zjjh,0)+
387
+NVL(a5.sk,0)+
388
+NVL(a6.sktz,0)+
389
+NVL(a7.fk,0)+
390
+NVL(a8.fm,0)+
391
+NVL(a9.fy,0)+
392
+NVL(a10.rzsq,0)+
393
+NVL(a11.rzfk,0)+
394
+NVL(a12.rzhk,0)+
395
+NVL(a13.dhtz,0)+
396
+NVL(a14.cgrk,0)+
397
+NVL(a15.qtrk,0)+
398
+NVL(a16.rkth,0)+
399
+NVL(a17.fh,0)+
400
+NVL(a18.xsck,0)+
401
+NVL(a19.qtck,0)+
402
+NVL(a20.jkdp,0)+
403
+NVL(a21.kptz,0)+
404
+NVL(a22.jxfp,0)+
405
+NVL(a23.fyfp,0)+
406
+NVL(a24.xsjs,0)+
407
+NVL(a25.xsfykp,0)+
408
+NVL(a26.hzzg,0)+
409
+NVL(a27.fyzg,0)+
410
+NVL(a28.spbmsq,0)+
411
+NVL(a30.zyjh,0)+
412
+NVL(a31.kcjg,0))>0
413
+
414
+order by USER_CODE

+ 45
- 0
查询表单配置的sql.txt 查看文件

@@ -0,0 +1,45 @@
1
+使用说明:在使用的时候请修改sql中"采购入库"的内容,修改内容为界面上的模块名称
2
+SELECT 
3
+    form_data."main_table_name" AS 表名,
4
+    form_data."header" AS 模块名,
5
+    ic."item_name" AS 字段名,
6
+    ic."item_show_name" AS 字段名称,
7
+    CASE WHEN ic."data_type" = 1 THEN '字符串' 
8
+     WHEN ic."data_type" = 2 THEN '整数类型'
9
+    WHEN ic."data_type" = 3 THEN '时间类型'
10
+    WHEN ic."data_type" = 4 THEN '小数类型'
11
+    WHEN ic."data_type" = 5 THEN '文本类型' 
12
+    WHEN ic."data_type" = 6 THEN '开关类型'
13
+    WHEN ic."data_type" = 7 THEN '下拉框' END 类型,
14
+    CASE WHEN ic."is_must_fill" = 1 THEN '必填' ELSE '' END AS 是否必填,
15
+    ic."expression_decimal_digit" AS 小数位数,
16
+    dd."dic_name" AS 数据字典,
17
+    fcg."eval_script" AS 必填条件组,
18
+COALESCE(fc_match."id", fc_empty."id") AS 调取id,
19
+COALESCE(fc_match."show_name", fc_empty."show_name") AS 调取名称,
20
+    COALESCE(fc_match."fetch_sql", fc_empty."fetch_sql") AS 相关调取sql
21
+FROM SGGMIIP."item_config" ic 
22
+LEFT JOIN SGGMIIP."data_dic" dd ON ic."dic_id" = dd."id" 
23
+LEFT JOIN (
24
+    SELECT 
25
+        fc_temp."id",
26
+        fc_temp."parent_id", 
27
+        fc_temp."main_table_name", 
28
+        fc_temp."header",
29
+        fc_temp."del_flag"
30
+    FROM SGGMIIP."form_config" fc_temp
31
+    WHERE fc_temp."del_flag" = '0'
32
+    START WITH fc_temp."parent_id" = '0' AND fc_temp."header" = '采购入库'
33
+    CONNECT BY PRIOR fc_temp."id" = fc_temp."parent_id"
34
+) form_data ON ic."form_config_id" = form_data."id" 
35
+LEFT JOIN SGGMIIP."form_condition_group" fcg ON fcg."id" = ic."is_must_fill_condition_id"
36
+LEFT JOIN SGGMIIP."fetch_config" fc_match ON (
37
+    ic."item_name" = fc_match."target_field" 
38
+    AND fc_match."target_form_id" LIKE '%' || ic."form_config_id" || '%'
39
+)LEFT JOIN SGGMIIP."fetch_config" fc_empty ON (
40
+    ic."item_name" = fc_empty."target_field" 
41
+    AND IFNULL(fc_empty."target_form_id", '') = ''
42
+    AND fc_match."target_field" IS NULL
43
+)
44
+WHERE form_data."id" IS NOT NULL
45
+ORDER BY ic."show_order";

+ 21
- 0
直运业务先销后采的修改sql.txt 查看文件

@@ -0,0 +1,21 @@
1
+--直运业务如果得先做采购再做销售,如果先销后采这么改
2
+select a.sourceid,a.poid,a.pono,a.* from salesDtl a where a.poid = '2000878405284927922'
3
+where a.sono = 'SOS04794250012-S2'
4
+where a.poid = '2000878405284927922'
5
+
6
+--销售合同
7
+update salesDtl a  set a.pono = 'SOS04794250012-P2'  where a.sono = 'SOS04794250012-S2'
8
+update salesDtl a  set a.sourceid = '2000878405284927922' where a.sono = 'SOS04794250012-S2'
9
+update salesDtl a  set a.poid = '2000878405284927922' where  a.sono = 'SOS04794250012-S2'
10
+
11
+select a.id,a.* from purchaseDtl a  where a.pono = 'SOS04794250012-P2'
12
+
13
+ ---销售订单
14
+select a.poid,a.pono,a.* from sOrderDtl a where a.sono = 'SOS04794250012-S2'
15
+update sOrderDtl a  set a.pono = 'SOS04794250012-P2' where a.sono = 'SOS04794250012-S2'
16
+update sOrderDtl a  set a.poid = '2000878405284927922' where  a.sono = 'SOS04794250012-S2'
17
+
18
+---放货
19
+select  a.poid,a.pono,a.* from delivNotiDtl a where a.sono = 'SOS04794250012-S2'
20
+update delivNotiDtl a  set a.pono = 'SOS04794250012-P2' where a.sono = 'SOS04794250012-S2'
21
+update delivNotiDtl a  set a.poid = '2000878405284927922' where  a.sono = 'SOS04794250012-S2'

+ 133
- 0
获取应收应付的sql 2.0.txt 查看文件

@@ -0,0 +1,133 @@
1
+------应收(新)------
2
+-----新应收------
3
+-----新应收------
4
+select 
5
+dp.deptname 制单部门 , a.create_by_name  制单人 , a.create_time 单据日期 ,
6
+a.fno 销售合同号 ,  a.serviceType 业务类型 ,a.fours , a.foursname 我方名称 , a.ctName 客商名称 ,
7
+a.curcy 合同币别 , a.rate 折人民币汇率  , a.rateUs  合同执行美元汇率 , a.totalAmt 合同金额 ,fh.soamt 放货金额 , 
8
+kp.soamt  销售开票金额 ,
9
+ifnull(sk.rlamt,0) 常规收款不含LC ,
10
+ifnull(sklc.rlamt,0) 常规收款LC , 
11
+ifnull(skSZ.totalAmt,0 ) 认证金额 ,
12
+xstk.appAmt  销售退款金额 ,
13
+
14
+ifnull(kp.soamt,0) - ifnull(sk.rlamt,0) -ifnull(sklc.rlamt,0) + ifnull(xstk.appAmt,0) 非代理应收金额,--发票金额-常规收款金额-信用证收款
15
+
16
+ifnull(dl.poamt,0) - ifnull(sk.rlamt,0) - ifnull(sklc.rlamt,0)+ ifnull(xstk.appAmt,0) 真代理业务应收金额 , 
17
+
18
+( ifnull(kp.soamt,0)+ ifnull(dl.poamt,0))   - ifnull(sk.rlamt,0) -ifnull(sklc.rlamt,0) + ifnull(xstk.appAmt,0) 应收金额,--发票金额-常规收款金额-信用证收款
19
+
20
+
21
+fy.appamt  费用付款金额 , fybz.poamt 费用发票金额 , 
22
+ifnull(fy.appamt,0)- ifnull(fybz.poamt,0) 费用应付金额,
23
+
24
+dl.poamt 代理产品金额 , dlcx1.soamt 代理产品冲销金额,
25
+d2.poamt 代理费金额 , dlcx2.soamt 代理费冲销金额 
26
+
27
+from  salesContract a 
28
+--放货申请/通知
29
+left join ( select a2.sono , sum(a2.soamt) soamt  from delivNotiReq a1 left join  delivNotiDtl a2 on a1.id=a2.rid	
30
+		where ifnull(a1.del_flag,0)<>1   
31
+		and  ifnull(a2.del_flag,0)<>1
32
+		and a1.placed='2'
33
+		and a1.fmodalid=450  group by a2.sono ) fh  on a.fno=fh.sono
34
+--销售出库		
35
+left join ( select a2.sono , sum(a2.soamt) soamt  from mdkcctrl a1 left join  mdkcdtl a2 on a1.id=a2.rid    
36
+		where ifnull(a1.del_flag,0)<>1   
37
+		and  ifnull(a2.del_flag,0)<>1
38
+		and a1.placed='2'
39
+		and a1.fmodalid=24  group by a2.sono ) ck  on a.fno=ck.sono		
40
+--收款登记
41
+left join ( select a2.sono , sum(a2.rlamt) rlamt  from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid	
42
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
43
+		and a1.placed='2'
44
+		and a1.fmodalid=19  
45
+		and a1.payType='常规收款'
46
+		and ifnull(a1.rcptMethod,'')<>'LC'
47
+		group by a2.sono ) sk  on a.fno=sk.sono
48
+ 
49
+--收款登记lc
50
+left join ( select a2.sono , sum(a2.rlamt) rlamt  from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid	
51
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
52
+		and a1.placed='2'
53
+		and a1.fmodalid=19  
54
+		and a1.payType='常规收款'
55
+		and ifnull(a1.rcptMethod,'')='LC'
56
+		group by a2.sono ) sklc  on a.fno=sklc.sono
57
+ 	
58
+--收证登记
59
+left join ( select a2.sono , sum(a2.rlamt) totalAmt  from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid	
60
+		where ifnull(a1.del_flag,0)<>1    and  ifnull(a2.del_flag,0)<>1
61
+		and a1.placed='2'
62
+		and a1.fmodalid=20   
63
+		group by a2.sono ) skSZ  on a.fno=skSZ.sono		
64
+		
65
+		
66
+--费用付款
67
+left join ( select a2.sono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
68
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
69
+		and a1.fmodalid=16  
70
+		and a1.placed='2'
71
+		group by a2.sono ) fy  on a.fno=fy.sono	
72
+--费用发票登记
73
+left join ( select a2.sono , sum(a2.poamt) poamt  from purMultiSettle a1 left join  purStlProdDtl a2 on a1.id=a2.rid	
74
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
75
+		and a1.fmodalid =300
76
+		and a1.placed='2'
77
+		group by a2.sono ) fybz  on a.fno=fybz.sono		
78
+--销售结算开票	
79
+left join ( select a2.sono , sum(a2.soamt) soamt  from saleSettle a1 left join  settleProdDtl a2 on a1.id=a2.rid	
80
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
81
+		and a1.fmodalid =36
82
+		and a1.placed='2'
83
+		group by a2.sono ) kp  on a.fno=kp.sono	
84
+		
85
+--销售退款 
86
+left join ( select a2.sono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
87
+		where ifnull(a1.del_flag,0)<>1   
88
+		and  ifnull(a2.del_flag,0)<>1
89
+		and a1.placed='2'
90
+		and a1.fmodalid=15  
91
+		and a1.payType like '%退款%'
92
+		group by a2.sono ) xstk  on a.fno=xstk.sono
93
+		
94
+--代理结算开票    产品明细金额
95
+left join ( select a2.sono , sum(a2.poamt) poamt  from saleSettle a1 left join  settleProdDtl a2 on a1.id=a2.rid
96
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
97
+		and a1.fmodalid =39
98
+		and a1.placed='2'
99
+		group by a2.sono ) dl  on a.fno=dl.sono
100
+
101
+--代理结算开票    产品明细金额冲销金额
102
+left join ( select a2.sono , sum(a2.amt) soamt from saleSettle a1 left join chargeReg a2 on a1.id=a2.rid
103
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
104
+		and a1.fmodalid =39
105
+		and a1.placed='2'
106
+		and a2.fcat='1'
107
+		group by a2.sono ) dlcx1  on a.fno=dl.sono		
108
+		
109
+
110
+
111
+--代理结算开票   代理费金额
112
+left join ( select a2.sono , sum(a2.soamt) poamt  from saleSettle a1 left join  salesInvDtl a2 on a1.id=a2.rid
113
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
114
+		and a1.fmodalid =39
115
+		and a1.placed='2'
116
+		group by a2.sono ) d2  on a.fno=d2.sono
117
+
118
+		
119
+--代理结算开票  代理费冲销金额
120
+left join ( select a2.sono , sum(a2.amt) soamt from saleSettle a1 left join chargeReg a2 on a1.id=a2.rid
121
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
122
+		and a1.fmodalid =39
123
+		and a1.placed='2'
124
+		group by a2.sono ) dlcx2 on a.fno=dlcx2.sono
125
+		
126
+ 
127
+			
128
+LEFT JOIN ( SELECT USER_CODE ,USER_name , user_desc , dept_id , user_id FROM View_User_Code ) u on a.create_by=u.USER_CODE
129
+left join ( select id  deptid , DEPT_CODE deptcode ,DEPT_NAME deptname from SYS_DEPARTMENT ) dp on u.dept_id=dp.deptid
130
+where ifnull(a.del_flag,0)<>1
131
+and a.placed='2' 
132
+--and a.fno = 'SOS52131250002'
133
+order by a.fours;

+ 191
- 0
获取应收应付的sql.txt 查看文件

@@ -0,0 +1,191 @@
1
+------应付------
2
+select 
3
+dp.deptname 制单部门 , a.create_by_name  制单人 , a.create_time 单据日期 ,
4
+a.fno 采购合同号 ,  a.serviceType 业务类型 ,a.fours , a.foursname 我方名称 , a.supName 供方名称 ,
5
+a.curcy 合同币别 , a.rate 折人民币汇率  , a.rateUs  合同执行美元汇率 , a.totalAmt 合同金额 ,
6
+bz.poamt 开票金额,
7
+ifnull(yf.appamt,0)  已付款金额 ,  
8
+ifnull(bz.poamt,0)- ifnull(yf.appamt,0) 应付金额,-- 发票金额-已付款金额+退款=应付金额
9
+ifnull(tk.appamt,0) 已收退款金额,
10
+ifnull(dljs.poamt,0) 代理结算金额,
11
+ ifnull(zg.poamt,0)- ifnull(zgcx.amt,0) 未冲销暂估金额 ,
12
+fy.appamt  费用付款金额 , fybz.poamt 费用发票金额 , ifnull(fybz.poamt,0)- ifnull(fy.appamt,0) 费用应付金额 
13
+
14
+
15
+from  purchaseContract a 
16
+--采购入库
17
+left join ( select a2.pono , sum(a2.poamt) poamt  from mdkcctrl a1 left join  mdkcdtl a2 on a1.id=a2.rid	
18
+		where ifnull(a1.del_flag,0)<>1   
19
+		and  ifnull(a2.del_flag,0)<>1
20
+		and a1.placed='2'
21
+		and a1.fmodalid=22  group by a2.pono ) rk  on a.fno=rk.pono
22
+--货款付款
23
+left join ( select a2.pono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
24
+		where ifnull(a1.del_flag,0)<>1   
25
+		and  ifnull(a2.del_flag,0)<>1
26
+		and a1.placed='2'
27
+		and a1.fmodalid=15  
28
+		and a1.payType in('保证金','预付款-发货前','预付款-发货后','发票后结算款')
29
+		group by a2.pono ) yf  on a.fno=yf.pono
30
+
31
+--退款
32
+left join ( select a2.pono , sum(a2.claimAmt) appamt from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid
33
+		where ifnull(a1.del_flag,0)<>1
34
+		and  ifnull(a2.del_flag,0)<>1
35
+		and a1.placed='2'
36
+		and a1.fmodalid=19
37
+		and ifnull(a2.PlacedForDtl,'')='1' 
38
+		and a2.kxlx like '%退款%' 
39
+		group by a2.pono ) tk  on a.fno=tk.pono		
40
+
41
+			
42
+--进口到票37		进项发票13		产品明细
43
+left join ( select a2.pono , sum(a2.poamt) poamt  from purMultiSettle a1 left join  purStlProdDtl a2 on a1.id=a2.rid	
44
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
45
+		and a1.fmodalid in (37,13)  
46
+		and a1.placed='2'
47
+		group by a2.pono ) bz  on a.fno=bz.pono
48
+--货值暂估
49
+left join ( select a2.pono , sum(a2.poamt) poamt  from provIn a1 left join  provInDtl a2 on a1.id=a2.rid	
50
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
51
+		-- and a1.fmodalid in (37,13)  
52
+		and a1.placed='2'
53
+		group by a2.pono ) zg  on a.fno=zg.pono		
54
+--进口到票37		进项发票13		冲销预付款
55
+left join ( select a2.pono , sum(a2.amt) amt  from purMultiSettle a1 left join  chargeStock a2 on a1.id=a2.rid	
56
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
57
+		and a1.fmodalid in (37,13)  
58
+		and a1.placed='2'
59
+		group by a2.pono ) zgcx  on a.fno=zgcx.pono	
60
+--费用付款
61
+left join ( select a2.pono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
62
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
63
+		and a1.fmodalid=16  
64
+		and a1.placed='2'
65
+		group by a2.pono ) fy  on a.fno=fy.pono	
66
+--费用发票登记
67
+left join ( select a2.pono , sum(a2.poamt) poamt  from purMultiSettle a1 left join  purStlProdDtl a2 on a1.id=a2.rid	
68
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
69
+		and a1.fmodalid =300
70
+		and a1.placed='2'
71
+		group by a2.pono ) fybz  on a.fno=fybz.pono
72
+		
73
+-- 代理结算
74
+left join ( select a2.pono , sum(a2.poamt) poamt  from saleSettle a1 left join  settleProdDtl a2 on a1.id=a2.rid	
75
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
76
+		and a1.fmodalid =39
77
+		and a1.placed='2'
78
+		group by a2.pono ) dljs on a.fno=dljs.pono 		
79
+						
80
+
81
+LEFT JOIN ( SELECT USER_CODE ,USER_name , user_desc , dept_id , user_id FROM View_User_Code ) u on a.create_by=u.USER_CODE
82
+left join ( select id  deptid , DEPT_CODE deptcode ,DEPT_NAME deptname from SYS_DEPARTMENT ) dp on u.dept_id=dp.deptid
83
+	
84
+where ifnull(a.del_flag,0)<>1
85
+and a.fno = 'SOS52090250002-P2'
86
+and a.placed='2'
87
+order by a.fours
88
+------应收------
89
+select 
90
+dp.deptname 制单部门 , a.create_by_name  制单人 , a.create_time 单据日期 ,
91
+a.fno 销售合同号 ,  a.serviceType 业务类型 ,a.fours , a.foursname 我方名称 , a.ctName 客商名称 ,
92
+a.curcy 合同币别 , a.rate 折人民币汇率  , a.rateUs  合同执行美元汇率 , a.totalAmt 合同金额 ,fh.soamt 放货金额 , 
93
+kp.soamt  销售开票金额 ,
94
+ifnull(sk.rlamt,0) 已收款金额 ,
95
+-- ifnull(sklc.totalAmt,0) 信用证收款 ,  
96
+ifnull(kp.soamt,0) - ifnull(sk.rlamt,0) -ifnull(sklc.totalAmt,0)  应收金额,--发票金额-常规收款金额-信用证收款
97
+fy.appamt  费用付款金额 , fybz.poamt 费用发票金额 , 
98
+ifnull(fy.appamt,0)- ifnull(fybz.poamt,0) 费用应付金额,
99
+xstk.appAmt  销售退款金额 ,
100
+dl.poamt 代理产品金额 , dlcx1.soamt 代理产品冲销金额,
101
+d2.poamt 代理费金额 , dlcx2.soamt 代理费冲销金额 
102
+
103
+from  salesContract a 
104
+--放货申请/通知
105
+left join ( select a2.sono , sum(a2.soamt) soamt  from delivNotiReq a1 left join  delivNotiDtl a2 on a1.id=a2.rid	
106
+		where ifnull(a1.del_flag,0)<>1   
107
+		and  ifnull(a2.del_flag,0)<>1
108
+		and a1.placed='2'
109
+		and a1.fmodalid=450  group by a2.sono ) fh  on a.fno=fh.sono
110
+--销售出库		
111
+left join ( select a2.sono , sum(a2.soamt) soamt  from mdkcctrl a1 left join  mdkcdtl a2 on a1.id=a2.rid    
112
+		where ifnull(a1.del_flag,0)<>1   
113
+		and  ifnull(a2.del_flag,0)<>1
114
+		and a1.placed='2'
115
+		and a1.fmodalid=24  group by a2.sono ) ck  on a.fno=ck.sono		
116
+--收款登记
117
+left join ( select a2.sono , sum(a2.rlamt) rlamt  from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid	
118
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
119
+		and a1.placed='2'
120
+		and a1.fmodalid=19  
121
+		and a1.payType='常规收款'
122
+		group by a2.sono ) sk  on a.fno=sk.sono
123
+--收证登记
124
+left join ( select a2.sono , sum(a2.rlamt) totalAmt  from breceiptctrl a1 left join  breceiptdtl a2 on a1.id=a2.rid	
125
+		where ifnull(a1.del_flag,0)<>1    and  ifnull(a2.del_flag,0)<>1
126
+		and a1.placed='2'
127
+		and a1.fmodalid=20   
128
+		group by a2.sono ) sklc  on a.fno=sklc.sono		
129
+--费用付款
130
+left join ( select a2.sono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
131
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
132
+		and a1.fmodalid=16  
133
+		and a1.placed='2'
134
+		group by a2.sono ) fy  on a.fno=fy.sono	
135
+--费用发票登记
136
+left join ( select a2.sono , sum(a2.poamt) poamt  from purMultiSettle a1 left join  purStlProdDtl a2 on a1.id=a2.rid	
137
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
138
+		and a1.fmodalid =300
139
+		and a1.placed='2'
140
+		group by a2.sono ) fybz  on a.fno=fybz.sono		
141
+--销售结算开票	
142
+left join ( select a2.sono , sum(a2.soamt) soamt  from saleSettle a1 left join  settleProdDtl a2 on a1.id=a2.rid	
143
+		where ifnull(a1.del_flag,0)<>1   and  ifnull(a2.del_flag,0)<>1
144
+		and a1.fmodalid =36
145
+		and a1.placed='2'
146
+		group by a2.sono ) kp  on a.fno=kp.sono	
147
+		
148
+--销售退款 
149
+left join ( select a2.sono , sum(a2.appAmt) appAmt  from PayMgrctrl a1 left join  paystockdtl a2 on a1.id=a2.rid	
150
+		where ifnull(a1.del_flag,0)<>1   
151
+		and  ifnull(a2.del_flag,0)<>1
152
+		and a1.placed='2'
153
+		and a1.fmodalid=15  
154
+		and a1.payType like '%退款%'
155
+		group by a2.sono ) xstk  on a.fno=xstk.sono
156
+		
157
+--代理结算开票    产品明细金额
158
+left join ( select a2.sono , sum(a2.poamt) poamt  from saleSettle a1 left join  settleProdDtl a2 on a1.id=a2.rid
159
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
160
+		and a1.fmodalid =39
161
+		and a1.placed='2'
162
+		group by a2.sono ) dl  on a.fno=dl.sono
163
+
164
+--代理结算开票    产品明细金额冲销金额
165
+left join ( select a2.sono , sum(a2.amt) soamt from saleSettle a1 left join chargeReg a2 on a1.id=a2.rid
166
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
167
+		and a1.fmodalid =39
168
+		and a1.placed='2'
169
+		and a2.fcat='1'
170
+		group by a2.sono ) dlcx1  on a.fno=dl.sono		
171
+--代理结算开票   代理费金额
172
+left join ( select a2.sono , sum(a2.soamt) poamt  from saleSettle a1 left join  salesInvDtl a2 on a1.id=a2.rid
173
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
174
+		and a1.fmodalid =39
175
+		and a1.placed='2'
176
+		group by a2.sono ) d2  on a.fno=d2.sono
177
+--代理结算开票  代理费冲销金额
178
+left join ( select a2.sono , sum(a2.amt) soamt from saleSettle a1 left join chargeReg a2 on a1.id=a2.rid
179
+		where ifnull(a1.del_flag,0)<>1	 and  ifnull(a2.del_flag,0)<>1
180
+		and a1.fmodalid =39
181
+		and a1.placed='2'
182
+		group by a2.sono ) dlcx2 on a.fno=dlcx2.sono
183
+		
184
+ 
185
+			
186
+LEFT JOIN ( SELECT USER_CODE ,USER_name , user_desc , dept_id , user_id FROM View_User_Code ) u on a.create_by=u.USER_CODE
187
+left join ( select id  deptid , DEPT_CODE deptcode ,DEPT_NAME deptname from SYS_DEPARTMENT ) dp on u.dept_id=dp.deptid
188
+where ifnull(a.del_flag,0)<>1
189
+and a.placed='2' 
190
+--and a.fno = 'SOS52068250001'
191
+order by a.fours;

+ 6
- 0
获取调取字段设置的sql.txt 查看文件

@@ -0,0 +1,6 @@
1
+使用说明:在使用的时候请修改sql中标红的内容,建议使用表单对应SQL中的“调取id”
2
+SELECT ffc."field_name" AS 数据库字段,
3
+ffc."show_name" AS 前端显示名称,
4
+ffc."target_field" AS 目标字段
5
+FROM SGGMIIP."fetch_field_config" ffc 
6
+WHERE ffc."fetch_config_id" ='1942033975690268672';

+ 8
- 0
银行客商查询.txt 查看文件

@@ -0,0 +1,8 @@
1
+银行客商查询
2
+
3
+select sd2.dept_name, b.dept_name,count(*) from custbank b
4
+LEFT JOIN SYS_DEPARTMENT sd ON b.DEPT_ID = sd.ID 
5
+LEFT JOIN SYS_DEPARTMENT sd2 ON sd2.DEPT_CODE = sd.f_id
6
+
7
+ where  b.ctStatus = '已准入'
8
+group by sd2.dept_name,b.dept_name

Loading…
取消
儲存