请问这段脚本是什么意思

Sub OnClick(ByVal Item)                                                                                                                                         
 Dim i
 Dim plt_thk,plt_wid,plt_len,pdi_tar_thk,pdi_tar_wid 
 Dim stl_code,pdi_tar_len
 Dim mystr,mystr1
 Dim Msg
 Dim shear_len,shear_amount,shear_len2,shear_amount2
 Dim mydate,myorder,myclass
 Dim inputtime,myuser,prod_status
 Dim d_num

 myorder=HMIRuntime.Tags("D_order").Read 
 If myorder=0 Then
   Msg=MsgBox("Data not complete",16,"Input Information")
  Exit Sub
 End If 

 mydate=HMIRuntime.Tags("D_plan_date").Read 
 If mydate="" Then
   Msg=MsgBox("Please input plan date!",16,"Input Information")
  Exit Sub
 End If

 plt_thk=HMIRuntime.Tags("D_plt_thk").Read
 plt_wid=HMIRuntime.Tags("D_plt_wid").Read
 plt_len=HMIRuntime.Tags("D_plt_len").Read
 pdi_tar_thk=HMIRuntime.Tags("D_tar_thk").Read
 pdi_tar_wid=HMIRuntime.Tags("D_tar_wid").Read
 stl_code=Trim(HMIRuntime.Tags("D_steel_grade").Read)
 shear_len=HMIRuntime.Tags("D_shear_len").Read 
 shear_amount=HMIRuntime.Tags("D_shear_amount").Read 
 shear_len2=HMIRuntime.Tags("D_shear_len_2").Read 
 shear_amount2=HMIRuntime.Tags("D_shear_amount_2").Read 

 prod_status=HMIRuntime.Tags("D_prod_status").Read 
 inputtime=Now
 myclass=HMIRuntime.Tags("D_class").Read 
 myuser=HMIRuntime.Tags("@CurrentUser").Read 
 d_num=HMIRuntime.Tags("D_amount").Read 
 If   pdi_tar_thk=0 Or pdi_tar_wid=0 Then
   Msg=MsgBox("data inputing not complete",16,"Input Information")
  Exit Sub
 End If

 mystr1="(" & myorder & ",'" & Trim(stl_code) & "'," & plt_thk & "," & plt_wid & "," & plt_len & "," & pdi_tar_thk & "," & pdi_tar_wid & ","_
  & shear_len & "," & shear_amount & "," & prod_status & "," & shear_len2 & "," & shear_amount2 & ",'"   & inputtime &"','" & mydate & "','" & myuser &"'," & myclass &","& d_num &")"
  mystr="INSERT INTO D_plan_data VALUES" & mystr1
 HMIRuntime.Trace "mystr=" & mystr & vbCrLf 
 Datamanage(mystr)

 
 If err.number=0  Then

  msg=MsgBox("Save OK! ",0,"Dispatcher Plan") 
 Else

  msg=MsgBox("  Save failure! ",0,"Dispatcher Plan")
 End If

 

 End Sub

问题补充:
能具体注明下各段程序的含义嘛?
 我以前没学过VB~!~!

最佳答案

这是插入数据到数据库中.是WINCC与数据之间的一段代码

提问者对于答案的评价:
恩 是这样的

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc274548.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2019年6月11日 上午10:50
下一篇 2019年6月11日 上午10:50

相关推荐

  • 怎么用通用模板连接没有前缀的变量

    怎么用通用模板连接没有前缀的变量? 看说是用SetTagValue/GetTagValue函数就可避免。怎么用啊 最佳答案 有好几个方法呢,为什么就要使用SetTagVa…

    SIMATIC WinCC 2019年6月11日
  • MP277画面切换

    请问:MP277触摸屏的画面切换可以用字地址里面的数字来切换吗,请知道的高人指点。谢谢 最佳答案 可以,在变量的属性——事件——更改数值,用ActivateScreenByNumb…

    SIMATIC WinCC 2019年6月11日
  • WINCC6.0的SQL2000安装报错

    我在安装WINCC6.0的SQL2000– 2/2的时候出现了报警窗口:step  finished with errors.就…

    SIMATIC WinCC 2019年6月11日
  • K-TP178触摸屏,

    各位好,我公司K-TP178触摸屏损坏了,有显示,但触摸无反应,请问如何上载和下载程序,软件哪有下载, 问题补充:我公司买了新屏,我是想把旧屏的程序调上来,下载,但坏屏按不动,能上…

    SIMATIC WinCC 2019年6月11日
  • 数据存储

    Wincc中数据存储第一步是保存数据,第二步读取数据,我在网上看到一个例程,http://www.ad.siemens.com.cn/club/bbs/post.asp?b_id=…

    SIMATIC WinCC 2019年6月11日
  • 博途V12下载时崩溃

    我的博途软件前段时间用的很多好,后来发现每次下载的时候就崩溃。其它功能都是正常的,只是不能下载。请问高手是咋回事呢? 图片说明:    最佳答案 用安装盘重新修…

    2017年7月26日
  • WINCC v6.0与CP343-1 lean 通讯

    PLC中用CP343-1 lean与WINCC V6.0进行通讯,我在WINCC中选工业以太网,新建连接参数中把CP343-1 lean的MAC地址也…

    SIMATIC WinCC 2019年6月11日
  • wincc vbs 赋值

    用vsflexgrid生成表第一行10个数据如1到十,包含10个地址的结构变量如db100到db119,怎样把这10个数值依次送到包含10个地址的结构变量,简便的vbs编方法,请高…

    SIMATIC WinCC 2019年6月11日
  • wincc flixble smart v3 组态问题

    各位大侠:       请问wincc flixble smart v3&nbs…

    SIMATIC WinCC 2021年7月5日
  • 关于named connections连接

    小弟的公司有三台400的PLC组成一个局域网,其中一个414和两台电脑用的是named connections连接,因工作需要需要增加一台电脑对这台414进行数据监控,小…

    2021年7月5日