From 8559abbd28b3ca5f91f07d461f04f45cb3ff3b0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Thu, 3 Mar 2022 18:07:09 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E6=90=AD=E5=BB=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
HBLConsole.Business/APIHelper.cs | 53 ++++++
.../HBLConsole.Business.csproj | 5 +
HBLConsole.Business/MORKS.cs | 19 ++
HBLConsole.Business/MessageServerBase.cs | 22 ++-
HBLConsole.Business/ServerData.cs | 56 ++++++
.../HBLConsole.Communication.csproj | 1 +
HBLConsole.Communication/M2MQTT/MqttM2.cs | 9 -
HBLConsole.Communication/ModbusTcpHelper.cs | 26 +++
HBLConsole.Factory/HBLConsole.Factory.csproj | 7 +
HBLConsole.Factory/SimpleFactory.cs | 10 +-
HBLConsole.GVL/GeneralConfig.cs | 20 +++
HBLConsole.GVL/HBLConsole.GVL.csproj | 3 +
HBLConsole.GVL/InternetInfo.cs | 30 +++-
.../HBLConsole.MainConsole.csproj | 7 +
HBLConsole.MainConsole/HeartbeatReport.cs | 63 +++++++
HBLConsole.MainConsole/Main.cs | 34 +++-
HBLConsole.Model/HBLConsole.Model.csproj | 6 +
.../KeepParameter/BatchingInfoPar.cs | 16 ++
HBLConsole.Service/HBLConsole.Service.csproj | 1 +
HBLConsole.Service/Sqlite.cs | 36 ++++
HBLConsole.sln | 10 +-
HBLConsole/App.config | 4 +-
HBLConsole/App.xaml.cs | 15 +-
.../DialogWindow/View/ListDialogView.xaml | 7 +-
.../ViewModel/ListDialogViewModel.cs | 169 +++++++-----------
HBLConsole/HBLConsole.csproj | 3 +-
HBLConsole/Model/MorkOrderPushPar.cs | 14 ++
HBLConsole/Model/OrderData.cs | 25 +++
HBLConsole/Server/SystemHelper.cs | 109 -----------
HBLConsole/Service/InitService.cs | 46 +++++
HBLConsole/View/MainView.xaml | 12 ++
HBLConsole/ViewModel/MainViewModel.cs | 12 +-
HBLConsole/ViewModel/OrderStatusViewModel.cs | 2 +-
HBLConsole/ViewModel/ViewModelBase.cs | 18 +-
34 files changed, 612 insertions(+), 258 deletions(-)
create mode 100644 HBLConsole.Business/APIHelper.cs
create mode 100644 HBLConsole.Business/MORKS.cs
create mode 100644 HBLConsole.Business/ServerData.cs
create mode 100644 HBLConsole.Communication/ModbusTcpHelper.cs
create mode 100644 HBLConsole.GVL/GeneralConfig.cs
create mode 100644 HBLConsole.MainConsole/HeartbeatReport.cs
create mode 100644 HBLConsole.Model/KeepParameter/BatchingInfoPar.cs
create mode 100644 HBLConsole.Service/Sqlite.cs
create mode 100644 HBLConsole/Model/MorkOrderPushPar.cs
create mode 100644 HBLConsole/Model/OrderData.cs
delete mode 100644 HBLConsole/Server/SystemHelper.cs
create mode 100644 HBLConsole/Service/InitService.cs
diff --git a/HBLConsole.Business/APIHelper.cs b/HBLConsole.Business/APIHelper.cs
new file mode 100644
index 0000000..311acef
--- /dev/null
+++ b/HBLConsole.Business/APIHelper.cs
@@ -0,0 +1,53 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using BPA.Utility;
+using HBLConsole.GVL;
+
+namespace HBLConsole.Business
+{
+ public class APIHelper
+ {
+
+ private volatile static APIHelper _Instance;
+ public static APIHelper GetInstance => _Instance ?? (_Instance = new APIHelper());
+ private APIHelper() { }
+
+ public void OrderStatusChange(string suborderId, int orderStatus)
+ {
+ var m = $"[/api/RobotOrder]_[{DateTime.Now.Ticks}]".AESEncrypt();
+ WebApiHelper.GetInstance().HttpPost(InternetInfo.GetInstance.OrderStatusChange, "");
+ }
+
+ public void GetBatchingInfo()
+ {
+
+ //string serviceAddress = "http://1.14.74.54:7001/api/Advertisement/htmlurl?storeId=3b007e32-f1cc-4021-b4e0-f4764fa90f12";
+ //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceAddress);
+ //request.Method = "GET";
+ //request.ContentType = "text/html;charset=UTF-8";
+ //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+ //Stream myResponseStream = response.GetResponseStream();
+ //StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
+ //string retString = myStreamReader.ReadToEnd();
+ //myStreamReader.Close();
+ //myResponseStream.Close();
+ ////Response.Write(retString);
+ //JObject obj = JObject.Parse(retString);
+ //string Data1 = obj["data"].ToString();
+ //string Data = string.Empty;
+ //if (Data1.Length > 0)
+ // Data = obj["data"]["data"].ToString();//获取连接
+ //GVL_VAR.GetInstance.SorbetesAddress = Data;
+ //if (SorbetesAddressNoti != null) SorbetesAddressNoti(Data);
+ //MessageLogOut.GetInstance.Show($"广告连接:={Data}");
+
+ }
+
+ }
+}
diff --git a/HBLConsole.Business/HBLConsole.Business.csproj b/HBLConsole.Business/HBLConsole.Business.csproj
index 5310c9f..7df6e4d 100644
--- a/HBLConsole.Business/HBLConsole.Business.csproj
+++ b/HBLConsole.Business/HBLConsole.Business.csproj
@@ -7,6 +7,8 @@
+
+
@@ -16,6 +18,9 @@
..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll
+
+ ..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll
+
diff --git a/HBLConsole.Business/MORKS.cs b/HBLConsole.Business/MORKS.cs
new file mode 100644
index 0000000..fe07f1c
--- /dev/null
+++ b/HBLConsole.Business/MORKS.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HBLConsole.Business
+{
+ public class MORKS
+ {
+
+ private volatile static MORKS _Instance;
+ public static MORKS GetInstance => _Instance ?? (_Instance = new MORKS());
+ private MORKS() { }
+
+
+
+ }
+}
diff --git a/HBLConsole.Business/MessageServerBase.cs b/HBLConsole.Business/MessageServerBase.cs
index dbca51b..4d55aa4 100644
--- a/HBLConsole.Business/MessageServerBase.cs
+++ b/HBLConsole.Business/MessageServerBase.cs
@@ -4,6 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HBLConsole.Abstract;
+using BPA.Message;
+using HBLConsole.Model;
+using HBLConsole.Service;
+using BPA.Message.Enum;
namespace HBLConsole.Business
{
@@ -11,7 +15,11 @@ namespace HBLConsole.Business
{
public override void AddOrder(T orderInfo)
{
- throw new NotImplementedException();
+ if (orderInfo == null) return;
+ if (orderInfo is MorkOrderPush morkOrderpush)
+ {
+ ActionManagerment.GetInstance.Send("orderSend", morkOrderpush);
+ }
}
public override void BatchingCountInfo()
@@ -21,12 +29,20 @@ namespace HBLConsole.Business
public override void GetBatchingInfo(T batchingInfo)
{
- throw new NotImplementedException();
+ if (batchingInfo == null) return;
+ if (batchingInfo is OrderMaterialDelivery BatchingInfos)
+ {
+ Json.GetInstance.Base.orderMaterialDelivery = BatchingInfos;
+ }
}
public override void GetRecipeBom(T recipeBomInfo)
{
- throw new NotImplementedException();
+ if (recipeBomInfo == null) return;
+ if (recipeBomInfo is RecipeBoms recipeBom)
+ {
+ Json.GetInstance.Base.recipeBoms = recipeBom;
+ }
}
}
}
diff --git a/HBLConsole.Business/ServerData.cs b/HBLConsole.Business/ServerData.cs
new file mode 100644
index 0000000..6a42d06
--- /dev/null
+++ b/HBLConsole.Business/ServerData.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using HBLConsole.Service;
+using System.Collections.Concurrent;
+using BPA.Message;
+using HBLConsole.GVL;
+using HBLConsole.Interface;
+using HBLConsole.Factory;
+
+namespace HBLConsole.Business
+{
+ public class ServerData
+ {
+
+ private volatile static ServerData _Instance;
+ public static ServerData GetInstance => _Instance ?? (_Instance = new ServerData());
+ private ServerData() { }
+
+ ConcurrentQueue receives = new ConcurrentQueue();
+
+ IServerMessage serverMessage = new ServerMessage();
+
+ public void Init()
+ {
+ ThreadManagerment.GetInstance.StartLong(new Action(() =>
+ {
+ while (receives.Count > 0)
+ {
+ if (receives.TryDequeue(out string msg))
+ {
+ var package = BPAPackage.Deserialize(msg);
+ if (package.ClientId == InternetInfo.GetInstance.ClientId)
+ {
+ if (package.Message != null)
+ {
+ serverMessage.Universal(SimpleFactory.GetInstance.GetAbsMessageServer, package.Message);
+ }
+ }
+ }
+ }
+ Thread.Sleep(100);
+ }), "");
+ }
+
+
+ public void ReceiveData(string info)
+ {
+ receives.Enqueue(info);
+ }
+
+ }
+}
diff --git a/HBLConsole.Communication/HBLConsole.Communication.csproj b/HBLConsole.Communication/HBLConsole.Communication.csproj
index b0c5653..90341c7 100644
--- a/HBLConsole.Communication/HBLConsole.Communication.csproj
+++ b/HBLConsole.Communication/HBLConsole.Communication.csproj
@@ -6,6 +6,7 @@
+
diff --git a/HBLConsole.Communication/M2MQTT/MqttM2.cs b/HBLConsole.Communication/M2MQTT/MqttM2.cs
index c2d5e8d..54d2913 100644
--- a/HBLConsole.Communication/M2MQTT/MqttM2.cs
+++ b/HBLConsole.Communication/M2MQTT/MqttM2.cs
@@ -10,16 +10,7 @@ using System.Threading.Tasks;
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
using Newtonsoft.Json;
-using Communication.Model;
using System.Collections.Concurrent;
-using Alarm.Enums;
-using Alarm.Models;
-using Alarm.Service;
-using ServiceModel;
-using GVL;
-using BPA.Message;
-using BPA.Utility;
-using Communication.MQTT;
using System.Drawing;
using HBLConsole.Model;
using HBLConsole.Service;
diff --git a/HBLConsole.Communication/ModbusTcpHelper.cs b/HBLConsole.Communication/ModbusTcpHelper.cs
new file mode 100644
index 0000000..97649f4
--- /dev/null
+++ b/HBLConsole.Communication/ModbusTcpHelper.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ModbusTcp;
+
+namespace HBLConsole.Communication
+{
+ public class ModbusTcpHelper
+ {
+
+ private volatile static ModbusTcpHelper _Instance;
+ public static ModbusTcpHelper GetInstance => _Instance ?? (_Instance = new ModbusTcpHelper());
+ private ModbusTcpHelper() { }
+
+ ModbusClient modbusClient;
+
+ public void Connect(string ip, int port)
+ {
+ modbusClient = new ModbusClient(ip, port);
+
+ }
+
+ }
+}
diff --git a/HBLConsole.Factory/HBLConsole.Factory.csproj b/HBLConsole.Factory/HBLConsole.Factory.csproj
index c1f3a16..e10c7c5 100644
--- a/HBLConsole.Factory/HBLConsole.Factory.csproj
+++ b/HBLConsole.Factory/HBLConsole.Factory.csproj
@@ -6,7 +6,14 @@
+
+
+
+ ..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll
+
+
+
diff --git a/HBLConsole.Factory/SimpleFactory.cs b/HBLConsole.Factory/SimpleFactory.cs
index 0bdd13c..ffc77ec 100644
--- a/HBLConsole.Factory/SimpleFactory.cs
+++ b/HBLConsole.Factory/SimpleFactory.cs
@@ -2,6 +2,8 @@
using HBLConsole.Interface;
using System;
using System.Reflection;
+using BPA.Message.Enum;
+using HBLConsole.GVL;
namespace HBLConsole.Factory
{
@@ -15,14 +17,14 @@ namespace HBLConsole.Factory
public AbstractMessageServer GetAbsMessageServer => _GetAbsMessageServer ?? (_GetAbsMessageServer = GetAbstractMessageServer());
private AbstractMessageServer _GetAbsMessageServer;
- public IServerMessage GetIServerMessage => _GetIServerMessage ?? (_GetIServerMessage = new ServerMessage());
- private IServerMessage _GetIServerMessage;
+ //public IServerMessage GetIServerMessage => _GetIServerMessage ?? (_GetIServerMessage = new ServerMessage());
+ //private IServerMessage _GetIServerMessage;
private AbstractMessageServer GetAbstractMessageServer()
{
- Type type = Assembly.Load("MqttMessageServer").GetType($"MqttMessageServer.{GVL_VAR.GetInstance.StartDeviceType.ToString()}");
+ Type type = Assembly.Load("HBLConsole.Business").GetType($"HBLConsole.Business.{GeneralConfig.GetInstance.DeviceType.ToString()}");
if (type == null)
- type = Assembly.Load("MqttMessageServer").GetType($"MqttMessageServer.Base");
+ type = Assembly.Load("HBLConsole.Business").GetType($"HBLConsole.Business.MessageServerBase");
return (AbstractMessageServer)Activator.CreateInstance(type);
}
}
diff --git a/HBLConsole.GVL/GeneralConfig.cs b/HBLConsole.GVL/GeneralConfig.cs
new file mode 100644
index 0000000..f6940ab
--- /dev/null
+++ b/HBLConsole.GVL/GeneralConfig.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPA.Message.Enum;
+
+namespace HBLConsole.GVL
+{
+ public class GeneralConfig
+ {
+
+ private volatile static GeneralConfig _Instance;
+ public static GeneralConfig GetInstance => _Instance ?? (_Instance = new GeneralConfig());
+ private GeneralConfig() { }
+
+ public DeviceClientType DeviceType { get; set; }
+
+ }
+}
diff --git a/HBLConsole.GVL/HBLConsole.GVL.csproj b/HBLConsole.GVL/HBLConsole.GVL.csproj
index b0ec00a..abc8fab 100644
--- a/HBLConsole.GVL/HBLConsole.GVL.csproj
+++ b/HBLConsole.GVL/HBLConsole.GVL.csproj
@@ -17,6 +17,9 @@
+
+ ..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll
+
..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll
diff --git a/HBLConsole.GVL/InternetInfo.cs b/HBLConsole.GVL/InternetInfo.cs
index 6b0760d..e89238a 100644
--- a/HBLConsole.GVL/InternetInfo.cs
+++ b/HBLConsole.GVL/InternetInfo.cs
@@ -8,6 +8,8 @@ using BPA.Utility.Consul.YT;
using System.IO;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Consul;
+using System.Threading;
+using HBLConsole.Service;
namespace HBLConsole.GVL
{
@@ -22,17 +24,30 @@ namespace HBLConsole.GVL
public void Init()
{
+ NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
+ while (!NetworkConnectState)
+ {
+ NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
+ Thread.Sleep(2000);
+ }
+
ConsulAddress = System.Configuration.ConfigurationManager.AppSettings["ConsulAddress"];
ClientId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ClientId"]);
- IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddConsul(ConsulAddress, "root/BQLControl/app.json", false, 5_000);
+ IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddConsul(ConsulAddress, "root/basic.json", false, 5_000);
IConfiguration config = configurationBuilder.Build();
- MqttUserName = config["Server:MqttUserName"];
- MqttAddress = config["Server:MqttAddress"];
- MqttPassword = config["Server:MqttPassword"];
- MqttPort = int.Parse(config["Server:MqttPort"]);
+ MqttUserName = config["MQTT:TcpAccount"];
+ MqttPassword = config["MQTT:TcpPwd"];
+ MqttAddress = config["MQTT:MqttAddress"];
+ MqttPort = int.Parse(config["MQTT:MqttPort"]);
+ OrderStatusChange = config["API:robotstatuschange"];
}
+ ///
+ /// 订单状态更改接口地址
+ ///
+ public string OrderStatusChange { get; set; }
+
///
/// Consul 地址
///
@@ -43,6 +58,11 @@ namespace HBLConsole.GVL
///
public bool NetworkConnectState { get; set; }
+ ///
+ /// 广告地址
+ ///
+ public Uri SorbetesAddress { get; set; }
+
///
/// 客户端ID
///
diff --git a/HBLConsole.MainConsole/HBLConsole.MainConsole.csproj b/HBLConsole.MainConsole/HBLConsole.MainConsole.csproj
index ea65f04..a3bf676 100644
--- a/HBLConsole.MainConsole/HBLConsole.MainConsole.csproj
+++ b/HBLConsole.MainConsole/HBLConsole.MainConsole.csproj
@@ -5,10 +5,17 @@
+
+
+
+ ..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll
+
+
+
diff --git a/HBLConsole.MainConsole/HeartbeatReport.cs b/HBLConsole.MainConsole/HeartbeatReport.cs
new file mode 100644
index 0000000..8534524
--- /dev/null
+++ b/HBLConsole.MainConsole/HeartbeatReport.cs
@@ -0,0 +1,63 @@
+//using BPA.Message;
+//using BPA.Utility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+//using GVL;
+//using BPA.Message.Enum;
+//using BPA.Communication;
+using System.Threading;
+using HBLConsole.Service;
+using HBLConsole.GVL;
+using BPA.Message;
+using HBLConsole.Communication;
+using BPA.Message.Enum;
+//using Communication.MQTT;
+//using BPA.Message.Kafka;
+//using Model.Enums;
+//using ServiceModel;
+//using Communication.SerialPortComm;
+
+namespace HBLConsole.MainConsole
+{
+ public class HeartbeatReport
+ {
+
+ private volatile static HeartbeatReport _Instance;
+ public static HeartbeatReport GetInstance => _Instance ?? (_Instance = new HeartbeatReport());
+ private HeartbeatReport() { }
+
+ ///
+ /// 消息包
+ ///
+ public BPAPackage MessagePackage { get; set; } = new BPAPackage();
+
+ public Func GetMessage { get; set; }
+
+ DeviceStatus deviceStatus = new DeviceStatus();
+ string Topic = string.Empty;
+
+ public void Init()
+ {
+ deviceStatus.DeviceType = GeneralConfig.GetInstance.DeviceType;
+ deviceStatus.BatchingInfo = new List();
+ deviceStatus.Healthy = DeviceHealthy.UnHealth;
+ Topic = TOPIC.GetInstance.GetHeatbeatTopic(GeneralConfig.GetInstance.DeviceType);
+
+ ThreadManagerment.GetInstance.StartLong(new Action(() =>
+ {
+ MessagePackage.ClientId = InternetInfo.GetInstance.ClientId;
+ MessagePackage.ClientType = GeneralConfig.GetInstance.DeviceType;
+ MessagePackage.MessageId = MessageID.MORK_HEART_BEAT;
+ MessagePackage.MessageVersion = 0x01;
+ MessagePackage.Timestamp = DateTime.Now;
+ MessagePackage.Message = GetMessage == null ? deviceStatus : GetMessage();
+ MqttHelper.GetInstance.MqttPublishAsync(Topic, MessagePackage.Serialize());
+ Thread.Sleep(1000);
+ }), "设备心跳上报");
+
+ }
+ }
+}
diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs
index 919ad6f..8b61932 100644
--- a/HBLConsole.MainConsole/Main.cs
+++ b/HBLConsole.MainConsole/Main.cs
@@ -3,6 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using HBLConsole.Model;
+using HBLConsole.Service;
+using HBLConsole.GVL;
+using HBLConsole.Communication;
+using BPA.Message;
+using HBLConsole.Business;
namespace HBLConsole.MainConsole
{
@@ -13,9 +19,35 @@ namespace HBLConsole.MainConsole
public static Main GetInstance => _Instance ?? (_Instance = new Main());
private Main() { }
- public void Init()
+ List Topics = new List();
+
+ public void BusinessInit()
{
+ Topics.Clear();
+ Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId));
+ Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId));
+ ThreadManagerment.GetInstance.Start(new Action(() =>
+ {
+ InternetInfo.GetInstance.Init();
+ MqttHelper.GetInstance.ConnectOk = new Action(() =>
+ {
+ MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());
+ HeartbeatReport.GetInstance.Init();
+ MqttHelper.GetInstance.MqttReceive = new Action((receivce) =>
+ {
+ ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload));
+ });
+ });
+
+ MqttHelper.GetInstance.Reconnection = new Action(() => { MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray()); });
+
+ MqttHelper.GetInstance.MqttInitAsync(InternetInfo.GetInstance.MqttUserName,
+ InternetInfo.GetInstance.MqttPassword,
+ InternetInfo.GetInstance.MqttAddress,
+ InternetInfo.GetInstance.MqttPort,
+ DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
+ }), "业务逻辑初始化");
}
}
diff --git a/HBLConsole.Model/HBLConsole.Model.csproj b/HBLConsole.Model/HBLConsole.Model.csproj
index f208d30..6b64af0 100644
--- a/HBLConsole.Model/HBLConsole.Model.csproj
+++ b/HBLConsole.Model/HBLConsole.Model.csproj
@@ -4,4 +4,10 @@
net5.0
+
+
+ ..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll
+
+
+
diff --git a/HBLConsole.Model/KeepParameter/BatchingInfoPar.cs b/HBLConsole.Model/KeepParameter/BatchingInfoPar.cs
new file mode 100644
index 0000000..0a7c6ba
--- /dev/null
+++ b/HBLConsole.Model/KeepParameter/BatchingInfoPar.cs
@@ -0,0 +1,16 @@
+using BPA.Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HBLConsole.Model
+{
+ public class BatchingInfoPar
+ {
+ public OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery();
+
+ public RecipeBoms recipeBoms { get; set; } = new RecipeBoms();
+ }
+}
diff --git a/HBLConsole.Service/HBLConsole.Service.csproj b/HBLConsole.Service/HBLConsole.Service.csproj
index 5db1cf0..25f57f2 100644
--- a/HBLConsole.Service/HBLConsole.Service.csproj
+++ b/HBLConsole.Service/HBLConsole.Service.csproj
@@ -17,6 +17,7 @@
+
diff --git a/HBLConsole.Service/Sqlite.cs b/HBLConsole.Service/Sqlite.cs
new file mode 100644
index 0000000..3b3d07a
--- /dev/null
+++ b/HBLConsole.Service/Sqlite.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Sqlite;
+
+namespace HBLConsole.Service
+{
+ public class Sqlite : DbContext where T : class, new()
+ {
+
+ private volatile static Sqlite _Instance;
+ public static Sqlite GetInstance => _Instance ?? (_Instance = new Sqlite());
+ private Sqlite() { }
+
+ public DbSet Base { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlite($"FileName={path}");
+ }
+
+ static string path
+ {
+ get
+ {
+ Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AccessFile"));
+ return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\{typeof(T).Name}.db";
+ }
+ }
+
+ }
+}
diff --git a/HBLConsole.sln b/HBLConsole.sln
index cf2470a..6bcc062 100644
--- a/HBLConsole.sln
+++ b/HBLConsole.sln
@@ -23,7 +23,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Interface", "HBL
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Abstract", "HBLConsole.Abstract\HBLConsole.Abstract.csproj", "{366CA88C-D690-4669-9AB8-1948D3CBF127}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Factory", "Factory\HBLConsole.Factory.csproj", "{A71309D9-6791-4D0A-BFAE-7D6AD63467A6}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLConsole.Factory", "HBLConsole.Factory\HBLConsole.Factory.csproj", "{1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -71,10 +71,10 @@ Global
{366CA88C-D690-4669-9AB8-1948D3CBF127}.Debug|Any CPU.Build.0 = Debug|Any CPU
{366CA88C-D690-4669-9AB8-1948D3CBF127}.Release|Any CPU.ActiveCfg = Release|Any CPU
{366CA88C-D690-4669-9AB8-1948D3CBF127}.Release|Any CPU.Build.0 = Release|Any CPU
- {A71309D9-6791-4D0A-BFAE-7D6AD63467A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A71309D9-6791-4D0A-BFAE-7D6AD63467A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A71309D9-6791-4D0A-BFAE-7D6AD63467A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A71309D9-6791-4D0A-BFAE-7D6AD63467A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B19BE8D-AFB9-4635-B114-8648B0C8BDF7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/HBLConsole/App.config b/HBLConsole/App.config
index cf3bea9..70eb11a 100644
--- a/HBLConsole/App.config
+++ b/HBLConsole/App.config
@@ -4,10 +4,10 @@
-
+
-
+
diff --git a/HBLConsole/App.xaml.cs b/HBLConsole/App.xaml.cs
index a0cd1d9..d8c6957 100644
--- a/HBLConsole/App.xaml.cs
+++ b/HBLConsole/App.xaml.cs
@@ -10,6 +10,8 @@ using HBLConsole.View;
using HBLConsole.Server;
using System.Diagnostics;
using HBLConsole.Service;
+using HBLConsole.Model;
+using HBLConsole.MainConsole;
namespace HBLConsole
{
@@ -19,24 +21,33 @@ namespace HBLConsole
public partial class App : Application
{
MainView mainView = new MainView();
- ListDialogView listDialogView = new ListDialogView();
+ ListDialogView listDialogView;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
- ActionManagerment.GetInstance.Register(new Func