Foxtable(狐表)用户栏目专家坐堂 → 数据导入的类型是否可以更改?


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

主题:数据导入的类型是否可以更改?

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


加好友 发短信
等级:狐精 帖子:3313 积分:23146 威望:0 精华:1 注册:2009/3/31 11:25:00
  发帖心情 Post By:2010/4/2 12:09:00 [显示全部帖子]

if filesys.fileExists("C:\barcode_up\ChSSU.txt") = true then
    Dim gb As System.Text.Encoding = System.Text.Encoding.GetEncoding("GB2312")
    Dim Muti As string = FileSys.ReadAllText("C:\barcode_up\ChSSU.txt",gb)
    Dim Values() As String = Muti.Split(Chr(10))


    For Index As Integer = 0 To Values.Length - 2
   
    Dim s As String = Values(Index).Trim
   
    If Not s.EndsWith("C") or s.length < 30 Then
        Continue For
    End If
    Dim r As Row = Tables("转库数据上传_Table1").rows.AddNew()   
    Dim bytes() As byte = gb.GetBytes(s)
    dim time1 as string = gb.GetString(bytes,71,12)
    dim s1 as string = time1.SubString(0,4) & "-" & time1.SubString(4,2) & "-" & time1.SubString(6,2)
    dim s2 as string = s1 & " " & time1.SubString(8,2) & ":" & time1.SubString(10,2) & ":00"
    dim kbh as string = gb.GetString(bytes,0,29)
   if kbh <> "" then
     dim kbh1 as string = kbh.SubString(0,1)
     dim kbh2 as string = kbh1.ToUpper()
     kbh = kbh.TrimStart("S")
     if kbh2 = "S" then
       kbh = kbh.substring(0,6) & "-" & kbh.substring(6,kbh.length - 6)
     end if
   end if
    r("捆包号") = kbh
    r("条码号")  = gb.GetString(bytes,0,29)
    r("库位")  = gb.GetString(bytes,30,40)
    r("扫描时间")  = s2
    r("上传人")  = Vars("用户")
    r("上传时间") = format(date.now,"yyyy-MM-dd HH:mm:ss")
    if r("捆包号") <> "" or r("库位") <> "" then
       r("有效标记") = "有效"   'gb.GetString(bytes,166,1)
    else
       r("有效标记") = "无效"   'gb.GetString(bytes,166,1)
    end if
 Next
else
   MessageBox.Show("转库扫描数据文件不存在,请检查!","提示")
end if




以上是我读取条形码产生的文本数据。每一行需要一个换行符或一个结束符。(条形码机器编程可达到的),参考下,看是否对你有帮助。

 回到顶部