Foxtable(狐表)用户栏目专家坐堂 → 数据格式化问题


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

主题:数据格式化问题

帅哥哟,离线,有人找我吗?
大红袍
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/14 1:32:00 [只看该作者]

以下是引用鲁吉在2016/7/13 23:52:00的发言:
5楼的代码是错的

 

只是提供思路啊。如果人家已经解码得到bmp文件那就直接用7楼的代码啊


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


加好友 发短信
等级:三尾狐 帖子:710 积分:5345 威望:0 精华:0 注册:2013/5/27 9:48:00
  发帖心情 Post By:2016/7/14 12:37:00 [只看该作者]

也拷贝过去了,窗口的图片控件也能显示,就是在数据表里没有,我把窗口的timertrick事件的代码复制下来,是这样的:

For i As Integer = 1001 To 1001
    Dim portflag As Integer = 1001
    '变量声明
    Dim CardPUCIIN As Byte() = New Byte(254) {}
    Dim pucManaMsg As Byte() = New Byte(254) {}
    Dim pucCHMsg As Byte() = New Byte(254) {}
    Dim pucPHMsg As Byte() = New Byte(3023) {}
    Dim puiCHMsgLen As UInt32 = 0
    Dim puiPHMsgLen As UInt32 = 0
    Dim st As Integer = 0
    '读卡操作
    st = SDT_StartFindIDCard(portflag, CardPUCIIN, 1)
   
    If st <> &H9f Then
        Continue For
    End If
    st = SDT_SelectIDCard(portflag, pucManaMsg, 1)
   
    If st <> &H90 Then
        Continue For
    End If
    st = SDT_ReadBaseMsg(portflag, pucCHMsg, puiCHMsgLen, pucPHMsg, puiPHMsgLen, 1)
   
    If st <> &H90 Then
        Continue For
    End If
   
    Dim s As String =(System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg))
    If s.Length > 0 Then
        '分段截取字符串并赋给窗口控件
        Dim r As Row = Tables("农民工实名制信息表").AddNew
        r("姓名") = s.SubString(0,14).Replace(".","-")
        r("性别") = s.SubString(15,1).Replace(".","-")
        r("民族") = s.SubString(16,2).Replace(".","-")
        Dim tmp As String = s.Substring(18, 8).Replace(".", "-")
        r("出生日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
        r("家庭住址") = s.SubString(26,35).Replace(".","-")
        r("身份证号") = s.SubString(61,18).Replace(".","-")
        r("发证机关") = s.SubString(79,14).Replace(".","-")
        tmp = s.SubString(94,8).Replace(".","-")
        r("签发日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
        tmp = s.SubString(102,8).Replace(".","-")
        r("有效日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
         If (filesys.FileExists(ProjectPath & "zp.wlt")) Then
            '删除
            FileSys.DeleteFile(ProjectPath & "zp.wlt",2,3)
        End If
       
        system.io.File.WriteAllBytes(ProjectPath & "zp.wlt", pucPHMsg)
       
        Select Case GetBmp(ProjectPath & "zp.wlt", 2)
            Case 0
                MessageBox.Show("调用sdtapi.dll错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case 1
                '正常
                Exit Select
            Case -1
                MessageBox.Show("相片解码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -2
                MessageBox.Show("wlt文件后缀错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -3
                MessageBox.Show("wlt文件打开错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -4
                MessageBox.Show("wlt文件格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -5
                MessageBox.Show("软件未授权!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -6
                MessageBox.Show("设备连接错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
        End Select
       
        If (filesys.FileExists(ProjectPath & "zp.bmp")) Then
            FileSys.CopyFile(ProjectPath & "zp.bmp", ProjectPath & "\Attachments\" & r("身份证号") & ".bmp",True) '照片复制到Attachments目录
           e.Form.Controls("PictureBox1").imagefile = ProjectPath & "zp.bmp"
 
        End If

    End If
Next


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


加好友 发短信
等级:三尾狐 帖子:710 积分:5345 威望:0 精华:0 注册:2013/5/27 9:48:00
  发帖心情 Post By:2016/7/14 12:39:00 [只看该作者]

窗口timertrick事件代码如下:

For i As Integer = 1001 To 1001
    Dim portflag As Integer = 1001
    '变量声明
    Dim CardPUCIIN As Byte() = New Byte(254) {}
    Dim pucManaMsg As Byte() = New Byte(254) {}
    Dim pucCHMsg As Byte() = New Byte(254) {}
    Dim pucPHMsg As Byte() = New Byte(3023) {}
    Dim puiCHMsgLen As UInt32 = 0
    Dim puiPHMsgLen As UInt32 = 0
    Dim st As Integer = 0
    '读卡操作
    st = SDT_StartFindIDCard(portflag, CardPUCIIN, 1)
   
    If st <> &H9f Then
        Continue For
    End If
    st = SDT_SelectIDCard(portflag, pucManaMsg, 1)
   
    If st <> &H90 Then
        Continue For
    End If
    st = SDT_ReadBaseMsg(portflag, pucCHMsg, puiCHMsgLen, pucPHMsg, puiPHMsgLen, 1)
   
    If st <> &H90 Then
        Continue For
    End If
   
    Dim s As String =(System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg))
    If s.Length > 0 Then
        '分段截取字符串并赋给窗口控件
        Dim r As Row = Tables("农民工实名制信息表").AddNew
        r("姓名") = s.SubString(0,14).Replace(".","-")
        r("性别") = s.SubString(15,1).Replace(".","-")
        r("民族") = s.SubString(16,2).Replace(".","-")
        Dim tmp As String = s.Substring(18, 8).Replace(".", "-")
        r("出生日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
        r("家庭住址") = s.SubString(26,35).Replace(".","-")
        r("身份证号") = s.SubString(61,18).Replace(".","-")
        r("发证机关") = s.SubString(79,14).Replace(".","-")
        tmp = s.SubString(94,8).Replace(".","-")
        r("签发日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
        tmp = s.SubString(102,8).Replace(".","-")
        r("有效日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
         If (filesys.FileExists(ProjectPath & "zp.wlt")) Then
            '删除
            FileSys.DeleteFile(ProjectPath & "zp.wlt",2,3)
        End If
       
        system.io.File.WriteAllBytes(ProjectPath & "zp.wlt", pucPHMsg)
       
        Select Case GetBmp(ProjectPath & "zp.wlt", 2)
            Case 0
                MessageBox.Show("调用sdtapi.dll错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case 1
                '正常
                Exit Select
            Case -1
                MessageBox.Show("相片解码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -2
                MessageBox.Show("wlt文件后缀错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -3
                MessageBox.Show("wlt文件打开错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -4
                MessageBox.Show("wlt文件格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -5
                MessageBox.Show("软件未授权!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
            Case -6
                MessageBox.Show("设备连接错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                Exit Select
        End Select
       
        If (filesys.FileExists(ProjectPath & "zp.bmp")) Then
            FileSys.CopyFile(ProjectPath & "zp.bmp", ProjectPath & "\Attachments\" & r("身份证号") & ".bmp",True) '照片复制到Attachments目录
           e.Form.Controls("PictureBox1").imagefile = ProjectPath & "zp.bmp"
 
        End If

    End If
Next


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/14 13:00:00 [只看该作者]

FileSys.CopyFile(ProjectPath & "zp.bmp", ProjectPath & "\Attachments\" & r("身份证号") & ".bmp",True) '照片复制到Attachments目录
e.Form.Controls("PictureBox1").imagefile = ProjectPath & "zp.bmp"

r("图片") = r("身份证号") & ".bmp"


 回到顶部
总数 14 上一页 1 2