|
@@ -12,6 +12,7 @@ using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
+using Virtual_PLC;
|
|
|
using WCS.Core;
|
|
|
using WCS.Core.DataTrans;
|
|
|
using WCS.Entity;
|
|
@@ -49,42 +50,14 @@ namespace WCS.Service
|
|
|
Configs.ProtocolProxyBaseType = typeof(ProtocolProxy);
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
Configs.StringEncoding = Encoding.UTF8;
|
|
|
- Db.CreateContext(new ConnectionConfig()
|
|
|
+ var data = new PLCData()
|
|
|
{
|
|
|
- ConnectionString = AppSettings.Config.GetConnectionString("WCSDB"),
|
|
|
- DbType = DbType.MySql
|
|
|
- }, "WCSDB");
|
|
|
- Db.SetDefaultDbContextType("WCSDB");
|
|
|
- Db.Do(db =>
|
|
|
- {
|
|
|
- //TODO:DbMaintenance.CreateDatabase()并没起到作用,如果没有对应的数据库的话任然需要手动新建一个
|
|
|
- db.Default.DbMaintenance.CreateDatabase();
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_CMD));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_PLC));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_DEVICE));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_PATH));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_PATHPOINT));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_ROUTE));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_TASK));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_TASK_OLD));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_EXCEPTION));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_SystemConfig));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_AGVTask));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_DEVICEPROTOCOL));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_GROUPMEMBER));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_MAPPINGENTRY));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_USERS));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_StatusLog));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_BCR80));
|
|
|
- db.Default.CodeFirst.InitTables(typeof(WCS_RGV520));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- //db.Default.CodeFirst.InitTables(typeof(WCS_DATABLOCK));
|
|
|
- });
|
|
|
+ IP = "192.168.3.1",
|
|
|
+ DB = "520",
|
|
|
+ Length = 1320,
|
|
|
+ DataLength = 22,
|
|
|
+ };
|
|
|
+ PlcData.Init("127.0.0.1,database=0").InitPlcData(data);
|
|
|
|
|
|
//日志发布事件s
|
|
|
Configs.PublishEvent += () =>
|