Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
OFL
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
OFL
Commits
c47f74c8
提交
c47f74c8
authored
4月 15, 2025
作者:
Administrator
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
设置进度条
上级
fe87a22c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
47 行删除
+33
-47
CostReportPlugin.cs
CostReportPlugin.cs
+33
-47
没有找到文件。
CostReportPlugin.cs
浏览文件 @
c47f74c8
...
@@ -18,7 +18,6 @@ using Kingdee.BOS.Core.List.PlugIn.Args;
...
@@ -18,7 +18,6 @@ using Kingdee.BOS.Core.List.PlugIn.Args;
using
Kingdee.BOS.Core
;
using
Kingdee.BOS.Core
;
using
Kingdee.BOS.Log
;
using
Kingdee.BOS.Log
;
using
System.Threading
;
using
Kingdee.BOS.KDThread
;
using
Kingdee.BOS.KDThread
;
namespace
LQKJ_OFLCostReport
namespace
LQKJ_OFLCostReport
...
@@ -26,40 +25,17 @@ namespace LQKJ_OFLCostReport
...
@@ -26,40 +25,17 @@ namespace LQKJ_OFLCostReport
[
Description
(
"获取销售订单明细报表数据"
),
HotUpdate
]
[
Description
(
"获取销售订单明细报表数据"
),
HotUpdate
]
public
class
CostReportPlugin
:
AbstractListPlugIn
public
class
CostReportPlugin
:
AbstractListPlugIn
{
{
//public override void OnInitialize(InitializeEventArgs e)
private
bool
isLoading
=
false
;
//{
// base.OnInitialize(e);
// ShowProgressBar(false);
//}
public
override
void
OnLoad
(
EventArgs
e
)
public
override
void
OnLoad
(
EventArgs
e
)
{
{
base
.
OnLoad
(
e
);
base
.
OnLoad
(
e
);
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"开始:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
));
if
(
isLoading
)
return
;
string
sql
=
$@"IF EXISTS (SELECT * FROM sys.tables WHERE name = 'cbmxCursor')
this
.
View
.
Session
[
"ProcessRateValue"
]
=
0
;
BEGIN
ShowProgressBar
(
false
);
delete cbmxCursor where FUserID =
{
this
.
Context
.
UserId
}
END"
;
DBServiceHelper
.
Execute
(
this
.
Context
,
sql
);
DataTable
dataTable
=
GetSaleDetailData
();
string
tmpTableName
=
createTmpTable
(
dataTable
);
//向表插入数据
using
(
KDTransactionScope
scope
=
new
KDTransactionScope
(
TransactionScopeOption
.
Required
))
{
DBUtils
.
BulkInserts
(
this
.
Context
,
dataTable
);
scope
.
Complete
();
}
CreateView
();
}
}
public
override
void
AfterBindData
(
EventArgs
e
)
{
base
.
AfterBindData
(
e
);
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"数据加载完成后,停止进度条:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
));
//数据加载完成后,停止进度条
this
.
View
.
Session
[
"ProcessRateValue"
]
=
100
;
}
private
void
ShowProgressBar
(
bool
userTruePro
)
private
void
ShowProgressBar
(
bool
userTruePro
)
{
{
...
@@ -69,16 +45,25 @@ END";
...
@@ -69,16 +45,25 @@ END";
{
{
try
try
{
{
var
counter
=
100
;
string
sql
=
$@"IF EXISTS (SELECT * FROM sys.tables WHERE name = 'cbmxCursor')
for
(
var
x
=
1
;
x
<
counter
;
++
x
)
BEGIN
delete cbmxCursor where FUserID =
{
this
.
Context
.
UserId
}
END"
;
DBServiceHelper
.
Execute
(
this
.
Context
,
sql
);
this
.
View
.
Session
[
"ProcessRateValue"
]
=
10
;
DataTable
dataTable
=
GetSaleDetailData
();
string
tmpTableName
=
createTmpTable
(
dataTable
);
//向表插入数据
using
(
KDTransactionScope
scope
=
new
KDTransactionScope
(
TransactionScopeOption
.
Required
))
{
{
if
(
Convert
.
ToInt32
(
this
.
View
.
Session
[
"ProcessRateValue"
])
==
100
)
return
;
DBUtils
.
BulkInserts
(
this
.
Context
,
dataTable
);
// TODO
scope
.
Complete
();
Thread
.
Sleep
(
1000
);
// 报告下执行进度
var
rate
=
Convert
.
ToInt32
(
x
*
100
/
counter
);
this
.
View
.
Session
[
"ProcessRateValue"
]
=
rate
;
}
}
CreateView
();
this
.
View
.
Session
[
"ProcessRateValue"
]
=
100
;
isLoading
=
true
;
this
.
View
.
Refresh
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -86,9 +71,6 @@ END";
...
@@ -86,9 +71,6 @@ END";
}
}
finally
finally
{
{
Logger
.
Info
(
"获取进度条"
,
"错误:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
));
// 此句必不可少,进度值100时进度条自动关闭
this
.
View
.
Session
[
"ProcessRateValue"
]
=
100
;
this
.
View
.
SendDynamicFormAction
(
this
.
View
);
this
.
View
.
SendDynamicFormAction
(
this
.
View
);
}
}
},
null
);
},
null
);
...
@@ -112,7 +94,7 @@ END";
...
@@ -112,7 +94,7 @@ END";
// 获取销售明细简单账表数据
// 获取销售明细简单账表数据
public
DataTable
GetSaleDetailData
()
public
DataTable
GetSaleDetailData
()
{
{
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"获取销售明细简单账表数据:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
))
;
this
.
View
.
Session
[
"ProcessRateValue"
]
=
20
;
ISysReportService
sysReporSservice
=
ServiceFactory
.
GetSysReportService
(
this
.
Context
);
ISysReportService
sysReporSservice
=
ServiceFactory
.
GetSysReportService
(
this
.
Context
);
IPermissionService
permissionService
=
ServiceFactory
.
GetPermissionService
(
this
.
Context
);
IPermissionService
permissionService
=
ServiceFactory
.
GetPermissionService
(
this
.
Context
);
try
try
...
@@ -156,6 +138,7 @@ END";
...
@@ -156,6 +138,7 @@ END";
}
}
}
finally
}
finally
{
{
this
.
View
.
Session
[
"ProcessRateValue"
]
=
50
;
ServiceFactory
.
CloseService
(
sysReporSservice
);
ServiceFactory
.
CloseService
(
sysReporSservice
);
ServiceFactory
.
CloseService
(
permissionService
);
ServiceFactory
.
CloseService
(
permissionService
);
}
}
...
@@ -163,7 +146,7 @@ END";
...
@@ -163,7 +146,7 @@ END";
}
}
public
string
createTmpTable
(
DataTable
data
)
public
string
createTmpTable
(
DataTable
data
)
{
{
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"创建临时表:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
))
;
this
.
View
.
Session
[
"ProcessRateValue"
]
=
60
;
string
fieldColumnSql
=
GetCreateTmpTableNameSql
(
data
.
Columns
);
string
fieldColumnSql
=
GetCreateTmpTableNameSql
(
data
.
Columns
);
string
tmpTableName
=
"cbmxCursor"
;
string
tmpTableName
=
"cbmxCursor"
;
data
.
TableName
=
tmpTableName
;
data
.
TableName
=
tmpTableName
;
...
@@ -191,6 +174,7 @@ END
...
@@ -191,6 +174,7 @@ END
"
;
"
;
DBServiceHelper
.
Execute
(
this
.
Context
,
createTmpTableSql
);
DBServiceHelper
.
Execute
(
this
.
Context
,
createTmpTableSql
);
this
.
View
.
Session
[
"ProcessRateValue"
]
=
70
;
return
tmpTableName
;
return
tmpTableName
;
}
}
...
@@ -209,7 +193,7 @@ END
...
@@ -209,7 +193,7 @@ END
}
}
private
void
CreateView
()
private
void
CreateView
()
{
{
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"创建视图开始:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
))
;
this
.
View
.
Session
[
"ProcessRateValue"
]
=
80
;
string
sql
=
$@"/*dialect*/IF OBJECT_ID('T_BAS_PREBDTWO', 'V') IS NULL
string
sql
=
$@"/*dialect*/IF OBJECT_ID('T_BAS_PREBDTWO', 'V') IS NULL
BEGIN
BEGIN
EXEC('CREATE VIEW T_BAS_PREBDTWO AS
EXEC('CREATE VIEW T_BAS_PREBDTWO AS
...
@@ -288,7 +272,7 @@ from cbmxCursor t1
...
@@ -288,7 +272,7 @@ from cbmxCursor t1
left join T_BD_EXPENSE_L t2L on t2.FEXPID = t2L.FEXPID and t2L.FLOCALEID = 2052
left join T_BD_EXPENSE_L t2L on t2.FEXPID = t2L.FEXPID and t2L.FLOCALEID = 2052
where t2L.FNAME = ''工资''
where t2L.FNAME = ''工资''
group by t1.FBillNo, t1.FBillSeq) ckzjrg
group by t1.FBillNo, t1.FBillSeq) ckzjrg
on t1.FBillNo = ckzj
cl.FBillNo and t1.FBillSeq = ckzjcl
.FBillSeq
on t1.FBillNo = ckzj
rg.FBillNo and t1.FBillSeq = ckzjrg
.FBillSeq
left join (SELECT t1.FBillNo, t1.FBillSeq, SUM(CAST(t1.FAmount AS DECIMAL(18, 2))) FOutManufacturingCost--制造费用
left join (SELECT t1.FBillNo, t1.FBillSeq, SUM(CAST(t1.FAmount AS DECIMAL(18, 2))) FOutManufacturingCost--制造费用
FROM cbmxCursor t1
FROM cbmxCursor t1
left join
left join
...
@@ -298,7 +282,7 @@ from cbmxCursor t1
...
@@ -298,7 +282,7 @@ from cbmxCursor t1
and t2L.FNAME <> ''工资''
and t2L.FNAME <> ''工资''
and FNAME not like ''%折旧%''
and FNAME not like ''%折旧%''
group by t1.FBillNo, t1.FBillSeq) ckzzfy
group by t1.FBillNo, t1.FBillSeq) ckzzfy
on t1.FBillNo = ckz
jcl.FBillNo and t1.FBillSeq = ckzjcl
.FBillSeq
on t1.FBillNo = ckz
zfy.FBillNo and t1.FBillSeq = ckzzfy
.FBillSeq
left join (SELECT t1.FBillNo, t1.FBillSeq, SUM(CAST(t1.FAmount AS DECIMAL(18, 2))) FOutAddDepreciation--累计折旧
left join (SELECT t1.FBillNo, t1.FBillSeq, SUM(CAST(t1.FAmount AS DECIMAL(18, 2))) FOutAddDepreciation--累计折旧
FROM cbmxCursor t1
FROM cbmxCursor t1
left join
left join
...
@@ -306,7 +290,7 @@ from cbmxCursor t1
...
@@ -306,7 +290,7 @@ from cbmxCursor t1
left join T_BD_EXPENSE_L t2L on t2.FEXPID = t2L.FEXPID and t2L.FLOCALEID = 2052
left join T_BD_EXPENSE_L t2L on t2.FEXPID = t2L.FEXPID and t2L.FLOCALEID = 2052
where FNAME like ''%折旧%''
where FNAME like ''%折旧%''
group by t1.FBillNo, t1.FBillSeq) ckljzj
group by t1.FBillNo, t1.FBillSeq) ckljzj
on t1.FBillNo = ck
zjcl.FBillNo and t1.FBillSeq = ckzjcl
.FBillSeq
on t1.FBillNo = ck
ljzj.FBillNo and t1.FBillSeq = ckljzj
.FBillSeq
where t1.FEXPENSENAME <> ''小计''
where t1.FEXPENSENAME <> ''小计''
group by t1.FBillDate,
group by t1.FBillDate,
t1.FBillNo,
t1.FBillNo,
...
@@ -331,11 +315,13 @@ group by t1.FBillDate,
...
@@ -331,11 +315,13 @@ group by t1.FBillDate,
ckzjrg.FOutDirectLabor,
ckzjrg.FOutDirectLabor,
ckzzfy.FOutManufacturingCost,
ckzzfy.FOutManufacturingCost,
ckljzj.FOutAddDepreciation;
ckljzj.FOutAddDepreciation;
')
')
END
END
"
;
"
;
DBServiceHelper
.
Execute
(
this
.
Context
,
sql
);
DBServiceHelper
.
Execute
(
this
.
Context
,
sql
);
Logger
.
Info
(
"获取销售订单明细报表数据"
,
"创建视图结束:"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss:fff"
))
;
this
.
View
.
Session
[
"ProcessRateValue"
]
=
90
;
}
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论