Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b2fb4069
由
LN
编写于
2020-08-19 13:39:48 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
点料算法更新
1 个父辈
6e29a642
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
146 行增加
和
74 行删除
RC1266-AutoCountMachine/dll/X-Ray/Asa.CarerayImage.dll
RC1266-AutoCountMachine/dll/X-Ray/Asa.CarerayImage.xml
RC1266-AutoCountMachine/dll/X-Ray/eyemLib.dll
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmComponentList.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.Designer.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.cs
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/countParam.csv
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/pnDetailedList.csv
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/manager/ParamManager.cs
RC1266-AutoCountMachine/source/LoadCVSLibrary/CSVReaderBase.cs
RC1266-AutoCountMachine/source/LoadCVSLibrary/storeConfig/CSVBomManager.cs
RC1266-AutoCountMachine/dll/X-Ray/Asa.CarerayImage.dll
查看文件 @
b2fb406
此文件类型无法预览
RC1266-AutoCountMachine/dll/X-Ray/Asa.CarerayImage.xml
查看文件 @
b2fb406
...
@@ -75,29 +75,18 @@
...
@@ -75,29 +75,18 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Asa.CarerayImage.GetLocalCount(System.String,System.Double,System.Int32,System.
Int32
@,Asa.API.EyemImage@)"
>
<member
name=
"M:Asa.CarerayImage.GetLocalCount(System.String,System.Double,System.Int32,System.
String
@,Asa.API.EyemImage@)"
>
<summary>
<summary>
本地文件
小
器件点料
本地文件
普通
器件点料
</summary>
</summary>
<param
name=
"path"
></param>
<param
name=
"path"
></param>
<param
name=
"dOffset"
></param>
<param
name=
"dOffset"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"
iObjC
ount"
></param>
<param
name=
"
c
ount"
></param>
<param
name=
"tpDstImg"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Asa.CarerayImage.GetLocalCountHuge(System.String,System.Double,System.Int32,System.Int32@,Asa.API.EyemImage@)"
>
<member
name=
"M:Asa.CarerayImage.GetLocalCountIrregular(System.String,System.Double,System.Int32,System.Int32,System.String@,Asa.API.EyemImage@)"
>
<summary>
本地文件大器件点料
</summary>
<param
name=
"path"
></param>
<param
name=
"dOffset"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iObjCount"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.CarerayImage.GetLocalCountIrregular(System.String,System.Double,System.Int32,System.Int32,System.Int32@,Asa.API.EyemImage@)"
>
<summary>
<summary>
本地文件异性器件点料
本地文件异性器件点料
</summary>
</summary>
...
@@ -105,7 +94,7 @@
...
@@ -105,7 +94,7 @@
<param
name=
"dOffset"
></param>
<param
name=
"dOffset"
></param>
<param
name=
"type"
></param>
<param
name=
"type"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"
iObjC
ount"
></param>
<param
name=
"
c
ount"
></param>
<param
name=
"tpDstImg"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
...
@@ -124,23 +113,9 @@
...
@@ -124,23 +113,9 @@
</summary>
</summary>
<param
name=
"ipImage"
></param>
<param
name=
"ipImage"
></param>
</member>
</member>
<member
name=
"M:Asa.API.eyemCountObject(Asa.API.EyemImage,System.String,System.Double,System.Int32,System.Int32,System.Int32,System.Int32@,Asa.API.EyemImage@)"
>
<member
name=
"M:Asa.API.eyemCountObject(Asa.API.EyemImage,System.String,System.Double,System.Int32,System.Int32,System.Int32,System.IntPtr@,Asa.API.EyemImage@)"
>
<summary>
小盘点料
</summary>
<param
name=
"tpSrcImg"
></param>
<param
name=
"fileName"
></param>
<param
name=
"dOffset"
></param>
<param
name=
"iMinArea"
></param>
<param
name=
"iMaxArea"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iObjCount"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.API.eyemCountObject4Huge(Asa.API.EyemImage,System.String,System.Double,System.Int32,System.Int32,System.Int32,System.Int32@,Asa.API.EyemImage@)"
>
<summary>
<summary>
大盘点料
普通器件
</summary>
</summary>
<param
name=
"tpSrcImg"
></param>
<param
name=
"tpSrcImg"
></param>
<param
name=
"fileName"
></param>
<param
name=
"fileName"
></param>
...
@@ -148,13 +123,13 @@
...
@@ -148,13 +123,13 @@
<param
name=
"iMinArea"
></param>
<param
name=
"iMinArea"
></param>
<param
name=
"iMaxArea"
></param>
<param
name=
"iMaxArea"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"
iObjCount
"
></param>
<param
name=
"
pNumObj
"
></param>
<param
name=
"tpDstImg"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Asa.API.eyemCountObjectIrregularParts(Asa.API.EyemImage,System.String,System.Double,System.Int32,System.Int32,System.Int32,System.Int
32
@,Asa.API.EyemImage@)"
>
<member
name=
"M:Asa.API.eyemCountObjectIrregularParts(Asa.API.EyemImage,System.String,System.Double,System.Int32,System.Int32,System.Int32,System.Int
Ptr
@,Asa.API.EyemImage@)"
>
<summary>
<summary>
异
性
器件
异
型
器件
</summary>
</summary>
<param
name=
"tpSrcImg"
></param>
<param
name=
"tpSrcImg"
></param>
<param
name=
"fileName"
></param>
<param
name=
"fileName"
></param>
...
@@ -162,7 +137,7 @@
...
@@ -162,7 +137,7 @@
<param
name=
"iType"
></param>
<param
name=
"iType"
></param>
<param
name=
"iMaxArea"
></param>
<param
name=
"iMaxArea"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"iWinSize"
></param>
<param
name=
"
iObjCount
"
></param>
<param
name=
"
pNumObj
"
></param>
<param
name=
"tpDstImg"
></param>
<param
name=
"tpDstImg"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
...
...
RC1266-AutoCountMachine/dll/X-Ray/eyemLib.dll
查看文件 @
b2fb406
此文件太大,无法显示。
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.cs
查看文件 @
b2fb406
...
@@ -142,7 +142,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -142,7 +142,7 @@ namespace OnlineStore.AutoCountClient
list
.
Add
(
obj
.
ToCSVStr
());
list
.
Add
(
obj
.
ToCSVStr
());
}
}
File
.
WriteAllLines
(
filePath
,
list
.
ToArray
<
string
>(),
Encoding
.
GetEncoding
(
"gbk"
)
);
File
.
WriteAllLines
(
filePath
,
list
.
ToArray
<
string
>(),
Encoding
.
UTF8
);
MessageBox
.
Show
(
"成功导出程序到文件:"
+
"\r\n"
+
filePath
);
MessageBox
.
Show
(
"成功导出程序到文件:"
+
"\r\n"
+
filePath
);
}
}
}
}
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmComponentList.cs
查看文件 @
b2fb406
...
@@ -282,7 +282,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -282,7 +282,7 @@ namespace OnlineStore.AutoCountClient
txtFengzhuang
.
Text
=
""
;
txtFengzhuang
.
Text
=
""
;
txtPartNum
.
Text
=
""
;
txtPartNum
.
Text
=
""
;
cmbSuanfa
.
SelectedIndex
=
5
;
cmbSuanfa
.
SelectedIndex
=
5
;
lblTuijian
.
Text
=
""
;
txtPartNum
.
Enabled
=
true
;
txtPartNum
.
Enabled
=
true
;
groupInfo
.
Text
=
"新增元器件"
;
groupInfo
.
Text
=
"新增元器件"
;
}
}
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.Designer.cs
查看文件 @
b2fb406
此文件的差异被折叠,
点击展开。
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.cs
查看文件 @
b2fb406
using
Acc.ImageBox
;
using
Acc.ImageBox
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.ComponentModel
;
...
@@ -20,9 +21,8 @@ namespace OnlineStore.AutoCountClient
...
@@ -20,9 +21,8 @@ namespace OnlineStore.AutoCountClient
public
FrmLearning
()
public
FrmLearning
()
{
{
InitializeComponent
();
InitializeComponent
();
}
}
private
ImageBox
currShowBox
=
null
;
private
int
CurrType
=
-
2
;
private
int
CurrType
=
-
1
;
private
string
CurrFullFileName
=
""
;
private
string
CurrFullFileName
=
""
;
private
string
CurrPN
=
""
;
private
string
CurrPN
=
""
;
...
@@ -84,8 +84,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -84,8 +84,7 @@ namespace OnlineStore.AutoCountClient
if
(
currIndex
>=
ImageList
.
Count
)
if
(
currIndex
>=
ImageList
.
Count
)
{
{
btnNext
.
Enabled
=
false
;
btnNext
.
Enabled
=
false
;
MessageBox
.
Show
(
"已经是最后一张图片"
);
MessageBox
.
Show
(
"已经是最后一张图片"
);
return
;
return
;
}
}
string
fullFName
=
ImageList
[
currIndex
];
string
fullFName
=
ImageList
[
currIndex
];
...
@@ -117,7 +116,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -117,7 +116,7 @@ namespace OnlineStore.AutoCountClient
}
}
else
else
{
{
ShowType
(-
1
);
ShowType
(-
1
);
}
}
imgCurrImg
.
HorizontalScroll
.
Value
=
173
;
imgCurrImg
.
HorizontalScroll
.
Value
=
173
;
...
@@ -126,6 +125,24 @@ namespace OnlineStore.AutoCountClient
...
@@ -126,6 +125,24 @@ namespace OnlineStore.AutoCountClient
{
{
btnNext
.
Enabled
=
false
;
btnNext
.
Enabled
=
false
;
}
}
if
(
LoadCSVLibrary
.
CSVBomManager
.
allComMap
.
ContainsKey
(
CurrPN
))
{
ComponetInfo
com
=
CSVBomManager
.
allComMap
[
CurrPN
];
lblDes
.
Text
=
"描述:"
+
com
.
Describe
;
lblFeng
.
Text
=
"封装:"
+
com
.
Encapsulations
;
lblPN
.
Text
=
"元器件编号:"
+
com
.
PartNum
;
lblProName
.
Text
=
"产品:"
+
com
.
ProductName
;
}
else
{
lblPN
.
Text
=
"元器件编号:"
+
CurrPN
;
lblDes
.
Text
=
"--"
;
lblFeng
.
Text
=
"--"
;
lblProName
.
Text
=
"--"
;
}
timer1
.
Start
();
timer1
.
Start
();
}
}
...
@@ -138,10 +155,12 @@ namespace OnlineStore.AutoCountClient
...
@@ -138,10 +155,12 @@ namespace OnlineStore.AutoCountClient
CurrType
=
type
;
CurrType
=
type
;
int
index
=
0
;
int
index
=
0
;
btnTest
.
Text
=
"请选择算法"
;
btnTest
.
Text
=
"请选择算法"
;
bool
findsuanfa
=
false
;
foreach
(
Button
btn
in
SelBtnList
)
foreach
(
Button
btn
in
SelBtnList
)
{
{
if
(
index
.
Equals
(
type
))
if
(
index
.
Equals
(
type
))
{
{
findsuanfa
=
true
;
btn
.
Text
=
gouStr
+
btn
.
Tag
;
btn
.
Text
=
gouStr
+
btn
.
Tag
;
btnTest
.
Text
=
btn
.
Tag
+
"-点料测试"
;
btnTest
.
Text
=
btn
.
Tag
+
"-点料测试"
;
btn
.
BackColor
=
Color
.
LightGreen
;
btn
.
BackColor
=
Color
.
LightGreen
;
...
@@ -153,12 +172,9 @@ namespace OnlineStore.AutoCountClient
...
@@ -153,12 +172,9 @@ namespace OnlineStore.AutoCountClient
}
}
index
++;
index
++;
}
}
bool
isShowBtn
=
(
type
>=
0
&&
type
<
5
);
btnTest
.
Enabled
=
isShowBtn
;
btnNext
.
Enabled
=
isShowBtn
;
btnEnd
.
Enabled
=
true
;
btnTest
.
Enabled
=
findsuanfa
;
btnNext
.
Enabled
=
findsuanfa
;
}
}
private
void
btnTest_Click
(
object
sender
,
EventArgs
e
)
private
void
btnTest_Click
(
object
sender
,
EventArgs
e
)
...
@@ -248,7 +264,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -248,7 +264,7 @@ namespace OnlineStore.AutoCountClient
private
void
btnNext_Click
(
object
sender
,
EventArgs
e
)
private
void
btnNext_Click
(
object
sender
,
EventArgs
e
)
{
{
btnNext
.
Enabled
=
false
;
//
btnNext.Enabled = false;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
WaitCursor
;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
WaitCursor
;
try
try
{
{
...
@@ -258,7 +274,7 @@ namespace OnlineStore.AutoCountClient
...
@@ -258,7 +274,7 @@ namespace OnlineStore.AutoCountClient
{
{
LogUtil
.
error
(
"下一张 报错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"下一张 报错:"
+
ex
.
ToString
());
}
}
btnNext
.
Enabled
=
true
;
//
btnNext.Enabled = true;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
Default
;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
Default
;
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/countParam.csv
查看文件 @
b2fb406
type,sign,value,threshold,windowSize
type,sign,value,threshold,windowSize
6H10B,1,5,0,0
6H10B,1,5,0,0
7H5S1,0,0,0,0
7H5S1,0,0,0,0
6H106,1,0,0,0
6H106,1,0,0,0
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/pnDetailedList.csv
查看文件 @
b2fb406
此文件的差异太大,无法显示。
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
b2fb406
...
@@ -559,29 +559,50 @@ namespace OnlineStore.DeviceLibrary
...
@@ -559,29 +559,50 @@ namespace OnlineStore.DeviceLibrary
}
}
public
int
GetCountResult
(
string
fileP
,
CountParam
param
,
out
Asa
.
API
.
EyemImage
tpDstImg
)
public
int
GetCountResult
(
string
fileP
,
CountParam
param
,
out
Asa
.
API
.
EyemImage
tpDstImg
)
{
{
// 器件类型
//"小器件" GetLocalCount
//"粘连不严重" GetLocalCountIrregular type = 0
//"大器件" GetLocalCountIrregular type = 1
//"长条型器件" GetLocalCountIrregular type = 2
//"E形状" GetLocalCountIrregular type = 3
//返回的数量是string类型,count = "4000,3000,3500,2000"
int
count
=
0
;
int
count
=
0
;
int
result
=
0
;
tpDstImg
=
new
API
.
EyemImage
();
int
type
=
param
.
Sign
;
try
int
threshold
=
param
.
Threshold
;
int
windowsize
=
param
.
WindowSize
;
if
(
param
.
Sign
.
Equals
(
0
))
{
result
=
carerayImage
.
GetLocalCount
(
fileP
,
threshold
,
windowsize
,
out
count
,
out
tpDstImg
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
count
+
"】"
);
}
else
if
(
param
.
Sign
.
Equals
(
1
))
{
{
result
=
carerayImage
.
GetLocalCountHuge
(
fileP
,
threshold
,
windowsize
,
out
count
,
out
tpDstImg
);
string
countStr
=
""
;
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
count
+
"】"
);
int
result
=
0
;
int
type
=
param
.
Sign
;
int
threshold
=
param
.
Threshold
;
int
windowsize
=
param
.
WindowSize
;
if
(
param
.
Sign
.
Equals
(
0
))
{
result
=
carerayImage
.
GetLocalCount
(
fileP
,
threshold
,
windowsize
,
out
countStr
,
out
tpDstImg
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
countStr
+
"】"
);
}
//else if (param.Sign.Equals(1))
//{
// result = carerayImage.GetLocalCountHuge(fileP, threshold, windowsize, out countStr, out tpDstImg);
// LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
//}
else
{
int
t
=
param
.
Sign
-
1
;
result
=
carerayImage
.
GetLocalCountIrregular
(
fileP
,
threshold
,
t
,
windowsize
,
out
countStr
,
out
tpDstImg
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCountIrregular 【"
+
fileP
+
"】【"
+
threshold
+
"】["
+
t
+
"]【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
countStr
+
"】"
);
}
string
[]
array
=
countStr
.
Split
(
','
);
if
(
array
.
Length
>
0
)
{
count
=
Convert
.
ToInt32
(
array
[
0
]);
}
}
}
else
catch
(
Exception
ex
)
{
{
int
t
=
param
.
Sign
-
2
;
LogUtil
.
error
(
"GetCountResult 出错: "
+
ex
.
ToString
());
WorkLog
(
"点料:开始调用 carerayImage.GetLocalCountIrregular "
);
result
=
carerayImage
.
GetLocalCountIrregular
(
fileP
,
threshold
,
t
,
windowsize
,
out
count
,
out
tpDstImg
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】["
+
t
+
"]【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
count
+
"】"
);
}
}
return
count
;
return
count
;
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/manager/ParamManager.cs
查看文件 @
b2fb406
...
@@ -121,6 +121,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -121,6 +121,8 @@ namespace OnlineStore.DeviceLibrary
File
.
WriteAllLines
(
ConfigFilePath
,
lineList
);
File
.
WriteAllLines
(
ConfigFilePath
,
lineList
);
LogUtil
.
info
(
"SaveMapToFile 【"
+
ConfigFilePath
+
"】"
);
LogUtil
.
info
(
"SaveMapToFile 【"
+
ConfigFilePath
+
"】"
);
CSVBomManager
.
BackFile
(
ConfigFilePath
,
lineList
.
ToArray
());
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
RC1266-AutoCountMachine/source/LoadCVSLibrary/CSVReaderBase.cs
查看文件 @
b2fb406
...
@@ -114,7 +114,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -114,7 +114,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
File
.
WriteAllLines
(
filePath
,
lines
,
Encoding
.
GetEncoding
(
"gbk"
));
File
.
WriteAllLines
(
filePath
,
lines
,
Encoding
.
GetEncoding
(
"gbk"
));
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
if
(!
titleIndex
.
ContainsKey
(
str
))
if
(!
titleIndex
.
ContainsKey
(
str
))
{
{
LogUtil
.
error
(
"未找到必须列:"
+
str
+
",加载数据失败!"
);
LogUtil
.
error
(
"未找到必须列:"
+
str
+
",加载数据失败!"
);
throw
new
CVSFieldNotMatchingExection
(
"
未找到必须列:"
+
str
+
"
,加载数据失败!"
);
throw
new
CVSFieldNotMatchingExection
(
"
【"
+
lineValue
+
"】未找到必须列:【"
+
str
+
"】
,加载数据失败!"
);
}
}
}
}
}
}
...
...
RC1266-AutoCountMachine/source/LoadCVSLibrary/storeConfig/CSVBomManager.cs
查看文件 @
b2fb406
...
@@ -56,9 +56,15 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -56,9 +56,15 @@ namespace OnlineStore.LoadCSVLibrary
}
}
public
static
string
getFilePath
()
public
static
string
getFilePath
()
{
{
string
ComPath_Config
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ComPath_Config
);
if
(
String
.
IsNullOrEmpty
(
ComPath_Config
))
{
ComPath_Config
=
@"\XRAY\pnDetailedList.csv"
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
ComPath_Config
,
ComPath_Config
);
}
string
appPath
=
Application
.
StartupPath
;
string
appPath
=
Application
.
StartupPath
;
string
fileName
=
appPath
+
Co
nfigAppSettings
.
GetValue
(
Setting_Init
.
ComPath_Config
)
;
string
fileName
=
appPath
+
Co
mPath_Config
;
return
fileName
;
return
fileName
;
}
}
/// <summary>
/// <summary>
...
@@ -245,6 +251,8 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -245,6 +251,8 @@ namespace OnlineStore.LoadCSVLibrary
}
}
bool
result
=
WriteCSVFile
(
filePath
,
lines
);
bool
result
=
WriteCSVFile
(
filePath
,
lines
);
LogUtil
.
info
(
"保存物料库列表到文件 SaveToFile :"
+
result
);
LogUtil
.
info
(
"保存物料库列表到文件 SaveToFile :"
+
result
);
BackFile
(
filePath
,
lines
);
return
true
;
return
true
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -264,6 +272,56 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -264,6 +272,56 @@ namespace OnlineStore.LoadCSVLibrary
return
false
;
return
false
;
}
}
public
static
void
BackFile
(
string
filePath
,
string
[]
lines
)
{
//备份保存
//try
//{
// FileInfo file = new FileInfo(filePath);
// string date = DateTime.Now.ToString("yyyy-MM-dd");
// string targetBackPath = @"C:\configBack\" + date + @"\";
// if (!Directory.Exists(targetBackPath))
// {
// Directory.CreateDirectory(targetBackPath);
// }
// string fileName = file.Name;
// string backFile = targetBackPath + fileName;
// if (File.Exists(backFile))
// {
// File.Delete(backFile);
// }
// File.WriteAllLines(backFile, lines, Encoding.GetEncoding("gbk"));
//}
//catch (Exception e)
//{
// LogUtil.error("备份["+ filePath + "]到C:configBack出错:" + e.ToString());
//}
//备份保存
try
{
FileInfo
file
=
new
FileInfo
(
filePath
);
string
date
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
);
string
targetBackPath
=
@"D:\configBack\" + date + @"
\
";
if
(!
Directory
.
Exists
(
targetBackPath
))
{
Directory
.
CreateDirectory
(
targetBackPath
);
}
string
fileName
=
file
.
Name
;
string
backFile
=
targetBackPath
+
fileName
;
if
(
File
.
Exists
(
backFile
))
{
File
.
Delete
(
backFile
);
}
File
.
WriteAllLines
(
backFile
,
lines
,
Encoding
.
UTF8
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
"备份["
+
filePath
+
"]到D:configBack出错:"
+
e
.
ToString
());
}
}
public
static
ComponetInfo
GetCom
(
string
partNum
)
public
static
ComponetInfo
GetCom
(
string
partNum
)
{
{
if
(
allComMap
.
ContainsKey
(
partNum
))
if
(
allComMap
.
ContainsKey
(
partNum
))
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论