From cd8493e5a1587a363e99e744944e18f283502d44 Mon Sep 17 00:00:00 2001 From: CaesarBao Date: Tue, 14 Apr 2026 17:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Emes=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Extensions/RfidFactorySetup.cs | 12 +- SlnMesnac.Model/domain/Base_sensor_info.cs | 158 ------- SlnMesnac.Model/domain/MesOrderInfo.cs | 18 + SlnMesnac.Model/domain/real_readdata.cs | 98 ++++ SlnMesnac.Rfid/ApiServer.cs | 2 +- SlnMesnac.Rfid/MeshttpClient.cs | 31 ++ SlnMesnac.Rfid/TouchSocketSetup.cs | 4 +- SlnMesnac.WPF/App.xaml.cs | 2 +- SlnMesnac.WPF/MainWindow.xaml | 10 +- SlnMesnac.WPF/Model/Real_DataInfo.cs | 112 ++++- SlnMesnac.WPF/Page/IndexPage/AlarmRecord.xaml | 235 ++++++++++ .../Page/IndexPage/AlarmRecord.xaml.cs | 34 ++ SlnMesnac.WPF/Page/IndexPage/ChangeType.xaml | 86 ++-- .../Page/IndexPage/HistorySearch.xaml | 235 ++++++++++ .../Page/IndexPage/HistorySearch.xaml.cs | 37 ++ SlnMesnac.WPF/Page/IndexPage/MiddleWare.xaml | 220 --------- .../Page/IndexPage/MiddleWare.xaml.cs | 130 ------ .../IndexPage/ProductionLineUserControl.xaml | 183 +++++--- SlnMesnac.WPF/SlnMesnac.WPF.csproj | 1 + .../Generate/GenerateControlViewModel.cs | 13 +- .../IndexPage/AlarmRecordViewModel.cs | 190 ++++++++ .../IndexPage/ChangeTypeViewModel.cs | 208 ++++++--- .../IndexPage/HistorySearchViewModel.cs | 190 ++++++++ .../IndexPage/MiddleWareViewModel.cs | 435 ------------------ .../IndexPage/ProductionLineViewModel.cs | 259 +++++++---- .../ViewModel/MainWindowViewModel.cs | 7 +- SlnMesnac.WPF/appsettings.json | 5 +- 27 files changed, 1694 insertions(+), 1221 deletions(-) delete mode 100644 SlnMesnac.Model/domain/Base_sensor_info.cs create mode 100644 SlnMesnac.Model/domain/MesOrderInfo.cs create mode 100644 SlnMesnac.Model/domain/real_readdata.cs create mode 100644 SlnMesnac.WPF/Page/IndexPage/AlarmRecord.xaml create mode 100644 SlnMesnac.WPF/Page/IndexPage/AlarmRecord.xaml.cs create mode 100644 SlnMesnac.WPF/Page/IndexPage/HistorySearch.xaml create mode 100644 SlnMesnac.WPF/Page/IndexPage/HistorySearch.xaml.cs delete mode 100644 SlnMesnac.WPF/Page/IndexPage/MiddleWare.xaml delete mode 100644 SlnMesnac.WPF/Page/IndexPage/MiddleWare.xaml.cs create mode 100644 SlnMesnac.WPF/ViewModel/IndexPage/AlarmRecordViewModel.cs create mode 100644 SlnMesnac.WPF/ViewModel/IndexPage/HistorySearchViewModel.cs delete mode 100644 SlnMesnac.WPF/ViewModel/IndexPage/MiddleWareViewModel.cs diff --git a/SlnMesnac.Extensions/RfidFactorySetup.cs b/SlnMesnac.Extensions/RfidFactorySetup.cs index dd9be7e..11b2d5d 100644 --- a/SlnMesnac.Extensions/RfidFactorySetup.cs +++ b/SlnMesnac.Extensions/RfidFactorySetup.cs @@ -50,7 +50,7 @@ namespace SlnMesnac.Extensions }; public static TcpServer _TcpServer; private static StringChange _StringChange; - private static List sensor_Infos; + public static void AddRfidFactorySetup(this IServiceCollection services) @@ -62,7 +62,7 @@ namespace SlnMesnac.Extensions _StringChange = x.GetService(); _TcpServer = x.GetService(); List baseRfidInfos = sqlSugarClient.Queryable().Where(x=>x.Collectid == appConfig.StationCode).ToList(); - sensor_Infos = sqlSugarClient.Queryable().Where(x => x.Deleteflag == 0).ToList(); + //sensor_Infos = sqlSugarClient.Queryable().Where(x => x.Deleteflag == 0).ToList(); List absractFactories = new List(); try @@ -92,8 +92,8 @@ namespace SlnMesnac.Extensions _rfid.deviceid = item.Deviceid; _rfid.ip = IP; _rfid.port = int.Parse(Port); - _rfid.ConfigKey = sensor_Infos.Find(x => x.Deviceid == item.Deviceid).Combineid; - _rfid.FilterData = sensor_Infos.Find(x => x.Deviceid == item.Deviceid).Mapid; + _rfid.ConfigKey = item.Deviceid; + //_rfid.FilterData = sensor_Infos.Find(x => x.Deviceid == item.Deviceid).Mapid; //bool connectResult = _rfid.Connect(IP, int.Parse(Port)); //_rfid._Action += RecvIdentifyData_Instance; bool connectResult = false; @@ -171,12 +171,12 @@ namespace SlnMesnac.Extensions private static ushort GetMESCallback(int id) { - var sensorInfo = sensor_Infos.Find((x) => { return x.Combineid == id.ToString(); }); + var sensorInfo = "1"; if (sensorInfo == null) { return 1; } - return (ushort)_StringChange.ParseToInt(sensorInfo.Mesid); + return (ushort)_StringChange.ParseToInt("1"); } diff --git a/SlnMesnac.Model/domain/Base_sensor_info.cs b/SlnMesnac.Model/domain/Base_sensor_info.cs deleted file mode 100644 index 77a578f..0000000 --- a/SlnMesnac.Model/domain/Base_sensor_info.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using SqlSugar; -namespace Models -{ - /// - /// - /// - [SugarTable("base_sensor_info")] - public class Base_sensor_info - { - - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="sensorid" ,IsPrimaryKey = true) ] - public string Sensorid { get; set; } = null!; - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="combineid" ) ] - public string Combineid { get; set; } = null!; - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="name" ) ] - public string? Name { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="sensorser" ) ] - public decimal? Sensorser { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="sensortypeid" ) ] - public decimal? Sensortypeid { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="deviceid" ) ] - public string? Deviceid { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="readinterval" ) ] - public decimal? Readinterval { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="multdata" ) ] - public decimal? Multdata { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="timedout" ) ] - public decimal? Timedout { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="returnimm" ) ] - public decimal? Returnimm { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="mapid" ) ] - public string? Mapid { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="recordtime" ) ] - public DateTime? Recordtime { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="deleteflag" ) ] - public int? Deleteflag { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="recordperson" ) ] - public int? Recordperson { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="objid" ,IsIdentity = true) ] - public int Objid { get; set; } - - /// - /// 备 注:是否调用适配器 1是 2否 - /// 默认值: - /// - [SugarColumn(ColumnName="CallAdapter" ) ] - public decimal? CallAdapter { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="CallCombineID" ) ] - public string? CallCombineID { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="mesid" ) ] - public string? Mesid { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="DelayTime" ) ] - public string? DelayTime { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName="ReadCounts" ) ] - public string? ReadCounts { get; set; } - - - } - -} \ No newline at end of file diff --git a/SlnMesnac.Model/domain/MesOrderInfo.cs b/SlnMesnac.Model/domain/MesOrderInfo.cs new file mode 100644 index 0000000..1e4b41e --- /dev/null +++ b/SlnMesnac.Model/domain/MesOrderInfo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Model.domain +{ + public class MesOrderInfo + { + public MesOrderInfo() { } + + public string ProductSpec { get; set; } + public string OrderNo { get; set; } + public string ProductCode { get; set; } + public string ProductType { get; set; } + public string ProductName { get; set; } + public decimal PlanQty { get; set; } + } +} diff --git a/SlnMesnac.Model/domain/real_readdata.cs b/SlnMesnac.Model/domain/real_readdata.cs new file mode 100644 index 0000000..78c6307 --- /dev/null +++ b/SlnMesnac.Model/domain/real_readdata.cs @@ -0,0 +1,98 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace SlnMesnac.Repository +{ + /// + /// + /// + [SugarTable("real_readdata")] + public partial class real_readdata + { + public real_readdata(){ + + + } + /// + /// Desc: + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="objid")] + public int objid {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="orderno")] + public string orderno {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="lineno")] + public string lineno {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="producttype")] + public string producttype {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="rfidepc")] + public string rfidepc {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="rfidascii")] + public string rfidascii {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="readtime")] + public DateTime? readtime {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="writetime")] + public DateTime? writetime {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="writestatus")] + public string writestatus {get;set;} + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "serialno")] + public string serialno { get; set; } + } +} diff --git a/SlnMesnac.Rfid/ApiServer.cs b/SlnMesnac.Rfid/ApiServer.cs index 1f59f72..f48d206 100644 --- a/SlnMesnac.Rfid/ApiServer.cs +++ b/SlnMesnac.Rfid/ApiServer.cs @@ -50,7 +50,7 @@ namespace SlnMesnac.TouchSocket { private readonly SerilogHelper _logger; private List rfidAbsractFactory; - private List base_Sensor_Infos; + public static Action _RefreshLogMessageAction; public static Action RefreshStateEvent; private IReal_mesdataService _real_MesdataService; diff --git a/SlnMesnac.Rfid/MeshttpClient.cs b/SlnMesnac.Rfid/MeshttpClient.cs index 29cfdd9..974f021 100644 --- a/SlnMesnac.Rfid/MeshttpClient.cs +++ b/SlnMesnac.Rfid/MeshttpClient.cs @@ -85,6 +85,37 @@ namespace SlnMesnac.TouchSocket return ResponseEntity; } + + public async Task> GetMesOrderInfo(string lineCode, string datetime) + { + try + { + var invokeOption_30s = new InvokeOption(30 * 1000) + { + FeedbackType = FeedbackType.WaitInvoke + }; + if (MESHttpClient == null) + { + return null; + } + var request = new WebApiRequest(); + request.Method = HttpMethodType.Get; + request.Querys = new KeyValuePair[] { new KeyValuePair("lineCode", lineCode), new KeyValuePair("planDate", datetime) }; + + var responseValue = await MESHttpClient.InvokeTAsync("/api/plan/get", invokeOption_30s, request); + + //JToken responseValue = await MESHttpClient.InvokeTAsync("Get:/api/plan", null, requestValue); + + return JTokenToEntity>(responseValue); + } + catch (Exception ex) + { + _logger.Info("ERROR: " + ex.Message); + return new ApiResponse(); + } + + } + /// /// 主动上报 /// diff --git a/SlnMesnac.Rfid/TouchSocketSetup.cs b/SlnMesnac.Rfid/TouchSocketSetup.cs index 7bc792d..ee56f94 100644 --- a/SlnMesnac.Rfid/TouchSocketSetup.cs +++ b/SlnMesnac.Rfid/TouchSocketSetup.cs @@ -44,9 +44,9 @@ namespace SlnMesnac.TouchSocket _apiServer.Init(); var _server = service.GetService(); _server.Init(5656); - //var _httpclient = service.GetService(); + var _httpclient = service.GetService(); //_server.Init(6001); - //await _httpclient.CreateWebApiClientAsync("172.16.0.106:9880"); + await _httpclient.CreateWebApiClientAsync("10.20.8.51:8005"); //_httpclient.CreateWebApiClient("127.0.0.1:9880"); } diff --git a/SlnMesnac.WPF/App.xaml.cs b/SlnMesnac.WPF/App.xaml.cs index 96f52ab..93912e5 100644 --- a/SlnMesnac.WPF/App.xaml.cs +++ b/SlnMesnac.WPF/App.xaml.cs @@ -405,7 +405,7 @@ namespace SlnMesnac.WPF .AddClasses(classes => classes.WithAttribute()) .AsSelf() .WithTransientLifetime()); - services.AddSingleton>(); + //services.AddSingleton>(); // 注册ORM services.AddSqlSugarSetup(); diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml index e2ef536..99ef4a9 100644 --- a/SlnMesnac.WPF/MainWindow.xaml +++ b/SlnMesnac.WPF/MainWindow.xaml @@ -49,10 +49,12 @@