Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
Line-Smart-Workstation
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 659eab71
由
LN
编写于
2025-03-20 14:43:59 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
元器件可增加图片,导出程序时带图片导出。
1 个父辈
e4c3b1e4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
422 行增加
和
88 行删除
Common/Setting_NInit.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/bean/BoardInfo.cs
DeviceLibrary/csvLoad/CSVBomManager.cs
DeviceLibrary/csvLoad/position/ComponetInfo.cs
DeviceLibrary/manager/BoardManager.cs
DeviceLibrary/manager/ImageUtilM.cs
TSA-V/FrmComponentList.Designer.cs
TSA-V/FrmComponentList.cs
TSA-V/FrmComponentList.resx
TSA-V/FrmMenu.cs
TSA-V/ResourceCulture.cs
TSA-V/frmBoard/FrmAddBoard.cs
TSA-V/frmBoard/FrmBoardList.cs
TSA-V/frmBoard/FrmNImageViewer.cs
TSA-V/workForm/FrmTSAV.Designer.cs
TSA-V/workForm/FrmTSAV.cs
TSA-V/workForm/PointDisplay.cs
Common/Setting_NInit.cs
查看文件 @
659eab7
...
@@ -97,7 +97,9 @@ namespace TSA_V.Common
...
@@ -97,7 +97,9 @@ namespace TSA_V.Common
[
MyConfigComment
(
"是否启用元器件计数功能"
)]
[
MyConfigComment
(
"是否启用元器件计数功能"
)]
public
static
MyConfig
<
bool
>
Device_UsePNCount
=
true
;
public
static
MyConfig
<
bool
>
Device_UsePNCount
=
true
;
[
MyConfigComment
(
"位号是否可以修改"
)]
[
MyConfigComment
(
"位号是否可以修改"
)]
public
static
MyConfig
<
bool
>
Device_CanModifyTagNo
=
false
;
public
static
MyConfig
<
bool
>
Device_CanModifyTagNo
=
false
;
[
MyConfigComment
(
"元器件图片路径"
)]
public
static
MyConfig
<
string
>
Device_ComImagePath
=
@"\config\componentImage\"
;
[
MyConfigComment
(
"手势服务器端口"
)]
[
MyConfigComment
(
"手势服务器端口"
)]
public
static
MyConfig
<
int
>
Hand_ServerPort
=
8765
;
public
static
MyConfig
<
int
>
Hand_ServerPort
=
8765
;
[
MyConfigComment
(
"手势范围设置:x,y,w,h"
)]
[
MyConfigComment
(
"手势范围设置:x,y,w,h"
)]
...
@@ -171,6 +173,8 @@ namespace TSA_V.Common
...
@@ -171,6 +173,8 @@ namespace TSA_V.Common
[
MyConfigComment
(
"最后一次校准信息,保存后作为新板子的基准"
)]
[
MyConfigComment
(
"最后一次校准信息,保存后作为新板子的基准"
)]
public
static
MyConfig
<
string
>
Data_LastCalibrateInfo
=
""
;
public
static
MyConfig
<
string
>
Data_LastCalibrateInfo
=
""
;
[
MyConfigComment
(
"最后一次选择图片的目录"
)]
public
static
MyConfig
<
string
>
Data_LastOpenImagePath
=
""
;
[
MyConfigComment
(
"RGB灯带端口号"
)]
[
MyConfigComment
(
"RGB灯带端口号"
)]
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
659eab7
...
@@ -35,6 +35,9 @@
...
@@ -35,6 +35,9 @@
<Prefer32Bit>false</Prefer32Bit>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="AOI">
<HintPath>..\dll\AOI.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX">
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
<HintPath>..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
</Reference>
...
...
DeviceLibrary/bean/BoardInfo.cs
查看文件 @
659eab7
...
@@ -97,6 +97,8 @@ namespace TSA_V.DeviceLibrary
...
@@ -97,6 +97,8 @@ namespace TSA_V.DeviceLibrary
public
Image
myImage
=
null
;
public
Image
myImage
=
null
;
public
List
<
ComponetInfo
>
componetList
{
get
;
set
;
}
=
null
;
public
string
GetImgPath
(
bool
isCheck
=
false
)
public
string
GetImgPath
(
bool
isCheck
=
false
)
{
{
string
path
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOARD_IMAGE_PATH
);
string
path
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOARD_IMAGE_PATH
);
...
@@ -109,7 +111,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -109,7 +111,7 @@ namespace TSA_V.DeviceLibrary
}
}
else
else
{
{
imagePath
=
Application
.
StartupPath
+
@"
\"
+
path
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOARD_IMAGE_DEFAULT
);
imagePath
=
Application
.
StartupPath
+
@"
/"
+
path
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOARD_IMAGE_PATH
);
}
}
}
}
return
imagePath
;
return
imagePath
;
...
@@ -176,6 +178,8 @@ namespace TSA_V.DeviceLibrary
...
@@ -176,6 +178,8 @@ namespace TSA_V.DeviceLibrary
/// </summary>
/// </summary>
public
byte
[]
imageByte
{
get
;
set
;
}
public
byte
[]
imageByte
{
get
;
set
;
}
public
string
imageBase64Data
{
get
;
set
;
}
public
bool
IsValid
()
public
bool
IsValid
()
{
{
if
(
String
.
IsNullOrEmpty
(
boardName
))
if
(
String
.
IsNullOrEmpty
(
boardName
))
...
...
DeviceLibrary/csvLoad/CSVBomManager.cs
查看文件 @
659eab7
...
@@ -401,7 +401,7 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -401,7 +401,7 @@ namespace TSA_V.LoadCSVLibrary
}
}
public
static
bool
UpdateComponet
(
string
bomName
,
ComponetInfo
com
)
public
static
bool
UpdateComponet
(
string
bomName
,
ComponetInfo
com
,
bool
updateImage
=
false
)
{
{
if
(!
allComMap
.
ContainsKey
(
bomName
))
if
(!
allComMap
.
ContainsKey
(
bomName
))
{
{
...
@@ -413,9 +413,17 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -413,9 +413,17 @@ namespace TSA_V.LoadCSVLibrary
if
(
oldList
[
index
].
IsSameCom
(
com
))
if
(
oldList
[
index
].
IsSameCom
(
com
))
{
{
oldList
[
index
]
=
com
;
oldList
[
index
]
=
com
;
break
;
if
(!
updateImage
)
{
break
;
}
}
else
if
(
updateImage
&&
oldList
[
index
].
PN
.
Equals
(
com
.
PN
))
{
oldList
[
index
].
imgInfo
=
null
;
}
}
}
}
if
(
SaveBomToFile
(
bomName
,
oldList
))
if
(
SaveBomToFile
(
bomName
,
oldList
))
{
{
...
@@ -537,17 +545,31 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -537,17 +545,31 @@ namespace TSA_V.LoadCSVLibrary
return
false
;
return
false
;
}
}
}
}
public
static
void
RemoveBom
(
string
bomName
)
public
static
void
RemoveBom
(
string
bomName
)
{
{
string
fileName
=
getFilePath
(
bomName
);
try
if
(
allComMap
.
ContainsKey
(
bomName
))
{
{
allComMap
.
Remove
(
bomName
);
string
fileName
=
getFilePath
(
bomName
);
if
(
allComMap
.
ContainsKey
(
bomName
))
{
allComMap
.
Remove
(
bomName
);
}
if
(
File
.
Exists
(
fileName
))
{
File
.
Delete
(
fileName
);
}
//删除图片文件夹
string
filePath
=
Path
.
Combine
(
Setting_NInit
.
Device_ComImagePath
,
@"/"
+
bomName
);
if
(
Directory
.
Exists
(
filePath
))
{
Directory
.
Delete
(
filePath
);
}
}
}
if
(
File
.
Exists
(
fileName
)
)
catch
(
Exception
ex
)
{
{
File
.
Delete
(
fileName
);
LogUtil
.
error
(
"RemoveBom "
+
bomName
+
"出错:"
+
ex
.
ToString
()
);
}
}
}
}
...
@@ -809,6 +831,7 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -809,6 +831,7 @@ namespace TSA_V.LoadCSVLibrary
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
{
list
[
i
].
Id
=
i
+
1
;
list
[
i
].
Id
=
i
+
1
;
list
[
i
].
SaveImage
(
bomName
,
null
,
list
[
i
].
ImgBase64Data
);
}
}
CSVBomManager
.
AddBom
(
bomName
,
list
);
CSVBomManager
.
AddBom
(
bomName
,
list
);
...
...
DeviceLibrary/csvLoad/position/ComponetInfo.cs
查看文件 @
659eab7
using
System
;
using
AOI
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
TSA_V.Common
;
using
TSA_V.Common
;
using
TSA_V.DeviceLibrary
;
using
TSA_V.DeviceLibrary
;
using
TSA_V.LoadCSVLibrary
;
using
TSA_V.LoadCSVLibrary
;
...
@@ -72,7 +75,80 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -72,7 +75,80 @@ namespace TSA_V.LoadCSVLibrary
///投影文字
///投影文字
/// </summary>
/// </summary>
[
CSVAttribute
(
"Text"
,
"投影文字"
,
false
)]
[
CSVAttribute
(
"Text"
,
"投影文字"
,
false
)]
public
string
Text
{
get
;
set
;
}
public
string
Text
{
get
;
set
;
}
///// <summary>
/////图片文件名
///// </summary>
//[CSVAttribute("ImageName", "图片文件名", false)]
//public string ImageName { get; set; } = "";
public
string
ImgBase64Data
{
get
;
set
;
}
=
""
;
public
Image
imgInfo
{
get
;
set
;
}
=
null
;
public
Image
GetImage
(
string
bomName
)
{
if
(
imgInfo
==
null
)
{
string
path
=
ImagePath
(
bomName
);
if
(
File
.
Exists
(
path
))
{
imgInfo
=
Eyemlib
.
DeepClone
(
Image
.
FromFile
(
path
));
}
}
return
imgInfo
;
}
public
bool
SaveImage
(
string
bomName
,
Image
newImage
,
string
base64Data
=
""
)
{
try
{
string
imagePath
=
ImagePath
(
bomName
);
//ImageName = @"\" + bomName + @"\" + PN + ".bmp";
string
path
=
Path
.
GetDirectoryName
(
imagePath
);
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
}
if
(
File
.
Exists
(
imagePath
))
{
File
.
Delete
(
imagePath
);
}
if
(
newImage
==
null
&&
base64Data
!=
""
)
{
ImageUtilM
.
Base64StringToFile
(
base64Data
,
imagePath
);
imgInfo
=
null
;
base64Data
=
""
;
return
true
;
}
if
(
newImage
==
null
)
{
//ImageName = "";
return
false
;
}
else
{
newImage
.
Save
(
imagePath
);
imgInfo
=
null
;
base64Data
=
""
;
return
true
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
+
ex
.
ToString
());
}
return
false
;
}
public
string
ImagePath
(
string
bomName
)
{
string
path
=
Application
.
StartupPath
+
Setting_NInit
.
Device_ComImagePath
+
@"\" + bomName + @"
\
" + PN + "
.
bmp
"; ;
return
path
;
}
public
int
GetSortPosition
()
public
int
GetSortPosition
()
{
{
...
...
DeviceLibrary/manager/BoardManager.cs
查看文件 @
659eab7
...
@@ -231,41 +231,49 @@ namespace TSA_V.DeviceLibrary
...
@@ -231,41 +231,49 @@ namespace TSA_V.DeviceLibrary
if
(!
CSVBomManager
.
BomNameIsExists
(
board
.
bomName
))
if
(!
CSVBomManager
.
BomNameIsExists
(
board
.
bomName
))
{
{
List
<
ComponetInfo
>
componetInfos
=
new
List
<
ComponetInfo
>();
List
<
ComponetInfo
>
componetInfos
=
new
List
<
ComponetInfo
>();
int
i
=
0
;
if
(
board
.
componetList
!=
null
&&
board
.
componetList
.
Count
>
0
)
foreach
(
SMTPointInfo
p
in
board
.
smtList
)
{
{
componetInfos
=
board
.
componetList
;
ComponetInfo
c
=
new
ComponetInfo
();
}
if
(
p
.
componet
!=
null
)
else
{
int
i
=
0
;
foreach
(
SMTPointInfo
p
in
board
.
smtList
)
{
{
c
=
p
.
componet
;
ComponetInfo
c
=
new
ComponetInfo
()
;
if
(
p
.
PositionNum
!=
c
.
PositionNum
)
if
(
p
.
componet
!=
null
)
{
{
LogUtil
.
error
(
$
"改导入程序【{board.boardName}】组装点【{p.TagNo + "
" + p.PN}】的位置从【{p.PositionNum}】改为元器件库对应位置【{c.PositionNum}】 "
);
c
=
p
.
componet
;
p
.
PositionNum
=
c
.
PositionNum
;
if
(
p
.
PositionNum
!=
c
.
PositionNum
)
{
LogUtil
.
error
(
$
"改导入程序【{board.boardName}】组装点【{p.TagNo + "
" + p.PN}】的位置从【{p.PositionNum}】改为元器件库对应位置【{c.PositionNum}】 "
);
p
.
PositionNum
=
c
.
PositionNum
;
}
}
}
}
else
else
{
{
c
.
Id
=
i
+
1
;
c
.
Id
=
i
+
1
;
c
.
PN
=
p
.
PN
;
c
.
PN
=
p
.
PN
;
c
.
PositionNum
=
p
.
PositionNum
;
c
.
PositionNum
=
p
.
PositionNum
;
c
.
PositionX
=
p
.
PositionX
;
c
.
PositionX
=
p
.
PositionX
;
c
.
PositionY
=
p
.
PositionY
;
c
.
PositionY
=
p
.
PositionY
;
c
.
TagNo
=
p
.
TagNo
;
c
.
TagNo
=
p
.
TagNo
;
c
.
Notes
=
""
;
c
.
Notes
=
""
;
c
.
Text
=
p
.
ShowText
;
c
.
Text
=
p
.
ShowText
;
c
.
ComponentDes
=
""
;
c
.
ComponentDes
=
""
;
}
i
++;
componetInfos
.
Add
(
c
);
}
}
i
++;
componetInfos
.
Add
(
c
);
}
}
board
.
bomName
=
CSVBomManager
.
AutoAddBomList
(
board
.
bomName
,
componetInfos
);
board
.
bomName
=
CSVBomManager
.
AutoAddBomList
(
board
.
bomName
,
componetInfos
);
LogUtil
.
info
(
"导入程序:程序名【"
+
board
.
boardName
+
"】,自动创建bom【"
+
board
.
bomName
+
"】"
);
LogUtil
.
info
(
"导入程序:程序名【"
+
board
.
boardName
+
"】,自动创建bom【"
+
board
.
bomName
+
"】"
);
}
}
board
.
componetList
=
null
;
board
.
boardId
=
BoardManager
.
GetNextId
();
board
.
boardId
=
BoardManager
.
GetNextId
();
BoardManager
.
Add
(
board
);
BoardManager
.
Add
(
board
);
...
...
DeviceLibrary/manager/ImageUtilM.cs
查看文件 @
659eab7
...
@@ -10,10 +10,10 @@ using TSA_V.Common;
...
@@ -10,10 +10,10 @@ using TSA_V.Common;
namespace
TSA_V.DeviceLibrary
namespace
TSA_V.DeviceLibrary
{
{
public
class
ImageUtilM
public
class
ImageUtilM
{
{
private
static
string
defPath
=
@"D:\image\"
;
private
static
string
defPath
=
@"D:\image\"
;
public
static
bool
canSavePic
(
string
path
=
""
,
int
checkZhao
=
50
)
public
static
bool
canSavePic
(
string
path
=
""
,
int
checkZhao
=
50
)
{
{
...
@@ -68,7 +68,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -68,7 +68,7 @@ namespace TSA_V.DeviceLibrary
{
{
if
(!
canSavePic
(
path
))
if
(!
canSavePic
(
path
))
{
{
DeleteOldFiles
(
path
,
day
);
DeleteOldFiles
(
path
,
day
);
}
}
else
else
{
{
...
@@ -115,7 +115,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -115,7 +115,7 @@ namespace TSA_V.DeviceLibrary
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
iamgeName
=
date
+
".bmp"
;
string
iamgeName
=
date
+
".bmp"
;
try
try
{
{
if
(
AutoDelFiles
(
dire
))
if
(
AutoDelFiles
(
dire
))
{
{
bitmap
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bitmap
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
...
@@ -129,5 +129,138 @@ namespace TSA_V.DeviceLibrary
...
@@ -129,5 +129,138 @@ namespace TSA_V.DeviceLibrary
}
}
return
dire
+
iamgeName
;
return
dire
+
iamgeName
;
}
}
public
static
string
BitMapToBase64
(
Image
bitmap
,
int
width
=
0
,
int
height
=
0
,
int
quality
=
100
)
{
try
{
if
(
bitmap
==
null
)
return
""
;
if
(
width
==
0
||
height
==
0
)
{
width
=
bitmap
.
Width
;
height
=
bitmap
.
Height
;
}
using
(
MemoryStream
ms
=
new
MemoryStream
())
{
var
tarbmp
=
ZoomImage
(
bitmap
,
height
,
width
,
quality
);
tarbmp
.
Save
(
ms
,
ImageFormat
.
Jpeg
);
byte
[]
bytes
=
ms
.
GetBuffer
();
string
base64
=
Convert
.
ToBase64String
(
bytes
);
// tarbmp.Save($".\\test_BitMapToBase64.bmp",ImageFormat.Jpeg);
//File.WriteAllText("E:\\Neotel\\Codes\\DLL\\IPCamera\\WindowsFormsApp1\\bin\\Debug\\test_BitMapToBase64.txt", base64);
//Base64ToBitmap(base64);
return
base64
;
}
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
"BitMapToStream: "
+
e
.
ToString
());
}
return
""
;
}
private
static
Image
ZoomImage
(
Image
bitmap
,
int
destHeight
,
int
destWidth
,
int
quality
=
100
)
{
try
{
System
.
Drawing
.
Image
sourImage
=
bitmap
;
int
width
=
0
,
height
=
0
;
//按比例缩放
int
sourWidth
=
sourImage
.
Width
;
int
sourHeight
=
sourImage
.
Height
;
if
(
sourHeight
>
destHeight
||
sourWidth
>
destWidth
)
{
if
((
sourWidth
*
destHeight
)
>
(
sourHeight
*
destWidth
))
{
width
=
destWidth
;
height
=
(
destWidth
*
sourHeight
)
/
sourWidth
;
}
else
{
height
=
destHeight
;
width
=
(
sourWidth
*
destHeight
)
/
sourHeight
;
}
}
else
{
width
=
sourWidth
;
height
=
sourHeight
;
}
Bitmap
destBitmap
=
new
Bitmap
(
destWidth
,
destHeight
);
Graphics
g
=
Graphics
.
FromImage
(
destBitmap
);
g
.
Clear
(
Color
.
Transparent
);
//设置画布的描绘质量
g
.
CompositingQuality
=
System
.
Drawing
.
Drawing2D
.
CompositingQuality
.
HighQuality
;
g
.
SmoothingMode
=
System
.
Drawing
.
Drawing2D
.
SmoothingMode
.
HighQuality
;
g
.
InterpolationMode
=
System
.
Drawing
.
Drawing2D
.
InterpolationMode
.
HighQualityBicubic
;
g
.
DrawImage
(
sourImage
,
new
Rectangle
((
destWidth
-
width
)
/
2
,
(
destHeight
-
height
)
/
2
,
width
,
height
),
0
,
0
,
sourImage
.
Width
,
sourImage
.
Height
,
GraphicsUnit
.
Pixel
);
//g.DrawImage(sourImage, new Rectangle(0, 0, destWidth, destHeight), new Rectangle(0, 0, sourImage.Width, sourImage.Height), GraphicsUnit.Pixel);
g
.
Dispose
();
//设置压缩质量
System
.
Drawing
.
Imaging
.
EncoderParameters
encoderParams
=
new
System
.
Drawing
.
Imaging
.
EncoderParameters
();
long
[]
qualitys
=
new
long
[
1
];
qualitys
[
0
]
=
quality
;
System
.
Drawing
.
Imaging
.
EncoderParameter
encoderParam
=
new
System
.
Drawing
.
Imaging
.
EncoderParameter
(
System
.
Drawing
.
Imaging
.
Encoder
.
Quality
,
qualitys
);
encoderParams
.
Param
[
0
]
=
encoderParam
;
sourImage
.
Dispose
();
return
destBitmap
;
}
catch
(
Exception
ex
)
{
return
bitmap
;
}
}
public
static
Bitmap
Base64StringToImage
(
string
inputStr
)
{
try
{
if
(
inputStr
==
""
)
{
return
null
;
}
byte
[]
arr
=
Convert
.
FromBase64String
(
inputStr
);
//using (MemoryStream ms = new MemoryStream(arr))
{
MemoryStream
ms
=
new
MemoryStream
(
arr
);
Bitmap
bmp
=
new
Bitmap
(
ms
);
ms
.
Close
();
return
bmp
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"Base64StringToImage 转换失败/nException:"
+
ex
.
ToString
());
return
null
;
}
}
public
static
bool
Base64StringToFile
(
string
inputStr
,
string
filePath
)
{
try
{
if
(
inputStr
==
""
)
{
return
false
;
}
byte
[]
arr
=
Convert
.
FromBase64String
(
inputStr
);
using
(
MemoryStream
ms
=
new
MemoryStream
(
arr
))
{
using
(
Image
image
=
Image
.
FromStream
(
ms
))
{
image
.
Save
(
filePath
,
ImageFormat
.
Bmp
);
// 可根据实际需要保存为不同格式的图片
return
true
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"Base64StringToImage 转换失败/nException:"
+
ex
.
ToString
());
return
false
;
}
}
}
}
}
}
TSA-V/FrmComponentList.Designer.cs
查看文件 @
659eab7
此文件的差异被折叠,
点击展开。
TSA-V/FrmComponentList.cs
查看文件 @
659eab7
此文件的差异被折叠,
点击展开。
TSA-V/FrmComponentList.resx
查看文件 @
659eab7
此文件的差异太大,无法显示。
TSA-V/FrmMenu.cs
查看文件 @
659eab7
...
@@ -51,14 +51,10 @@ namespace TSA_V
...
@@ -51,14 +51,10 @@ namespace TSA_V
lblMsg
.
Text
=
""
;
lblMsg
.
Text
=
""
;
Setting_NInit
.
ChangeConfig
();
Setting_NInit
.
ChangeConfig
();
AGerberController
.
ErrorLogEvent
+=
AGerberController_ErrorLogEvent
;
AGerberController
.
ErrorLogEvent
+=
AGerberController_ErrorLogEvent
;
//if (FormManager.UserInfo.Limit.Equals(UserLimit.Admin))
if
(
String
.
IsNullOrEmpty
(
Setting_NInit
.
Data_LastOpenImagePath
))
//{
{
// btnMaintenance.Visible = true;
Setting_NInit
.
Data_LastOpenImagePath
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
DesktopDirectory
);
//}
}
//else
//{
// btnMaintenance.Visible = false ;
//}
}
}
private
void
AGerberController_ErrorLogEvent
(
Exception
ex
)
private
void
AGerberController_ErrorLogEvent
(
Exception
ex
)
...
...
TSA-V/ResourceCulture.cs
查看文件 @
659eab7
...
@@ -931,6 +931,14 @@ namespace TSA_V
...
@@ -931,6 +931,14 @@ namespace TSA_V
/// 元器件【{0}】已配置位置【{1}】,请重新输入位置
/// 元器件【{0}】已配置位置【{1}】,请重新输入位置
/// </summary>
/// </summary>
public
static
string
PnHasPos
=
"PnHasPos"
;
public
static
string
PnHasPos
=
"PnHasPos"
;
/// <summary>
/// 图片名称
/// </summary>
public
static
string
Column_imgName
=
"Column_imgName"
;
/// <summary>
/// 图片
/// </summary>
public
static
string
Column_img
=
"Column_img"
;
}
}
}
}
TSA-V/frmBoard/FrmAddBoard.cs
查看文件 @
659eab7
...
@@ -431,14 +431,10 @@ namespace TSA_V
...
@@ -431,14 +431,10 @@ namespace TSA_V
}
}
private
void
btnOpenFile_Click
(
object
sender
,
LinkLabelLinkClickedEventArgs
e
)
private
void
btnOpenFile_Click
(
object
sender
,
LinkLabelLinkClickedEventArgs
e
)
{
{
openFileDialogImg
.
InitialDirectory
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
DesktopDirectory
);
//openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg";
//openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg";
openFileDialogImg
.
Filter
=
"Image Files|*.bmp;*.jpg;*.gif;*.png;*jpeg|gerber Files|*.*"
;
openFileDialogImg
.
Filter
=
"Image Files|*.bmp;*.jpg;*.gif;*.png;*jpeg|gerber Files|*.*"
;
openFileDialogImg
.
Multiselect
=
true
;
openFileDialogImg
.
Multiselect
=
true
;
string
directory
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
DesktopDirectory
);
//桌面路径
openFileDialogImg
.
InitialDirectory
=
Setting_NInit
.
Data_LastOpenImagePath
;
openFileDialogImg
.
InitialDirectory
=
directory
;
if
(
openFileDialogImg
.
ShowDialog
()
==
DialogResult
.
OK
)
if
(
openFileDialogImg
.
ShowDialog
()
==
DialogResult
.
OK
)
{
{
...
@@ -476,6 +472,7 @@ namespace TSA_V
...
@@ -476,6 +472,7 @@ namespace TSA_V
{
{
txtBoardW
.
Text
=
w
.
ToString
();
txtBoardW
.
Text
=
w
.
ToString
();
}
}
Setting_NInit
.
Data_LastOpenImagePath
=
Path
.
GetDirectoryName
(
files
[
0
]);
}
}
}
}
else
else
...
@@ -493,6 +490,7 @@ namespace TSA_V
...
@@ -493,6 +490,7 @@ namespace TSA_V
this
.
txtImagePath
.
Text
=
openFileDialogImg
.
FileName
;
this
.
txtImagePath
.
Text
=
openFileDialogImg
.
FileName
;
return
;
return
;
}
}
Setting_NInit
.
Data_LastOpenImagePath
=
Path
.
GetDirectoryName
(
file
);
}
}
}
}
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"FileError"
,
"文件格式错误 "
));
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"FileError"
,
"文件格式错误 "
));
...
...
TSA-V/frmBoard/FrmBoardList.cs
查看文件 @
659eab7
...
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
...
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
TSA_V.LoadCSVLibrary
;
using
TSA_V.LoadCSVLibrary
;
using
System.Drawing.Imaging
;
using
System.Drawing.Imaging
;
using
AOI
;
namespace
TSA_V
namespace
TSA_V
{
{
...
@@ -353,20 +354,59 @@ namespace TSA_V
...
@@ -353,20 +354,59 @@ namespace TSA_V
BoardInfo
board
=
(
BoardInfo
)
cmbBoardList
.
SelectedItem
;
BoardInfo
board
=
(
BoardInfo
)
cmbBoardList
.
SelectedItem
;
board
.
imageByte
=
BoardManager
.
ImgToByte
(
board
.
GetImgPath
());
board
.
imageByte
=
BoardManager
.
ImgToByte
(
board
.
GetImgPath
());
for
(
int
i
=
0
;
i
<
board
.
smtList
.
Count
;
i
++){
//for (int i= 0;i < board.smtList.Count; i++){
SMTPointInfo
p
=
board
.
smtList
[
i
];
// SMTPointInfo p = board.smtList[i];
board
.
smtList
[
i
].
componet
=
CSVBomManager
.
GetCom
(
board
.
boardName
,
p
);
// board.smtList[i].componet = CSVBomManager.GetCom(board.bomName, p);
// //优先使用bom的位置
// if(board.smtList[i].componet!=null)
// {
// string bomPos = board.smtList[i].componet.PositionNum;
// if (p.PositionNum!=bomPos )
// {
// p.PositionNum = bomPos;
// }
// //图片设置为base64格式
// string path = board.smtList[i].componet.ImagePath(board.bomName);
// if (File.Exists(path))
// {
// Image image = Image.FromFile(path);
// board.smtList[i].componet.ImgBase64Data = ImageUtilM.BitMapToBase64(Eyemlib.DeepClone(image));
// }
// }
//}
for
(
int
i
=
0
;
i
<
board
.
smtList
.
Count
;
i
++)
{
ComponetInfo
obj
=
CSVBomManager
.
GetCom
(
board
.
bomName
,
board
.
smtList
[
i
]);
//优先使用bom的位置
//优先使用bom的位置
if
(
board
.
smtList
[
i
].
componet
!=
null
)
if
(
obj
!=
null
)
{
if
(
board
.
smtList
[
i
].
PositionNum
!=
obj
.
PositionNum
)
{
board
.
smtList
[
i
].
PositionNum
=
obj
.
PositionNum
;
}
}
board
.
smtList
[
i
].
componet
=
null
;
}
List
<
ComponetInfo
>
componetInfos
=
CSVBomManager
.
GetComList
(
board
.
bomName
);
if
(
componetInfos
!=
null
&&
componetInfos
.
Count
>
0
)
{
board
.
componetList
=
new
List
<
ComponetInfo
>();
foreach
(
ComponetInfo
obj
in
componetInfos
)
{
{
string
bomPos
=
board
.
smtList
[
i
].
componet
.
PositionNum
;
//图片设置为base64格式
if
(
p
.
PositionNum
!=
bomPos
)
string
path
=
obj
.
ImagePath
(
board
.
bomName
);
if
(
File
.
Exists
(
path
))
{
{
p
.
PositionNum
=
bomPos
;
Image
image
=
Image
.
FromFile
(
path
);
}
obj
.
ImgBase64Data
=
ImageUtilM
.
BitMapToBase64
(
Eyemlib
.
DeepClone
(
image
));
}
board
.
componetList
.
Add
(
obj
);
}
}
}
}
SaveFileDialog
sfd
=
new
SaveFileDialog
();
SaveFileDialog
sfd
=
new
SaveFileDialog
();
sfd
.
FileName
=
""
;
sfd
.
FileName
=
""
;
sfd
.
InitialDirectory
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
DesktopDirectory
);
sfd
.
InitialDirectory
=
Environment
.
GetFolderPath
(
Environment
.
SpecialFolder
.
DesktopDirectory
);
...
@@ -387,6 +427,7 @@ namespace TSA_V
...
@@ -387,6 +427,7 @@ namespace TSA_V
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"成功导出程序到文件:"
)+
"\r\n"
+
filePath
,
ResourceCulture
.
GetString
(
"提示"
));
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"成功导出程序到文件:"
)+
"\r\n"
+
filePath
,
ResourceCulture
.
GetString
(
"提示"
));
}
}
}
}
board
.
componetList
=
null
;
}
}
}
}
...
...
TSA-V/frmBoard/FrmNImageViewer.cs
查看文件 @
659eab7
...
@@ -18,10 +18,17 @@ namespace TSA_V
...
@@ -18,10 +18,17 @@ namespace TSA_V
{
{
private
string
fileName
=
""
;
private
string
fileName
=
""
;
private
bool
update
=
false
;
private
bool
update
=
false
;
public
FrmNImageViewer
(
string
fileName
)
public
Image
lastImage
=
null
;
/// <summary>
/// 选择图片的方式0=新增电路板。1=元器件图片
/// </summary>
public
int
SelType
=
0
;
public
FrmNImageViewer
(
string
fileName
,
int
type
=
0
)
{
{
InitializeComponent
();
InitializeComponent
();
this
.
fileName
=
fileName
;
this
.
fileName
=
fileName
;
this
.
SelType
=
type
;
}
}
private
void
FrmImageViewer_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmImageViewer_Load
(
object
sender
,
EventArgs
e
)
...
@@ -30,6 +37,8 @@ namespace TSA_V
...
@@ -30,6 +37,8 @@ namespace TSA_V
{
{
System
.
Drawing
.
Image
img
=
System
.
Drawing
.
Image
.
FromFile
(
fileName
);
System
.
Drawing
.
Image
img
=
System
.
Drawing
.
Image
.
FromFile
(
fileName
);
Bitmap
myImage
=
new
System
.
Drawing
.
Bitmap
(
img
);
Bitmap
myImage
=
new
System
.
Drawing
.
Bitmap
(
img
);
lastImage
=
myImage
;
this
.
picViewer
.
Image
=
myImage
;
this
.
picViewer
.
Image
=
myImage
;
img
.
Dispose
();
img
.
Dispose
();
...
@@ -64,11 +73,22 @@ namespace TSA_V
...
@@ -64,11 +73,22 @@ namespace TSA_V
{
{
if
(
update
)
if
(
update
)
{
{
//备份原图
if
(
SelType
==
0
)
BackFile
();
{
Image
newImage
=
(
Image
)
picViewer
.
Image
.
Clone
();
//备份原图
newImage
.
Save
(
fileName
);
BackFile
();
LogUtil
.
info
(
"保存修改后的图片:"
+
fileName
);
Image
newImage
=
(
Image
)
picViewer
.
Image
.
Clone
();
lastImage
=
newImage
;
newImage
.
Save
(
fileName
);
LogUtil
.
info
(
"保存修改后的图片:"
+
fileName
);
}
else
{
Image
newImage
=
(
Image
)
picViewer
.
Image
.
Clone
();
lastImage
=
newImage
;
LogUtil
.
info
(
$
"SelType={SelType}不需要保存图片"
);
}
}
}
this
.
DialogResult
=
DialogResult
.
OK
;
this
.
DialogResult
=
DialogResult
.
OK
;
...
...
TSA-V/workForm/FrmTSAV.Designer.cs
查看文件 @
659eab7
此文件的差异被折叠,
点击展开。
TSA-V/workForm/FrmTSAV.cs
查看文件 @
659eab7
...
@@ -680,6 +680,21 @@ namespace TSA_V
...
@@ -680,6 +680,21 @@ namespace TSA_V
Setting_NInit
.
Work_ProcedureName
=
""
;
Setting_NInit
.
Work_ProcedureName
=
""
;
Setting_NInit
.
Work_TagNumber
=
0
;
Setting_NInit
.
Work_TagNumber
=
0
;
}
}
if
(
com
.
GetImage
(
BoardManager
.
CurrBoard
.
bomName
)
!=
null
)
{
picPNImg
.
SizeMode
=
PictureBoxSizeMode
.
Zoom
;
picPNImg
.
Image
=
com
.
imgInfo
;
panPNImg
.
Visible
=
true
;
groupPNImg
.
Visible
=
true
;
}
else
{
picPNImg
.
Image
=
null
;
panPNImg
.
Visible
=
false
;
groupPNImg
.
Visible
=
false
;
}
#
endregion
#
endregion
}
}
else
else
...
@@ -1156,20 +1171,20 @@ namespace TSA_V
...
@@ -1156,20 +1171,20 @@ namespace TSA_V
private
void
WriteStateStr
()
private
void
WriteStateStr
()
{
{
return
;
return
;
//全局图(粉色表示已完成;橘色表示未开始;红色表示实时位置) 12, 327
////全局图(粉色表示已完成;橘色表示未开始;红色表示实时位置) 12, 327
//Graphics g = e.Graphics;
////Graphics g = e.Graphics;
Graphics
g
=
groupBoard
.
CreateGraphics
();
//Graphics g= groupBoard.CreateGraphics();
Font
f
=
new
Font
(
"微软雅黑"
,
10.5F
);
//Font f = new Font("微软雅黑", 10.5F);
string
end
=
ResourceCulture
.
GetString
(
ResourceCulture
.
State_End
,
"已完成"
);
//string end = ResourceCulture.GetString(ResourceCulture.State_End, "已完成");
string
notStart
=
ResourceCulture
.
GetString
(
ResourceCulture
.
State_NotStart
,
"未开始"
);
//string notStart = ResourceCulture.GetString(ResourceCulture.State_NotStart, "未开始");
string
postion
=
ResourceCulture
.
GetString
(
ResourceCulture
.
State_Postiion
,
"实时位置"
);
//string postion = ResourceCulture.GetString(ResourceCulture.State_Postiion, "实时位置");
int
width
=
groupBoard
.
Size
.
Width
;
//int width = groupBoard.Size.Width;
g
.
DrawString
(
end
,
f
,
Brushes
.
HotPink
,
width
-
260
,
0
);
//g.DrawString(end, f, Brushes.HotPink, width-260, 0);
g
.
DrawString
(
notStart
,
f
,
Brushes
.
Orange
,
width
-
160
,
0
);
//g.DrawString(notStart, f, Brushes.Orange, width-160, 0);
g
.
DrawString
(
postion
,
f
,
Brushes
.
Red
,
width
-
80
,
0
);
//g.DrawString(postion, f, Brushes.Red, width-80, 0);
////g.Dispose();
//g.Flush();
//g.Dispose();
//g.Dispose();
g
.
Flush
();
g
.
Dispose
();
}
}
private
void
btnIo_Click
(
object
sender
,
EventArgs
e
)
private
void
btnIo_Click
(
object
sender
,
EventArgs
e
)
...
@@ -1198,6 +1213,9 @@ namespace TSA_V
...
@@ -1198,6 +1213,9 @@ namespace TSA_V
groupBoard
.
Size
=
new
Size
(
picBoard
.
Width
+
6
,
picBoard
.
Height
+
6
);
groupBoard
.
Size
=
new
Size
(
picBoard
.
Width
+
6
,
picBoard
.
Height
+
6
);
groupBoard
.
Location
=
new
Point
(
groupBox2
.
Location
.
X
+
groupBox2
.
Width
-
groupBoard
.
Width
,
groupBox2
.
Location
.
Y
+
groupBox2
.
Height
-
groupBoard
.
Height
);
groupBoard
.
Location
=
new
Point
(
groupBox2
.
Location
.
X
+
groupBox2
.
Width
-
groupBoard
.
Width
,
groupBox2
.
Location
.
Y
+
groupBox2
.
Height
-
groupBoard
.
Height
);
}
}
groupPNImg
.
Size
=
new
Size
(
groupBox2
.
Width
/
5
,
groupBox2
.
Height
/
5
);
groupPNImg
.
Location
=
new
Point
(
groupBox2
.
Location
.
X
,
groupBox2
.
Location
.
Y
+
groupBox2
.
Height
-
groupPNImg
.
Height
);
}
}
private
void
StartVideo
()
private
void
StartVideo
()
...
...
TSA-V/workForm/PointDisplay.cs
查看文件 @
659eab7
...
@@ -98,8 +98,10 @@ namespace TSA_V
...
@@ -98,8 +98,10 @@ namespace TSA_V
int
index
=
0
;
int
index
=
0
;
foreach
(
SMTPointInfo
weld
in
pointList
)
foreach
(
SMTPointInfo
weld
in
pointList
)
{
{
float
x
=
(
float
)
Math
.
Abs
(
weld
.
PositionX
)
*
imageXiShu
;
//float x = (float)Math.Abs(weld.PositionX) * imageXiShu;
float
y
=
(
float
)
Math
.
Abs
(
weld
.
PositionY
)
*
imageXiShu
;
//float y = (float)Math.Abs(weld.PositionY) * imageXiShu;
float
x
=
(
float
)
weld
.
PositionX
*
imageXiShu
;
float
y
=
(
float
)
weld
.
PositionY
*
imageXiShu
;
int
lineLength
=
8
;
int
lineLength
=
8
;
Color
color
=
Color
.
HotPink
;
Color
color
=
Color
.
HotPink
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论