Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
leifei
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
彭寒菲
leifei
Commits
f334e6ec
提交
f334e6ec
authored
1月 21, 2022
作者:
彭寒菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
物料导入
上级
b53ac515
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
89 行增加
和
31 行删除
+89
-31
DynamicForm.BomTree.cs
...essPlugin/LF.K3.SCM.BusinessPlugin/DynamicForm.BomTree.cs
+2
-2
ImportDatePlugin.cs
...sinessPlugin/LF.K3.SCM.BusinessPlugin/ImportDatePlugin.cs
+87
-29
qaz_BOMTASK.2052.dymx
DataModel/6002_51c046d1/qaz_BOMTASK.2052.dymx
+0
-0
qaz_BOMTASK.dym
DataModel/6002_51c046d1/qaz_BOMTASK.dym
+0
-0
没有找到文件。
Code/LF.K3.SCM.BusinessPlugin/LF.K3.SCM.BusinessPlugin/DynamicForm.BomTree.cs
浏览文件 @
f334e6ec
...
...
@@ -483,7 +483,7 @@ left join T_BD_MATERIAL_L l on stepCTE.子项物料=l.FMATERIALID ";
{
if
(
Examine
.
ContainsKey
(
treeNodeLst
.
text
)
)
{
treeNodeLst
.
Forecolor
=
"#
EE0000
"
;
treeNodeLst
.
Forecolor
=
"#
0000FF
"
;
List
<
TreeNode
>
nodes
=
new
List
<
TreeNode
>();
var
a
=
Examine
[
treeNodeLst
.
text
].
Count
;
for
(
int
i
=
0
;
i
<
Examine
[
treeNodeLst
.
text
].
Count
;
i
++)
...
...
@@ -500,7 +500,7 @@ left join T_BD_MATERIAL_L l on stepCTE.子项物料=l.FMATERIALID ";
}
if
(
Disable
.
ContainsKey
(
treeNodeLst
.
text
))
{
treeNodeLst
.
Forecolor
=
"#
00008B
"
;
treeNodeLst
.
Forecolor
=
"#
EE0000
"
;
List
<
TreeNode
>
nodes
=
new
List
<
TreeNode
>();
var
a
=
Disable
[
treeNodeLst
.
text
].
Count
;
for
(
int
i
=
0
;
i
<
Disable
[
treeNodeLst
.
text
].
Count
;
i
++)
...
...
Code/LF.K3.SCM.BusinessPlugin/LF.K3.SCM.BusinessPlugin/ImportDatePlugin.cs
浏览文件 @
f334e6ec
...
...
@@ -2,12 +2,15 @@
using
Kingdee.BOS.App
;
using
Kingdee.BOS.App.Data
;
using
Kingdee.BOS.Contracts
;
using
Kingdee.BOS.Core
;
using
Kingdee.BOS.Core.CommonFilter
;
using
Kingdee.BOS.Core.DynamicForm
;
using
Kingdee.BOS.Core.DynamicForm.PlugIn
;
using
Kingdee.BOS.Core.DynamicForm.PlugIn.Args
;
using
Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel
;
using
Kingdee.BOS.Core.List.PlugIn
;
using
Kingdee.BOS.Core.Metadata.FieldElement
;
using
Kingdee.BOS.Core.Validation
;
using
Kingdee.BOS.JSON
;
using
Kingdee.BOS.ServiceHelper
;
using
Kingdee.BOS.ServiceHelper.Excel
;
...
...
@@ -16,6 +19,7 @@ using System;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -27,38 +31,75 @@ namespace LF.K3.SCM.BusinessPlugin
{
DataTable
dtexcel
;
private
string
_filePath
;
int
CFnum
;
int
Excelsum
;
//
int CFnum;
//
int Excelsum;
int
jg
;
DataTable
sbtab
;
public
override
void
BeforeDoOperation
(
BeforeDoOperationEventArgs
e
)
{
if
(
e
.
Operation
.
FormOperation
.
Id
==
"FImportDate"
)
{
//数据的操作
Impoort
();
if
(
this
.
IsNotNull
())
{
//数据的操作
Impoort
();
if
(
jg
==
-
1
)
if
(
jg
==
1
)
{
this
.
View
.
ShowWarnningMessage
(
"导入失败"
);
}
else
if
(
CFnum
>
0
)
{
this
.
View
.
ShowWarnningMessage
(
"excel中存在"
+
CFnum
+
"条重复物料,"
+
(
Excelsum
-
CFnum
)
+
"条物料导入新增成功"
);
this
.
View
.
Refresh
();
string
fileName
=
string
.
Format
(
"{0}_{1}.xls"
,
this
.
View
.
BillBusinessInfo
.
GetForm
().
Name
,
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssff"
));
ExcelOperation
excelHelper
=
new
ExcelOperation
(
this
.
View
);
excelHelper
.
BeginExport
();
string
filePath
=
PathUtils
.
GetPhysicalPath
(
KeyConst
.
TEMPFILEPATH
,
fileName
);
string
outServicePath
=
PathUtils
.
GetServerPath
(
KeyConst
.
TEMPFILEPATH
,
fileName
);
List
<
DynamicObject
>
dObjList
=
new
List
<
DynamicObject
>();
var
headerRow
=
sbtab
.
NewRow
();
sbtab
.
Rows
.
InsertAt
(
headerRow
,
0
);
foreach
(
DataColumn
column
in
sbtab
.
Columns
)
{
headerRow
[
column
]
=
column
.
ColumnName
;
}
excelHelper
.
AddSheet
(
"物料导入"
+
Kingdee
.
BOS
.
Resource
.
ResManager
.
LoadKDString
(
"(错误提示)"
,
"0022877030028396"
,
Kingdee
.
BOS
.
Resource
.
SubSystemType
.
BOS
));
excelHelper
.
ExportToFile
(
sbtab
);
excelHelper
.
EndExport
(
filePath
,
SaveFileType
.
XLS
);
if
(
sbtab
.
Rows
.
Count
==
1
)
{
this
.
View
.
ShowMessage
(
Kingdee
.
BOS
.
Resource
.
ResManager
.
LoadKDString
(
"引入成功!"
,
"0022877030028379"
,
Kingdee
.
BOS
.
Resource
.
SubSystemType
.
BOS
));
}
else
if
(
sbtab
.
Rows
.
Count
>
1
)
{
this
.
View
.
ShowWarnningMessage
(
Kingdee
.
BOS
.
Resource
.
ResManager
.
LoadKDString
(
"部分数据引入成功,存在引入失败的数据!"
,
"0022877030028394"
,
Kingdee
.
BOS
.
Resource
.
SubSystemType
.
BOS
),
action
:
(
result
)
=>
{
this
.
DownLoadFile
(
outServicePath
);
});
}
return
;
}
else
{
this
.
View
.
ShowMessage
(
"物料导入成功"
);
this
.
View
.
Refresh
();
this
.
View
.
ShowMessage
(
"数据异常"
);
}
}
}
}
protected
new
void
DownLoadFile
(
string
url
)
{
DynamicFormShowParameter
param
=
new
DynamicFormShowParameter
();
param
.
FormId
=
"BOS_FileDownLoad"
;
param
.
OpenStyle
.
ShowType
=
ShowType
.
Modal
;
param
.
CustomParams
.
Add
(
"IsExportData"
,
"true"
);
param
.
CustomParams
.
Add
(
"url"
,
url
);
this
.
View
.
ShowForm
(
param
);
}
public
override
void
AfterBindData
(
EventArgs
e
)
{
this
.
EnableButton
(
"FImportDate"
,
false
);
...
...
@@ -138,45 +179,62 @@ namespace LF.K3.SCM.BusinessPlugin
dataSet
=
excelOperation
.
ReadFromFile
(
this
.
_filePath
,
0
,
0
);
DataTable
dt
=
dataSet
.
Tables
[
0
];
string
strTest
=
GetCreateTmpTableNameSql
(
dt
.
Columns
);
//获取Excel列
string
taball
=
DBServiceHelper
.
CreateTemporaryTableName
(
this
.
Context
);
string
tabcg
=
DBServiceHelper
.
CreateTemporaryTableName
(
this
.
Context
);
string
tabsb
=
DBServiceHelper
.
CreateTemporaryTableName
(
this
.
Context
);
//截取sql表列
strTest
=
strTest
.
Substring
(
1
,
strTest
.
Length
-
1
);
strTest
=
strTest
.
Remove
(
strTest
.
Length
-
1
,
1
);
//判断是否存在此表,如果存在则删除
string
sql2
=
$@"/*dialect*/ IF Object_id('
LStable
') IS NOT NULL DROP TABLE LStable"
;
var
a
=
DBUtils
.
Execute
(
this
.
Context
,
sql2
);
string
sql2
=
$@"/*dialect*/ IF Object_id('
{
taball
}
') IS NOT NULL DROP TABLE LStable"
;
var
a
=
DBUtils
.
Execute
(
this
.
Context
,
sql2
);
//创建表
string
sql1
=
"create table LStable
("
+
strTest
;
string
sql1
=
$@"/*dialect*/ create table
{
taball
}
("
+
strTest
;
DBUtils
.
Execute
(
this
.
Context
,
sql1
);
//移除datatable中的第一行(第一行数据为Excel中的列字段信息)
dt
.
Rows
.
RemoveAt
(
0
);
//表名匹配
dt
.
TableName
=
"LStable"
;
dt
.
TableName
=
taball
;
//Excel数据批量导入表中
DBServiceHelper
.
BulkInserts
(
this
.
Context
,
string
.
Empty
,
string
.
Empty
,
dt
);
//定义输出参数
int
num
=
0
;
string
xznum
=
""
;
SqlParam
sqlParam1
=
new
SqlParam
(
"@num"
,
KDDbType
.
Int16
,
num
);
SqlParam
sqlParam2
=
new
SqlParam
(
"@xznum"
,
KDDbType
.
String
,
xznum
);
sqlParam1
.
Direction
=
ParameterDirection
.
Output
;
sqlParam2
.
Direction
=
ParameterDirection
.
Output
;
string
xznum
=
""
;
SqlParam
sqlParam1
=
new
SqlParam
(
"@TableName"
,
KDDbType
.
String
,
taball
);
SqlParam
sqlParam2
=
new
SqlParam
(
"@TableNamesb"
,
KDDbType
.
String
,
tabsb
);
SqlParam
sqlParam3
=
new
SqlParam
(
"@TableNamecg"
,
KDDbType
.
String
,
tabcg
);
SqlParam
sqlParam4
=
new
SqlParam
(
"@xznum"
,
KDDbType
.
Int32
,
xznum
);
sqlParam1
.
Direction
=
ParameterDirection
.
Input
;
sqlParam2
.
Direction
=
ParameterDirection
.
Input
;
sqlParam3
.
Direction
=
ParameterDirection
.
Input
;
sqlParam4
.
Direction
=
ParameterDirection
.
Output
;
List
<
SqlParam
>
sqlParams
=
new
List
<
SqlParam
>();
sqlParams
.
Add
(
sqlParam1
);
sqlParams
.
Add
(
sqlParam2
);
sqlParams
.
Add
(
sqlParam3
);
sqlParams
.
Add
(
sqlParam4
);
//执行存储过程
var
result
=
DBUtils
.
ExecuteStoreProcedure
(
this
.
Context
,
"ImportData"
,
sqlParams
);
if
(
result
.
Count
>
0
)
{
Excelsum
=
dt
.
Rows
.
Count
;
CFnum
=
Convert
.
ToInt32
(
result
[
0
].
Value
);
//重复物料
jg
=
Convert
.
ToInt32
(
result
[
1
].
Value
);
//最后结果
//
Excelsum = dt.Rows.Count;
jg
=
Convert
.
ToInt32
(
result
[
0
].
Value
);
//最后结果
// CFnum = Convert.ToInt32(result[1].Value);//重复物料
}
else
{
jg
=
-
1
;
}
string
sqldata
=
$@"/*dialect*/ select [失败原因],[创建人],[货品代号],[名称],[规格],[主单位],[大类],[中类],[预设仓库],[品牌],[12NC],[SKU],[CK编码], [接头数量],[接头型号]
,[线缆长度(米)],[材质],[长],[宽],[高],[拼板数],[开模图号],[每模穴数],[单模日产],[使用范围],[调价物料类型],[发料是否取整] from
{
tabsb
}
"
;
sbtab
=
DBUtils
.
ExecuteDataSet
(
this
.
Context
,
sqldata
).
Tables
[
0
];
//删除表
string
sql3
=
"DROP TABLE LStable"
;
DBUtils
.
Execute
(
this
.
Context
,
sql3
);
string
[]
strarr
=
new
string
[
3
];
strarr
[
0
]
=
taball
;
strarr
[
0
]
=
tabcg
;
strarr
[
0
]
=
tabsb
;
var
abcc
=
DBServiceHelper
.
DeleteTemporaryTableName
(
this
.
Context
,
strarr
);
}
//自定义方法,拼接临时表字段
private
string
GetCreateTmpTableNameSql
(
DataColumnCollection
fieldColumn
)
...
...
DataModel/6002_51c046d1/qaz_BOMTASK.2052.dymx
浏览文件 @
f334e6ec
No preview for this file type
DataModel/6002_51c046d1/qaz_BOMTASK.dym
浏览文件 @
f334e6ec
No preview for this file type
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论