Foxtable(狐表)用户栏目专家坐堂 → 求教,打印反映速度较慢原因.


  共有8256人关注过本帖树形打印复制链接

主题:求教,打印反映速度较慢原因.

帅哥哟,离线,有人找我吗?
baoxyang
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
求教,打印反映速度较慢原因.  发帖心情 Post By:2012/5/28 22:24:00 [只看该作者]

Dim doc As New PrintDoc() '定义一个报表
doc.PageSetting.Width = 90 '纸张宽度为90毫米
doc.PageSetting.Height = 50
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.BarWidth = 0.33
Bar.BarHeight = 15
Bar.BearerBarWidth = 10
Bar.CodeAlignment = Barpro.Alignment.AboveCenter
Bar.DisplayChecksum = False
Bar.DisplayStartStopChar = False
Bar.Font = New Font("宋体",10)
 For i As Integer = 0 To s3 -1
        Doc.PageSetting.Landscape = True '横向打印
        Dim ra As New prt.RenderArea '定义一个容器
         Dim rt2 As New prt.RenderTable() '定义一个表格对象

         .

         .

         .

        ra1.Children.Add(img1) '加入图片到RenderArea中
        ra2.Children.Add(img2) '加入图片到RenderArea中
        ra.Children.Add(rt2) '加入到容器中
        ra.Children.Add(rt1) '加入到容器中
         Doc.Body.ChildRen.Add(ra) '将容器加入到报表中 
Next
Doc.PrinterName = pt
doc.Print()

 

一共只有3页,从开始到打印需要至少40秒种.

请教,产生原因可能是哪方面?谢谢指点!




 回到顶部
帅哥哟,离线,有人找我吗?
don
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12993 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2012/5/28 23:24:00 [只看该作者]

猜测可能图片过大

 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 8:12:00 [只看该作者]

图片很小的.


 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  4楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 8:36:00 [只看该作者]

老大,帮分析下原因吧.(按生成一个条码来计算)

只打印生成的条码,前段用时10秒,

Doc.PrinterName = pt
doc.Print()

这两行用时20秒左右.

[此贴子已经被作者于2012-5-29 8:35:58编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  5楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 8:38:00 [只看该作者]

贴出全部代码:

Dim st As Date = Date.Now
If Vars("权限").Contains("托运管理\其它管理\标签打印") = False Then
    msgbox("无操作权限,请联系管理员!",64,"提示")
    Return
End If
Dim cmd As New SQLCommand
cmd.C
Dim pt As String = Functions.Execute("打印机选择","标签打印")
Dim doc As New PrintDoc() '定义一个报表
doc.PageSetting.Width = 90 '纸张宽度为90毫米
doc.PageSetting.Height = 50
Doc.PageSetting.LeftMargin = 1 '设置左边距
Doc.PageSetting.RightMargin = 1 '设置右边距
Doc.PageSetting.TopMargin = 1 '设置上边距
Doc.PageSetting.BottomMargin = 1 '设置下边距
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code93
Bar.BarWidth = 0.33
Bar.BarHeight = 15
Bar.BearerBarWidth = 10
Bar.CodeAlignment = Barpro.Alignment.AboveCenter
Bar.DisplayChecksum = False
Bar.DisplayStartStopChar = False
Bar.Font = New Font("宋体",10)
Dim s1,s2,s3,s4,s5,s6,s7 As String
Dim r As Row = Tables("S托运单查询_Table1").current
s1 = r("条码单号")
s2 = r("订单号")
s3 = r("货物件数")
s4 = r("客户简称")
s5 = r("配送点")
cmd.commandtext = "select 库位 from {托运配送点} where 简称 = '"& s5 &"'"
s6 = cmd.ExecuteScalar()
If r IsNot Nothing Then
    For i As Integer = 0 To s3 -1
        Doc.PageSetting.Landscape = True '横向打印
        Dim ra As New prt.RenderArea '定义一个容器
 Dim rt2 As New prt.RenderTable() '定义一个表格对象
        rt2.CellStyle.Spacing.All = 1 '单元格内容缩进1毫米
        rt2.Style.Spacing.Bottom = 0 '和下一个工资条的距离是3毫米
 rt2.Rows.Count = 1 '设置总行数
        rt2.Cols.Count = 2 '设置总列数
        rt2.Height = 19 '设置表格的高度
        rt2.Width = 88
 '       rt2.Rows(0).Height = 73
        rt2.Cols(0).Width = 74
        rt2.Cols(1).Width = 282
'        Dim ra1 As New prt.RenderArea '定义一个容器
'        ra1 = rt2.Cells(0,0).Area
        Dim ra2 As New prt.RenderArea '定义一个容器
        ra2 = rt2.Cells(0,1).Area
        Bar.Code = s1 & "-" & i +1
'        Dim img1 As prt.RenderImage
'        img1 = new prt.RenderImage
'        img1.Image = GetImage("双得力.png")
'        img1.Width = 18
'        img1.Height = 18
        Dim img2 As prt.RenderImage
        img2 = new prt.RenderImage
        img2.Image = bar.GetImage
        img2.Height = 18

 Dim rt1 As New prt.RenderTable() '定义一个表格对象
        rt1.CellStyle.Spacing.All = 1 '单元格内容缩进1毫米
        rt1.Style.Spacing.Bottom = 1 '和下一个工资条的距离是3毫米
        rt1.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
        rt1.Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt1.Style.Font = New Font("宋体",11,FontStyle.Bold)
 rt1.Rows.Count = 3 '设置总行数
        rt1.Cols.Count = 4 '设置总列数
        rt1.Height = 28 '设置表格的高度
        rt1.Width = 87
        rt1.Cols(0).Width = 49
        rt1.Cols(1).Width = 131
        rt1.Cols(2).Width = 49
        rt1.Cols(3).Width = 112
        rt1.Rows(0).Height = 27
        rt1.Rows(1).Height = 37
        rt1.Rows(2).Height = 37
 rt1.Cells(0,0).Text= s5
 rt1.Cells(0,3).Text= s6
 rt1.Cells(1,0).Text = "订单号"
 rt1.Cells(1,1).Text = s2
 rt1.Cells(2,0).Text= "商品名称"
 rt1.Cells(2,1).Text = s4
 rt1.Cells(2,2).Text= "箱数编号"
 rt1.Cells(2,3).Text = s3 & "-" & i +1 & "#"
 rt1.Cells(0,0).SpanCols = 2
 rt1.Cells(1,1).SpanCols = 2
 rt1.Cells(0,3).Style.Font = New Font("宋体",14,FontStyle.Bold)
        rt1.Cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Left    
 rt1.Cells(2,1).Style.Font = New Font("宋体",12,FontStyle.Bold)
 rt1.Cells(2,3).Style.Font = New Font("宋体",12,FontStyle.Bold)
'        ra1.Children.Add(img1) '加入图片到RenderArea中
        ra2.Children.Add(img2) '加入图片到RenderArea中
 ra.Children.Add(rt2) '加入到容器中
 ra.Children.Add(rt1) '加入到容器中
        Doc.Body.ChildRen.Add(ra) '将容器加入到报表中 
    Next
MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒") '
Dim st1 As Date = Date.Now
    Doc.PrinterName = pt
    doc.Print()
MessageBox.Show("耗时: " & (Date.Now - st1).TotalSeconds & "秒")
 End If


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/5/29 9:47:00 [只看该作者]

发一个能直接运行的代码来测试吧


 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  7楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 13:17:00 [只看该作者]

发现使用

Dim doc As New PrintDoc '定义一个报表
...

doc.Preview()

或者打印

都是很慢的.

不知各位是否还是这样?还是我电脑有问题?


 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  8楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 13:28:00 [只看该作者]

初步判断是跟电脑有关系.我请教下跟电脑什么有关系?

 回到顶部
帅哥哟,离线,有人找我吗?
baoxyang
  9楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3313 积分:23134 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2012/5/29 14:01:00 [只看该作者]

最后还发现跟打印机有关系,有一个针对打印机比条码打印机要快很多.


 回到顶部