Compare commits
No commits in common. "main" and "master" have entirely different histories.
BIN
RFIDReaderTC/.vs/ProjectEvaluation/rfidreadertc.metadata.v9.bin
Normal file
BIN
RFIDReaderTC/.vs/ProjectEvaluation/rfidreadertc.projects.v9.bin
Normal file
BIN
RFIDReaderTC/.vs/ProjectEvaluation/rfidreadertc.strings.v9.bin
Normal file
BIN
RFIDReaderTC/.vs/RFIDReaderTC/DesignTimeBuild/.dtbcache.v2
Normal file
BIN
RFIDReaderTC/.vs/RFIDReaderTC/v17/.futdcache.v2
Normal file
BIN
RFIDReaderTC/.vs/RFIDReaderTC/v17/.suo
Normal file
84
RFIDReaderTC/.vs/RFIDReaderTC/v17/DocumentLayout.backup.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\viewmodel\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\viewmodel\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "MainWindowViewModel.cs",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"RelativeToolTip": "RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"ViewState": "AgIAAOgAAAAAAAAAAAAkwHgBAABDAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-02-13T00:14:40.935Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "App.config",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\App.config",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\App.config",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\App.config",
|
||||
"RelativeToolTip": "RFIDReaderTC\\App.config",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAlAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
|
||||
"WhenOpened": "2025-02-13T00:15:14.493Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "MainWindow.xaml.cs",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"RelativeToolTip": "RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"ViewState": "AQIAABIAAAAAAAAAAAAAACQAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-01-03T12:29:00.615Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MainWindow.xaml",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\MainWindow.xaml",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml",
|
||||
"RelativeToolTip": "RFIDReaderTC\\MainWindow.xaml",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
||||
"WhenOpened": "2025-01-03T07:38:15.418Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
101
RFIDReaderTC/.vs/RFIDReaderTC/v17/DocumentLayout.json
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\viewmodel\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\viewmodel\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\commons\\ledhelper.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\commons\\ledhelper.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|d:\\work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\rfidreadertc\\rfidreadertc\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}",
|
||||
"RelativeMoniker": "D:0:0:{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}|RFIDReaderTC\\RFIDReaderTC.csproj|solutionrelative:rfidreadertc\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "LEDHelper.cs",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\Commons\\LEDHelper.cs",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\Commons\\LEDHelper.cs",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\Commons\\LEDHelper.cs",
|
||||
"RelativeToolTip": "RFIDReaderTC\\Commons\\LEDHelper.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAArAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-11T06:45:26.155Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "MainWindowViewModel.cs",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"RelativeToolTip": "RFIDReaderTC\\ViewModel\\MainWindowViewModel.cs",
|
||||
"ViewState": "AgIAAH8BAAAAAAAAAAAqwAwCAAA5AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-02-13T00:14:40.935Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "App.config",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\App.config",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\App.config",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\App.config",
|
||||
"RelativeToolTip": "RFIDReaderTC\\App.config",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAlAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
|
||||
"WhenOpened": "2025-02-13T00:15:14.493Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MainWindow.xaml.cs",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"RelativeToolTip": "RFIDReaderTC\\MainWindow.xaml.cs",
|
||||
"ViewState": "AQIAABIAAAAAAAAAAAAAACQAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-01-03T12:29:00.615Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "MainWindow.xaml",
|
||||
"DocumentMoniker": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml",
|
||||
"RelativeDocumentMoniker": "RFIDReaderTC\\MainWindow.xaml",
|
||||
"ToolTip": "D:\\Work\\\u5B89\u5FBD\u5929\u957F\u5E02\\\u8F6F\u4EF6\\\u5929\u957F\u4F7F\u7528\u7A0B\u5E8F\\RFIDReaderTC\\RFIDReaderTC\\MainWindow.xaml",
|
||||
"RelativeToolTip": "RFIDReaderTC\\MainWindow.xaml",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
||||
"WhenOpened": "2025-01-03T07:38:15.418Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
11
RFIDReaderTC/DBOperator/App.config
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!-- SQL connection string for database-->
|
||||
<!--<add key="ConnString" value="Server = 172.18.131.12; uid = sa ; pwd =sa; database = SSWCMS_aux; MAX Pool Size = 1024;Min Pool Size=0 " />-->
|
||||
<add key="ConnString" value="Server=.;uid =sa;pwd=tcdl2010*;database=AHTC_WCS;MAX Pool Size=512"/>
|
||||
|
||||
<add key="DBFactory" value="SQLServerDBFactory"/>
|
||||
|
||||
</appSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
23
RFIDReaderTC/DBOperator/DBFactory.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.EnterpriseServices;
|
||||
namespace DBFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// DBFactory是产生操作数据库相关对象的抽象工厂,可以产生数据库联接、数据库命令、数据适配器
|
||||
/// </summary>
|
||||
public abstract class DBFactory
|
||||
{
|
||||
public abstract IDbConnection GetDBConnection();
|
||||
public abstract IDbTransaction GetDBTransaction(IsolationLevel LockAction);
|
||||
public abstract IDbCommand GetDBCommand();
|
||||
public abstract IDbCommand GetDBCommand(string cmdText,IDbConnection conn);
|
||||
public abstract IDbDataAdapter GetDataAdapter(IDbCommand dbc);
|
||||
public abstract IDbDataAdapter GetDataAdapter();
|
||||
public abstract IDbDataParameter GetParameter();
|
||||
public abstract IDbDataParameter GetParameter(string ParameterName,DbType dbtype);
|
||||
public abstract IDataReader GetDataReader(IDbCommand dbc);
|
||||
}
|
||||
}
|
111
RFIDReaderTC/DBOperator/DBFactory.csproj
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DBFactory</RootNamespace>
|
||||
<AssemblyName>DBFactory</AssemblyName>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.OracleClient" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DBFactory.cs" />
|
||||
<Compile Include="DBOperator.cs" />
|
||||
<Compile Include="OleDBFactory.cs" />
|
||||
<Compile Include="OracleDBFactory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SQLServerDBFactory.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
2
RFIDReaderTC/DBOperator/DBFactory.csproj.pdsync
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<ModelFileSync />
|
14
RFIDReaderTC/DBOperator/DBFactory.csproj.user
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory />
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>zh-CN</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
10
RFIDReaderTC/DBOperator/DBFactory.csproj.vspscc
Normal file
@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = "relative:DBOperator"
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
26
RFIDReaderTC/DBOperator/DBFactory.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBFactory", "DBFactory.csproj", "{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "测试", "..\测试\测试.csproj", "{D24004EB-F9AD-41E5-9399-0ECF0FD6218A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D24004EB-F9AD-41E5-9399-0ECF0FD6218A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D24004EB-F9AD-41E5-9399-0ECF0FD6218A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D24004EB-F9AD-41E5-9399-0ECF0FD6218A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D24004EB-F9AD-41E5-9399-0ECF0FD6218A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
RFIDReaderTC/DBOperator/DBFactory.suo
Normal file
1109
RFIDReaderTC/DBOperator/DBOperator.cs
Normal file
677
RFIDReaderTC/DBOperator/DbHelperSQL.cs
Normal file
@ -0,0 +1,677 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Configuration;
|
||||
namespace Dictionary.DBUtility
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据访问抽象基础类
|
||||
/// Copyright (C) 2004-2008
|
||||
/// All rights reserved
|
||||
/// </summary>
|
||||
public abstract class DbHelperSQL
|
||||
{
|
||||
//数据库连接字符串(web.config来配置)
|
||||
public static string _dbconnString = ConfigurationSettings.AppSettings["_dbconnString"];
|
||||
//public static string _dbconnString = LTP.Common.DEncrypt.DESEncrypt.Decrypt(LTP.Common.ConfigHelper.GetConfigString("_dbconnString"));
|
||||
public DbHelperSQL()
|
||||
{
|
||||
}
|
||||
|
||||
#region 公用方法
|
||||
|
||||
public static int GetMaxID(string FieldName, string TableName)
|
||||
{
|
||||
string strsql = "select max(" + FieldName + ")+1 from " + TableName;
|
||||
object obj = GetSingle(strsql);
|
||||
if (obj == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return int.Parse(obj.ToString());
|
||||
}
|
||||
}
|
||||
public static bool Exists(string strSql)
|
||||
{
|
||||
object obj =GetSingle(strSql);
|
||||
int cmdresult;
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
cmdresult = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdresult = int.Parse(obj.ToString());
|
||||
}
|
||||
if (cmdresult == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static bool Exists(string strSql, params SqlParameter[] cmdParms)
|
||||
{
|
||||
object obj =GetSingle(strSql, cmdParms);
|
||||
int cmdresult;
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
cmdresult = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdresult = int.Parse(obj.ToString());
|
||||
}
|
||||
if (cmdresult == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 执行简单SQL语句
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL语句,返回影响的记录数
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteSql(string SQLString)
|
||||
{
|
||||
using (IDbCommand cmd = _dbf.GetDBCommand(SQLString, _dbconn))
|
||||
{
|
||||
try
|
||||
{
|
||||
Open();
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
return rows;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
Close();
|
||||
throw E;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL语句,设置命令的执行等待时间
|
||||
/// </summary>
|
||||
/// <param name="SQLString"></param>
|
||||
/// <param name="Times"></param>
|
||||
/// <returns></returns>
|
||||
public static int ExecuteSqlByTime(string SQLString, int Times)
|
||||
{
|
||||
using (IDbCommand cmd = _dbf.GetDBCommand(SQLString, _dbconn))
|
||||
{
|
||||
try
|
||||
{
|
||||
Open();
|
||||
cmd.CommandTimeout = Times;
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
return rows;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
Close();
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行多条SQL语句,实现数据库事务。
|
||||
/// </summary>
|
||||
/// <param name="SQLStringList">多条SQL语句</param>
|
||||
public static void ExecuteSqlTran(ArrayList SQLStringList)
|
||||
{
|
||||
conn.Open();
|
||||
IDbCommand cmd = _dbf.GetDBCommand();//IDbCommand cmd = _dbf.GetDBCommand();
|
||||
cmd.Connection = _dbconn;
|
||||
TransBegin();
|
||||
cmd.Transaction = _dbtrans
|
||||
try
|
||||
{
|
||||
for (int n = 0; n < SQLStringList.Count; n++)
|
||||
{
|
||||
string strsql = SQLStringList[n].ToString();
|
||||
if (strsql.Trim().Length > 1)
|
||||
{
|
||||
cmd.CommandText = strsql;
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
TransCommit();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
tx.Rollback();
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行带一个存储过程参数的SQL语句。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteSql(string SQLString, string content)
|
||||
{
|
||||
IDbCommand cmd = _dbf.GetDBCommand(SQLString, _dbconn);
|
||||
IDbDataParameter myParameter =_dbf.GetParameter("@content", DbType.NText);
|
||||
myParameter.Value = content;
|
||||
cmd.Parameters.Add(myParameter);
|
||||
try
|
||||
{
|
||||
Open();
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
return rows;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Dispose();
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行带一个存储过程参数的的SQL语句。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static object ExecuteSqlGet(string SQLString, string content)
|
||||
{
|
||||
IDbCommand cmd = _dbf.GetDBCommand(SQLString, _dbconn);
|
||||
IDbDataParameter myParameter =_dbf.GetParameter("@content", DbType.NText);
|
||||
myParameter.Value = content;
|
||||
cmd.Parameters.Add(myParameter);
|
||||
try
|
||||
{
|
||||
Open();
|
||||
object obj = cmd.ExecuteScalar();
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Dispose();
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 向数据库里插入图像格式的字段(和上面情况类似的另一种实例)
|
||||
/// </summary>
|
||||
/// <param name="strSQL">SQL语句</param>
|
||||
/// <param name="fs">图像字节,数据库的字段类型为image的情况</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteSqlInsertImg(string strSQL, byte[] fs)
|
||||
{
|
||||
IDbCommand cmd = _dbf.GetDBCommand(strSQL, _dbconn);
|
||||
IDbDataParameter myParameter =_dbf.GetParameter("@fs", DbType.Image);
|
||||
myParameter.Value = fs;
|
||||
cmd.Parameters.Add(myParameter);
|
||||
try
|
||||
{
|
||||
Open();
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
return rows;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Dispose();
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行一条计算查询结果语句,返回查询结果(object)。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">计算查询结果语句</param>
|
||||
/// <returns>查询结果(object)</returns>
|
||||
public static object GetSingle(string SQLString)
|
||||
{
|
||||
using (IDbCommand cmd = _dbf.GetDBCommand(SQLString, _dbconn))
|
||||
{
|
||||
try
|
||||
{
|
||||
Open();
|
||||
object obj = cmd.ExecuteScalar();
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Close();
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回SqlDataReader(使用该方法切记要手工关闭SqlDataReader和连接)
|
||||
/// </summary>
|
||||
/// <param name="strSQL">查询语句</param>
|
||||
/// <returns>SqlDataReader</returns>
|
||||
public static IDbDataReader ExecuteReader(string strSQL)
|
||||
{
|
||||
IDbCommand cmd = _dbf.GetDBCommand(strSQL, _dbconn);
|
||||
try
|
||||
{
|
||||
Open();
|
||||
IDataReader myReader =GetDataReader( cmd);
|
||||
return myReader;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
//finally //不能在此关闭,否则,返回的对象将无法使用
|
||||
//{
|
||||
// cmd.Dispose();
|
||||
// Close();
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回DataSet
|
||||
/// </summary>
|
||||
/// <param name="SQLString">查询语句</param>
|
||||
/// <returns>DataSet</returns>
|
||||
public static DataSet Query(string SQLString)
|
||||
{
|
||||
try
|
||||
{
|
||||
IDbCommand dbc = _dbf.GetDBCommand();
|
||||
if (_dbtrans != null)
|
||||
{
|
||||
dbc.Transaction = _dbtrans;
|
||||
}
|
||||
dbc.Connection = _dbconn;
|
||||
dbc.CommandText = sql;
|
||||
IDbDataAdapter ida = _dbf.GetDataAdapter(dbc);
|
||||
DataSet ds = new DataSet();
|
||||
ida.Fill(ds);
|
||||
return ds;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_DBConnInfo = ex.Message;
|
||||
throw ex;
|
||||
//return null;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回DataSet,设置命令的执行等待时间
|
||||
/// </summary>
|
||||
/// <param name="SQLString"></param>
|
||||
/// <param name="Times"></param>
|
||||
/// <returns></returns>
|
||||
public static DataSet Query(string SQLString, int Times)
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
try
|
||||
{
|
||||
Open();
|
||||
IDbCommand dbc = _dbf.GetDBCommand();
|
||||
if (_dbtrans != null)
|
||||
{
|
||||
dbc.Transaction = _dbtrans;
|
||||
}
|
||||
dbc.Connection = _dbconn;
|
||||
dbc.CommandText = SQLString;
|
||||
SqlDataAdapter command = new SqlDataAdapter(dbc);
|
||||
command.SelectCommand.CommandTimeout = Times;
|
||||
command.Fill(ds, "ds");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
return ds;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 执行带参数的SQL语句
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL语句,返回影响的记录数
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteSql(string SQLString, params IDbDataParameter[] cmdParms)
|
||||
{
|
||||
using (IDbCommand cmd = _dbf.GetDBCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, _dbconn, null, SQLString, cmdParms);
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
return rows;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行多条SQL语句,实现数据库事务。
|
||||
/// </summary>
|
||||
/// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])</param>
|
||||
public static void ExecuteSqlTran(Hashtable SQLStringList)
|
||||
{
|
||||
Open();
|
||||
TransBegin();
|
||||
IDbCommand cmd = _dbf.GetDBCommand();
|
||||
try
|
||||
{
|
||||
//循环
|
||||
foreach (DictionaryEntry myDE in SQLStringList)
|
||||
{
|
||||
string cmdText = myDE.Key.ToString();
|
||||
IDbDataParameter[] cmdParms = (IDbDataParameter[])myDE.Value;
|
||||
PrepareCommand(cmd, _dbconn, _dbtrans, cmdText, cmdParms);
|
||||
int val = cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
TransCommit();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
TransRollback();
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行一条计算查询结果语句,返回查询结果(object)。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">计算查询结果语句</param>
|
||||
/// <returns>查询结果(object)</returns>
|
||||
public static object GetSingle(string SQLString, params IDbDataParameter[] cmdParms)
|
||||
{
|
||||
using (IDbCommand cmd = _dbf.GetDBCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, _dbconn, null, SQLString, cmdParms);
|
||||
object obj = cmd.ExecuteScalar();
|
||||
cmd.Parameters.Clear();
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回SqlDataReader (使用该方法切记要手工关闭SqlDataReader和连接)
|
||||
/// </summary>
|
||||
/// <param name="strSQL">查询语句</param>
|
||||
/// <returns>SqlDataReader</returns>
|
||||
public static IDataReader ExecuteReader(string SQLString, params IDbDataParameter[] cmdParms)
|
||||
{
|
||||
|
||||
IDbCommand cmd = _dbf.GetDBCommand();
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, _dbconn, null, SQLString, cmdParms);
|
||||
IDataReader myReader =_dbf.GetDataReader( cmd);
|
||||
cmd.Parameters.Clear();
|
||||
return myReader;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
//finally //不能在此关闭,否则,返回的对象将无法使用
|
||||
//{
|
||||
// cmd.Dispose();
|
||||
// Close();
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回DataSet
|
||||
/// </summary>
|
||||
/// <param name="SQLString">查询语句</param>
|
||||
/// <returns>DataSet</returns>
|
||||
public static DataSet Query(string SQLString, params IDbDataParameter[] cmdParms)
|
||||
{
|
||||
|
||||
IDbCommand cmd = _dbf.GetDBCommand();
|
||||
PrepareCommand(cmd, _dbconn, null, SQLString, cmdParms);
|
||||
using (IDataAdapter da = _dbf.GetDataAdapter(cmd))
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
try
|
||||
{
|
||||
da.Fill(ds, "ds");
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
return ds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void PrepareCommand(IDbCommand cmd, IDbConnection conn, IDbTransaction trans, string cmdText, SqlParameter[] cmdParms)
|
||||
{
|
||||
Open();
|
||||
cmd.Connection = _dbconn;
|
||||
cmd.CommandText = cmdText;
|
||||
if (trans != null)
|
||||
cmd.Transaction = trans;
|
||||
cmd.CommandType = CommandType.Text;//cmdType;
|
||||
if (cmdParms != null)
|
||||
{
|
||||
|
||||
|
||||
foreach (IDbDataParameter parameter in cmdParms)
|
||||
{
|
||||
if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
|
||||
(parameter.Value == null))
|
||||
{
|
||||
parameter.Value = DBNull.Value;
|
||||
}
|
||||
cmd.Parameters.Add(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 存储过程操作
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程 (使用该方法切记要手工关闭SqlDataReader和连接)
|
||||
/// </summary>
|
||||
/// <param name="storedProcName">存储过程名</param>
|
||||
/// <param name="parameters">存储过程参数</param>
|
||||
/// <returns>SqlDataReader</returns>
|
||||
public static IDataReader RunProcedure(string storedProcName, IDataParameter[] parameters)
|
||||
{
|
||||
|
||||
SqlDataReader returnReader;
|
||||
Open();
|
||||
IDbCommand command = BuildQueryCommand(_dbconn, storedProcName, parameters);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
returnReader =_dbf.GetDataReader();
|
||||
//Close(); 不能在此关闭,否则,返回的对象将无法使用
|
||||
return returnReader;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程
|
||||
/// </summary>
|
||||
/// <param name="storedProcName">存储过程名</param>
|
||||
/// <param name="parameters">存储过程参数</param>
|
||||
/// <param name="tableName">DataSet结果中的表名</param>
|
||||
/// <returns>DataSet</returns>
|
||||
public static DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName)
|
||||
{
|
||||
|
||||
DataSet dataSet = new DataSet();
|
||||
Open();
|
||||
IDbDataAdapter sqlDA = _dbf.GetDataAdapter();
|
||||
sqlDA.SelectCommand = BuildQueryCommand(_dbconn, storedProcName, parameters);
|
||||
sqlDA.Fill(dataSet, tableName);
|
||||
Close();
|
||||
return dataSet;
|
||||
|
||||
}
|
||||
public static DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName, int Times)
|
||||
{
|
||||
|
||||
DataSet dataSet = new DataSet();
|
||||
Open();
|
||||
IDbDataAdapter sqlDA = _dbf.GetDataAdapter();
|
||||
sqlDA.SelectCommand = BuildQueryCommand(_dbconn, storedProcName, parameters);
|
||||
sqlDA.SelectCommand.CommandTimeout = Times;
|
||||
sqlDA.Fill(dataSet, tableName);
|
||||
Close();
|
||||
return dataSet;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构建 SqlCommand 对象(用来返回一个结果集,而不是一个整数值)
|
||||
/// </summary>
|
||||
/// <param name="_dbconn">数据库连接</param>
|
||||
/// <param name="storedProcName">存储过程名</param>
|
||||
/// <param name="parameters">存储过程参数</param>
|
||||
/// <returns>SqlCommand</returns>
|
||||
private static IDbCommand BuildQueryCommand(IDbConnection _dbconn, string storedProcName, IDataParameter[] parameters)
|
||||
{
|
||||
IDbCommand command = _dbf.GetDBCommand(storedProcName, _dbconn);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
foreach (SqlParameter parameter in parameters)
|
||||
{
|
||||
if (parameter != null)
|
||||
{
|
||||
// 检查未分配值的输出参数,将其分配以DBNull.Value.
|
||||
if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
|
||||
(parameter.Value == null))
|
||||
{
|
||||
parameter.Value = DBNull.Value;
|
||||
}
|
||||
command.Parameters.Add(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程,返回影响的行数
|
||||
/// </summary>
|
||||
/// <param name="storedProcName">存储过程名</param>
|
||||
/// <param name="parameters">存储过程参数</param>
|
||||
/// <param name="rowsAffected">影响的行数</param>
|
||||
/// <returns></returns>
|
||||
public static int RunProcedure(string storedProcName, IDataParameter[] parameters, out int rowsAffected)
|
||||
{
|
||||
|
||||
int result;
|
||||
Open();
|
||||
IDbCommand command = BuildIntCommand(_dbconn, storedProcName, parameters);
|
||||
rowsAffected = command.ExecuteNonQuery();
|
||||
result = (int)command.Parameters["ReturnValue"].Value;
|
||||
//Close();
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建 SqlCommand 对象实例(用来返回一个整数值)
|
||||
/// </summary>
|
||||
/// <param name="storedProcName">存储过程名</param>
|
||||
/// <param name="parameters">存储过程参数</param>
|
||||
/// <returns>SqlCommand 对象实例</returns>
|
||||
private static IDbCommand BuildIntCommand(IDbConnection _dbconn, string storedProcName, IDataParameter[] parameters)
|
||||
{
|
||||
IDbCommand command = BuildQueryCommand(_dbconn, storedProcName, parameters);
|
||||
command.Parameters.Add(new SqlParameter("ReturnValue",
|
||||
SqlDbType.Int, 4, ParameterDirection.ReturnValue,
|
||||
false, 0, 0, string.Empty, DataRowVersion.Default, null));
|
||||
return command;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
74
RFIDReaderTC/DBOperator/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
||||
namespace DBFactory
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(400, 33);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(126, 36);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(12, 86);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(573, 276);
|
||||
this.dataGridView1.TabIndex = 1;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(597, 374);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
}
|
||||
}
|
28
RFIDReaderTC/DBOperator/Form1.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DBFactory
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
DBOperator db = new DBOperator();
|
||||
db.Open();
|
||||
DataSet ds= db.ExceSQL("select * from Products");
|
||||
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
||||
}
|
||||
}
|
||||
}
|
120
RFIDReaderTC/DBOperator/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
49
RFIDReaderTC/DBOperator/OleDBFactory.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
namespace DBFactory
|
||||
{
|
||||
public class OleDBFactory:DBFactory
|
||||
{
|
||||
OleDbConnection conn = new OleDbConnection();
|
||||
public override IDbConnection GetDBConnection()
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
public override IDbTransaction GetDBTransaction(IsolationLevel LockAction)
|
||||
{
|
||||
|
||||
return conn.BeginTransaction(LockAction);
|
||||
}
|
||||
public override IDbCommand GetDBCommand()
|
||||
{
|
||||
return new OleDbCommand();
|
||||
}
|
||||
public override IDbCommand GetDBCommand(string cmdText, IDbConnection conn1)
|
||||
{
|
||||
return new OleDbCommand(cmdText,(OleDbConnection) conn1);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter(IDbCommand dbc)
|
||||
{
|
||||
return new OleDbDataAdapter((OleDbCommand)dbc);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter()
|
||||
{
|
||||
return new OleDbDataAdapter();
|
||||
}
|
||||
public override IDbDataParameter GetParameter()
|
||||
{
|
||||
return new OleDbParameter();
|
||||
}
|
||||
public override IDbDataParameter GetParameter(string ParameterName, DbType dbtype)
|
||||
{
|
||||
return new OleDbParameter(ParameterName, (OleDbType)dbtype);
|
||||
}
|
||||
public override IDataReader GetDataReader(IDbCommand dbc)
|
||||
{
|
||||
return ((OleDbCommand)dbc).ExecuteReader(); ;
|
||||
}
|
||||
}
|
||||
}
|
53
RFIDReaderTC/DBOperator/OracleDBFactory.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.OracleClient;
|
||||
namespace DBFactory
|
||||
{
|
||||
public class OracleDBFactory:DBFactory
|
||||
{
|
||||
OracleConnection conn = new OracleConnection();
|
||||
public override IDbConnection GetDBConnection()
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
public override IDbTransaction GetDBTransaction(IsolationLevel LockAction)
|
||||
{
|
||||
|
||||
return conn.BeginTransaction( LockAction);
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
public override IDbCommand GetDBCommand()
|
||||
{
|
||||
return new OracleCommand();
|
||||
}
|
||||
public override IDbCommand GetDBCommand(string cmdText, IDbConnection conn1)
|
||||
{
|
||||
return new OracleCommand(cmdText,(OracleConnection) conn1);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter(IDbCommand dbc)
|
||||
{
|
||||
return new OracleDataAdapter((OracleCommand)dbc);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter( )
|
||||
{
|
||||
return new OracleDataAdapter( );
|
||||
}
|
||||
public override IDbDataParameter GetParameter()
|
||||
{
|
||||
return new OracleParameter();
|
||||
}
|
||||
public override IDbDataParameter GetParameter(string ParameterName, DbType dbtype)
|
||||
{
|
||||
|
||||
return new OracleParameter(ParameterName, (OracleType)dbtype);
|
||||
}
|
||||
public override IDataReader GetDataReader(IDbCommand dbc)
|
||||
{
|
||||
return ((OracleCommand)dbc).ExecuteReader() ;
|
||||
}
|
||||
}
|
||||
}
|
35
RFIDReaderTC/DBOperator/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过下列属性集
|
||||
// 控制。更改这些属性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("DBOperator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("沈阳柔科科技发展有限公司")]
|
||||
[assembly: AssemblyProduct("DBOperator")]
|
||||
[assembly: AssemblyCopyright("版权所有 (C) 沈阳柔科科技发展有限公司 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 属性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("a5eb2ba5-28e7-4c0f-8d8c-3b2134c2caa5")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
BIN
RFIDReaderTC/DBOperator/Properties/vssver2.scc
Normal file
51
RFIDReaderTC/DBOperator/SQLServerDBFactory.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.EnterpriseServices;
|
||||
namespace DBFactory
|
||||
{
|
||||
public class SQLServerDBFactory:DBFactory
|
||||
{
|
||||
SqlConnection conn = new SqlConnection();
|
||||
public override IDbConnection GetDBConnection()
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
public override IDbTransaction GetDBTransaction(IsolationLevel LockAction)
|
||||
{
|
||||
|
||||
return conn.BeginTransaction(LockAction);
|
||||
}
|
||||
public override IDbCommand GetDBCommand()
|
||||
{
|
||||
return new SqlCommand();
|
||||
}
|
||||
public override IDbCommand GetDBCommand(string cmdText,IDbConnection conn1)
|
||||
{
|
||||
return new SqlCommand(cmdText,(SqlConnection)conn1);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter(IDbCommand dbc)
|
||||
{
|
||||
return new SqlDataAdapter((SqlCommand)dbc);
|
||||
}
|
||||
public override IDbDataAdapter GetDataAdapter()
|
||||
{
|
||||
return new SqlDataAdapter();
|
||||
}
|
||||
public override IDbDataParameter GetParameter()
|
||||
{
|
||||
return new SqlParameter();
|
||||
}
|
||||
public override IDbDataParameter GetParameter(string ParameterName,DbType dbtype)
|
||||
{
|
||||
IDbDataParameter dbdp=new SqlParameter(ParameterName,(SqlDbType ) dbtype);
|
||||
return dbdp;
|
||||
}
|
||||
public override IDataReader GetDataReader(IDbCommand dbc)
|
||||
{
|
||||
return ((SqlCommand)dbc).ExecuteReader();
|
||||
}
|
||||
}
|
||||
}
|
BIN
RFIDReaderTC/DBOperator/bin/Debug/DBFactory.dll
Normal file
11
RFIDReaderTC/DBOperator/bin/Debug/DBFactory.dll.config
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!-- SQL connection string for database-->
|
||||
<!--<add key="ConnString" value="Server = 172.18.131.12; uid = sa ; pwd =sa; database = SSWCMS_aux; MAX Pool Size = 1024;Min Pool Size=0 " />-->
|
||||
<add key="ConnString" value="Server=.;uid =sa;pwd=tcdl2010*;database=AHTC_WCS;MAX Pool Size=512"/>
|
||||
|
||||
<add key="DBFactory" value="SQLServerDBFactory"/>
|
||||
|
||||
</appSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
BIN
RFIDReaderTC/DBOperator/bin/Debug/DBFactory.pdb
Normal file
BIN
RFIDReaderTC/DBOperator/bin/Debug/System.configuration.dll
Normal file
BIN
RFIDReaderTC/DBOperator/bin/Release/DBFactory.dll
Normal file
27
RFIDReaderTC/DBOperator/bin/Release/DBFactory.dll.config
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
|
||||
<!-- SQL connection string for database-->
|
||||
<add key="ConnString" value="Server = (local) ; uid = sa ; pwd =; database = SSWCMS_YJTF ; MAX Pool Size = 512 ;unicode=true"/>
|
||||
<!-- SQL connection string for database-->
|
||||
<!--<add key="ManConnString" value="Server = 192.168.1.49 ; uid = sa ; pwd =; database = SSWMS_YJTF ; MAX Pool Size = 512 " />-->
|
||||
<!--<add key="ManConnString" value="Server = HUANAN; uid = SA ; pwd =; database = SSWMS ; MAX Pool Size = 512 "/>-->
|
||||
|
||||
<!-- Oracle connection strings-->
|
||||
<add key="ManConnString" value="Data Source=ssawms ; User ID=cigaux ; Password=cigaux; MAX Pool Size = 512 ;unicode=true"/>
|
||||
<!-- OtherOLEDB connection strings-->
|
||||
<!--<add key="ConnString" value="Provider=OraOLEDB.Oracle.1;Data Source=Richard-liu;User ID=sa;Password=" ; MAX Pool Size = 512 />-->
|
||||
<!-- DAL configuration settings. Possible values: SQLServerDBFactory for SqlServer, OracleDBFactory for Oracle
|
||||
, OleDBFactory for Ole Database
|
||||
-->
|
||||
|
||||
<add key="ManDBFactory" value="SQLServerDBFactory"/>
|
||||
<add key="DBFactory" value="SQLServerDBFactory"/>
|
||||
<!--
|
||||
|
||||
<add key="ERPDBFactory" value="OracleDBFactory"/>
|
||||
-->
|
||||
|
||||
</appSettings>
|
||||
</configuration>
|
BIN
RFIDReaderTC/DBOperator/bin/Release/DBFactory.pdb
Normal file
5
RFIDReaderTC/DBOperator/mssccprj.scc
Normal file
@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[DBFactory.csproj]
|
||||
SCC_Aux_Path="\\SIASUNRGV\VSS2005"
|
||||
SCC_Project_Name="$/藿렌든제SSWCMS.root/藿렌든제SSWCMS/DBOperator", UHAAAAAA
|
12
RFIDReaderTC/DBOperator/obj/DBFactory.csproj.FileList.txt
Normal file
@ -0,0 +1,12 @@
|
||||
bin\Release\DBFactory.dll.config
|
||||
bin\Release\DBFactory.dll
|
||||
bin\Release\DBFactory.pdb
|
||||
obj\Release\ResolveAssemblyReference.cache
|
||||
obj\Release\DBFactory.dll
|
||||
obj\Release\DBFactory.pdb
|
||||
bin\Debug\DBFactory.dll.config
|
||||
bin\Debug\DBFactory.dll
|
||||
bin\Debug\DBFactory.pdb
|
||||
obj\Debug\ResolveAssemblyReference.cache
|
||||
obj\Debug\DBFactory.dll
|
||||
obj\Debug\DBFactory.pdb
|
@ -0,0 +1,60 @@
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.dll
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.pdb
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\DBFactory.dll
|
||||
C:\richard.liu\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\lsp\新松自动化立体仓库监控系统\ControlSystem\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\lsp\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
G:\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
C:\richard.liu\延吉卷烟厂\调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\延吉卷烟厂\延吉调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\聊城电力\聊城电力调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\聊城电力调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\聊城电力调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
E:\聊城电力调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\聊城电力调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
F:\Program\潍坊电力调度系统0518\潍坊电力调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
||||
F:\Program\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
F:\Program\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.dll
|
||||
F:\Program\潍坊电力调度系统\DBOperator\bin\Debug\DBFactory.pdb
|
||||
F:\Program\潍坊电力调度系统\DBOperator\obj\Debug\ResolveAssemblyReference.cache
|
||||
F:\Program\潍坊电力调度系统\DBOperator\obj\Debug\DBFactory.dll
|
||||
F:\Program\潍坊电力调度系统\DBOperator\obj\Debug\DBFactory.pdb
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
@ -0,0 +1 @@
|
||||
e4d235ce64001d886381b1c3a8e8ee3f35fc0d887b6c3a3c17e59f42854dd41a
|
@ -0,0 +1,109 @@
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\soft\AHFY\新库\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\瑞吉德\svn\安徽亳州\王澳发服务\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\安徽亳州\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csprojAssemblyReference.cache
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\9.库房系统\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\安徽阜南\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
C:\Users\RGD\Desktop\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\软件\最新\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
F:\项目代码\庐江\2023.3.14服务修改箱码顺序\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\Code\安徽庐江\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\安徽明光\WCS_RGD_with_HIVE.WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
C:\Users\Administrator.BF-202410101621\Desktop\软件\安徽定远(1)\WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\WebService\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\Work\安徽天长市\软件\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
E:\Work\安徽天长市\软件\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
E:\Work\安徽天长市\软件\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\DBOperator\obj\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.pdb
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.dll
|
||||
E:\Work\安徽天长市\软件\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.pdb
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.dll.config
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.dll
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\bin\Debug\DBFactory.pdb
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.csproj.AssemblyReference.cache
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.csproj.CoreCompileInputs.cache
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.dll
|
||||
D:\库房程序\天长使用程序\RFIDReaderTC\DBOperator\obj\Debug\DBFactory.pdb
|
BIN
RFIDReaderTC/DBOperator/obj/Debug/DBFactory.dll
Normal file
BIN
RFIDReaderTC/DBOperator/obj/Debug/DBFactory.pdb
Normal file
BIN
RFIDReaderTC/DBOperator/obj/Debug/Refactor/DBFactory.dll
Normal file
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
BIN
RFIDReaderTC/DBOperator/obj/Release/DBFactory.dll
Normal file
BIN
RFIDReaderTC/DBOperator/obj/Release/DBFactory.pdb
Normal file
BIN
RFIDReaderTC/DBOperator/vssver2.scc
Normal file
38
RFIDReaderTC/RFIDReaderTC.sln
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35527.113
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFIDReaderTC", "RFIDReaderTC\RFIDReaderTC.csproj", "{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBFactory", "DBOperator\DBFactory.csproj", "{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Debug|x64.Build.0 = Debug|x64
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Release|x64.ActiveCfg = Release|x64
|
||||
{2C8C06C0-3964-43A9-8F07-C9F3483E96B7}.Release|x64.Build.0 = Release|x64
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4E27122E-93A2-4D17-B8B5-63FAC14F73C0}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
17
RFIDReaderTC/RFIDReaderTC/App.config
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="ReadUrl" value="192.168.0.202" />
|
||||
<add key="UploadPath" value="http://10.165.174.219:30080" />
|
||||
<add key="DispatchPath" value="http://10.165.174.219:30080" />
|
||||
<add key="LEDPath" value="192.168.0.201" />
|
||||
<add key="Antenna1" value="2600" />
|
||||
<add key="Antenna2" value="2600" />
|
||||
<add key="Antenna3" value="2600" />
|
||||
<add key="Antenna4" value="2600" />
|
||||
<add key="Antenna5" value="2600" />
|
||||
<add key="Antenna6" value="2600" />
|
||||
<add key="Antenna7" value="2600" />
|
||||
<add key="Antenna8" value="2600" />
|
||||
</appSettings>
|
||||
</configuration>
|
15
RFIDReaderTC/RFIDReaderTC/App.xaml
Normal file
@ -0,0 +1,15 @@
|
||||
<Application x:Class="RFIDReaderTC.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:RFIDReaderTC"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/RFIDReaderTC;component/Style.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
43
RFIDReaderTC/RFIDReaderTC/App.xaml.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace RFIDReaderTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private static Mutex _mutex = null;
|
||||
const string appName = "RFIDReaderTC";
|
||||
bool createdNew;
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
_mutex = new Mutex(true, appName, out createdNew);
|
||||
|
||||
if (!createdNew)
|
||||
{
|
||||
//应用程序已经在运行!当前的执行退出。
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
public static void Restart()
|
||||
{
|
||||
// 释放互斥锁
|
||||
_mutex.ReleaseMutex();
|
||||
|
||||
string executablePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RFIDReaderTC.exe");
|
||||
System.Diagnostics.Process.Start(executablePath);
|
||||
//System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
|
||||
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
10
RFIDReaderTC/RFIDReaderTC/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
25
RFIDReaderTC/RFIDReaderTC/Commons/Common.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RFIDReaderTC.Commons
|
||||
{
|
||||
public class Common
|
||||
{
|
||||
public static bool checkBarcode(string strCheck, string barcode)
|
||||
{
|
||||
Match mCode = Regex.Match(barcode, strCheck);
|
||||
if (mCode.Success)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace RFIDReaderTC.Commons
|
||||
{
|
||||
public class IndexConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
ListViewItem item = (ListViewItem)value;
|
||||
ListView listView = ItemsControl.ItemsControlFromItemContainer(item) as ListView;
|
||||
int index = listView.ItemContainerGenerator.IndexFromContainer(item) + 1;
|
||||
return index.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class EllipseFillConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool isOK)
|
||||
{
|
||||
return isOK ? Brushes.Green : Brushes.Red;
|
||||
}
|
||||
return Brushes.Gray; // 默认颜色
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class RunTextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool isOK)
|
||||
{
|
||||
return isOK ? "连接成功" : "连接失败";
|
||||
}
|
||||
return "未知状态"; // 默认文本
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class ReadRunTextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool isOK)
|
||||
{
|
||||
return isOK ? "采集中" : "空闲";
|
||||
}
|
||||
return "未知状态"; // 默认文本
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
723
RFIDReaderTC/RFIDReaderTC/Commons/LEDHelper.cs
Normal file
@ -0,0 +1,723 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonClassLib
|
||||
{
|
||||
public class LEDHelper
|
||||
{
|
||||
//string ip = "192.168.1.141";
|
||||
|
||||
/// <summary>
|
||||
/// 射频门创建LED节目
|
||||
/// </summary>
|
||||
/// <param name="IP"></param>
|
||||
/// <param name="logoPath"></param>
|
||||
/// <param name="sResult"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CreateScanScreen(string IP,string logoPath,out string sResult)
|
||||
{
|
||||
byte[] byScreenName = System.Text.Encoding.UTF8.GetBytes("ScanScreen");
|
||||
|
||||
int nRet = ListenDll.LV_CreateScreen(byScreenName);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult="创建屏幕失败"+ GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] byProgramId = System.Text.Encoding.UTF8.GetBytes("ScanProgram");
|
||||
|
||||
page pageInfo = new page();
|
||||
pageInfo.pageId = 0;
|
||||
pageInfo.resolution = "256X64";
|
||||
pageInfo.bgColor = "#000000";
|
||||
string strBgFileName = "";//本地的一个图片文件
|
||||
pageInfo.bgImg = strBgFileName;
|
||||
pageInfo.eqType = "Q5";
|
||||
pageInfo.pageTime = 20;
|
||||
pageInfo.guid = Guid.NewGuid().ToString();
|
||||
|
||||
string strPageInfo = JsonExtension.ToJSON(pageInfo);
|
||||
byte[] byPageInfo = System.Text.Encoding.UTF8.GetBytes(strPageInfo);
|
||||
|
||||
nRet = ListenDll.LV_AddPageToProgram(byScreenName, byProgramId, byPageInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加页面失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
PicArea picArea = new PicArea();
|
||||
|
||||
picArea.id = 1;
|
||||
picArea.type = 1;
|
||||
picArea.borderEffect = 0;
|
||||
picArea.borderSW = 0;
|
||||
picArea.borderSpeed = 0;
|
||||
picArea.borderType = 0;
|
||||
picArea.left = 2;
|
||||
picArea.top = 2;
|
||||
picArea.width = 60;
|
||||
picArea.height = 60;
|
||||
picArea.pauseTime = 5;
|
||||
picArea.rotation = 0;
|
||||
//picArea.siderType = 6;//老的特效,设备系统版本低于4.4.7支持
|
||||
|
||||
//下面4项为新特效模式,设备系统版本4.4.7及以上才支持
|
||||
picArea.picStyleIn = 0;//特效为0时,特效时间无效
|
||||
picArea.picStyleInTime = 10 * 1000;
|
||||
picArea.picStyleOut = 0;//特效为0时,特效时间无效
|
||||
picArea.picStyleOutTime = 10 * 1000;
|
||||
|
||||
|
||||
picArea.picScaleType = 0;
|
||||
|
||||
|
||||
picArea.srcGroup = new List<PicArea.SrcGroup>();
|
||||
PicArea.SrcGroup s = new PicArea.SrcGroup();
|
||||
s.Id = 1;
|
||||
|
||||
s.src = logoPath;
|
||||
picArea.srcGroup.Add(s);
|
||||
picArea.zIndex = 1;
|
||||
string strPicjson = JsonExtension.ToJSON(picArea);//对象转为Json
|
||||
|
||||
byte[] byPicInfo = System.Text.Encoding.UTF8.GetBytes(strPicjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byPicInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加图片失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//射频门
|
||||
TextArea textArea = new TextArea();
|
||||
|
||||
textArea.id = 2;
|
||||
textArea.type = 2;
|
||||
textArea.borderEffect = 0;
|
||||
textArea.borderSW = 0;
|
||||
textArea.borderSpeed = 0;
|
||||
textArea.borderType = 0;
|
||||
textArea.left = 64;
|
||||
textArea.top = 15;
|
||||
textArea.width = 128;
|
||||
textArea.height = 30;
|
||||
|
||||
textArea.background = "#000000";
|
||||
textArea.fontColor = "#00ff00";
|
||||
textArea.fontFamily = "宋体";
|
||||
textArea.fontSize = 30;
|
||||
textArea.italic = 0;
|
||||
textArea.bold = 0;
|
||||
textArea.textLine = 0;
|
||||
textArea.lineHeight = 12;
|
||||
textArea.pauseTime = 5;
|
||||
textArea.scrollSpeed = 1;
|
||||
textArea.siderType = 0;
|
||||
textArea.textAlign = 1;
|
||||
textArea.colorEffect = 0;
|
||||
textArea.textTop = 1;
|
||||
textArea.rotation = 0;
|
||||
textArea.text = "射频门";
|
||||
textArea.textShow = 0;//0: 多行 1:单行
|
||||
|
||||
textArea.zIndex = 1;
|
||||
string strTextjson = JsonExtension.ToJSON(textArea);//对象转为Json
|
||||
|
||||
byte[] byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加字幕失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//箱表
|
||||
TextArea textArea2 = new TextArea();
|
||||
|
||||
textArea2.id = 3;
|
||||
textArea2.type = 2;
|
||||
textArea2.borderEffect = 0;
|
||||
textArea2.borderSW = 0;
|
||||
textArea2.borderSpeed = 0;
|
||||
textArea2.borderType = 0;
|
||||
textArea2.left = 192;
|
||||
textArea2.top = 5;
|
||||
textArea2.width = 64;
|
||||
textArea2.height = 54;
|
||||
|
||||
textArea2.background = "#000000";
|
||||
textArea2.fontColor = "#ff0000";
|
||||
textArea2.fontFamily = "宋体";
|
||||
textArea2.fontSize = 20;
|
||||
textArea2.italic = 0;
|
||||
textArea2.bold = 0;
|
||||
textArea2.textLine = 0;
|
||||
textArea2.lineHeight = 12;
|
||||
textArea2.pauseTime = 5;
|
||||
textArea2.scrollSpeed = 1;
|
||||
textArea2.siderType = 0;
|
||||
textArea2.textAlign = 0;
|
||||
textArea2.colorEffect = 0;
|
||||
textArea2.textTop = 1;
|
||||
textArea2.rotation = 0;
|
||||
textArea2.text = "箱:\r\n表:";
|
||||
//textArea2.text = "";
|
||||
textArea2.textShow = 0;//0: 多行 1:单行
|
||||
|
||||
textArea2.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(textArea2);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加字幕失败"+GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//箱
|
||||
StaticTextArea staticTextAreaBox = new StaticTextArea();
|
||||
|
||||
staticTextAreaBox.id = 4;
|
||||
staticTextAreaBox.type = 200;//静态区域和字幕区域属性有通用的地方.但大部分
|
||||
|
||||
staticTextAreaBox.left = 220;
|
||||
staticTextAreaBox.top = 5;
|
||||
staticTextAreaBox.width = 30;
|
||||
staticTextAreaBox.height = 27;
|
||||
|
||||
|
||||
|
||||
staticTextAreaBox.background = "#000000";
|
||||
staticTextAreaBox.fontColor = "#ff0000";
|
||||
staticTextAreaBox.fontFamily = "宋体";//当前只支持默认字体.字体需要设备端有对应字库才能支持
|
||||
staticTextAreaBox.fontSize = 20;
|
||||
|
||||
staticTextAreaBox.text = "0";
|
||||
//staticTextAreaBox.text = "";
|
||||
|
||||
staticTextAreaBox.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(staticTextAreaBox);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加静态区域失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//表
|
||||
StaticTextArea staticTextAreaGoods = new StaticTextArea();
|
||||
|
||||
staticTextAreaGoods.id = 5;
|
||||
staticTextAreaGoods.type = 200;//静态区域和字幕区域属性有通用的地方.但大部分
|
||||
|
||||
staticTextAreaGoods.left = 220;
|
||||
staticTextAreaGoods.top = 36;
|
||||
staticTextAreaGoods.width = 30;
|
||||
staticTextAreaGoods.height = 27;
|
||||
|
||||
|
||||
|
||||
staticTextAreaGoods.background = "#000000";
|
||||
staticTextAreaGoods.fontColor = "#ff0000";
|
||||
staticTextAreaGoods.fontFamily = "宋体";//当前只支持默认字体.字体需要设备端有对应字库才能支持
|
||||
staticTextAreaGoods.fontSize = 20;
|
||||
//staticTextAreaGoods.italic = 0;
|
||||
//staticTextAreaGoods.bold = 0;
|
||||
//staticTextAreaGoods.textLine = 0;
|
||||
staticTextAreaGoods.text = "0";
|
||||
//staticTextAreaGoods.text = "";
|
||||
|
||||
staticTextAreaGoods.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(staticTextAreaGoods);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加静态区域失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送节目
|
||||
byte[] byIp = System.Text.Encoding.UTF8.GetBytes(IP);
|
||||
byte[] byProgramName = System.Text.Encoding.UTF8.GetBytes("ScanProgramName");
|
||||
|
||||
byte[] byPassword = System.Text.Encoding.UTF8.GetBytes("");
|
||||
|
||||
nRet = ListenDll.LV_SendProgramToDevice(byScreenName, byIp, byProgramId, byProgramName, byPassword);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "发送节目失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送计划
|
||||
List<ProgramPlan> listPlan = new List<ProgramPlan>();
|
||||
|
||||
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
|
||||
ProgramPlan plan1 = new ProgramPlan();
|
||||
plan1.createDate = Convert.ToInt64(ts.TotalMilliseconds);
|
||||
plan1.programId = "ScanProgram";
|
||||
plan1.programName = "ScanProgramName";
|
||||
plan1.programType = 1;
|
||||
plan1.updateDate = Convert.ToInt64(ts.TotalMilliseconds);
|
||||
plan1.date = new List<ProgramPlan.Date>();
|
||||
plan1.planWeekDay = new List<int>();
|
||||
plan1.time = new List<ProgramPlan.Time>();
|
||||
plan1.isDefault = 0;
|
||||
|
||||
listPlan.Add(plan1);
|
||||
|
||||
|
||||
string strPlanJson = JsonExtension.ToJSON(listPlan);//对象转为Json
|
||||
byte[] byPlanInfo = System.Text.Encoding.UTF8.GetBytes(strPlanJson);
|
||||
string strDefVideo = "";//如果是默认节目,同时默认节目中存在视频文件,该字符串才不为空字符串
|
||||
byte[] byDefVideo = System.Text.Encoding.UTF8.GetBytes(strDefVideo);
|
||||
|
||||
nRet = ListenDll.LV_SendProgramPlan(byIp, byPlanInfo, byDefVideo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "发送计划失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
sResult = string.Empty;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新射频门LED节目
|
||||
/// </summary>
|
||||
/// <param name="boxCount"></param>
|
||||
/// <param name="goodsCount"></param>
|
||||
/// <param name="ip"></param>
|
||||
/// <param name="sResult"></param>
|
||||
/// <returns></returns>
|
||||
public static bool refreshScanScreen(string boxCount, string goodsCount, string ip,out string sResult)
|
||||
{
|
||||
RefreshData refreshData = new RefreshData();
|
||||
refreshData.areaId = 4;//区域ID必须与节目中的静态文本区域ID一致才能刷新
|
||||
refreshData.text = boxCount;
|
||||
refreshData.fontColor = "#ff0000";
|
||||
refreshData.refreshTimes = 0;
|
||||
refreshData.base64 = 0;
|
||||
|
||||
RefreshData refreshData2 = new RefreshData();
|
||||
refreshData2.areaId = 5;//区域ID必须与节目中的静态文本区域ID一致才能刷新
|
||||
refreshData2.text = goodsCount;
|
||||
refreshData2.fontColor = "#ff0000";
|
||||
refreshData2.refreshTimes = 0;
|
||||
refreshData2.base64 = 0;
|
||||
|
||||
List<RefreshData> list = new List<RefreshData>();
|
||||
list.Add(refreshData);
|
||||
list.Add(refreshData2);
|
||||
|
||||
string strRefreshData = JsonExtension.ToJSON(list);//对象转为Json
|
||||
|
||||
byte[] byRefreshData = System.Text.Encoding.UTF8.GetBytes(strRefreshData);
|
||||
byte[] byIp = System.Text.Encoding.UTF8.GetBytes(ip);
|
||||
int nRet = ListenDll.LV_RefreshFixedArea(byIp, byRefreshData);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "创建屏幕失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
nRet = ListenDll.LV_CleanProgramTemporary();
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "清除缓存失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
sResult = string.Empty;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 拆码垛机更新LED节目
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="totalCount"></param>
|
||||
/// <param name="ip"></param>
|
||||
/// <param name="sResult"></param>
|
||||
/// <returns></returns>
|
||||
public static bool refreshUnpack(string count, string totalCount, string ip, out string sResult)
|
||||
{
|
||||
RefreshData refreshData = new RefreshData();
|
||||
refreshData.areaId = 4;//区域ID必须与节目中的静态文本区域ID一致才能刷新
|
||||
refreshData.text = count;
|
||||
refreshData.fontColor = "#ff0000";
|
||||
refreshData.refreshTimes = 0;
|
||||
refreshData.base64 = 0;
|
||||
|
||||
RefreshData refreshData2 = new RefreshData();
|
||||
refreshData2.areaId = 5;//区域ID必须与节目中的静态文本区域ID一致才能刷新
|
||||
refreshData2.text = totalCount;
|
||||
refreshData2.fontColor = "#ff0000";
|
||||
refreshData2.refreshTimes = 0;
|
||||
refreshData2.base64 = 0;
|
||||
|
||||
List<RefreshData> list = new List<RefreshData>();
|
||||
list.Add(refreshData);
|
||||
list.Add(refreshData2);
|
||||
|
||||
string strRefreshData = JsonExtension.ToJSON(list);//对象转为Json
|
||||
|
||||
byte[] byRefreshData = System.Text.Encoding.UTF8.GetBytes(strRefreshData);
|
||||
byte[] byIp = System.Text.Encoding.UTF8.GetBytes(ip);
|
||||
int nRet = ListenDll.LV_RefreshFixedArea(byIp, byRefreshData);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "创建屏幕失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
nRet = ListenDll.LV_CleanProgramTemporary();
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "清除缓存失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
sResult = string.Empty;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 拆码垛机创建LED节目
|
||||
/// </summary>
|
||||
/// <param name="IP"></param>
|
||||
/// <param name="logoPath"></param>
|
||||
/// <param name="sResult"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CreateUnpackScreen(string IP, string logoPath, out string sResult)
|
||||
{
|
||||
byte[] byScreenName = System.Text.Encoding.UTF8.GetBytes("ScanScreen");
|
||||
|
||||
int nRet = ListenDll.LV_CreateScreen(byScreenName);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "创建屏幕失败"+GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] byProgramId = System.Text.Encoding.UTF8.GetBytes("ScanProgram");
|
||||
|
||||
page pageInfo = new page();
|
||||
pageInfo.pageId = 0;
|
||||
pageInfo.resolution = "256X64";
|
||||
pageInfo.bgColor = "#000000";
|
||||
string strBgFileName = "";//本地的一个图片文件
|
||||
pageInfo.bgImg = strBgFileName;
|
||||
pageInfo.eqType = "Q5";
|
||||
pageInfo.pageTime = 20;
|
||||
pageInfo.guid = Guid.NewGuid().ToString();
|
||||
|
||||
string strPageInfo = JsonExtension.ToJSON(pageInfo);
|
||||
byte[] byPageInfo = System.Text.Encoding.UTF8.GetBytes(strPageInfo);
|
||||
|
||||
nRet = ListenDll.LV_AddPageToProgram(byScreenName, byProgramId, byPageInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加页面失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
PicArea picArea = new PicArea();
|
||||
|
||||
picArea.id = 1;
|
||||
picArea.type = 1;
|
||||
picArea.borderEffect = 0;
|
||||
picArea.borderSW = 0;
|
||||
picArea.borderSpeed = 0;
|
||||
picArea.borderType = 0;
|
||||
picArea.left = 2;
|
||||
picArea.top = 2;
|
||||
picArea.width = 60;
|
||||
picArea.height = 60;
|
||||
picArea.pauseTime = 5;
|
||||
picArea.rotation = 0;
|
||||
//picArea.siderType = 6;//老的特效,设备系统版本低于4.4.7支持
|
||||
|
||||
//下面4项为新特效模式,设备系统版本4.4.7及以上才支持
|
||||
picArea.picStyleIn = 0;//特效为0时,特效时间无效
|
||||
picArea.picStyleInTime = 10 * 1000;
|
||||
picArea.picStyleOut = 0;//特效为0时,特效时间无效
|
||||
picArea.picStyleOutTime = 10 * 1000;
|
||||
|
||||
|
||||
picArea.picScaleType = 0;
|
||||
|
||||
|
||||
picArea.srcGroup = new List<PicArea.SrcGroup>();
|
||||
PicArea.SrcGroup s = new PicArea.SrcGroup();
|
||||
s.Id = 1;
|
||||
|
||||
s.src = logoPath;
|
||||
picArea.srcGroup.Add(s);
|
||||
picArea.zIndex = 1;
|
||||
string strPicjson = JsonExtension.ToJSON(picArea);//对象转为Json
|
||||
|
||||
byte[] byPicInfo = System.Text.Encoding.UTF8.GetBytes(strPicjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byPicInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加页面失败"+ GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
//拆垛机
|
||||
TextArea textArea = new TextArea();
|
||||
|
||||
textArea.id = 2;
|
||||
textArea.type = 2;
|
||||
textArea.borderEffect = 0;
|
||||
textArea.borderSW = 0;
|
||||
textArea.borderSpeed = 0;
|
||||
textArea.borderType = 0;
|
||||
textArea.left = 64;
|
||||
textArea.top = 15;
|
||||
textArea.width = 128;
|
||||
textArea.height = 30;
|
||||
|
||||
textArea.background = "#000000";
|
||||
textArea.fontColor = "#00ff00";
|
||||
textArea.fontFamily = "宋体";
|
||||
textArea.fontSize = 30;
|
||||
textArea.italic = 0;
|
||||
textArea.bold = 0;
|
||||
textArea.textLine = 0;
|
||||
textArea.lineHeight = 12;
|
||||
textArea.pauseTime = 5;
|
||||
textArea.scrollSpeed = 1;
|
||||
textArea.siderType = 0;
|
||||
textArea.textAlign = 1;
|
||||
textArea.colorEffect = 0;
|
||||
textArea.textTop = 1;
|
||||
textArea.rotation = 0;
|
||||
textArea.text = "拆垛机";
|
||||
textArea.textShow = 0;//0: 多行 1:单行
|
||||
|
||||
textArea.zIndex = 1;
|
||||
string strTextjson = JsonExtension.ToJSON(textArea);//对象转为Json
|
||||
|
||||
byte[] byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
//MessageBox.Show(nRet == 0 ? "添加字幕成功\r\n Text added successfully" : "添加字幕失败\r\nText added failed");
|
||||
|
||||
//第共
|
||||
TextArea textArea2 = new TextArea();
|
||||
|
||||
textArea2.id = 3;
|
||||
textArea2.type = 2;
|
||||
textArea2.borderEffect = 0;
|
||||
textArea2.borderSW = 0;
|
||||
textArea2.borderSpeed = 0;
|
||||
textArea2.borderType = 0;
|
||||
textArea2.left = 192;
|
||||
textArea2.top = 5;
|
||||
textArea2.width = 64;
|
||||
textArea2.height = 54;
|
||||
|
||||
textArea2.background = "#000000";
|
||||
textArea2.fontColor = "#ff0000";
|
||||
textArea2.fontFamily = "宋体";
|
||||
textArea2.fontSize = 20;
|
||||
textArea2.italic = 0;
|
||||
textArea2.bold = 0;
|
||||
textArea2.textLine = 0;
|
||||
textArea2.lineHeight = 12;
|
||||
textArea2.pauseTime = 5;
|
||||
textArea2.scrollSpeed = 1;
|
||||
textArea2.siderType = 0;
|
||||
textArea2.textAlign = 0;
|
||||
textArea2.colorEffect = 0;
|
||||
textArea2.textTop = 1;
|
||||
textArea2.rotation = 0;
|
||||
textArea2.text = "第 箱\r\n共 箱";
|
||||
//textArea2.text = "";
|
||||
textArea2.textShow = 0;//0: 多行 1:单行
|
||||
|
||||
textArea2.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(textArea2);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加字幕失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
//第
|
||||
StaticTextArea staticTextAreaBox = new StaticTextArea();
|
||||
|
||||
staticTextAreaBox.id = 4;
|
||||
staticTextAreaBox.type = 200;//静态区域和字幕区域属性有通用的地方.但大部分
|
||||
|
||||
staticTextAreaBox.left = 211;
|
||||
staticTextAreaBox.top = 1;
|
||||
staticTextAreaBox.width = 30;
|
||||
staticTextAreaBox.height = 27;
|
||||
|
||||
|
||||
|
||||
staticTextAreaBox.background = "#000000";
|
||||
staticTextAreaBox.fontColor = "#ff0000";
|
||||
staticTextAreaBox.fontFamily = "宋体";//当前只支持默认字体.字体需要设备端有对应字库才能支持
|
||||
staticTextAreaBox.fontSize = 20;
|
||||
|
||||
staticTextAreaBox.text = "5";
|
||||
//staticTextAreaBox.text = "";
|
||||
|
||||
staticTextAreaBox.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(staticTextAreaBox);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加静态区域失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
//共
|
||||
StaticTextArea staticTextAreaGoods = new StaticTextArea();
|
||||
|
||||
staticTextAreaGoods.id = 5;
|
||||
staticTextAreaGoods.type = 200;//静态区域和字幕区域属性有通用的地方.但大部分
|
||||
|
||||
staticTextAreaGoods.left = 211;
|
||||
staticTextAreaGoods.top = 33;
|
||||
staticTextAreaGoods.width = 30;
|
||||
staticTextAreaGoods.height = 27;
|
||||
|
||||
|
||||
|
||||
staticTextAreaGoods.background = "#000000";
|
||||
staticTextAreaGoods.fontColor = "#ff0000";
|
||||
staticTextAreaGoods.fontFamily = "宋体";//当前只支持默认字体.字体需要设备端有对应字库才能支持
|
||||
staticTextAreaGoods.fontSize = 20;
|
||||
//staticTextAreaGoods.italic = 0;
|
||||
//staticTextAreaGoods.bold = 0;
|
||||
//staticTextAreaGoods.textLine = 0;
|
||||
staticTextAreaGoods.text = "60";
|
||||
//staticTextAreaGoods.text = "";
|
||||
|
||||
staticTextAreaGoods.zIndex = 1;
|
||||
strTextjson = JsonExtension.ToJSON(staticTextAreaGoods);//对象转为Json
|
||||
|
||||
byTextInfo = System.Text.Encoding.UTF8.GetBytes(strTextjson);
|
||||
|
||||
nRet = ListenDll.LV_AddArea(byScreenName, byProgramId, 0, byTextInfo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "添加静态区域失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送节目
|
||||
byte[] byIp = System.Text.Encoding.UTF8.GetBytes(IP);
|
||||
byte[] byProgramName = System.Text.Encoding.UTF8.GetBytes("ScanProgramName");
|
||||
|
||||
byte[] byPassword = System.Text.Encoding.UTF8.GetBytes("");
|
||||
|
||||
nRet = ListenDll.LV_SendProgramToDevice(byScreenName, byIp, byProgramId, byProgramName, byPassword);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "发送节目失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
//发送计划
|
||||
List<ProgramPlan> listPlan = new List<ProgramPlan>();
|
||||
|
||||
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
|
||||
ProgramPlan plan1 = new ProgramPlan();
|
||||
plan1.createDate = Convert.ToInt64(ts.TotalMilliseconds);
|
||||
plan1.programId = "ScanProgram";
|
||||
plan1.programName = "ScanProgramName";
|
||||
plan1.programType = 1;
|
||||
plan1.updateDate = Convert.ToInt64(ts.TotalMilliseconds);
|
||||
plan1.date = new List<ProgramPlan.Date>();
|
||||
plan1.planWeekDay = new List<int>();
|
||||
plan1.time = new List<ProgramPlan.Time>();
|
||||
plan1.isDefault = 0;
|
||||
|
||||
listPlan.Add(plan1);
|
||||
|
||||
|
||||
string strPlanJson = JsonExtension.ToJSON(listPlan);//对象转为Json
|
||||
byte[] byPlanInfo = System.Text.Encoding.UTF8.GetBytes(strPlanJson);
|
||||
string strDefVideo = "";//如果是默认节目,同时默认节目中存在视频文件,该字符串才不为空字符串
|
||||
byte[] byDefVideo = System.Text.Encoding.UTF8.GetBytes(strDefVideo);
|
||||
|
||||
nRet = ListenDll.LV_SendProgramPlan(byIp, byPlanInfo, byDefVideo);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
sResult = "发送节目失败" + GetErrInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
sResult=string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string GetErrInfo()
|
||||
{
|
||||
byte[] byErrInfo = new byte[1024];
|
||||
int nRet = ListenDll.LV_GetLastErrInfo(byErrInfo, 1024);
|
||||
if (nRet > 0)
|
||||
{
|
||||
return Encoding.UTF8.GetString(byErrInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
271
RFIDReaderTC/RFIDReaderTC/Commons/ListenDll.cs
Normal file
@ -0,0 +1,271 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonClassLib
|
||||
{
|
||||
public static class ListenDll
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化DLL
|
||||
/// <param name="nlog">是否生成log日志文件</para>
|
||||
/// </summary>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static void LV_InitDllEx(int nlog);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化DLL
|
||||
/// <param name="nlog">是否生成log日志文件</para>
|
||||
/// <param name="pWorkPath">软件的工作目录,用来存储节目文件,临时文件</param>
|
||||
/// </summary>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static void LV_InitDllEx2(int nlog, byte[] pWorkPath);
|
||||
|
||||
/// <summary>
|
||||
/// 释放dll
|
||||
/// </summary>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static void LV_ReleaseDllEx();
|
||||
|
||||
/// <summary>
|
||||
/// 获取dll的版本号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static UInt32 LV_DllVersion();
|
||||
/// <summary>
|
||||
/// 搜索设备
|
||||
/// </summary>
|
||||
/// <param name="pDeviceInfo">设备数据的数组</param>
|
||||
/// <param name="nBufLen">数组的长度</param>
|
||||
/// <returns>搜索到的设备数量</returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SearchDeviceInfoEx(byte[] pDeviceInfo, int nBufLen);
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个节目页面
|
||||
/// </summary>
|
||||
/// <param name="pScreenName">屏幕名称</param>
|
||||
/// <param name="pProgramId">节目id</param>
|
||||
/// <param name="pPageJson">页面数据的json</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_AddPageToProgram(byte[] pScreenName, byte[] pProgramId, byte[] pPageJson);
|
||||
/// <summary>
|
||||
/// 给节目添加一个区域信息
|
||||
/// </summary>
|
||||
/// <param name="pScreenName">屏幕名称</param>
|
||||
/// <param name="pProgramId">节目id</param>
|
||||
/// <param name="nPageId">页面</param>
|
||||
/// <param name="pAreaInfoJson">区域json</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_AddArea(byte[] pScreenName, byte[] pProgramId, int nPageId, byte[] pAreaInfoJson);
|
||||
/// <summary>
|
||||
/// 发送对应IP的节目 与LV_SendProgramToDevice2的区别详见接口文档
|
||||
/// </summary>
|
||||
/// <param name="pIp">设备ip</param>
|
||||
/// <param name="pProgramId">节目id</param>
|
||||
/// <param name="pProgramName">节目名</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SendProgramToDevice(byte[] pScreenName, byte[] pIp, byte[] pProgramId, byte[] pProgramName, byte[] pPassword);
|
||||
|
||||
/// <summary>
|
||||
/// 发送对应IP的节目 与LV_SendProgramToDevice的区别详见接口文档
|
||||
/// </summary>
|
||||
/// <param name="pIp">设备ip</param>
|
||||
/// <param name="pProgramId">节目id</param>
|
||||
/// <param name="pProgramName">节目名</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SendProgramToDevice2(byte[] pScreenName, byte[] pIp, byte[] pProgramId, byte[] pProgramName, byte[] pPassword);
|
||||
|
||||
/// <summary>
|
||||
/// 发送对应IP的节目计划
|
||||
/// </summary>
|
||||
/// <param name="pIp">设备ip</param>
|
||||
/// <param name="pPlanData">计划数据</param>
|
||||
/// <param name="pDefResVideoFile">默认节目中使用的视频资源组成的json.如果没有默认节目,或默认节目中没有使用视频,则该值为空字符串</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SendProgramPlan(byte[] pIp, byte[] pPlanData, byte[] pDefResVideoFile);
|
||||
|
||||
/// <summary>
|
||||
/// 发送对应IP的节目计划2
|
||||
/// </summary>
|
||||
/// <param name="pIp">设备ip</param>
|
||||
/// <param name="pPlanData">计划数据</param>
|
||||
/// <param name="pDefResVideoFile">默认节目中使用的视频资源组成的json.如果没有默认节目,或默认节目中没有使用视频,则该值为空字符串</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SendProgramPlan2(byte[] pIp, byte[] pPlanData, byte[] pDefResVideoFile);
|
||||
|
||||
/// <summary>
|
||||
/// 用来清除节目生成的临时文件和临时数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_CleanProgramTemporary();
|
||||
|
||||
/// <summary>
|
||||
/// 开关屏
|
||||
/// </summary>
|
||||
/// <param name="pIp"></param>
|
||||
/// <param name="isOn"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_SwitchLed(byte[] pIp, int isOn);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个屏幕,如果之前存在这个屏幕数据,那么之前的数据将会被删除
|
||||
/// </summary>
|
||||
/// <param name="pScreenName">屏幕名称</param>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_CreateScreen(byte[] pScreenName);
|
||||
|
||||
/// <summary>
|
||||
/// 刷新固定区域(静态文本区域)
|
||||
/// </summary>
|
||||
/// <param name="pIp">发送的设备的ip地址</param>
|
||||
/// <param name="pInfo">参数;详见接口说明文档</param>
|
||||
/// <returns>0:成功 -1:失败,可调用LV_GetLastErrInfo()接口获取错误信息</returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_RefreshFixedArea(byte[] pIp, byte[] pInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 清理设备存储
|
||||
/// </summary>
|
||||
/// <param name="pIp">发送的设备的ip地址</param>
|
||||
/// <returns>0:成功 -1:失败,可调用LV_GetLastErrInfo()接口获取错误信息</returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_ClearDeviceSpace(byte[] pIp);
|
||||
|
||||
/// <summary>
|
||||
/// <para name="pErrInfo">错误信息数据的数组</para>
|
||||
/// <param name="nBufLen">数组长度</param>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_GetLastErrInfo(byte[] pErrInfo, int nBufLen);
|
||||
|
||||
/// <summary>
|
||||
/// 刷新图片区域的显示
|
||||
/// </summary>
|
||||
/// <param name="pIp">发送的设备的ip地址</param>
|
||||
/// <param name="pInfo">参数;详见接口说明文档</param>
|
||||
/// <returns>0:成功 -1:失败,可调用LV_GetLastErrInfo()接口获取错误信息</returns>
|
||||
[DllImport(@"ListenLedX3.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
public extern static int LV_RefreshPictureArea(byte[] pIp, byte[] pInfo);
|
||||
}
|
||||
|
||||
|
||||
public static class JsonExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 把对象转换为JSON字符串
|
||||
/// </summary>
|
||||
/// <param name="o">对象</param>
|
||||
/// <returns>JSON字符串</returns>
|
||||
public static string ToJSON(this object o)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return JsonConvert.SerializeObject(o);
|
||||
}
|
||||
/// <summary>
|
||||
/// 把Json文本转为实体
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static T FromJSON<T>(this string input)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(input);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class DeviceInfo
|
||||
{
|
||||
public List<Device> device;
|
||||
|
||||
public class Device
|
||||
{
|
||||
private string _ip;
|
||||
|
||||
public string ip
|
||||
{
|
||||
get { return _ip; }
|
||||
set { _ip = value; }
|
||||
}
|
||||
private string _mac;
|
||||
|
||||
public string mac
|
||||
{
|
||||
get { return _mac; }
|
||||
set { _mac = value; }
|
||||
}
|
||||
private string _name;
|
||||
|
||||
public string name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
private string _pattern;
|
||||
|
||||
public string pattern
|
||||
{
|
||||
get { return _pattern; }
|
||||
set { _pattern = value; }
|
||||
}
|
||||
private string _width;
|
||||
|
||||
public string width
|
||||
{
|
||||
get { return _width; }
|
||||
set { _width = value; }
|
||||
}
|
||||
private string _height;
|
||||
|
||||
public string height
|
||||
{
|
||||
get { return _height; }
|
||||
set { _height = value; }
|
||||
}
|
||||
private string _systemVersion;
|
||||
|
||||
public string systemVersion
|
||||
{
|
||||
get { return _systemVersion; }
|
||||
set { _systemVersion = value; }
|
||||
}
|
||||
private string _cardMemory;
|
||||
|
||||
public string cardMemory
|
||||
{
|
||||
get { return _cardMemory; }
|
||||
set { _cardMemory = value; }
|
||||
}
|
||||
}
|
||||
public DeviceInfo()
|
||||
{
|
||||
device = new List<Device>();
|
||||
}
|
||||
}
|
||||
}
|
1017
RFIDReaderTC/RFIDReaderTC/Commons/PorgramData.cs
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"ExtendedData": {
|
||||
"inputs": [
|
||||
"http://24.50.92.184:17021/RGDWCSService/"
|
||||
],
|
||||
"collectionTypes": [
|
||||
"System.Array",
|
||||
"System.Collections.Generic.Dictionary`2"
|
||||
],
|
||||
"namespaceMappings": [
|
||||
"*, ServiceReference1"
|
||||
],
|
||||
"targetFramework": "net6.0",
|
||||
"typeReuseMode": "None"
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,并在以下条件下丢失:
|
||||
// 代码重新生成。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ServiceReference1
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
|
||||
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference1.IRGDWCSService")]
|
||||
public interface IRGDWCSService
|
||||
{
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/getWhEquipStatus", ReplyAction="http://tempuri.org/IRGDWCSService/getWhEquipStatusResponse")]
|
||||
System.Threading.Tasks.Task<string> getWhEquipStatusAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/packTask", ReplyAction="http://tempuri.org/IRGDWCSService/packTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> packTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/startArrangeTask", ReplyAction="http://tempuri.org/IRGDWCSService/startArrangeTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> startArrangeTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/startInTask", ReplyAction="http://tempuri.org/IRGDWCSService/startInTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> startInTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/startInventoryTask", ReplyAction="http://tempuri.org/IRGDWCSService/startInventoryTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> startInventoryTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/startBoxInvTask", ReplyAction="http://tempuri.org/IRGDWCSService/startBoxInvTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> startBoxInvTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/startOutTask", ReplyAction="http://tempuri.org/IRGDWCSService/startOutTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> startOutTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/stopTask", ReplyAction="http://tempuri.org/IRGDWCSService/stopTaskResponse")]
|
||||
System.Threading.Tasks.Task<string> stopTaskAsync(string xml);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/RFIDReadyToRead", ReplyAction="http://tempuri.org/IRGDWCSService/RFIDReadyToReadResponse")]
|
||||
System.Threading.Tasks.Task<string> RFIDReadyToReadAsync(string station_code);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/RFIDRequestWithReturn", ReplyAction="http://tempuri.org/IRGDWCSService/RFIDRequestWithReturnResponse")]
|
||||
System.Threading.Tasks.Task<string> RFIDRequestWithReturnAsync(string RFIDRequest);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/ReadyToHandleVision", ReplyAction="http://tempuri.org/IRGDWCSService/ReadyToHandleVisionResponse")]
|
||||
System.Threading.Tasks.Task<int> ReadyToHandleVisionAsync(string station_code);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/VISIONRequestWithReturn", ReplyAction="http://tempuri.org/IRGDWCSService/VISIONRequestWithReturnResponse")]
|
||||
System.Threading.Tasks.Task<string> VISIONRequestWithReturnAsync(string VISIONRequest);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRGDWCSService/Update_IO_Vision", ReplyAction="http://tempuri.org/IRGDWCSService/Update_IO_VisionResponse")]
|
||||
System.Threading.Tasks.Task<int> Update_IO_VisionAsync(string device_code, int read_flag);
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
|
||||
public interface IRGDWCSServiceChannel : ServiceReference1.IRGDWCSService, System.ServiceModel.IClientChannel
|
||||
{
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")]
|
||||
public partial class RGDWCSServiceClient : System.ServiceModel.ClientBase<ServiceReference1.IRGDWCSService>, ServiceReference1.IRGDWCSService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 实现此分部方法,配置服务终结点。
|
||||
/// </summary>
|
||||
/// <param name="serviceEndpoint">要配置的终结点</param>
|
||||
/// <param name="clientCredentials">客户端凭据</param>
|
||||
static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
|
||||
|
||||
public RGDWCSServiceClient() :
|
||||
base(RGDWCSServiceClient.GetDefaultBinding(), RGDWCSServiceClient.GetDefaultEndpointAddress())
|
||||
{
|
||||
this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IRGDWCSService.ToString();
|
||||
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
|
||||
}
|
||||
|
||||
public RGDWCSServiceClient(EndpointConfiguration endpointConfiguration) :
|
||||
base(RGDWCSServiceClient.GetBindingForEndpoint(endpointConfiguration), RGDWCSServiceClient.GetEndpointAddress(endpointConfiguration))
|
||||
{
|
||||
this.Endpoint.Name = endpointConfiguration.ToString();
|
||||
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
|
||||
}
|
||||
|
||||
public RGDWCSServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
|
||||
base(RGDWCSServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
|
||||
{
|
||||
this.Endpoint.Name = endpointConfiguration.ToString();
|
||||
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
|
||||
}
|
||||
|
||||
public RGDWCSServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
|
||||
base(RGDWCSServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
|
||||
{
|
||||
this.Endpoint.Name = endpointConfiguration.ToString();
|
||||
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
|
||||
}
|
||||
|
||||
public RGDWCSServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
|
||||
base(binding, remoteAddress)
|
||||
{
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> getWhEquipStatusAsync(string xml)
|
||||
{
|
||||
return base.Channel.getWhEquipStatusAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> packTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.packTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> startArrangeTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.startArrangeTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> startInTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.startInTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> startInventoryTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.startInventoryTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> startBoxInvTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.startBoxInvTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> startOutTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.startOutTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> stopTaskAsync(string xml)
|
||||
{
|
||||
return base.Channel.stopTaskAsync(xml);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> RFIDReadyToReadAsync(string station_code)
|
||||
{
|
||||
return base.Channel.RFIDReadyToReadAsync(station_code);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> RFIDRequestWithReturnAsync(string RFIDRequest)
|
||||
{
|
||||
return base.Channel.RFIDRequestWithReturnAsync(RFIDRequest);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<int> ReadyToHandleVisionAsync(string station_code)
|
||||
{
|
||||
return base.Channel.ReadyToHandleVisionAsync(station_code);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<string> VISIONRequestWithReturnAsync(string VISIONRequest)
|
||||
{
|
||||
return base.Channel.VISIONRequestWithReturnAsync(VISIONRequest);
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<int> Update_IO_VisionAsync(string device_code, int read_flag)
|
||||
{
|
||||
return base.Channel.Update_IO_VisionAsync(device_code, read_flag);
|
||||
}
|
||||
|
||||
public virtual System.Threading.Tasks.Task OpenAsync()
|
||||
{
|
||||
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
|
||||
}
|
||||
|
||||
private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
|
||||
{
|
||||
if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IRGDWCSService))
|
||||
{
|
||||
System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
|
||||
result.MaxBufferSize = int.MaxValue;
|
||||
result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
|
||||
result.MaxReceivedMessageSize = int.MaxValue;
|
||||
result.AllowCookies = true;
|
||||
return result;
|
||||
}
|
||||
throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
|
||||
}
|
||||
|
||||
private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
|
||||
{
|
||||
if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IRGDWCSService))
|
||||
{
|
||||
return new System.ServiceModel.EndpointAddress("http://24.50.92.184:17021/RGDWCSService/");
|
||||
}
|
||||
throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
|
||||
}
|
||||
|
||||
private static System.ServiceModel.Channels.Binding GetDefaultBinding()
|
||||
{
|
||||
return RGDWCSServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IRGDWCSService);
|
||||
}
|
||||
|
||||
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
|
||||
{
|
||||
return RGDWCSServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IRGDWCSService);
|
||||
}
|
||||
|
||||
public enum EndpointConfiguration
|
||||
{
|
||||
|
||||
BasicHttpBinding_IRGDWCSService,
|
||||
}
|
||||
}
|
||||
}
|
393
RFIDReaderTC/RFIDReaderTC/MainWindow.xaml
Normal file
@ -0,0 +1,393 @@
|
||||
<Window x:Class="RFIDReaderTC.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:RFIDReaderTC"
|
||||
xmlns:local_index="clr-namespace:RFIDReaderTC.Commons"
|
||||
xmlns:viewmodel="clr-namespace:RFIDReaderTC.ViewModel"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
mc:Ignorable="d"
|
||||
Title="智能库房采集系统" Height="850" Width="1200">
|
||||
<!--<Window.DataContext>
|
||||
<viewmodel:MainWindowViewModel></viewmodel:MainWindowViewModel>
|
||||
</Window.DataContext>-->
|
||||
<Window.Resources>
|
||||
<Style TargetType="Thumb" x:Key="CustomThumbStyle">
|
||||
<!-- 设置Thumb的背景 -->
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<!-- 设置Thumb的边框 -->
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<!-- 设置Thumb的宽度 -->
|
||||
<Setter Property="Height" Value="20"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="Cursor" Value="SizeNS"/>
|
||||
|
||||
<!-- 自定义控件模板 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Grid>
|
||||
<!-- 这里可以定义Thumb的内容 -->
|
||||
<Rectangle Fill="Transparent" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<local_index:IndexConverter x:Key="IndexToSerialNumberConverter" />
|
||||
<local_index:RunTextConverter x:Key="RunTextConverter" />
|
||||
<local_index:ReadRunTextConverter x:Key="ReadRunTextConverter" />
|
||||
<local_index:EllipseFillConverter x:Key="EllipseFillConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="#EFF1F3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="68"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="15"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Background="White">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="1" Source="/Resources/Image/title.png" VerticalAlignment="Center" HorizontalAlignment="Right"></Image>
|
||||
<WrapPanel Grid.Column="0" VerticalAlignment="Center" Margin="50,0,0,0">
|
||||
<Image Source="/Resources/Image/kufanghuanjing.png" Height="25" Margin="0,0,15,0"></Image>
|
||||
<Image Source="/Resources/Image/name.png" Height="20"></Image>
|
||||
</WrapPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Name="MenuView" Panel.ZIndex="1" Visibility="{Binding MenuView, Converter={StaticResource BoolToVisibilityConverter}}" Grid.Row="1" Grid.Column="2" >
|
||||
<Border Background="White" CornerRadius="10" Margin="20,10">
|
||||
<Grid Margin="30,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="70"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Margin="40" Grid.Row="0">
|
||||
<TextBlock FontSize="20" FontWeight="Bold" Foreground="#666">基 础 配 置</TextBlock>
|
||||
<StackPanel Margin="10,20">
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">工控平台地址:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Grid.Column="1" Text="{Binding UploadPath}"></TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">调度服务地址:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Grid.Column="1" Text="{Binding DispatchPath}"></TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">读写器IP:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Grid.Column="1" Text="{Binding ReadUrl}"></TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">LED IP:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Grid.Column="1" Text="{Binding LEDPath}"></TextBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<TextBlock FontSize="20" FontWeight="Bold" Foreground="#666">读 写 器 配 置</TextBlock>
|
||||
<Grid Margin="10,20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线1读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna1}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线2读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna2}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线3读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna3}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线4读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna4}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Column="1" HorizontalAlignment="Left">
|
||||
<StackPanel>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线5读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna5}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线6读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna6}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线7读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna7}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="0">天线8读取功率:</TextBlock>
|
||||
<TextBox VerticalAlignment="Center" InputMethod.IsInputMethodEnabled="False" Width="100" Text="{Binding Antenna8}" HorizontalAlignment="Left" Grid.Column="1">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewTextInput">
|
||||
<i:CallMethodAction TargetObject="{Binding}" MethodName="TextBox_PreviewTextInput"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" >
|
||||
<Button HorizontalAlignment="Right" Width="110" Content="保存配置并重启" Command="{Binding ButtonSaveCommand}" Height="40" Margin="30,0,180,0" VerticalAlignment="Center">
|
||||
<Button.Resources>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border BorderThickness="1" BorderBrush="#2048EC" CornerRadius="5" Background="Transparent">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="#2048EC"/>
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Issensor}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
<Button HorizontalAlignment="Right" Width="120" Style="{StaticResource BtnCornerRadius2}" Command="{Binding ButtonMenuViewCommand}" Content="退出" Height="40" Margin="30,0" VerticalAlignment="Center"></Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid Name="HomeView" Grid.Row="1" Grid.Column="2">
|
||||
<Grid Margin="20,20,20,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="20"></RowDefinition>
|
||||
<RowDefinition Height="150"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Grid.RowSpan="3" Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="3*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" Name="MainGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="4*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Background="White" Margin="0,0,0,1" CornerRadius="10,10,0,0">
|
||||
<Grid Margin="20,0">
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" FontSize="16" Foreground="#000000">箱条码</TextBlock>
|
||||
<WrapPanel VerticalAlignment="Center" HorizontalAlignment='Right'>
|
||||
<Image Source="/Resources/Image/icon1.png" Height="15" Margin="0,0,10,0"></Image>
|
||||
<TextBlock x:Name="lbTagsCount" Grid.Row="0" FontSize="16" Foreground="#00BD62" Text="{Binding LbTagsCount,Mode=OneWay}"></TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Row="1" CornerRadius="0,0,10,10">
|
||||
<ListView ItemsSource="{Binding TagInfos}" Background="White" BorderBrush="Transparent" BorderThickness="0" AlternationCount="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<!-- 序号列 -->
|
||||
<GridViewColumn Width="80" Header="序号" DisplayMemberBinding ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Converter={StaticResource IndexToSerialNumberConverter}}" />
|
||||
<GridViewColumn Width="400" Header="资产条码" DisplayMemberBinding="{Binding Tag,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<GridViewColumn Width="200" Header="采集次数" DisplayMemberBinding="{Binding Count,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Border>
|
||||
<!-- 拖动区域 -->
|
||||
<Thumb Grid.Row="2" Height="20" Style="{StaticResource CustomThumbStyle}" DragDelta="Thumb_DragDelta" VerticalAlignment="Center" Cursor="SizeNS"/>
|
||||
<Border Grid.Row="3" Background="White" Margin="0,0,0,1" CornerRadius="10,10,0,0">
|
||||
<Grid Margin="20,0">
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" FontSize="16" Foreground="#000000">表条码</TextBlock>
|
||||
<WrapPanel VerticalAlignment="Center" HorizontalAlignment='Right'>
|
||||
<Image Source="/Resources/Image/icon1.png" Height="15" Margin="0,0,10,0"></Image>
|
||||
<TextBlock x:Name="BoxCount" Grid.Row="0" FontSize="16" Foreground="#00BD62" Text="{Binding LbGoodsTagsCount,Mode=OneWay}"></TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Row="4" Background="White" CornerRadius="0,0,10,10">
|
||||
<ListView ItemsSource="{Binding GoodsTagInfos}" Background="White" BorderBrush="Transparent" BorderThickness="0">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<!-- 序号列 -->
|
||||
<GridViewColumn Width="80" Header="序号" DisplayMemberBinding ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Converter={StaticResource IndexToSerialNumberConverter}}" />
|
||||
<GridViewColumn Width="400" Header="资产条码" DisplayMemberBinding="{Binding Tag,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<GridViewColumn Width="200" Header="采集次数" DisplayMemberBinding="{Binding Count,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6*"></RowDefinition>
|
||||
<RowDefinition Height="2.2*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<RichTextBox Grid.Row="0" Name="Mesg" ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
|
||||
</RichTextBox>
|
||||
<!--<WrapPanel Grid.Row="1">
|
||||
<Button Width="100" Height="30" Command="{Binding ButtonConnectCommand}">连接</Button>
|
||||
</WrapPanel>-->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Height="70" Style="{StaticResource BtnCornerRadius_2}" Command="{Binding ButtonReadOpenCommand}" Margin="0,10" Content="开 始 读 取" IsEnabled="{Binding ReaderPerson}"></Button>
|
||||
<Button Grid.Column="2" Height="70" Style="{StaticResource BtnCornerRadius_1}" Command="{Binding ButtonReadCloseCommand}" Margin="0,10" Content="停 止 读 取" IsEnabled="{Binding ReaderPerson}"></Button>
|
||||
</Grid>
|
||||
<StackPanel VerticalAlignment="Bottom">
|
||||
<Button Height="70" Style="{StaticResource BtnCornerRadius_1}" Command="{Binding ButtonMenuViewCommand}" Margin="0,10" Content="功 能 设 置" Click="Button_Click"></Button>
|
||||
<!--<Button Width="100" Height="30" Command="{Binding ButtonAddCommand}">增加数据</Button>-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Grid.Row="2" Margin="20,5,20,5" Background="White" CornerRadius="10">
|
||||
<WrapPanel VerticalAlignment="Center" Margin="20,0">
|
||||
<WrapPanel>
|
||||
<Ellipse Width="20" Height="20" Fill="{Binding DispatchState, Converter={StaticResource EllipseFillConverter}}" />
|
||||
<TextBlock Margin="10,0,0,0" VerticalAlignment="Center">
|
||||
调度服务连接状态:
|
||||
<Run Foreground="{Binding DispatchState, Converter={StaticResource EllipseFillConverter}}" Text="{Binding DispatchState, Converter={StaticResource RunTextConverter}}"/>
|
||||
</TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="50,0">
|
||||
<Ellipse Width="20" Height="20" Fill="{Binding ReaderState, Converter={StaticResource EllipseFillConverter}}" />
|
||||
<TextBlock Margin="10,0,0,0" VerticalAlignment="Center">
|
||||
读写器连接状态:
|
||||
<Run Foreground="{Binding ReaderState, Converter={StaticResource EllipseFillConverter}}" Text="{Binding ReaderState, Converter={StaticResource RunTextConverter}}"/>
|
||||
</TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Ellipse Width="20" Height="20" Fill="Green" />
|
||||
<TextBlock Margin="10,0,0,0" VerticalAlignment="Center">
|
||||
读写器工作状态:
|
||||
<Run Foreground="Green" Text="{Binding ReadIsOpen, Converter={StaticResource ReadRunTextConverter}}"/>
|
||||
</TextBlock>
|
||||
</WrapPanel>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
50
RFIDReaderTC/RFIDReaderTC/MainWindow.xaml.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using RFIDReaderTC.Model;
|
||||
using RFIDReaderTC.ViewModel;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace RFIDReaderTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 传递 MainWindow 的实例到 ViewModel
|
||||
this.DataContext = new MainWindowViewModel(this);
|
||||
var viewModel = (MainWindowViewModel)this.DataContext;
|
||||
Mesg.Document = viewModel.RichText; // 将 FlowDocument 赋值给 RichTextBox 的 Document 属性
|
||||
}
|
||||
|
||||
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
|
||||
{
|
||||
// 获取第1行的RowDefinition
|
||||
var rowDefinition = MainGrid.RowDefinitions[1];
|
||||
|
||||
// 计算新的行高度
|
||||
double newHeight = rowDefinition.Height.Value + e.VerticalChange;
|
||||
|
||||
// 设置新的行高度,避免行高度为负数
|
||||
if (newHeight >= 0)
|
||||
{
|
||||
rowDefinition.Height = new GridLength(newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
1358
RFIDReaderTC/RFIDReaderTC/Model/ReaderRunTime.cs
Normal file
25
RFIDReaderTC/RFIDReaderTC/Model/TagInfo.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace RFIDReaderTC.Model
|
||||
{
|
||||
|
||||
public partial class TagInfo : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string tag;
|
||||
|
||||
[ObservableProperty]
|
||||
private int count;
|
||||
|
||||
public TagInfo() {Tag = ""; Count = 0; }
|
||||
public TagInfo(string tag, int count) { Tag = tag; Count = count; }
|
||||
|
||||
}
|
||||
}
|
112
RFIDReaderTC/RFIDReaderTC/RFIDReaderTC.csproj
Normal file
@ -0,0 +1,112 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<ApplicationIcon>Resources\Image\icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\Image\add.png" />
|
||||
<None Remove="Resources\Image\back.png" />
|
||||
<None Remove="Resources\Image\back1.png" />
|
||||
<None Remove="Resources\Image\back2.png" />
|
||||
<None Remove="Resources\Image\back3.png" />
|
||||
<None Remove="Resources\Image\back3_1.png" />
|
||||
<None Remove="Resources\Image\back4.png" />
|
||||
<None Remove="Resources\Image\back4_1.png" />
|
||||
<None Remove="Resources\Image\chaxun.png" />
|
||||
<None Remove="Resources\Image\icon.ico" />
|
||||
<None Remove="Resources\Image\icon1.png" />
|
||||
<None Remove="Resources\Image\kufanghuanjing.png" />
|
||||
<None Remove="Resources\Image\name.png" />
|
||||
<None Remove="Resources\Image\shezhi.png" />
|
||||
<None Remove="Resources\Image\title.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Image\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="HandyControl" Version="3.5.1" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="6.0.*" />
|
||||
<PackageReference Include="System.ServiceModel.Federation" Version="6.0.0" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="6.0.0" />
|
||||
<PackageReference Include="System.ServiceModel.NetNamedPipe" Version="6.0.*" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="6.0.*" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="6.0.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="View\" />
|
||||
<Folder Include="NetWork\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DBOperator\DBFactory.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="ModuleAPI">
|
||||
<HintPath>bin\Debug\net6.0-windows\ModuleAPI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Image\add.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back2.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back3.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back3_1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back4.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\back4_1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\chaxun.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\icon.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\icon1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\kufanghuanjing.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\name.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\shezhi.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Image\title.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
17
RFIDReaderTC/RFIDReaderTC/RFIDReaderTC.csproj.user
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Update="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="MainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Style.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/add.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back1.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back2.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back3.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back3_1.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back4.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/back4_1.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/chaxun.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/icon.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/icon1.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/kufanghuanjing.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/name.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/shezhi.png
Normal file
After Width: | Height: | Size: 725 B |
BIN
RFIDReaderTC/RFIDReaderTC/Resources/Image/title.png
Normal file
After Width: | Height: | Size: 28 KiB |
370
RFIDReaderTC/RFIDReaderTC/Style.xaml
Normal file
@ -0,0 +1,370 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="dgButton" TargetType="Button" >
|
||||
<Setter Property="FontSize" Value="40"/>
|
||||
<Setter Property="Content" Value="按钮"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<!--<RadialGradientBrush>
|
||||
<GradientStop Color="#FFC564B8" Offset="0"/>
|
||||
<GradientStop Color="#FFF57A7A" Offset="1"/>
|
||||
</RadialGradientBrush>-->
|
||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FFC564B8" Offset="0"/>
|
||||
<GradientStop Color="#FFF57A7A" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style >
|
||||
<ControlTemplate x:Key="buttonTemplate" TargetType="Button" >
|
||||
<Border BorderThickness="1" CornerRadius="30" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<!--<Grid >
|
||||
<Ellipse Name="faceEllipse" Height="50" Width="100" Fill="{TemplateBinding Button.Background}"/>
|
||||
<TextBlock Name="txtBlock" />
|
||||
</Grid >-->
|
||||
<ControlTemplate.Triggers >
|
||||
<Trigger Property="Button.IsMouseOver" Value="True">
|
||||
<Setter Property="Button.Background" Value="blue"/>
|
||||
</Trigger >
|
||||
</ControlTemplate.Triggers >
|
||||
</ControlTemplate >
|
||||
|
||||
<!--文本框圆角效果-->
|
||||
<ControlTemplate x:Key="FilletTextBox" TargetType="{x:Type TextBox}">
|
||||
<Border Background="#EBEBEB" CornerRadius="8">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<!--禁用button的悬浮效果-->
|
||||
<Style x:Key="ButtonStyle" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="{x:Null}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Cursor" Value="No"/>
|
||||
<Setter Property="Opacity" Value="0.2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!--禁用button的悬浮效果 加 圆角 带描边的-->
|
||||
<Style x:Key="BtnCornerRadius" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border BorderThickness="1" BorderBrush="#2048EC" CornerRadius="5" Background="Transparent">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="#2048EC"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BtnCornerRadius_1" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="/Resources/Image/back3_1.png"></ImageBrush>
|
||||
</Border.Background>
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Style>
|
||||
<Style x:Key="BtnCornerRadius_2" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="/Resources/Image/back4_1.png"></ImageBrush>
|
||||
</Border.Background>
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Style>
|
||||
<Style x:Key="BtnCornerRadius_3" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10">
|
||||
<Border.Background>
|
||||
<ImageBrush ImageSource="/Resources/Image/back1.png"></ImageBrush>
|
||||
</Border.Background>
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Style>
|
||||
<!--禁用button的悬浮效果 加 圆角 实色-->
|
||||
<Style x:Key="BtnCornerRadius2" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="5" Background="#2048EC">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Cursor" Value="No"/>
|
||||
<Setter Property="Opacity" Value="0.2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--禁用button的悬浮效果-->
|
||||
<Style x:Key="ButtonStyleBold" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="24"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="{x:Null}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--禁用button的悬浮效果 + 禁止状态-->
|
||||
<Style x:Key="ButtonStyleBoldProhibition" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="24"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="{x:Null}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Cursor" Value="No"/>
|
||||
<Setter Property="Opacity" Value="0.2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!--禁用button的悬浮效果 + 禁止状态-->
|
||||
<Style x:Key="ButtonStyleBoldProhibition2" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="24"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter Property="Background" Value="{x:Null}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Cursor" Value="No"/>
|
||||
<Setter Property="Opacity" Value="0.2"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!--滚动条样式-->
|
||||
<ControlTemplate x:Key="scroll_background" TargetType="RepeatButton">
|
||||
<Border Background="Transparent">
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="scroll_thumb_style" TargetType="Thumb">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Rectangle Width="3" Fill="#7A7A7A" RadiusX="1" RadiusY="1">
|
||||
</Rectangle>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="scroll_thumb_stylecrosswise" TargetType="Thumb">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Rectangle Fill="#7A7A7A" RadiusX="1" RadiusY="1">
|
||||
</Rectangle>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!--DataGrid样式-->
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#999999"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="Height" Value="35"/>
|
||||
</Style>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
<Style x:Key="CenteredTextBlockStyle" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style x:Key="CenteredCheckBlockStyle" TargetType="{x:Type CheckBox}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type ScrollBar}">
|
||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="Width" Value="3"/>
|
||||
<Setter Property="MinWidth" Value="3"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="true" Background="#F1F1F1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.00001*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Track HorizontalAlignment="Center" Name="PART_Track" Width="{TemplateBinding Width}" Maximum="{TemplateBinding Maximum}" Minimum="{TemplateBinding Minimum}"
|
||||
Value="{TemplateBinding Value}" IsDirectionReversed="true">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineUpCommand" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
<Track.IncreaseRepeatButton>
|
||||
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineDownCommand" />
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb Style="{StaticResource scroll_thumb_style}" >
|
||||
</Thumb>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Orientation" Value="Horizontal">
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
<Setter Property="MinWidth" Value="0"/>
|
||||
<Setter Property="Height" Value="10"/>
|
||||
<Setter Property="MinHeight" Value="10"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="true" Background="#7FA7A7A7">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.00001*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Track x:Name="PART_Track" Grid.Column="1" IsEnabled="{TemplateBinding IsMouseOver}">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineUpCommand" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
<Track.IncreaseRepeatButton>
|
||||
<RepeatButton Template="{StaticResource scroll_background}" Command="ScrollBar.LineDownCommand" />
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb Style="{DynamicResource scroll_thumb_stylecrosswise}" Height="8"/>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
923
RFIDReaderTC/RFIDReaderTC/ViewModel/MainWindowViewModel.cs
Normal file
@ -0,0 +1,923 @@
|
||||
using CommonClassLib;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using DBFactory;
|
||||
using HandyControl.Controls;
|
||||
using Microsoft.VisualBasic;
|
||||
using ModuleTech;
|
||||
using ModuleTech.Gen2;
|
||||
using Newtonsoft.Json;
|
||||
using ReaderManager.Models;
|
||||
using RFIDReaderTC.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml;
|
||||
namespace RFIDReaderTC.ViewModel
|
||||
{
|
||||
public partial class MainWindowViewModel: ObservableObject
|
||||
{
|
||||
|
||||
public Reader? rdr;
|
||||
/// <summary>
|
||||
/// 定时器 监听GPI 状态 false为读取状态 true为空闲状态
|
||||
/// </summary>
|
||||
System.Timers.Timer? timer;
|
||||
|
||||
//服务地址
|
||||
//RGDWCSService.RGDWCSServiceClient service = new RGDWCSService.RGDWCSServiceClient();
|
||||
|
||||
/// <summary>
|
||||
/// 设置页面是否显示
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool menuView;
|
||||
|
||||
/// <summary>
|
||||
/// 调度服务连接状态
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool dispatchState;
|
||||
|
||||
/// <summary>
|
||||
/// 读写器连接状态
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool readerState;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool readIsOpen;
|
||||
/// <summary>
|
||||
/// 是否允许手动操作
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool readerPerson;
|
||||
|
||||
/// <summary>
|
||||
/// 箱条码数据
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private FlowDocument richText = new FlowDocument();
|
||||
|
||||
/// <summary>
|
||||
/// 箱条码数据
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<TagInfo> tagInfos = new ObservableCollection<TagInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 表条码数据
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<TagInfo> goodsTagInfos = new ObservableCollection<TagInfo>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 读取数量
|
||||
/// </summary>
|
||||
public string LbTagsCount => "读取数量: " + TagInfos.Count;
|
||||
|
||||
/// <summary>
|
||||
/// 读取数量
|
||||
/// </summary>
|
||||
public string LbGoodsTagsCount => "读取数量: " + GoodsTagInfos.Count;
|
||||
|
||||
|
||||
#region 配置相关
|
||||
[ObservableProperty]
|
||||
private string antenna1 = GetSetting("Antenna1");
|
||||
[ObservableProperty]
|
||||
private string antenna2 = GetSetting("Antenna2");
|
||||
[ObservableProperty]
|
||||
private string antenna3 = GetSetting("Antenna3");
|
||||
[ObservableProperty]
|
||||
private string antenna4 = GetSetting("Antenna4");
|
||||
[ObservableProperty]
|
||||
private string antenna5 = GetSetting("Antenna5");
|
||||
[ObservableProperty]
|
||||
private string antenna6 = GetSetting("Antenna6");
|
||||
[ObservableProperty]
|
||||
private string antenna7 = GetSetting("Antenna7");
|
||||
[ObservableProperty]
|
||||
private string antenna8 = GetSetting("Antenna8");
|
||||
[ObservableProperty]
|
||||
private string readUrl = GetSetting("ReadUrl");
|
||||
[ObservableProperty]
|
||||
private string uploadPath = GetSetting("UploadPath");
|
||||
[ObservableProperty]
|
||||
private string dispatchPath = GetSetting("DispatchPath");
|
||||
[ObservableProperty]
|
||||
private string lEDPath = GetSetting("LEDPath");
|
||||
|
||||
public void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
|
||||
if (!e.Handled)
|
||||
{
|
||||
System.Windows.Controls.TextBox textBox = sender as System.Windows.Controls.TextBox;
|
||||
string currentText = textBox.Text;
|
||||
|
||||
// 当前输入的文本位置
|
||||
int selectionStart = textBox.SelectionStart;
|
||||
int selectionLength = textBox.SelectionLength;
|
||||
|
||||
// 预测输入后的文本
|
||||
string newText = currentText.Remove(selectionStart, selectionLength).Insert(selectionStart, e.Text);
|
||||
|
||||
if (int.TryParse(newText, out int result))
|
||||
{
|
||||
// 限制输入值在 0 到 3300 之间
|
||||
if (result < 0 || result > 3300)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region botton绑定事件
|
||||
|
||||
[RelayCommand]
|
||||
private void ButtonSave()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
SetSetting("Antenna1", Antenna1);
|
||||
SetSetting("Antenna2", Antenna2);
|
||||
SetSetting("Antenna3", Antenna3);
|
||||
SetSetting("Antenna4", Antenna4);
|
||||
SetSetting("Antenna5", Antenna5);
|
||||
SetSetting("Antenna6", Antenna6);
|
||||
SetSetting("Antenna7", Antenna7);
|
||||
SetSetting("Antenna8", Antenna8);
|
||||
|
||||
SetSetting("ReadUrl", ReadUrl);
|
||||
SetSetting("UploadPath", UploadPath);
|
||||
SetSetting("DispatchPath", DispatchPath);
|
||||
SetSetting("LEDPath", LEDPath);
|
||||
|
||||
App.Restart();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void ButtonReadOpen()
|
||||
{
|
||||
TagInfos.Clear();
|
||||
GoodsTagInfos.Clear();
|
||||
try
|
||||
{
|
||||
rdr.StartReading();
|
||||
ReadIsOpen = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ButtonReadClose()
|
||||
{
|
||||
rdr.StopReading();
|
||||
ReadIsOpen = false;
|
||||
MessageBoxResult result = HandyControl.Controls.MessageBox.Show(
|
||||
"是否需要进行数据上传?", // 提示信息
|
||||
"确认", // 窗口标题
|
||||
MessageBoxButton.YesNo, // 按钮选择
|
||||
MessageBoxImage.Question // 图标样式
|
||||
);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
string sR = string.Empty;
|
||||
LEDHelper.refreshScanScreen(TagInfos.Count.ToString(), GoodsTagInfos.Count.ToString(), LEDPath, out sR);
|
||||
submitData();
|
||||
TxtAdd("");
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void ButtonMenuView()
|
||||
{
|
||||
if (MenuView)
|
||||
{
|
||||
MenuView = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuView = true;
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void ButtonAdd()
|
||||
{
|
||||
try
|
||||
{
|
||||
TxtAdd("11111");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void ButtonConnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenReader();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
static DBOperator dbo = new DBOperator();
|
||||
public ServiceReference1.RGDWCSServiceClient _I_RFID;
|
||||
MainWindow main;
|
||||
public MainWindowViewModel(MainWindow mn)
|
||||
{
|
||||
ReaderPerson = true;
|
||||
ReadIsOpen = false;
|
||||
main = mn;
|
||||
tagInfos.CollectionChanged -= TagInfos_CollectionChanged;
|
||||
goodsTagInfos.CollectionChanged += TagInfos_CollectionChanged;
|
||||
//读写器初始化
|
||||
Task.Run(() =>
|
||||
{
|
||||
ReaderState = OpenReader();
|
||||
if (ReaderState)
|
||||
{
|
||||
//读写器状态监听
|
||||
timer = new System.Timers.Timer(300);
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Start();
|
||||
}
|
||||
});
|
||||
Task.Run(() =>
|
||||
{
|
||||
_I_RFID = new ServiceReference1.RGDWCSServiceClient();
|
||||
WebServerInint();
|
||||
|
||||
ListenDll.LV_InitDllEx(0);
|
||||
string sR = string.Empty;
|
||||
LEDHelper.refreshScanScreen("0", "0", LEDPath, out sR);
|
||||
});
|
||||
timer_Read = new System.Threading.Timer(ProcessTags, null, Timeout.Infinite, 300);
|
||||
|
||||
}
|
||||
public async void WebServerInint()
|
||||
{
|
||||
try
|
||||
{
|
||||
await this._I_RFID.RFIDReadyToReadAsync("12002");
|
||||
DispatchState = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DispatchState = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示信息
|
||||
/// </summary>
|
||||
public void TxtAdd(string txt)
|
||||
{
|
||||
// 获取当前 FlowDocument
|
||||
FlowDocument document = RichText;
|
||||
|
||||
// 创建一个新的 Paragraph
|
||||
Paragraph newParagraph = new Paragraph();
|
||||
|
||||
Run normalText = new Run("上传时间:"+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
normalText.Foreground = Brushes.Black;
|
||||
normalText.FontWeight = FontWeights.Bold; // 设置加粗
|
||||
newParagraph.Inlines.Add(normalText);
|
||||
newParagraph.Inlines.Add(new LineBreak());
|
||||
newParagraph.Inlines.Add(new LineBreak());
|
||||
|
||||
Run boldText = new Run("-----------箱条码-----------");
|
||||
boldText.FontWeight = FontWeights.Bold; // 设置加粗
|
||||
newParagraph.Inlines.Add(boldText);
|
||||
newParagraph.Inlines.Add(new LineBreak());
|
||||
|
||||
Run box = new Run(JsonConvert.SerializeObject(TagInfos));
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
newParagraph.Inlines.Add(box);
|
||||
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
Run goodsText = new Run("-----------表条码-----------");
|
||||
goodsText.FontWeight = FontWeights.Bold;
|
||||
newParagraph.Inlines.Add(goodsText);
|
||||
|
||||
newParagraph.Inlines.Add(new LineBreak());
|
||||
newParagraph.Inlines.Add(new LineBreak());
|
||||
Run good = new Run(JsonConvert.SerializeObject(GoodsTagInfos));
|
||||
newParagraph.Inlines.Add(good);
|
||||
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
Run sResult = new Run("-----------上传结果-----------");
|
||||
sResult.FontWeight = FontWeights.Bold;
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
newParagraph.Inlines.Add(sResult);
|
||||
|
||||
Run Result = new Run(txt);
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
newParagraph.Inlines.Add(Result);
|
||||
newParagraph.Inlines.Add(new LineBreak()); // 这是一个换行符
|
||||
|
||||
// 将新的 Paragraph 添加到 FlowDocument 中
|
||||
document.Blocks.Add(newParagraph);
|
||||
// 滚动到最底部
|
||||
main.Mesg.ScrollToEnd();
|
||||
}
|
||||
#region 读写器相关
|
||||
|
||||
private readonly System.Threading.Timer timer_Read; // 定时器
|
||||
private readonly object lockObj = new object(); // 锁对象
|
||||
private bool isProcessing = false; // 定时器是否正在运行
|
||||
|
||||
/// <summary>
|
||||
/// 启动定时器
|
||||
/// </summary>
|
||||
private void StartProcessing()
|
||||
{
|
||||
lock (lockObj)
|
||||
{
|
||||
if (!isProcessing)
|
||||
{
|
||||
isProcessing = true;
|
||||
// 启动定时器
|
||||
timer_Read.Change(0, 300); // 立即启动并每300毫秒执行一次
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 停止定时器
|
||||
/// </summary>
|
||||
private void StopProcessing()
|
||||
{
|
||||
lock (lockObj)
|
||||
{
|
||||
if (isProcessing)
|
||||
{
|
||||
isProcessing = false;
|
||||
// 停止定时器
|
||||
timer_Read.Change(Timeout.Infinite, 300); // 停止定时器
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void ProcessTags(object state)
|
||||
{
|
||||
List<TagReadData> temp_tags;
|
||||
lock (lockObj)
|
||||
{
|
||||
temp_tags = new List<TagReadData>(tagList); // 拷贝 tags 数据
|
||||
tagList.Clear(); // 清空 tags
|
||||
}
|
||||
|
||||
if (temp_tags.Count > 0)
|
||||
{
|
||||
// 使用并行处理每个 tag
|
||||
var tasks = temp_tags.Select(tag =>
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string barcode = tag.EPCString.Replace(" ", "");
|
||||
//24位,后12位有不多余1个非0字符
|
||||
if (barcode.Contains("000000000000") || (barcode.Substring(barcode.Length - 12).Distinct().Count() <= 2))
|
||||
{
|
||||
barcode = barcode.Substring(0, 12);
|
||||
var tagInfo = TagInfos.FirstOrDefault(t => t.Tag == barcode);
|
||||
|
||||
// 在 UI 线程上修改集合
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (tagInfo != null)
|
||||
{
|
||||
tagInfo.Count += tag.ReadCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
TagInfo tags = new TagInfo
|
||||
{
|
||||
Tag = barcode,
|
||||
Count = tag.ReadCount
|
||||
};
|
||||
TagInfos.Add(tags);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (barcode.Length >= 22)
|
||||
{
|
||||
barcode = barcode.Substring(0, 22);
|
||||
var tagInfo = GoodsTagInfos.FirstOrDefault(t => t.Tag == barcode);
|
||||
|
||||
// 在 UI 线程上修改集合
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (tagInfo != null)
|
||||
{
|
||||
tagInfo.Count += tag.ReadCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
TagInfo tags = new TagInfo
|
||||
{
|
||||
Tag = barcode,
|
||||
Count = tag.ReadCount
|
||||
};
|
||||
GoodsTagInfos.Add(tags);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}).ToArray(); // 将任务数组化
|
||||
|
||||
// 等待所有任务完成
|
||||
await Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
// 如果没有待处理的 tags,停止定时器
|
||||
if (tagList.Count == 0)
|
||||
{
|
||||
StopProcessing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static readonly object TimerLock = new object();
|
||||
/// <summary>
|
||||
/// 定时器事件监听到射频门状态发生变化后进行收取
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
lock (TimerLock)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ReadIsOpen)
|
||||
{
|
||||
var gpistate_temp = rdr.GPIGet(1);
|
||||
if (!gpistate_temp)
|
||||
{
|
||||
timer.Stop();
|
||||
//射频开始采集
|
||||
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
TagInfos.Clear();
|
||||
GoodsTagInfos.Clear();
|
||||
rdr.StartReading();
|
||||
ReadIsOpen = true;
|
||||
ReaderPerson = false;
|
||||
}));
|
||||
Task.Run(() =>
|
||||
{
|
||||
Object dv = dbo.GetSingle("select F_TASK_TYPE from T_WareHouse");
|
||||
//string TASK_TYPE = dv.ToString();
|
||||
Thread.Sleep(5000);
|
||||
//if (TASK_TYPE == "Inventory")
|
||||
// Thread.Sleep(5000);
|
||||
//else
|
||||
// Thread.Sleep(2000);
|
||||
|
||||
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
//射频采集结束
|
||||
rdr.StopReading();
|
||||
ReadIsOpen = false;
|
||||
ReaderPerson = true;
|
||||
|
||||
string sR = string.Empty;
|
||||
LEDHelper.refreshScanScreen(TagInfos.Count.ToString(), GoodsTagInfos.Count.ToString(), LEDPath, out sR);
|
||||
submitData();
|
||||
timer.Start();
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
//Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化打开
|
||||
/// </summary>
|
||||
bool OpenReader()
|
||||
{
|
||||
if (rdr != null)
|
||||
{
|
||||
rdr.Disconnect();
|
||||
rdr = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 当使用设备的串口进行连接的时候,Create函数的第一个参数也可能是串口号
|
||||
* (例如com1)当设备仅有一个天线端口时(例如一体机或者发卡器),Create
|
||||
* 函数的第三个参数也可能为1,读写器出厂默认IP为192.168.1.100
|
||||
* */
|
||||
int antnum = 16;
|
||||
try
|
||||
{
|
||||
//rdr = Reader.Create("192.168.0.202", ModuleTech.Region.PRC, antnum);
|
||||
rdr = Reader.Create(ReadUrl, ModuleTech.Region.NA, antnum);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#region 必须要设置的参数
|
||||
|
||||
#region 设置读写器的发射功率
|
||||
//获取读写器最大发射功率
|
||||
//int a= ()rdr.ParamGet("RfPowerMax");
|
||||
ushort maxp = Convert.ToUInt16(rdr.ParamGet("RfPowerMax"));// rdr.ParamGet("RfPowerMax");
|
||||
AntPower[] pwrs = new AntPower[antnum];
|
||||
for (int i = 0; i < antnum; ++i)
|
||||
{
|
||||
pwrs[i].AntId = (byte)(i + 1);//天线id
|
||||
pwrs[i].ReadPower = GetReadPower(i + 1);//天线频率
|
||||
pwrs[i].WritePower = maxp;
|
||||
}
|
||||
//设置读写器发射功率,本例设置为最大发射功率,可根据实际情况调整,
|
||||
//一般来说,功率越大则识别距离越远
|
||||
rdr.ParamSet("AntPowerConf", pwrs);
|
||||
#endregion
|
||||
|
||||
#region 设置盘存标签使用的天线
|
||||
//如果要使用其它天线可以在数组useants中放置其它多个天线编号,本例中是使用天线1
|
||||
int[] useants = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
rdr.ParamSet("ReadPlan", new SimpleReadPlan(TagProtocol.GEN2, useants));
|
||||
#endregion
|
||||
|
||||
#region 设置盘存操作的其它细节选项
|
||||
BackReadOption bro = new BackReadOption();
|
||||
BackReadOption.FastReadTagMetaData frtmdata = new BackReadOption.FastReadTagMetaData();
|
||||
/*是否采用高速模式(目前只有slr11xx和slr12xx系列读写器才支持),对于
|
||||
*一般标签数量不大,速度不快的应用没有必要使用高速模式,本例没有设置
|
||||
*使用高速模式
|
||||
* */
|
||||
bro.IsFastRead = true;
|
||||
#region 选择使用高速模式才起作用的选项
|
||||
//参照如下设置即可,如果使能高速模式,则只需取消以下被注释的代码即可
|
||||
|
||||
//标签信息是否携带识别天线的编号
|
||||
frtmdata.IsAntennaID = true;
|
||||
//标签信息是否携带标签识别次数
|
||||
frtmdata.IsReadCnt = false;
|
||||
//标签信息是否携带识别标签时的信号强度
|
||||
frtmdata.IsRSSI = false;
|
||||
//标签信息是否携带时间戳
|
||||
frtmdata.IsTimestamp = false;
|
||||
//标签信息是否携带识别标签时的工作频点
|
||||
frtmdata.IsFrequency = false;
|
||||
//标签信息是否携带识别标签时同时读取的其它bank数据信息,如果要获取在
|
||||
//盘存时同时读取其它bank的信息还必须设置EmbededCmdOfInventory参数,
|
||||
//(目前只有slr11xx和slr12xx系列读写器才支持)
|
||||
frtmdata.IsEmdData = false;
|
||||
//保留字段,可始终设置为false
|
||||
frtmdata.IsRFU = false;
|
||||
//高速模式下为取得最佳效果设置为0即可
|
||||
bro.FastReadDutyRation = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 非高速模式才起作用的选项
|
||||
/*
|
||||
//盘存周期,单位为ms,可根据实际使用的天线个数按照每个天线需要200ms
|
||||
//的方式计算得出,如果启用高速模式则此选项没有任何意义,可以设置为
|
||||
//任意值,或者干脆不设置
|
||||
bro.ReadDuration = (ushort)(200 * useants.Length);
|
||||
//盘存周期间的设备不工作时间,单位为ms,一般可设置为0,增加设备不工作
|
||||
//时间有利于节电和减少设备发热(针对某些使用电池供电或空间结构不利
|
||||
//于散热的情况会有帮助)
|
||||
bro.ReadInterval = 0;
|
||||
*/
|
||||
#endregion
|
||||
|
||||
bro.FRTMetadata = frtmdata;
|
||||
rdr.ParamSet("BackReadOption", bro);
|
||||
SetParams();
|
||||
rdr.ParamSet("Ex10FastModeParams", null);
|
||||
//rdr.ParamSet("Ex10FastModeParams", new Ex10FastModeParams());
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 必须要设置的事件处理函数
|
||||
//识别到标签事件的处理函数
|
||||
rdr.ReadException += OnReaderException;
|
||||
//读写器异常发生事件的处理函数
|
||||
rdr.TagsRead += OnTagsRead;
|
||||
#endregion
|
||||
|
||||
#region 根据应用需求可能要设置的参数
|
||||
//
|
||||
#region 设置Gen2Session
|
||||
/*
|
||||
//标签数量比较大,且移动速度缓慢或静止不动,设置为Session1可取得更
|
||||
//好效果,反之标签数量较少移动速度较快应设置为Session0,读写器默认
|
||||
//为Session0
|
||||
rdr.ParamSet("Gen2Session", Session.Session1);
|
||||
*/
|
||||
rdr.ParamSet("Gen2Session", Session.Session1);
|
||||
#endregion
|
||||
|
||||
#region 设置GPI触发控制读写工作
|
||||
/*
|
||||
//共有三种触发模式:
|
||||
//1 预定义两种GPI状态,一种作为触发读写器启动盘存的条件,另一种
|
||||
// 作为停止盘存的条件
|
||||
//2 预定义一种GPI状态,触发读写器启动盘存,指定一段时间(必须大于
|
||||
// 5秒)后自动停止盘存标签
|
||||
//3 预定义两种GPI状态,满足任何一种GPI状态都触发读写器启动盘存,
|
||||
// 指定一段时间(必须大于5秒)后自动停止盘存标签
|
||||
|
||||
//详见"读写器GPI触发工作模式.pdf"
|
||||
//以下示例为模式1,Trigger1State为启动工作时的GPI状态,且可以指
|
||||
//定多个GPI的状态,此例指定当GPI1为false时读写器开始盘存,当GPI2
|
||||
//为false时读写器停止盘存
|
||||
GPITrigger GpiTriiger = new GPITrigger();
|
||||
GPIState[] startstates = new GPIState[1];
|
||||
startstates[0] = new GPIState(1, false);
|
||||
GpiTriiger.Trigger1State = startstates;
|
||||
GpiTriiger.TriggerType = GPITriggerType.GPITrigger_Tri1Start_Tri2Stop;
|
||||
|
||||
GPIState[] stopstates = new GPIState[1];
|
||||
stopstates[0] = new GPIState(2, false);
|
||||
GpiTriiger.Trigger2State = stopstates;
|
||||
rdr.ParamSet("BackReadGPITrigger", GpiTriiger);
|
||||
//在GPI触发工作时,当触发条件发生时的处理函数,可通过此事件获取触
|
||||
//发时刻的GPI状态,如果不关心触发时刻的GPI状态以及时序关系,可以
|
||||
//不添加此事件,详见文档"读写器GPI触发工作模式.pdf"
|
||||
rdr.GpiTrigger += GpiStateOnTrigger;
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region 设置盘存标签时的过滤条件
|
||||
/*
|
||||
//对于某些应用可能需要读写器只盘存符合某些数据特征的标签,
|
||||
//可以通过设置过滤条件来实现,这样对于不符合特征的标签就
|
||||
//不会被采集,以下代码实现只盘存EPC码以0011(二进制)开头
|
||||
//的标签
|
||||
string binstr = "0011";
|
||||
byte[] fiterdata = ByteFormat.FromBin(binstr);
|
||||
Gen2TagFilter filter = new Gen2TagFilter(binstr.Length, fiterdata, MemBank.EPC, 32, false);
|
||||
rdr.ParamSet("Singulation", filter);
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region 设置盘存过程中同时读其它bank数据
|
||||
/*
|
||||
//有些应用除了快速盘存标签的EPC码外还想同时抓取某一个bank内的
|
||||
//数据,可以通过设置此参数实现(目前只有slr11xx和slr12xx系列
|
||||
//读写器才支持),以下代码实现抓取tid区从0块开始的12个字节
|
||||
//的数据,需要注意的是抓取的字节数必须是2的倍数,如果成功获得其
|
||||
//它bank的数据则TagReadData类的成员EbdData则为获得的数据,如果
|
||||
//失败的话则EbdData为null
|
||||
EmbededCmdData ecd = new EmbededCmdData(MemBank.TID, 0, 12);
|
||||
rdr.ParamSet("EmbededCmdOfInventory", ecd);
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
return true;
|
||||
}
|
||||
public void SetParams()
|
||||
{
|
||||
//rdr.ParamSet("Gen2Target", (ModuleTech.Gen2.Target)12);
|
||||
//rdr.ParamSet("Gen2Qvalue", 2);
|
||||
rdr.ParamSet("EmbededCmdOfInventory", null);
|
||||
rdr.ParamSet("AccessPassword", (uint)0);
|
||||
rdr.ParamSet("Gen2Session", (ModuleTech.Gen2.Session)0);
|
||||
//rdr.ParamSet("gen2tagEncoding", 111);
|
||||
}
|
||||
List<TagReadData> tagList = new List<TagReadData>();
|
||||
int number = 0;
|
||||
/// <summary>
|
||||
/// 读写器触发采集
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="tagsArgs"></param>
|
||||
void OnTagsRead(object sender, Reader.TagsReadEventArgs tagsArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
Reader rdrtmp = (Reader)sender;
|
||||
#region 示例在盘存标签事件中做其它标签访问操作
|
||||
/*
|
||||
//可以对读到的标签做进一步的读,写,锁和GPIO等操作等操作
|
||||
//注:只有在非高速盘存模式下才可以进行其它的标签操作,高速盘存模式下禁
|
||||
//止再进行其它标签操作,否则盘存操作将被终止,其它的标签操作也不会成功。
|
||||
//但GPIO的操作是例外,不论哪种盘存模式都可以在此处操作GPIO
|
||||
* */
|
||||
/*
|
||||
//以下示例写入两个块的数据到盘存到的标签的USER区中
|
||||
foreach (TagReadData tag in tagsArgs.Tags)
|
||||
{
|
||||
ushort[] wdata = new ushort[2];
|
||||
wdata[0] = 0x1234;
|
||||
wdata[1] = 0x5678;
|
||||
Gen2TagFilter filter = new Gen2TagFilter(tag.EPC.Length * 8, tag.EPC, MemBank.EPC, 32, false);
|
||||
try
|
||||
{
|
||||
//必须设置操作使用的天线,一般可设置为标签被盘存到时的天线
|
||||
rdrtmp.ParamSet("TagopAntenna", tag.Antenna);
|
||||
rdrtmp.WriteTagMemWords(filter, MemBank.USER, 0, wdata);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
//操作有可能失败(很多原因可能造成操作失败,常见的比如标签速度过快,已经不在天线场内)
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region 示例在盘存标签事件中操作GPO
|
||||
/*
|
||||
//设置GPO1为1
|
||||
try
|
||||
{
|
||||
rdrtmp.GPOSet(1, true);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
//操作有可能失败,比如由于断网
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
tagList = new List<TagReadData>(tagsArgs.Tags);
|
||||
if (!isProcessing)
|
||||
{
|
||||
StartProcessing();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 读写器异常发生事件的处理函数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="expArgs"></param>
|
||||
void OnReaderException(object sender, Reader.ReadExceptionEventArgs expArgs)
|
||||
{
|
||||
Reader rdrtmp = (Reader)sender;
|
||||
string aa = rdrtmp.Address + "--异常信息:" + expArgs.ReaderException.ToString();
|
||||
//如果需要可在此处记录异常日志
|
||||
Debug.WriteLine(aa);
|
||||
|
||||
return;
|
||||
}
|
||||
public static ushort GetReadPower(int i)
|
||||
{
|
||||
ushort maxp = Convert.ToUInt16(3300);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna1"));
|
||||
break;
|
||||
case 2:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna2"));
|
||||
break;
|
||||
case 3:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna3"));
|
||||
break;
|
||||
case 4:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna4"));
|
||||
break;
|
||||
case 5:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna5"));
|
||||
break;
|
||||
case 6:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna6"));
|
||||
break;
|
||||
case 7:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna7"));
|
||||
break;
|
||||
case 8:
|
||||
maxp = Convert.ToUInt16(GetSetting("Antenna8"));
|
||||
break;
|
||||
}
|
||||
|
||||
return maxp;
|
||||
}
|
||||
public static string GetSetting(string key)
|
||||
{
|
||||
return ConfigurationManager.AppSettings[key];
|
||||
}
|
||||
public static void SetSetting(string key, string value)
|
||||
{
|
||||
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
config.AppSettings.Settings[key].Value = value;
|
||||
config.Save(ConfigurationSaveMode.Modified);
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
/// <summary>
|
||||
/// 采集的数据进行上报
|
||||
/// </summary>
|
||||
public async void submitData()
|
||||
{
|
||||
StringBuilder strXml = new StringBuilder();
|
||||
strXml.Append("<RFIDRequest>").Append("\n");
|
||||
strXml.Append("<BindingDeviceID>").Append("12002").Append("</BindingDeviceID>").Append("\n");
|
||||
string boxBarCode = "";
|
||||
string boxCode = "";
|
||||
strXml.Append("<BoxRFID>").Append("\n");
|
||||
StringBuilder strXmlBoxCode = new StringBuilder();
|
||||
StringBuilder strXmlBoxBarCode = new StringBuilder();
|
||||
|
||||
foreach (var item in TagInfos)
|
||||
{
|
||||
boxCode = boxCode + item.Tag + ",";
|
||||
strXmlBoxCode.Append("<BoxCode>").Append(item.Tag).Append("</BoxCode>").Append("\n");
|
||||
}
|
||||
foreach (var item in GoodsTagInfos)
|
||||
{
|
||||
boxBarCode = boxBarCode + item.Tag + ",";
|
||||
strXmlBoxBarCode.Append("<GoodsCode>").Append(item.Tag).Append("</GoodsCode>").Append("\n");
|
||||
}
|
||||
strXml.Append(strXmlBoxCode);
|
||||
strXml.Append("</BoxRFID>").Append("\n");
|
||||
strXml.Append("<GoodsRFID>").Append("\n");
|
||||
strXml.Append(strXmlBoxBarCode);
|
||||
strXml.Append("</GoodsRFID>").Append("\n");
|
||||
strXml.Append("</RFIDRequest>").Append("\n");
|
||||
try
|
||||
{
|
||||
// 设置超时
|
||||
this._I_RFID.Endpoint.Binding.SendTimeout = TimeSpan.FromMinutes(5); // 发送超时 3分钟
|
||||
this._I_RFID.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromMinutes(5); // 接收超时 3分钟
|
||||
string sResult = await this._I_RFID.RFIDRequestWithReturnAsync(strXml.ToString());
|
||||
TxtAdd(sResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TxtAdd("请求超时,请手动扫描后重新上传");
|
||||
}
|
||||
//string sResult = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 子数据发生变化时触发
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void TagInfos_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(nameof(LbTagsCount));
|
||||
OnPropertyChanged(nameof(LbGoodsTagsCount));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
BIN
RFIDReaderTC/RFIDReaderTC/bin/Debug/net6.0-windows/ModuleAPI.dll
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!-- SQL connection string for database-->
|
||||
<!--<add key="ConnString" value="Server = 172.18.131.12; uid = sa ; pwd =sa; database = SSWCMS_aux; MAX Pool Size = 1024;Min Pool Size=0 " />-->
|
||||
<add key="ConnString" value="Server=.;uid =sa;pwd=tcdl2010*;database=AHTC_WCS;MAX Pool Size=512"/>
|
||||
|
||||
<add key="DBFactory" value="SQLServerDBFactory"/>
|
||||
|
||||
</appSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<log4net>
|
||||
|
||||
<!--定义输出到文件中-->
|
||||
<appender name="InfoLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<!--定义文件存放位置-->
|
||||
<file value="D:\调度与平台接口日志\RFIDlog\INFO_" />
|
||||
<appendToFile value="true" />
|
||||
<param name="StaticLogFileName" value="false" />
|
||||
<param name="RollingStyle" value="Date" />
|
||||
|
||||
<param name="DatePattern" value="yyyyMMdd".txt"" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!--每条日志末尾的文字说明-->
|
||||
<footer value="" />
|
||||
<!--输出格式-->
|
||||
<conversionPattern value="[%date] [%thread] [%-5level] [%message]%newline" />
|
||||
</layout>
|
||||
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<param name="LevelMin" value="INFO" />
|
||||
<param name="LevelMax" value="INFO" />
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="WarnLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<!--定义文件存放位置-->
|
||||
<file value="D:\调度与平台接口日志\RFIDlog\WARN_" />
|
||||
<appendToFile value="true" />
|
||||
<param name="StaticLogFileName" value="false" />
|
||||
<param name="RollingStyle" value="Date" />
|
||||
|
||||
<param name="DatePattern" value="yyyyMMdd".txt"" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!--每条日志末尾的文字说明-->
|
||||
<footer value="" />
|
||||
<!--输出格式-->
|
||||
<conversionPattern value="[%date] [%thread] [%-5level] [%message]%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<param name="LevelMin" value="WARN" />
|
||||
<param name="LevelMax" value="WARN" />
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="DebugLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<!--定义文件存放位置-->
|
||||
<file value="D:\调度与平台接口日志\RFIDlog\Debug_" />
|
||||
<appendToFile value="true" />
|
||||
<param name="StaticLogFileName" value="false" />
|
||||
<param name="RollingStyle" value="Date" />
|
||||
|
||||
<param name="DatePattern" value="yyyyMMdd".txt"" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!--每条日志末尾的文字说明-->
|
||||
<footer value="" />
|
||||
<!--输出格式-->
|
||||
<conversionPattern value="[%date] [%thread] [%-5level] [%message]%newline" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<param name="LevelMin" value="DEBUG" />
|
||||
<param name="LevelMax" value="DEBUG" />
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<!--文件形式记录日志-->
|
||||
<appender-ref ref="InfoLogFileAppender" />
|
||||
<appender-ref ref="WarnLogFileAppender" />
|
||||
<appender-ref ref="DebugLogFileAppender" />
|
||||
</root>
|
||||
</log4net>
|