Sub btnWrite_Click (Params As Map)
Dim ft8 As Future = plc1.GetProp("checked")
Dim ft9 As Future = interval1.GetVal
Dim ft10 As Future = ip1.GetVal
Dim ft11 As Future = port1.GetVal
Dim ft12 As Future = address1.GetVal
Dim ft13 As Future = size1.GetVal
If ft8.Value=True Then
If ft9.Value<1 Then
WebUtils.bsAlert(ws,"請設定PLC讀取時間>0")
Return
End If
'
If ft10.Value="" Then ' 192.168.1.1
Dim ss() As String = Regex.Split(".",ft10.Value)
If ss.Length<>4 Then
WebUtils.bsAlert(ws,"PLC位址有誤")
Return
End If
If Not(IsNumber(ss(0)) And IsNumber(ss(1)) And IsNumber(ss(2)) And IsNumber(ss(3))) Then
WebUtils.bsAlert(ws,"PLC位址有誤")
Return
End If
End If
'
If Not(IsNumber(ft11.Value)) Then
WebUtils.bsAlert(ws,"PLC埠號有誤")
Return
End If
End If
Devices.plc.used = ft8.Value
Devices.plc.interval = ft9.Value
Devices.plc.ip = ft10.Value
Devices.plc.port = ft11.Value
Devices.plc.address = ft12.Value
Devices.plc.size = ft13.Value
Dim ft As Future=word1.GetProp("checked")
Devices.plc.word1 = ft.Value
For n1=0 To Devices.Size-1
ft8=ws.GetElementById("inp"&(n1+1)).Getval
Devices.Title(n1)=ft8.Value
ft8=ws.GetElementById("used"&n1).GetProp("checked")
Devices.used(n1)=ft8.Value
Next
WebUtils.bsMessageBox(ws,"PLC參數存檔完成") <<<<<----- Send "bsModal" to Page(A)
Devices.save
Log("param/plc save")
End Sub