增加对面板模型阴影效果的处理
This commit is contained in:
493
CorelDRAW.vb
493
CorelDRAW.vb
@@ -11,15 +11,16 @@ Imports VGCore
|
||||
Public Class CorelDRAW
|
||||
|
||||
Public M_Redisip As String = "127.0.0.1"
|
||||
Public M_Redisport As Integer = 6379 '10079 ' 10079
|
||||
Public M_Redispassword As String = "" ' "blw@redis-ser@123" ' "" '
|
||||
Public M_Redisport As Integer = 6379 ' 10079 '10079 ' 10079
|
||||
Public M_Redispassword As String = "" '"blw@redis-ser@123" ' "blw@redis-ser@123" ' "" '
|
||||
'redis消息队列
|
||||
Public M_RedisQueue As Queue
|
||||
'事件处理线程
|
||||
Public M_EventThread As Thread
|
||||
|
||||
'服务器文件路径
|
||||
Private M_ServerPath As String = "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" ' "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" '"D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" ' "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" '
|
||||
'素材库路径
|
||||
Private M_MaterialPath As String = "D:\Canvas\material\" ' "R:\Canvas\material\" '
|
||||
Private M_MaterialPath As String = "D:\Canvas\material\" ' "R:\Canvas\material\" ' "R:\Canvas\material\" '
|
||||
'成平文件路径
|
||||
Private M_TplPath As String = "D:\CorelDRAW\"
|
||||
Public G_RedisSub, G_Redislish As RedisSubscriber
|
||||
@@ -51,7 +52,7 @@ Public Class CorelDRAW
|
||||
'End If
|
||||
APP = New Application()
|
||||
Thread.Sleep(300)
|
||||
APP.Visible = False
|
||||
APP.Visible = True
|
||||
' Dim MaterialPath As String = M_MaterialPath & "素材模板.cdr"
|
||||
'G_LibDoc = APP.OpenDocument(MaterialPath, False)
|
||||
G_Log = New RuningLog(RichTextBox1, System.Windows.Forms.Application.StartupPath & "\log")
|
||||
@@ -74,7 +75,8 @@ Public Class CorelDRAW
|
||||
DisposeRedisMsgNode1(MsgNode)
|
||||
Case 2
|
||||
Dim MsgNode = JsonConvert.DeserializeObject(Of PreviewRoomTypePanel)(item.MsgNode.ToString)
|
||||
DisposeRedisMsgNode2(MsgNode)
|
||||
DisposeRedisMsgNode3(MsgNode)
|
||||
'DisposeRedisMsgNode2(MsgNode)
|
||||
End Select
|
||||
|
||||
End If
|
||||
@@ -125,7 +127,8 @@ Public Class CorelDRAW
|
||||
End Sub
|
||||
Sub DisposeRedisMsgNode2(node As PreviewRoomTypePanel)
|
||||
Dim gLogNode As LogNode
|
||||
Dim filedir As String = "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic"
|
||||
|
||||
Dim filedir As String = M_ServerPath ' "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic"
|
||||
|
||||
Dim RsNode As New RedisSendNode
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialLibraryNotExist
|
||||
@@ -139,8 +142,6 @@ Public Class CorelDRAW
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Dim doc As Document
|
||||
Try
|
||||
|
||||
|
||||
doc = APP.CreateDocument()
|
||||
doc.Unit = cdrUnit.cdrMillimeter ' 设置单位为毫米
|
||||
|
||||
@@ -386,6 +387,378 @@ Public Class CorelDRAW
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub DisposeRedisMsgNode3(node As PreviewRoomTypePanel)
|
||||
Dim gLogNode As LogNode
|
||||
|
||||
Dim filedir As String = M_ServerPath ' "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic"
|
||||
|
||||
Dim RsNode As New RedisSendNode
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialLibraryNotExist
|
||||
RsNode.PictureNum = node.picNum
|
||||
Dim RMNode As New RedisMsgNode
|
||||
RMNode.MsgType = 2
|
||||
RMNode.MsgNode = RsNode
|
||||
Dim hotelText, hotelnodeText As Shape
|
||||
Dim nodeText As String
|
||||
Dim bProject As Project = Nothing
|
||||
Dim remark As String() = {"思源黑体", "36"}
|
||||
Try
|
||||
InpotMessage1("1、文档初始化")
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档!", RuningLog.LogType.e_info, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Dim doc As Document
|
||||
Try
|
||||
doc = APP.CreateDocument()
|
||||
doc.Unit = cdrUnit.cdrMillimeter ' 设置单位为毫米
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
APP = New Application()
|
||||
Thread.Sleep(1000)
|
||||
APP.Visible = False
|
||||
|
||||
doc = APP.CreateDocument()
|
||||
doc.Unit = cdrUnit.cdrMillimeter ' 设置单位为毫米
|
||||
End Try
|
||||
|
||||
InpotMessage1("2、打开总览框 模板 拷贝模版")
|
||||
Dim overviewFilePath As String = Path.Combine(M_MaterialPath, "BLV_总览框.cdr")
|
||||
Dim overviewDoc As Document = Nothing
|
||||
Dim previewBox As Shape = Nothing
|
||||
|
||||
Dim hotelName As String = ""
|
||||
|
||||
If Not File.Exists(overviewFilePath) Then
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialLibraryNotExist
|
||||
RsNode.Msg = $"未找到文件{vbCrLf}BLV_总览框.cdr!!"
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"BLV_总览框.cdr文件不存在::{ overviewFilePath}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
doc.Close()
|
||||
Return
|
||||
Else
|
||||
InpotMessage1("3、处理标题信息")
|
||||
|
||||
If node.project IsNot Nothing AndAlso node.project.Count > 0 Then
|
||||
hotelName = node.project(0).hotel_name
|
||||
bProject = node.project(0)
|
||||
Else
|
||||
RsNode.Status = RedisSendNode.StatusType.SerializeFail
|
||||
RsNode.Msg = $"未找到标题信息!!"
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档失败:{ RsNode.Msg}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
doc.Close()
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim chpcolor As Color = New Color
|
||||
chpcolor.RGBAssign(0, 140, 140)
|
||||
Dim ZcdrDoc As Document = APP.OpenDocument(overviewFilePath, False)
|
||||
If ZcdrDoc.Pages.Count > 0 AndAlso ZcdrDoc.Pages(1).ActiveLayer.Shapes.Count > 0 Then
|
||||
hotelText = ZcdrDoc.Pages(1).ActiveLayer.Shapes(1)
|
||||
'将hotelText 拷贝到doc
|
||||
InpotMessage1("将总览框拷贝文件中")
|
||||
shapeCopy(hotelText)
|
||||
hotelText = doc.ActiveLayer.Paste()
|
||||
'设置总览框图形中心点与文档中心点一致
|
||||
hotelText.CenterX = doc.ActivePage.CenterX
|
||||
hotelText.CenterY = doc.ActivePage.CenterY
|
||||
hotelText.TopY = doc.ActivePage.TopY
|
||||
'设置总览框图形原点 为垂直居上水平居中
|
||||
|
||||
ZcdrDoc.Close()
|
||||
'查找hotelText中名称为 Frame_Blv_Overview 的形状
|
||||
For Each shape As Shape In hotelText.Shapes
|
||||
If shape.Name.ToLower.Equals("Project_Title".ToLower) Then
|
||||
'遍历其子形状,查找名称为 PreviewBox 的形状
|
||||
|
||||
For Each childShape As Shape In shape.Shapes
|
||||
nodeText = ""
|
||||
'当名称分别为Txt_EnglishFont、Txt_SocketSeries、Txt_ChineseFont、Txt_SwitchSeries、Txt_Data、Txt_Protocol、Txt_SocketSizeText、Txt_SwitchSizeText、Txt_ProjectName时
|
||||
Select Case childShape.Name.ToLower
|
||||
Case "Txt_EnglishFont".ToLower
|
||||
nodeText = $"{bProject.en_font} {bProject.en_font_size.ToString}PT"
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
'移动到childShape对象中心位置
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_SocketSeries".ToLower
|
||||
nodeText = bProject.socket_series
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_ChineseFont".ToLower
|
||||
nodeText = $"{bProject.cn_font} {bProject.cn_font_size.ToString}PT"
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_SwitchSeries".ToLower
|
||||
nodeText = bProject.switch_series
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_Data".ToLower
|
||||
nodeText = node.RecordDate
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_Protocol".ToLower
|
||||
nodeText = bProject.protocol
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_SocketSizeText".ToLower
|
||||
nodeText = bProject.SocketSizeText.Replace("_", vbCrLf)
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_SwitchSizeText".ToLower
|
||||
nodeText = bProject.SwitchSizeText.Replace("_", vbCrLf)
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
Case "Txt_ProjectName".ToLower
|
||||
nodeText = bProject.project_name
|
||||
hotelnodeText = CreateTextImage2(doc.ActiveLayer, nodeText, remark)
|
||||
hotelnodeText.Fill.ApplyUniformFill(chpcolor)
|
||||
hotelnodeText.CenterX = childShape.CenterX
|
||||
hotelnodeText.CenterY = childShape.CenterY
|
||||
End Select
|
||||
Next
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialNotExist
|
||||
RsNode.Msg = $"未找到文件{vbCrLf}{overviewFilePath}{vbCrLf}中的图像!!"
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档失败:{ RsNode.Msg}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
doc.Close()
|
||||
Return
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
InpotMessage1("4、标题信息处理完成")
|
||||
|
||||
Dim currentY As Double = hotelText.CenterY - 20 ' 标题底部向下50mm
|
||||
|
||||
InpotMessage1("5、数据分组处理")
|
||||
Dim roomGroups As Dictionary(Of String, List(Of Panel)) = New Dictionary(Of String, List(Of Panel))()
|
||||
For Each panel As Panel In node.panels
|
||||
If Not roomGroups.ContainsKey(panel.room_name) Then
|
||||
roomGroups.Add(panel.room_name, New List(Of Panel)())
|
||||
End If
|
||||
roomGroups(panel.room_name).Add(panel)
|
||||
Next
|
||||
|
||||
InpotMessage1("6、房型分类处理")
|
||||
For Each roomName As String In roomGroups.Keys
|
||||
InpotMessage1("创建房型标题文本")
|
||||
|
||||
RsNode.Status = RedisSendNode.StatusType.BuildImageFail
|
||||
RsNode.Msg = "创建酒店房型标题失败!!"
|
||||
remark = {"思源黑体", "28"}
|
||||
Dim roomText As Shape = CreateTextImage2(doc.ActiveLayer, roomName, remark)
|
||||
roomText.CenterY = currentY
|
||||
roomText.LeftX = 0
|
||||
'Dim roomText As Shape = doc.ActiveLayer.CreateArtisticText(0, currentY, roomName)
|
||||
'With roomText.Text.Properties
|
||||
' .Font = "Source Han Sans SC"
|
||||
' .Size = 28
|
||||
'End With
|
||||
|
||||
|
||||
|
||||
|
||||
currentY = roomText.CenterY - (roomText.OriginalHeight / 2) - 10 ' 房型标题底部向下30mm
|
||||
Dim currentX As Double = 0 ' 当前行的X坐标
|
||||
Dim maxHeight As Double = 0 ' 当前行最高图像的高度
|
||||
|
||||
InpotMessage1("遍历该房型对应的所有panel")
|
||||
For Each panel As Panel In roomGroups(roomName)
|
||||
Dim cdr_filename As String = $"{filedir}\{panel.cdr_filename}".Replace("\\", "\")
|
||||
InpotMessage1("7、CDR文件图像处理")
|
||||
If File.Exists(cdr_filename) Then
|
||||
InpotMessage1("打开CDR文件")
|
||||
RsNode.Status = RedisSendNode.StatusType.BuildImageFail
|
||||
RsNode.Msg = $"拷贝文件{vbCrLf}{cdr_filename}{vbCrLf}中的面板图像失败!!"
|
||||
Dim cdrDoc As Document = APP.OpenDocument(cdr_filename, False)
|
||||
|
||||
If cdrDoc.Pages.Count > 0 AndAlso cdrDoc.Pages(1).ActiveLayer.Shapes.Count > 0 Then
|
||||
InpotMessage1("复制第一个图像")
|
||||
Dim cdrShape As Shape = cdrDoc.Pages(1).ActiveLayer.Shapes(1)
|
||||
'cdrShape.Copy()
|
||||
shapeCopy(cdrShape)
|
||||
InpotMessage1("粘贴到当前文档")
|
||||
|
||||
Dim pastedShape As Shape = doc.ActiveLayer.Paste() 'doc.ActiveLayer.Shapes(doc.ActiveLayer.Shapes.Count)
|
||||
|
||||
InpotMessage1("设置图像位置")
|
||||
pastedShape.LeftX = currentX
|
||||
pastedShape.CenterY = currentY - (pastedShape.OriginalHeight / 2)
|
||||
|
||||
|
||||
|
||||
InpotMessage1("8、属性文本生成")
|
||||
|
||||
|
||||
InpotMessage1("生成panel_list_name文本")
|
||||
RsNode.Status = RedisSendNode.StatusType.BuildImageFail
|
||||
RsNode.Msg = $"生成名称文本图像失败:{panel.panel_list_name} !!"
|
||||
remark = {"思源黑体", "24"}
|
||||
Dim listNameText As Shape = CreateTextImage2(doc.ActiveLayer, "名称:" & panel.panel_list_name, remark)
|
||||
Dim textY As Double = pastedShape.CenterY - (pastedShape.OriginalHeight / 2) - 10
|
||||
listNameText.CenterY = textY
|
||||
listNameText.LeftX = currentX
|
||||
'Dim listNameText As Shape = doc.ActiveLayer.CreateArtisticText(currentX, textY, "名称:" & panel.panel_list_name)
|
||||
'With listNameText.Text.Properties
|
||||
' .Font = "Source Han Sans SC"
|
||||
' .Size = 12
|
||||
'End With
|
||||
|
||||
InpotMessage1("生成position文本")
|
||||
RsNode.Status = RedisSendNode.StatusType.BuildImageFail
|
||||
RsNode.Msg = $"生成位置文本图像失败:{panel.position} !!"
|
||||
Dim positionText As Shape = CreateTextImage2(doc.ActiveLayer, "位置:" & panel.position, remark)
|
||||
textY = listNameText.CenterY - (listNameText.OriginalHeight / 2) - 10
|
||||
positionText.CenterY = textY
|
||||
positionText.LeftX = currentX
|
||||
'Dim positionText As Shape = doc.ActiveLayer.CreateArtisticText(currentX, textY + 10, "位置:" & panel.position)
|
||||
'With positionText.Text.Properties
|
||||
' .Font = "Source Han Sans SC"
|
||||
' .Size = 12
|
||||
'End With
|
||||
|
||||
InpotMessage1("生成carving_quantity文本")
|
||||
RsNode.Status = RedisSendNode.StatusType.BuildImageFail
|
||||
RsNode.Msg = $"生成数量文本图像失败:{panel.carving_quantity} !!"
|
||||
Dim quantityText As Shape = CreateTextImage2(doc.ActiveLayer, "数量:" & panel.carving_quantity, remark)
|
||||
textY = positionText.CenterY - (positionText.OriginalHeight / 2) - 10
|
||||
quantityText.CenterY = textY
|
||||
quantityText.LeftX = currentX
|
||||
'Dim quantityText As Shape = doc.ActiveLayer.CreateArtisticText(currentX, textY + 20, "数量:" & panel.carving_quantity)
|
||||
'With quantityText.Text.Properties
|
||||
' .Font = "Source Han Sans SC"
|
||||
' .Size = 12
|
||||
'End With
|
||||
|
||||
InpotMessage1("9、图文组合")
|
||||
|
||||
pastedShape.Selected = True
|
||||
listNameText.Selected = True
|
||||
positionText.Selected = True
|
||||
quantityText.Selected = True
|
||||
|
||||
Dim group As Shape = doc.SelectionRange.Group()
|
||||
group.Name = pastedShape.Name 'Path.GetFileNameWithoutExtension(panel.cdr_filename)
|
||||
group.Selected = False
|
||||
pastedShape.Selected = False
|
||||
listNameText.Selected = False
|
||||
positionText.Selected = False
|
||||
quantityText.Selected = False
|
||||
|
||||
|
||||
InpotMessage1("更新X坐标,为下一个图像留出50mm间距")
|
||||
InpotMessage1("计算当前行的最大高度")
|
||||
If group.OriginalHeight > maxHeight Then
|
||||
maxHeight = group.OriginalHeight
|
||||
End If
|
||||
currentX += pastedShape.SizeWidth + 50
|
||||
Else
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialNotExist
|
||||
RsNode.Msg = $"未找到文件{vbCrLf}{cdr_filename}{vbCrLf}中的图像!!"
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档失败:{ RsNode.Msg}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Return
|
||||
End If
|
||||
|
||||
InpotMessage1("关闭CDR文件")
|
||||
cdrDoc.Close()
|
||||
|
||||
Else
|
||||
RsNode.Status = RedisSendNode.StatusType.MaterialNotExist
|
||||
RsNode.Msg = $"文件{vbCrLf}{cdr_filename}{vbCrLf}不存在!!"
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档失败:{ RsNode.Msg}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Return
|
||||
End If
|
||||
Next
|
||||
|
||||
' 更新Y坐标,为下一个房型留出50mm间距
|
||||
currentY = currentY - maxHeight - 20
|
||||
Next
|
||||
|
||||
|
||||
|
||||
InpotMessage1("10、文档保存")
|
||||
RsNode.Status = RedisSendNode.StatusType.SaveFileFail
|
||||
RsNode.Msg = $"生成文件失败 !!"
|
||||
Dim savePath As String = $"{filedir}\{hotelName}\{Now:yyyyMMdd}"
|
||||
If Not Directory.Exists(savePath) Then
|
||||
Directory.CreateDirectory(savePath)
|
||||
End If
|
||||
|
||||
Dim cdrFileName As String = $"{node.picNum}.cdr"
|
||||
Dim cdrFilePath As String = Path.Combine(savePath, cdrFileName)
|
||||
Dim ssao As New StructSaveAsOptions
|
||||
ssao.Filter = VGCore.cdrFilter.cdrCDR
|
||||
ssao.Range = VGCore.cdrExportRange.cdrAllPages
|
||||
ssao.Version = VGCore.cdrFileVersion.cdrVersion19
|
||||
doc.SaveAs(cdrFilePath, ssao)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'InpotMessage1("9、文档导出")
|
||||
'Dim pltFileName As String = $"PreviewRoomTypePanel{node.picNum}.plt"
|
||||
'Dim pltFilePath As String = Path.Combine(savePath, pltFileName)
|
||||
'doc.Export(pltFilePath, cdrExportFileFormat.cdrPLT)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
InpotMessage1("关闭文档")
|
||||
doc.Close()
|
||||
RsNode.Status = RedisSendNode.StatusType.Success
|
||||
RsNode.Msg = "Ok"
|
||||
RsNode.CdrPath = cdrFilePath.Replace(filedir & "\", "")
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
InpotMessage1($"11、向Redis写入生成成功信息")
|
||||
gLogNode = New LogNode($"成功生成酒店房间面板预览文档:{cdrFilePath}", RuningLog.LogType.e_info, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Return
|
||||
Catch ex As Exception
|
||||
|
||||
RedisPublishMessage1(RsNode.PictureNum, JsonConvert.SerializeObject(RMNode))
|
||||
gLogNode = New LogNode($"生成酒店房间面板预览文档失败:{ex.Message}", RuningLog.LogType.e_Error, RuningLog.LogMode.e_fileandRichTextBox)
|
||||
gLogNode.SetLogColor(System.Drawing.Color.Red)
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' 检测图库文件命名及内容是否符合规范
|
||||
''' </summary>
|
||||
@@ -1274,7 +1647,7 @@ Public Class CorelDRAW
|
||||
Dim destLayer As Layer
|
||||
Dim MLibDoc As Document
|
||||
Dim li As New List(Of (Shape, Shape))
|
||||
Dim ServerFilePath As String = "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" ' "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" '
|
||||
Dim ServerFilePath As String = M_ServerPath '"R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" ' "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic\" '
|
||||
'''Console.WriteLine($"到达节点1耗时:{(Now - oldTime).TotalMilliseconds}毫秒")
|
||||
'查找素材库
|
||||
InpotMessage1("2、检测模版素材库是否存在")
|
||||
@@ -1305,11 +1678,11 @@ Public Class CorelDRAW
|
||||
APP = New Application()
|
||||
Thread.Sleep(1000)
|
||||
APP.Visible = False
|
||||
G_LibDoc = APP.OpenDocument(MaterialPath, False)
|
||||
G_LibDoc = APP.OpenDocument(MaterialPath, True)
|
||||
MLibDoc = APP.CreateDocument()
|
||||
End Try
|
||||
APP.EventsEnabled = False
|
||||
APP.Optimization = True
|
||||
'APP.EventsEnabled = False
|
||||
'APP.Optimization = True
|
||||
|
||||
'APP.EventsEnabled = True
|
||||
'APP.Optimization = False
|
||||
@@ -1629,9 +2002,9 @@ Public Class CorelDRAW
|
||||
InpotMessage1($"14、开始将整个图像移动至中心位置")
|
||||
SetIconToCentered(npage, fshp)
|
||||
'Dim sel As ShapeRange = APP.ActiveSelectionRange
|
||||
APP.EventsEnabled = True
|
||||
APP.Optimization = False
|
||||
APP.Refresh()
|
||||
'APP.EventsEnabled = True
|
||||
'APP.Optimization = False
|
||||
'APP.Refresh()
|
||||
|
||||
'fshp.SetSize(Math.Abs(fshp.SizeWidth) * 10000, Math.Abs(fshp.SizeHeight) * 10000)
|
||||
InpotMessage1($"15、开始保存图像成文件")
|
||||
@@ -1643,6 +2016,23 @@ Public Class CorelDRAW
|
||||
Ef.Finish()
|
||||
RsNode.ImagePath = ProjectPath.Replace(ServerFilePath, "")
|
||||
Case 1
|
||||
|
||||
For Each shnode In fshp.Shapes
|
||||
'查找名称为Mode_的子节点
|
||||
If shnode.Name.Contains("Mode_") Then
|
||||
'倒序遍历其子节点
|
||||
Dim xvbnode As Shape
|
||||
For i = shnode.Shapes.Count To 1 Step -1
|
||||
xvbnode = shnode.Shapes.Item(i)
|
||||
'将子节点中名称带有Effect _ 的节点删除
|
||||
If xvbnode.Name.Contains("Effect") Then
|
||||
xvbnode.Delete()
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
ProjectPath = $"{ProjectPath}\{node.TemplateName.Replace("Mode_", "")}_{Now:yyyyMMddHHmmss}.cdr"
|
||||
Dim ssao As New StructSaveAsOptions
|
||||
ssao.Filter = VGCore.cdrFilter.cdrCDR
|
||||
@@ -2538,7 +2928,7 @@ Public Class CorelDRAW
|
||||
|
||||
Private Sub ToolStripButton1_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
|
||||
'打开文件选择器 选择cDR后缀的文件
|
||||
Dim ServerFilePath As String = "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic" ' "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic" '
|
||||
Dim ServerFilePath As String = M_ServerPath ' "R:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic" ' "D:\IIS ROOT\BLWLog\Web\wwwroot\PanelSelectionPic" '
|
||||
Dim OpenFileDialog1 As New OpenFileDialog()
|
||||
OpenFileDialog1.Filter = "CorelDRAW Files (*.cdr)|*.cdr"
|
||||
Dim srcDoc As Document '素材文件
|
||||
@@ -2553,6 +2943,7 @@ Public Class CorelDRAW
|
||||
Dim ProjectPath As String
|
||||
Dim SafeFileName As String
|
||||
Dim errorMessage As String
|
||||
Dim xvbnode As Shape
|
||||
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
|
||||
|
||||
' 上传前检查文件是否符合规范
|
||||
@@ -2616,11 +3007,23 @@ Public Class CorelDRAW
|
||||
Location = $"{pint}_{lint}_{Sint}"
|
||||
Select Case strbuf(0).ToLower
|
||||
Case "Mode".ToLower
|
||||
|
||||
|
||||
For i = Shape.Shapes.Count To 1 Step -1
|
||||
xvbnode = Shape.Shapes.Item(i)
|
||||
'将子节点中名称带有Effect _ 的节点删除
|
||||
If xvbnode.Name.Contains("Effect") Then
|
||||
xvbnode.Visible = False
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim modepath As String = $"{ProjectPath}\Mode\"
|
||||
If Not Directory.Exists(modepath) Then
|
||||
Directory.CreateDirectory(modepath)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim Direction As String
|
||||
|
||||
Direction = strbuf(1).Replace("连体", "").Trim
|
||||
@@ -2661,15 +3064,18 @@ Public Class CorelDRAW
|
||||
G_Log.AddLogNode(gLogNode)
|
||||
Return
|
||||
End If
|
||||
|
||||
|
||||
Dim schpcolor As New Color
|
||||
schpcolor.RGBAssign(255, 255, 255)
|
||||
schpcolor = SetImageStyle(Shape, True, schpcolor)
|
||||
schpcolor = SetImageStyle1(Shape, True, schpcolor)
|
||||
Shape.Selected = True
|
||||
Dim Ef As ExportFilter = srcDoc.ExportBitmap(modepath, VGCore.cdrFilter.cdrPNG, VGCore.cdrExportRange.cdrSelection, VGCore.cdrImageType.cdrRGBColorImage)
|
||||
Ef.Finish()
|
||||
SetImageStyle(Shape, False, schpcolor)
|
||||
SetImageStyle1(Shape, False, schpcolor)
|
||||
Shape.Selected = False
|
||||
If modeindex = 0 Then
|
||||
modeindex = modeindex + 1
|
||||
'更新 tbl_cdr_file表
|
||||
Shape.Selected = True
|
||||
modepath = $"{ProjectPath}\Mode\ShapeName.png"
|
||||
@@ -2904,6 +3310,55 @@ Public Class CorelDRAW
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Function SetImageStyle1(Shape As Shape, isTransparent As Boolean, Transparentcolor As Color)
|
||||
'设置图像背景色为透明
|
||||
Dim Transparent As Integer
|
||||
Dim chpcolor As New Color
|
||||
Dim result As New Color
|
||||
Dim r, g, b, a As Integer
|
||||
If isTransparent Then
|
||||
|
||||
Transparent = 100
|
||||
chpcolor.RGBAssign(102, 102, 102)
|
||||
|
||||
Else
|
||||
Transparent = 0
|
||||
chpcolor.RGBAssign(255, 255, 255)
|
||||
End If
|
||||
For i As Integer = 1 To Shape.Shapes.Count
|
||||
If Shape.Shapes(i).Name.ToLower.Contains("IconB".ToLower) Then
|
||||
|
||||
Select Case Shape.Shapes(i).Fill.UniformColor.Type
|
||||
Case cdrColorType.cdrColorCMYK
|
||||
Dim C As Double, M As Double, Y As Double, K As Double
|
||||
C = Shape.Shapes(i).Fill.UniformColor.CMYKCyan
|
||||
M = Shape.Shapes(i).Fill.UniformColor.CMYKMagenta
|
||||
Y = Shape.Shapes(i).Fill.UniformColor.CMYKYellow
|
||||
K = Shape.Shapes(i).Fill.UniformColor.CMYKBlack
|
||||
result.CMYKAssign(C, M, Y, K)
|
||||
Case cdrColorType.cdrColorRGB
|
||||
r = Shape.Shapes(i).Fill.UniformColor.RGBRed
|
||||
g = Shape.Shapes(i).Fill.UniformColor.RGBGreen
|
||||
b = Shape.Shapes(i).Fill.UniformColor.RGBBlue
|
||||
result.RGBAssign(r, g, b)
|
||||
Case Else
|
||||
result.RGBAssign(255, 255, 255)
|
||||
End Select
|
||||
|
||||
'Shape.Shapes(i).Transparency.ApplyUniformTransparency(Transparent)
|
||||
Shape.Shapes(i).Fill.ApplyUniformFill(Transparentcolor)
|
||||
|
||||
Else
|
||||
Shape.Shapes(i).Fill.ApplyUniformFill(chpcolor)
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Return result
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
'设置图片样式
|
||||
Private Function SetImageStyle(Shape As Shape, isTransparent As Boolean, Transparentcolor As Color)
|
||||
'设置图像背景色为透明
|
||||
|
||||
@@ -115,6 +115,8 @@ Public Class PreviewRoomTypePanel
|
||||
Public Property panels As List(Of Panel)
|
||||
Public Property picNum As String
|
||||
Public Property project As List(Of Project)
|
||||
Public Property RecordDate As String
|
||||
|
||||
End Class
|
||||
|
||||
Public Class Panel
|
||||
@@ -143,4 +145,16 @@ Public Class Project
|
||||
Public Property report_id As String
|
||||
Public Property room_data_json As String
|
||||
Public Property room_type_count As Integer
|
||||
|
||||
Public Property protocol As String
|
||||
Public Property project_name As String
|
||||
Public Property switch_series As String
|
||||
Public Property socket_series As String
|
||||
Public Property cn_font As String
|
||||
Public Property cn_font_size As Double
|
||||
Public Property en_font As String
|
||||
Public Property en_font_size As Double
|
||||
Public Property SwitchSizeText As String
|
||||
Public Property SocketSizeText As String
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user