From d79fcd9534d97f5bbb4edb66dbb925dea0479304 Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期日, 22 九月 2024 15:06:34 +0800 Subject: [PATCH] ssd12313 --- Admin.NET/WCS.Application/PLC/PLCService.cs | 111 ++- Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs | 98 ++ Admin.NET/WCS.Application/Util/HttpService.cs | 8 Admin.NET/WCS.Application/Util/LedDll.cs | 1147 ++++++++++++++++++++++++++++++++++++++++++ Admin.NET/WCS.Application/Configuration/Database.json | 2 Admin.NET/WCS.Application/OpenApi/Dto/WCSTasks.cs | 141 +++++ Admin.NET/WCS.Application/PLC/PLCCommon.cs | 55 + Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 2 Admin.NET/WCS.Application/Model/TaskRequest.cs | 21 Admin.NET/WCS.Application/OpenApi/Dto/WCSResultModel.cs | 15 Admin.NET/WCS.Application/WCS.Application.csproj | 1 11 files changed, 1,523 insertions(+), 78 deletions(-) diff --git a/Admin.NET/WCS.Application/Configuration/Database.json b/Admin.NET/WCS.Application/Configuration/Database.json index a17735f..9ae67f7 100644 --- a/Admin.NET/WCS.Application/Configuration/Database.json +++ b/Admin.NET/WCS.Application/Configuration/Database.json @@ -11,7 +11,7 @@ //"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 搴撹繛鎺ュ瓧绗︿覆 //"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 搴撹繛鎺ュ瓧绗︿覆", //"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle 搴撹繛鎺ュ瓧绗︿覆 - "ConnectionString": "Server=192.168.62.200;Database=WCSnet6;User Id=sa;Password=sql2019;", // SqlServer 搴撹繛鎺ュ瓧绗︿覆 + "ConnectionString": "Server=10.18.99.10;Database=WCSnet6;User Id=sa;Password=sql2024;", // SqlServer 搴撹繛鎺ュ瓧绗︿覆 //"SlaveConnectionConfigs": [ // 璇诲啓鍒嗙/涓讳粠 // { diff --git a/Admin.NET/WCS.Application/Model/TaskRequest.cs b/Admin.NET/WCS.Application/Model/TaskRequest.cs index 1ae0b35..3767fa9 100644 --- a/Admin.NET/WCS.Application/Model/TaskRequest.cs +++ b/Admin.NET/WCS.Application/Model/TaskRequest.cs @@ -7,6 +7,17 @@ public TaskTypeEnum TaskType { get; set; } // 浠诲姟绫诲瀷 public TaskStatusEnum TaskStatus { get; set; } // 浠诲姟鐘舵�� 0 绛夊緟鎵ц 1 姝e湪鎵ц 2 鎵ц瀹屾垚 3 寮傚父缁撴潫 4 浠诲姟鍙栨秷 } +public class TaskRequestWMS +{ + public string TaskNo { get; set; } // 浠诲姟鍙� + public string PalletNo { get; set; } // 鎵樼洏鍙� + public string TaskType { get; set; } // 浠诲姟绫诲瀷 + public string TaskStatus { get; set; } // 浠诲姟鐘舵�� 0 绛夊緟鎵ц 1 姝e湪鎵ц 2 鎵ц瀹屾垚 3 寮傚父缁撴潫 4 浠诲姟鍙栨秷 +} + +/// <summary> +/// 鐢宠宸烽亾WMS杩斿洖鐨勫疄浣� +/// </summary> public class ResponseTasks { public string StatusCode { get; set; } @@ -17,6 +28,16 @@ public ResponseTasksModel TaskList { get; set; } } +/// <summary> +/// 浠诲姟瀹屾垚 WMS杩斿洖瀹炰綋 +/// </summary> +public class ResponseModel +{ + public int StatusCode { get; set; } + public string Msg { get; set; } + +} + public class ResponseTasksModel { /// <summary> diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs index 0224c16..7d14fa9 100644 --- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs +++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs @@ -1,22 +1,84 @@ -锘縩amespace WCS.Application; +锘縰sing System.Diagnostics.CodeAnalysis; +using System.Text; +using WCS.Application.OpenApi.Dto; -///// <summary> -///// 绀轰緥寮�鏀炬帴鍙� -///// </summary> -//[ApiDescriptionSettings("寮�鏀炬帴鍙�", Name = "Demo", Order = 100)] +namespace WCS.Application; + +/// <summary> +/// 绀轰緥寮�鏀炬帴鍙� +/// </summary> +[ApiDescriptionSettings("寮�鏀炬帴鍙�", Name = "Demo", Order = 100)] //[Authorize(AuthenticationSchemes = SignatureAuthenticationDefaults.AuthenticationScheme)] -//public class DemoOpenApi : IDynamicApiController -//{ -// private readonly UserManager _userManager; +public class DemoOpenApi : IDynamicApiController +{ + private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); -// public DemoOpenApi(UserManager userManager) -// { -// _userManager = userManager; -// } + private readonly UserManager _userManager; -// [HttpGet("helloWord")] -// public Task<string> HelloWord() -// { -// return Task.FromResult($"Hello word. {_userManager.Account}"); -// } -//} \ No newline at end of file + public DemoOpenApi(UserManager userManager) + { + _userManager = userManager; + } + + //[HttpGet("helloWord")] + //public Task<string> HelloWord() + //{ + // return Task.FromResult($"Hello word. {_userManager.Account}"); + //} + + /// <summary> + /// WCS鎺ュ彈WMS涓嬪彂鐨勪换鍔�(鍗曟潯浠诲姟) + /// </summary> + /// <param name="models">浠诲姟淇℃伅</param> + /// <returns>鍙嶉淇℃伅</returns> + [AllowAnonymous] + public WCSResultModel AddWcsTask(WCSTasks models) + { + WCSResultModel result = new WCSResultModel(); + try + { + // 楠岃瘉浠诲姟鏄惁宸插瓨鍦� + var taskInfo = _db.Queryable<WcsTask>().First(w => w.TaskNo == models.TaskNo); + if (taskInfo != null) + { + result.StatusCode = "-1"; + result.Msg = "浠诲姟:" + models.TaskNo + ";宸插瓨鍦�!"; + return result; + } + if (models.Type == "0") + { + models.Levels = "1.5"; + } + else + { + models.Levels = "2"; + } + //鏂板浠诲姟 + var taskAdd = new WcsTask() + { + TaskNo = models.TaskNo, + TaskType = TaskTypeEnum.Out, + Status = TaskStatusEnum.Wait, + //IsSuccess =TaskSuccessEnum.Success, + Origin = "WMS", + StartRoadway= models.StartRoadway, + StartLocate = models.StartLocate, + EndLocate = models.EndLocate, + EndRoadway= models.EndRoadway, + PalletNo = models.PalletNo, + + LotNo =models.LotNo, + SkuNo=models.SkuNo, + SkuName=models.SkuName, + Qty=models.Qty + }; + _db.Insertable(taskAdd).ExecuteCommand(); + + return new WCSResultModel() { StatusCode = "1", Msg = "鎻掑叆鎴愬姛" }; + } + catch (Exception ex) + { + return new WCSResultModel() { StatusCode = "-1", Msg = ex.Message }; + } + } +} \ No newline at end of file diff --git a/Admin.NET/WCS.Application/OpenApi/Dto/WCSResultModel.cs b/Admin.NET/WCS.Application/OpenApi/Dto/WCSResultModel.cs new file mode 100644 index 0000000..6bfd3fb --- /dev/null +++ b/Admin.NET/WCS.Application/OpenApi/Dto/WCSResultModel.cs @@ -0,0 +1,15 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.Application.OpenApi.Dto; +public class WCSResultModel +{ + /// <summary> + /// 1:鎴愬姛 -1:澶辫触 + /// </summary> + public string StatusCode { get; set; } + public string Msg { get; set; } +} diff --git a/Admin.NET/WCS.Application/OpenApi/Dto/WCSTasks.cs b/Admin.NET/WCS.Application/OpenApi/Dto/WCSTasks.cs new file mode 100644 index 0000000..33725a9 --- /dev/null +++ b/Admin.NET/WCS.Application/OpenApi/Dto/WCSTasks.cs @@ -0,0 +1,141 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.Application.OpenApi.Dto; +/// <summary> +/// 浠诲姟瀹炰綋绫� +/// </summary> +public class WCSTasks +{ + public int? Id { get; set; } + /// <summary> + /// 浠诲姟鍙� + /// </summary> + public string TaskNo { get; set; } + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + public string Type { get; set; } + /// <summary> + /// 鐘舵�� + /// </summary> + public string Status { get; set; } + /// <summary> + /// 鏄惁鍥為鎴愬姛 + /// </summary> + public int? IsSuccess { get; set; } + /// <summary> + /// 寮傚父淇℃伅 + /// </summary> + public string Information { get; set; } + /// <summary> + /// 鏉ユ簮 + /// </summary> + public string Origin { get; set; } + /// <summary> + /// 璧峰浣嶇疆 + /// </summary> + public string StartLocat { get; set; } + public string StartLocate { get; set; } + /// <summary> + /// 璧峰宸烽亾 + /// </summary> + public string StartRoadway { get; set; } + + /// <summary> + /// 鐩爣浣嶇疆 + /// </summary> + public string EndLocate { get; set; } + /// <summary> + /// 鐩爣宸烽亾 + /// </summary> + public string EndRoadway { get; set; } + /// <summary> + /// 鎵樼洏鍙� + /// </summary> + public string PalletNo { get; set; } + /// <summary> + /// 鎵樼洏绫诲瀷 + /// </summary> + public string PalletType { get; set; } + /// <summary> + /// 鎵规鍙� + /// </summary> + public string LotNo { get; set; } + /// <summary> + /// 渚涜揣鎵规 + /// </summary> + public string SupplierLot { get; set; } + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + public string SkuNo { get; set; } + /// <summary> + /// 鐗╂枡鍚嶇О + /// </summary> + public string SkuName { get; set; } + + /// <summary> + /// 鐗╂枡绫诲瀷 + /// </summary> + public string SkuType { get; set; } + /// <summary> + /// 鏁伴噺 + /// </summary> + public int? Qty { get; set; } + /// <summary> + /// 鍙栨秷鏃堕棿 + /// </summary> + public DateTime? CancelDate { get; set; } + /// <summary> + /// 瀹屾垚鏃堕棿 + /// </summary> + public DateTime? FinishDate { get; set; } + /// <summary> + /// 鏈�鍚庡啓鍏ユ祦绋嬫帶鍒跺瓧鍊� + /// </summary> + public string WcsPosValue { get; set; } + /// <summary> + /// 浼樺厛绾� + /// </summary> + public string Levels { get; set; } + + /// <summary> + /// 鏄惁瑁瑰寘 + /// </summary> + public string IsBale { get; set; } + /// <summary> + /// 鏄惁鎵撳甫 + /// </summary> + public string IsBelt { get; set; } + /// <summary> + /// 鏄惁鍚屾鍒癢MS + /// </summary> + public string SyncWms { get; set; } + /// <summary> + /// 澶囨敞 + /// </summary> + public string Demo { get; set; } + public string IsStacking1 { get; set; } + public string IsStacking2 { get; set; } + public string IsStacking3 { get; set; } + public string Dismantling { get; set; } + /// <summary> + /// 鐗╂枡浠诲姟绫诲瀷 + /// </summary> + public string TaskType { get; set; } + + + public string IsDel { get; set; } + public DateTime? TopTime { get; set; } + public DateTime? CreateTime { get; set; } + public int? CreateUser { get; set; } + public DateTime? UpdateTime { get; set; } + public int? UpdateUser { get; set; } + + public string OutMode { get; set; } + public int Order { get; set; } +} \ No newline at end of file diff --git a/Admin.NET/WCS.Application/PLC/PLCCommon.cs b/Admin.NET/WCS.Application/PLC/PLCCommon.cs index 7407266..7efbe37 100644 --- a/Admin.NET/WCS.Application/PLC/PLCCommon.cs +++ b/Admin.NET/WCS.Application/PLC/PLCCommon.cs @@ -556,33 +556,42 @@ //var conveyList2 = new List<string>() { "252", "254", "260", "262", "272", "270", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" }; //var conveyList3 = new List<string>() { "401", "402", "405", "406", "409", "410", "413", "414", "417", "418", "421", "422", "425", "426", "429", "430", "433", "434", "437", "438" }; - var ipInfo = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine); - var ip1 = ipInfo.First(m=>m.Text == "1灞傛墭鐩樿緭閫佺嚎"); - var ip2 = ipInfo.First(m=>m.Text == "2灞傛墭鐩樿緭閫佺嚎"); - var ip3 = ipInfo.First(m=>m.Text == "3灞傛墭鐩樿緭閫佺嚎"); - - var dev1 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip1.Id).Select(m=>m.StationNum).ToList(); - var dev2 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip2.Id).Select(m => m.StationNum).ToList(); - var dev3 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip3.Id).Select(m => m.StationNum).ToList(); + var ipInfo = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine); + var ip1 = ipInfo.First(m => m.Text == "1灞傛墭鐩樿緭閫佺嚎"); + var ip2 = ipInfo.First(m => m.Text == "2灞傛墭鐩樿緭閫佺嚎"); + var ip3 = ipInfo.First(m => m.Text == "3灞傛墭鐩樿緭閫佺嚎"); - if (dev1.Contains(StationNum)) + if (ip1 != null) { - value = "1"; - } - else if (dev2.Contains(StationNum)) - { - value = "2"; - } - else if (dev3.Contains(StationNum)) - { - value = "3"; - } - else - { - throw new Exception("宸ヤ綅鏈煡璇㈠埌"); + var dev1 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip1.Id).Select(m => m.StationNum).ToList(); + if (dev1.Contains(StationNum)) + { + value = "1"; + return value; + } } - return value; + if (ip2 != null) + { + var dev2 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip2.Id).Select(m => m.StationNum).ToList(); + if (dev2.Contains(StationNum)) + { + value = "2"; + return value; + } + } + + if (ip3 != null) + { + var dev3 = PLCTaskAction.plcDevices.Where(m => m.IsDelete == false && m.PlcId == ip3.Id).Select(m => m.StationNum).ToList(); + if (dev3.Contains(StationNum)) + { + value = "3"; + return value; + } + } + + throw new Exception("宸ヤ綅鏈煡璇㈠埌"); } /// <summary> diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs index da065a4..0a425c0 100644 --- a/Admin.NET/WCS.Application/PLC/PLCService.cs +++ b/Admin.NET/WCS.Application/PLC/PLCService.cs @@ -10,6 +10,7 @@ using System; using System.Data; using System.Reflection.Emit; +using WCS.Application.Util; namespace WCS.Application; public static class PLCService @@ -70,7 +71,7 @@ } // 鏍规嵁鐩爣鍦板潃鍜屽贩閬撹幏鍙栨斁璐у伐浣嶅搴旂殑鎺掑垪灞� - PlcTaskInfo taskInfo = PLCCommon.GetCTaskInfo(modTask.EndLocate, modTask.TaskType.ToString(), + PlcTaskInfo taskInfo = PLCCommon.GetCTaskInfo(modTask.EndLocate, ((int)modTask.TaskType).ToString(), modTask.StartRoadway, modTask.EndRoadway); // 鐩爣宸ヤ綅涓嶄负null锛岄渶鍏堝垽鏂斁璐у伐浣嶆槸鍚︾┖闂� @@ -197,7 +198,7 @@ { // 鑾峰彇浠诲姟淇℃伅 string tasknoVal = val.ToString(); - var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.IsDelete == true); + var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.IsDelete == false); if (modTask == null) { Log.Error(string.Format("PLC鎺у埗瀛�840:鏈壘鍒板搴旂殑浠诲姟銆�")); @@ -218,16 +219,16 @@ { // 鑾峰彇璺烘満璧峰宸ヤ綅鐐逛綅閰嶇疆,璇诲彇璧峰宸ヤ綅 var modPosStartStation = modDevice.listStation.FirstOrDefault(m => m.Text == "璧峰宸ヤ綅"); - var (startStationRes, startStationVal) = plcConn.GetPlcDBValue(PLCDataTypeEnum.String, modDevice.DbNumber, modPosStartStation.PlcPos); + var (startStationRes, startStationVal) = plcConn.GetPlcDBValue(PLCDataTypeEnum.Short, modDevice.DbNumber, modPosStartStation.PlcPos); if (startStationRes.IsSucceed) { // 鏍规嵁宸ヤ綅鍙疯幏鍙栧搴旂殑杈撻�佺嚎IP - var plcConveyorConn = PLCCommon.GetPlcIp(startStationVal); + var plcConveyorConn = PLCCommon.GetPlcIp(startStationVal.ToString()); if (plcConveyorConn.Connected) { // 鍚戝彇璐у伐浣嶅啓鍏ユ祦绋嬪瓧640 鍙栬揣宸插畬鎴� - var ConveyorMod = PLCTaskAction.plcDevices.First(m => m.StationNum == startStationVal - && m.DeviceType == DeviceTypeEnum.Business && m.IsDelete == true); + var ConveyorMod = PLCTaskAction.plcDevices.First(m => m.StationNum == startStationVal.ToString() + && m.DeviceType == DeviceTypeEnum.Business && m.IsDelete == false); var retc = plcConveyorConn.SetPlcDBValue(ConveyorMod.PosType, ConveyorMod.DbNumber, ConveyorMod.WcsPos, "640"); var modcTaskMonitor = new WcsTaskMonitor() { @@ -236,7 +237,7 @@ PlcName = ConveyorMod.Text, PalletNo = modTask.PalletNo, Status = TaskStatusEnum.Complete, - StartLocat = startStationVal, + StartLocat = startStationVal.ToString(), EndLocat = modTask.EndLocate // 鐩爣鍌ㄤ綅鍦板潃 }; if (!retc.IsSucceed) @@ -283,6 +284,11 @@ // 璁板綍浠诲姟鏄庣粏 modInsertTaskMonitor.InteractiveMsg = string.Format("鍌ㄤ綅鍦板潃锛歿0}鍙栬揣瀹屾垚", modTask.StartLocate); modInsertTaskMonitor.EndLocat = endStation; // 鏀捐揣宸ヤ綅 + + // 鎻掑叆浜や簰鏃ュ織 + _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); + //涓嬪彂浠诲姟鏃ュ織 + HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); } else { @@ -295,12 +301,13 @@ modInsertTaskMonitor.InteractiveMsg = string.Format("鍌ㄤ綅鍦板潃锛歿0}鍙栬揣瀹屾垚", modTask.StartLocate); modInsertTaskMonitor.EndLocat = endStation; // 鐩爣鍌ㄤ綅 - } - // 鎻掑叆浜や簰鏃ュ織 - _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); - //涓嬪彂浠诲姟鏃ュ織 - HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); + // 鎻掑叆浜や簰鏃ュ織 + _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); + //涓嬪彂浠诲姟鏃ュ織 + HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); + } + //淇敼led灞忎俊鎭� //LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modTask.EndLocate, "鍑哄簱涓� " + $"鍌ㄤ綅鍦板潃锛歿modTask.StartLocate}", "鎵樼洏鍙�:" + modTask.PalletNo); } @@ -315,7 +322,7 @@ if (res.IsSucceed) { string tasknoVal = val.ToString(); - var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.IsDelete == true); + var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.IsDelete == false); if (modTask == null) { Log.Error(string.Format("璺烘満鎺у埗瀛�860:鏈壘鍒板搴旂殑浠诲姟銆�")); @@ -352,24 +359,35 @@ if (modTask.Origin == "WMS") { // 鍙嶉WMS - var requestMode = new TaskRequest() + var requestMode = new TaskRequestWMS() { TaskNo = modTask.TaskNo, PalletNo = modTask.PalletNo, - TaskType = TaskTypeEnum.In, - TaskStatus = TaskStatusEnum.Complete + TaskType = ((int)TaskTypeEnum.In).ToString(), + TaskStatus = ((int)TaskStatusEnum.Complete).ToString() }; HttpService httpService = new HttpService(); var modResponseTask = httpService.RequestTask(requestMode).Result; - if (modResponseTask.StatusCode == "0") + if (modResponseTask.StatusCode == 0) { modTaskMonitor.InteractiveMsg = "浠诲姟瀹屾垚锛岃繑鍥炵粰WMS浠诲姟瀹屾垚"; } + else + { + Log.Error(string.Format("浠诲姟鍙嶉澶辫触锛歋tatusCode锛歿0};Msg锛歿1}", modResponseTask.StatusCode, modResponseTask.Msg)); + } } + // 鏍规嵁浠诲姟鍙疯幏鍙栬捣濮嬪伐浣嶅湴鍧�锛屾牴鎹捣濮嬪伐浣嶅湴鍧�鑾峰彇LEDIP 鎺ㄩ�佸埌LED灞忓箷銆� + var taskInfo = _db.Queryable<WcsTask>().First(w => w.TaskNo == modTask.TaskNo); + modDevice.LedIP = _db.Queryable<WcsDevice>().Where(w => w.StationNum == taskInfo.StartLocate).Select(s => s.LedIP).First(); + // 鎻掑叆浜や簰鏃ュ織 _db.Insertable(modTaskMonitor).ExecuteCommand(); //涓嬪彂浠诲姟鏃ュ織 HubUtil.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); + + // led鏄剧ず鍐呭 + LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modTask.StartLocate, "鍏ュ簱瀹屾垚 " + $"浠诲姟瀹屾垚:{modTask.TaskNo}", "鎵樼洏鍙�:" + modTask.PalletNo); // 姝ゅ娣诲姞涓嶇┖璺戜笟鍔� } @@ -478,16 +496,16 @@ if (modTask.Origin == "WMS") { // 鍙嶉WMS - var requestMode = new TaskRequest() + var requestMode = new TaskRequestWMS() { TaskNo = modTask.TaskNo, PalletNo = modTask.PalletNo, - TaskType = TaskTypeEnum.Move, - TaskStatus = TaskStatusEnum.Complete + TaskType = TaskTypeEnum.Move.ToString(), + TaskStatus = TaskStatusEnum.Complete.ToString() }; HttpService httpService = new HttpService(); var modResponseTask = httpService.RequestTask(requestMode).Result; - if (modResponseTask.StatusCode == "0") + if (modResponseTask.StatusCode == 0) { modcTaskMonitor.InteractiveMsg = "浠诲姟瀹屾垚锛岃繑鍥炵粰WMS浠诲姟瀹屾垚"; //淇敼鍌ㄤ綅淇℃伅 浠诲姟绫诲瀷 鎵ц鐘舵�� 璧峰浣嶇疆 鐩爣浣嶇疆 @@ -752,6 +770,10 @@ if (!strMsg.Contains("-1")) { + // 鏍规嵁浠诲姟鍙疯幏鍙栬捣濮嬪伐浣嶅湴鍧�锛屾牴鎹捣濮嬪伐浣嶅湴鍧�鑾峰彇LEDIP 鎺ㄩ�佸埌LED灞忓箷銆� + var taskInfo = _db.Queryable<WcsTask>().First(w => w.TaskNo == TaskNo); + modDevice.LedIP = _db.Queryable<WcsDevice>().Where(w => w.StationNum == taskInfo.StartLocate).Select(s => s.LedIP).First(); + // 鍐欏叆330 var ret = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "330"); @@ -775,9 +797,8 @@ // 閫氱煡浠诲姟鐣岄潰浠诲姟宸插瓨鍦ㄦ洿鏂� 璇锋洿鏂扮晫闈� HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); - // led鏇存柊鍐呭 - //DataRow ConveyorsRow10 = PlcInfoDt.Select($"Level = '2' and StationNum = '{EndLocat}'")[0]; - //LedDisplay(ConveyorsRow10["LedIP"].ToString(), "宸ヤ綅:" + EndLocat, "鍑哄簱涓� " + $"鍌ㄤ綅鍦板潃锛歿StartLocat}", "鎵樼洏鍙�:" + PalletNo); + // led鏄剧ず鍐呭 + LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modDevice.StationNum, "鐢宠鍏ュ簱 " + $"鐩爣宸烽亾锛歿EndLocate}", "鎵樼洏鍙�:" + palletVal); } } @@ -790,6 +811,7 @@ break; case "330": { + // 鍐欏叆浠诲姟 鎵樼洏绉诲姩 340 // 鑾峰彇宸ヤ綅鎵樼洏鐮佷俊鎭� @@ -838,6 +860,8 @@ var ret = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "340"); + // 鏍规嵁浠诲姟鍙疯幏鍙栬捣濮嬪伐浣嶅湴鍧�锛屾牴鎹捣濮嬪伐浣嶅湴鍧�鑾峰彇LEDIP 鎺ㄩ�佸埌LED灞忓箷銆� + modDevice.LedIP = _db.Queryable<WcsDevice>().Where(w => w.StationNum == modTask.StartLocate).Select(s => s.LedIP).First(); if (ret.IsSucceed) { @@ -860,8 +884,8 @@ // 閫氱煡浠诲姟鐣岄潰浠诲姟宸插瓨鍦ㄦ洿鏂� 璇锋洿鏂扮晫闈� HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); - // led鏇存柊鍐呭 - //LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modTask.EndLocate, "鍑哄簱涓� " + $"鍌ㄤ綅鍦板潃锛歿modTask.StartLocate}", "鎵樼洏鍙�:" + modTask.PalletNo); + // led鏄剧ず鍐呭 + LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modDevice.StationNum, "鍏ュ簱涓� " + $"鐩爣宸烽亾锛歿endLocatVlue}", "鎵樼洏鍙�:" + palletVal); } } @@ -896,6 +920,11 @@ string TaskNo = ""; // 鍚慦MS鐢宠鍌ㄤ綅淇℃伅 strMsg = http.RequestLocate(palletVal, modDevice.StationNum, taskModel, roadway, ref TaskNo); + + // 鏍规嵁浠诲姟鍙疯幏鍙栬捣濮嬪伐浣嶅湴鍧�锛屾牴鎹捣濮嬪伐浣嶅湴鍧�鑾峰彇LEDIP 鎺ㄩ�佸埌LED灞忓箷銆� + var taskInfo = _db.Queryable<WcsTask>().First(w => w.TaskNo == TaskNo); + modDevice.LedIP = _db.Queryable<WcsDevice>().Where(w => w.StationNum == taskInfo.StartLocate).Select(s => s.LedIP).First(); + if (!strMsg.Contains("-1")) { // 鍐欏叆娴佺▼瀛� 630 @@ -921,9 +950,8 @@ // 閫氱煡浠诲姟鐣岄潰浠诲姟宸插瓨鍦ㄦ洿鏂� 璇锋洿鏂扮晫闈� HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); - // led鏇存柊鍐呭 - //DataRow ConveyorsRow10 = PlcInfoDt.Select($"Level = '2' and StationNum = '{EndLocat}'")[0]; - //LedDisplay(ConveyorsRow10["LedIP"].ToString(), "宸ヤ綅:" + EndLocat, "鍑哄簱涓� " + $"鍌ㄤ綅鍦板潃锛歿StartLocat}", "鎵樼洏鍙�:" + PalletNo); + // led鏄剧ず鍐呭 + LedDisplay(modDevice.LedIP, "宸ヤ綅:" + modDevice.StationNum, "鍏ュ簱涓� " + $"鐢宠鍌ㄤ綅鍦板潃:{strMsg}", "鎵樼洏鍙�:" + palletVal); } } else @@ -982,7 +1010,9 @@ string lie = int.Parse(endLocate.Substring(2, 2)).ToString(); string ceng = int.Parse(endLocate.Substring(4, 2)).ToString(); - var djMod = PLCTaskAction.plcDevices.First(m => m.StationNum == modTask.EndRoadway + var djmodel = _db.Queryable<WcsPlc>().First(m => m.IP == sInfo.Ip); + + var djMod = PLCTaskAction.plcDevices.First(m => m.PlcId == djmodel.Id && m.DeviceType == DeviceTypeEnum.Business && m.IsDelete == false); var djInfos = PLCTaskAction.plcPositions.Where(m => m.IsDelete == false && m.DeviceId == djMod.Id).ToList(); var djInfo = djInfos.First(m => m.Text == "PLC娴佺▼瀛�"); @@ -990,7 +1020,7 @@ // 鑾峰彇璺烘満褰撳墠鐘舵�� var (djRes, djVal) = plcStackeConn.GetPlcDBValue(djMod.PosType, djMod.DbNumber, djMod.PlcPos); - if (!djRes.IsSucceed || djVal != "820") + if (!djRes.IsSucceed || djVal.ToString() != "820") { // 璺烘満闈炵┖闂茬瓑寰� break; @@ -1004,7 +1034,7 @@ var modPosTaskType = djInfos.FirstOrDefault(s => s.Text == "浠诲姟绫诲瀷"); var taskTypeStr = (int)modTask.TaskType; listResult.Add(plcStackeConn.SetPlcDBValue(modPosTaskType.PosType, djMod.DbNumber, modPosTaskType.PlcPos, taskTypeStr.ToString())); - var modPosPalletNo = djInfos.FirstOrDefault(s => s.Text == "鎵樼洏鍙�"); + var modPosPalletNo = djInfos.FirstOrDefault(s => s.Text == "鎵樼洏鐮�"); listResult.Add(plcStackeConn.SetPlcDBValue(modPosPalletNo.PosType, djMod.DbNumber, modPosPalletNo.PlcPos, modTask.PalletNo)); //璧峰宸ヤ綅 @@ -1202,6 +1232,23 @@ } } + /// <summary> + /// Led灞忓睍绀轰俊鎭� + /// </summary> + /// <param name="ip">鍦板潃</param> + /// <param name="top">涓婃柟鍖哄煙</param> + /// <param name="content">涓棿鍖哄煙</param> + /// <param name="foot">搴曢儴鍖哄煙</param> + private static void LedDisplay(string ip, string top, string content, string foot) + { + try + { + LedDll Led = new LedDll(); + Led.LEDstr(ip, top, content, foot); + } + catch { } + } + private static void Test(WcsDeviceDto modDevice) { //鍐欐娴嬭瘯璇籹tring diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs index 73cd1e3..b2aca60 100644 --- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs +++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs @@ -171,7 +171,7 @@ } } - Thread.Sleep(10000); + Thread.Sleep(1000); } catch (OperationCanceledException) { diff --git a/Admin.NET/WCS.Application/Util/HttpService.cs b/Admin.NET/WCS.Application/Util/HttpService.cs index 644eb1b..5a894d5 100644 --- a/Admin.NET/WCS.Application/Util/HttpService.cs +++ b/Admin.NET/WCS.Application/Util/HttpService.cs @@ -99,7 +99,9 @@ string returnStr = ""; - var task = _db.Queryable<WcsTask>().First(m => m.IsDelete == false && (m.Status == TaskStatusEnum.Wait || m.Status == TaskStatusEnum.Doing) && m.TaskType == TaskTypeEnum.In && m.PalletNo == palletNo && string.IsNullOrWhiteSpace(m.EndLocate)); + var task = _db.Queryable<WcsTask>().First(m => m.IsDelete == false + && (m.Status == TaskStatusEnum.Wait || m.Status == TaskStatusEnum.Doing) + && m.TaskType == TaskTypeEnum.In && m.PalletNo == palletNo && !string.IsNullOrWhiteSpace(m.EndLocate)); if (task == null) { @@ -168,10 +170,10 @@ /// </summary> /// <param name="model">浠诲姟瀹屾垚鐘舵��</param> /// <returns></returns> - public async Task<ResponseTasks> RequestTask(TaskRequest model) + public async Task<ResponseModel> RequestTask(TaskRequestWMS model) { string url = Urls.WMSAddress + ":" + Urls.WMSPort; - var result = await (url + "/api/DownAPi/ReceiveWcsSignal").SetBody(model, "application/json", Encoding.UTF8).PostAsAsync<ResponseTasks>(); + var result = await (url + "/api/DownAPi/ReceiveWcsSignal").SetBody(model, "application/json", Encoding.UTF8).PostAsAsync<ResponseModel>(); Log.Information("璋冪敤WMS鎺ュ彛鍙嶉浠诲姟鎺ュ彛" + result.ToJson()); return result; } diff --git a/Admin.NET/WCS.Application/Util/LedDll.cs b/Admin.NET/WCS.Application/Util/LedDll.cs new file mode 100644 index 0000000..f881361 --- /dev/null +++ b/Admin.NET/WCS.Application/Util/LedDll.cs @@ -0,0 +1,1147 @@ +锘縰sing NLog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace WCS.Application.Util; +public class LedDll +{ + //棰滆壊鍊� R 0x0000ff G 0x00ff00 B 0xff0000 + public const int COLOR_RED = 0xff; //绾㈣壊 + public const int COLOR_GREEN = 0xff00; //缁胯壊 + public const int COLOR_YELLOW = 0xffff; //榛勮壊 + + public const int ADDTYPE_STRING = 0; //娣诲姞绫诲瀷涓哄瓧绗︿覆 + public const int ADDTYPE_FILE = 1; //娣诲姞绫诲瀷涓烘枃浠� + + public const int OK = 0;//鍑芥暟杩斿洖鎴愬姛 + + //******鑺傜洰瀹氭椂鍚敤鏃ユ湡鏃堕棿鏄熸湡鐨勬爣蹇楀畯*************************************************************************** + public const int ENABLE_DATE = 0x01; + public const int ENABLE_TIME = 0x02; + public const int ENABLE_WEEK = 0x04; + //***************************************************************************************************************** + + //******鑺傜洰瀹氭椂鏄熸湡閲屾煇澶╁惎鐢ㄥ畯*********************************************************** + public const int WEEK_MON = 0x01; + public const int WEEK_TUES = 0x02; + public const int WEEK_WEN = 0x04; + public const int WEEK_THUR = 0x08; + public const int WEEK_FRI = 0x10; + public const int WEEK_SAT = 0x20; + public const int WEEK_SUN = 0x40; + //***************************************************************************** + + //[StructLayout(LayoutKind.Sequential, Size = 8, CharSet = CharSet.Unicode, Pack = 1)] + + //**閫氳璁剧疆缁撴瀯浣�********************************************************* + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct COMMUNICATIONINFO + { + public int LEDType; ////LED绫诲瀷 0.6浠绯籄绯籜C绯� 1.6浠绯� 2.X1X2 3.7浠绯� + public int SendType; //閫氳鏂瑰紡 0.涓篢cp鍙戦�侊紙鍙堢О鍥哄畾IP閫氳锛�, 1.骞挎挱鍙戦�侊紙鍙堢О鍗曟満鐩磋繛锛� 2.涓插彛閫氳 3.纾佺洏淇濆瓨 4.骞垮煙缃戦�氳 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string IpStr; //LED灞忕殑IP鍦板潃锛屽彧鏈夐�氳鏂瑰紡涓�0鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪�� + public int Commport; //涓插彛鍙凤紝鍙湁閫氳鏂瑰紡涓�2鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪�� + public int Baud; //娉㈢壒鐜囷紝鍙湁閫氳鏂瑰紡涓�2鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪��, 0.9600 1.57600 2.115200 鐩存帴璧嬪�� 9600锛�19200锛�38400锛�57600锛�115200浜﹀彲 + public int LedNumber; //LED鐨勫睆鍙凤紝鍙湁閫氳鏂瑰紡涓�2鏃讹紝涓旂敤485閫氳鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪�� + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string OutputDir; //纾佺洏淇濆瓨鐨勭洰褰曪紝鍙湁閫氳鏂瑰紡涓�3鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪�� + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)] + public string networkIdStr; //缃戠粶ID锛屽彧鏈夐�氳鏂瑰紡涓�4鏃舵墠闇�璧嬪�硷紝鍏跺畠閫氳鏂瑰紡鏃犻渶璧嬪�� + }; + //*********************************************************************** + + //**鍖哄煙鍧愭爣缁撴瀯浣�********************************************************* + public struct AREARECT + { + public int left; //鍖哄煙宸︿笂瑙掓í鍧愭爣 + public int top; //鍖哄煙宸︿笂瑙掔旱鍧愭爣 + public int width; //鍖哄煙鐨勫搴� + public int height; //鍖哄煙鐨勯珮搴� + }; + //**************************************************************************** + //***瀛椾綋灞炴�х粨鏋勫********************************************************** + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct FONTPROP + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string FontName; //瀛椾綋鍚� + public int FontSize; //瀛楀彿(鍗曚綅纾�) + public int FontColor; //瀛椾綋棰滆壊 + public int FontBold; //鏄惁鍔犵矖 + public int FontItalic; //鏄惁鏂滀綋 + public int FontUnderLine; //鏃跺惁涓嬪垝绾� + }; + //**************************************************************************** + + //**椤甸潰鏄剧ず鐨勫睘鎬х粨鏋勪綋**************************************************** + public struct PLAYPROP + { + public int InStyle; //鍏ュ満鐗规妧鍊硷紙鍙栧�艰寖鍥� 0-38锛� + public int OutStyle; //閫�鍦虹壒鎶�鍊硷紙鐜版棤鏁堬紝棰勭暀锛岀疆0锛� + public int Speed; //鐗规妧鏄剧ず閫熷害(鍙栧�艰寖鍥�1-255) 鍊艰秺澶э紝閫熷害瓒婃參 + public int DelayTime; //椤甸潰鐣欏仠鏃堕棿(1-65535) 娉細褰撳叆鍦虹壒鎶�涓鸿繛缁乏绉汇�佽繛缁彸绉汇�佽繛缁笂绉汇�佽繛缁笅绉绘椂锛屾鍙傛暟鏃犳晥 + }; + /* 鐗规妧鍊煎搴� + 0=绔嬪嵆鏄剧ず + 1=闅忔満 + 2=宸︾Щ + 3=鍙崇Щ + 4=涓婄Щ + 5=涓嬬Щ + 6=杩炵画宸︾Щ + 7=杩炵画鍙崇Щ + 8=杩炵画涓婄Щ + 9=杩炵画涓嬬Щ + 10=闂儊 + 11=婵�鍏夊瓧(鍚戜笂) + 12=婵�鍏夊瓧(鍚戜笅) + 13=婵�鍏夊瓧(鍚戝乏) + 14=婵�鍏夊瓧(鍚戝彸) + 15=姘村钩浜ゅ弶鎷夊箷 + 16=涓婁笅浜ゅ弶鎷夊箷 + 17=宸﹀彸鍒囧叆 + 18=涓婁笅鍒囧叆 + 19=宸﹁鐩� + 20=鍙宠鐩� + 21=涓婅鐩� + 22=涓嬭鐩� + 23=姘村钩鐧惧彾(宸﹀彸) + 24=姘村钩鐧惧彾(鍙冲乏) + 25=鍨傜洿鐧惧彾(涓婁笅) + 26=鍨傜洿鐧惧彾(涓嬩笂) + 27=宸﹀彸瀵瑰紑 + 28=涓婁笅瀵瑰紑 + 29=宸﹀彸闂悎 + 30=涓婁笅闂悎 + 31=鍚戝乏鎷変几 + 32=鍚戝彸鎷変几 + 33=鍚戜笂鎷変几 + 34=鍚戜笅鎷変几 + 35=鍒嗘暎鍚戝乏鎷変几 + 36=鍒嗘暎鍚戝彸鎷変几 + 37=鍐掓场 + 38=涓嬮洩 + */ + //******************************************************************************* + //**璁剧疆鑺傜洰瀹氭椂灞炴�х粨鏋勪綋**************************************************** + public struct PROGRAMTIME + { + public int EnableFlag; //鍚敤瀹氭椂鐨勬爣璁帮紝ENABLE_DATE涓哄惎鐢ㄦ棩鏈�,ENABLE_TIME涓哄惎鐢ㄦ椂闂�,ENABLE_WEEK涓哄惎鐢ㄦ槦鏈�,鍙敤鎴栬繍绠楄繘琛岀粍鍚堬紝濡� ENABLE_DATE | ENABLE_TIME | ENABLE_WEEK + public int WeekValue; //鍚敤鏄熸湡鍚庯紝閫夋嫨瑕佸畾鏃剁殑鏄熸湡閲岀殑鏌愪簺澶╋紝鐢ㄥ畯 WEEK_MON,WEEK_TUES,WEEK_WEN,WEEK_THUR,WEEK_FRI,WEEK_SAT,WEEK_SUN 閫氳繃鎴栬繍绠楄繘琛岀粍鍚� + public int StartYear; //璧峰骞� + public int StartMonth; //璧峰鏈� + public int StartDay; //璧峰鏃� + public int StartHour; //璧峰鏃� + public int StartMinute; //璧峰鍒� + public int StartSecond; //璧峰绉� + public int EndYear; //缁撴潫骞� + public int EndMonth; //缁撴潫鏈� + public int EndDay; //缁撴潫鏃� + public int EndHour; //缁撴潫鏃� + public int EndMinute; //缁撴潫鍒� + public int EndSecond; //缁撴潫绉� + }; + //********************************************************************************** + //鏁板瓧鏃堕挓灞炴�х粨鏋勪綋********************************************************************************* + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct DIGITALCLOCKAREAINFO + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string ShowStr; //鑷畾涔夋樉绀哄瓧绗︿覆 + //[MarshalAs(UnmanagedType.Struct)] + public FONTPROP ShowStrFont; //鑷畾涔夋樉绀哄瓧绗︿覆浠ュ強鏃ユ湡鏄熸湡鏃堕棿鐨勫瓧浣撳睘鎬э紝娉ㄦ剰姝ゅ瓧浣撳睘鎬ч噷鐨凢ontColor鍙鑷畾涔夋樉绀哄瓧浣撴湁鏁堬紝鍏跺畠椤圭殑棰滆壊鏈夊崟鐙殑棰滆壊灞炴�э紝灞炴�х殑璧嬪�艰FONTPROP缁撴瀯浣撹鏄� + public int TimeLagType; //鏃跺樊绫诲瀷 0涓鸿秴鍓嶏紝1涓烘粸鍚� + public int HourNum; //鏃跺樊灏忔椂鏁� + public int MiniteNum; //鏃跺樊鍒嗛挓鏁� + public int DateFormat; //鏃ユ湡鏍煎紡 0.YYYY骞碝M鏈圖D鏃� 1.YY骞碝M鏈圖D鏃� 2.MM/DD/YYYY 3.YYYY/MM/DD 4.YYYY-MM-DD 5.YYYY.MM.DD 6.MM.DD.YYYY 7.DD.MM.YYYY + public int DateColor; //鏃ユ湡瀛椾綋棰滆壊 鏍煎紡鏄�16杩涘埗 BBGGRR锛堝锛氱孩鑹�0xff 缁胯壊0xff00 榛勮壊0xffff锛� + public int WeekFormat; //鏄熸湡鏍煎紡 0.鏄熸湡X 1.Monday 2.Mon. + public int WeekColor; //鏄熸湡瀛椾綋棰滆壊 + public int TimeFormat; //鏃堕棿鏍煎紡 0.HH鏃秏m鍒唖s绉� 1.HH鏅俶m鍒唖s绉� 2.HH:mm:ss 3.涓婂崍 HH:mm:ss 4.AM HH:mm:ss 5.HH:mm:ss 涓婂崍 6.HH:mm:ss AM + public int TimeColor; //鏃堕棿瀛椾綋棰滆壊 + public int IsShowYear; //鏄惁鏄剧ず骞� TRUE涓烘樉绀� FALSE涓嶆樉绀� 涓嬪悓 + public int IsShowWeek; //鏄惁鏄剧ず鏄熸湡 + public int IsShowMonth; //鏄惁鏄剧ず鏈� + public int IsShowDay; //鏄惁鏄剧ず鏃� + public int IsShowHour; //鏄惁鏄剧ず鏃� + public int IsShowMinute; //鏄惁鏄剧ず鍒� + public int IsShowSecond; //鏄惁鏄剧ず绉� + public int IsMutleLineShow; //鏄惁澶氳鏄剧ず + }; + //****************************************************************************** + //**妯℃嫙鏃堕挓灞炴�х粨鏋勪綋********************************************************* + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct CLOCKAREAINFO + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string ShowStr; //鑷畾涔夋樉绀哄瓧绗︿覆 + public FONTPROP ShowStrFont; //鑷畾涔夋樉绀哄瓧绗︿覆瀛椾綋灞炴�� + public int TimeLagType; //鏃跺樊绫诲瀷 0涓鸿秴鍓嶏紝1涓烘粸鍚� + public int HourNum; //鏃跺樊灏忔椂鏁� + public int MiniteNum; //鏃跺樊鍒嗛挓鏁� + public int ClockType; //琛ㄧ洏绫诲瀷 0.鍦嗗舰 1.姝f柟褰� + public int HourMarkColor; //鏃舵爣棰滆壊 鏍煎紡鏄�16杩涘埗 BBGGRR锛堝锛氱孩鑹�0xff 缁胯壊0xff00 榛勮壊0xffff锛� + public int HourMarkType; //鏃舵爣绫诲瀷 0.鍦嗗舰 1.姝f柟褰� + public int HourMarkWidth; //鏃舵爣瀹藉害 1~16 + public int MiniteMarkColor; //鍒嗘爣棰滆壊 + public int MiniteMarkType; //鍒嗘爣绫诲瀷 0.鍦嗗舰 1.姝f柟褰� + public int MiniteMarkWidth; //鍒嗘爣瀹藉害 1~16 + public int HourPointerColor; //鏃堕拡棰滆壊 + public int MinutePointerColor; //鍒嗛拡棰滆壊 + public int SecondPointerColor; //绉掗拡棰滆壊 + public int HourPointerWidth; //鏃堕拡鐨勫搴� 1~5 + public int MinutePointerWidth; //鍒嗛拡鐨勫搴� 1~5 + public int SecondPointerWidth; //绉掗拡鐨勫搴� 1~5 + public int IsShowDate; //鏄惁鏄剧ず鏃ユ湡 + public int DateFormat; //鏃ユ湡鏍煎紡 0.YYYY骞碝M鏈圖D鏃� 1.YY骞碝M鏈圖D鏃� 2.MM/DD/YYYY 3.YYYY/MM/DD 4.YYYY-MM-DD 5.YYYY.MM.DD 6.MM.DD.YYYY 7.DD.MM.YYYY + public FONTPROP DateFont; //鏃ユ湡瀛椾綋灞炴�� + public int IsShowWeek; //鏄惁鏄剧ず鏄熸湡 + public int WeekFormat; //鏄熸湡鏍煎紡 0.鏄熸湡X 1.Monday 2.Mon. + public FONTPROP WeekFont; //鏄熸湡瀛椾綋灞炴�� + }; + //************************************************************************************** + + //**璁℃椂灞炴�х粨鏋勪綋********************************************************************** + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct TIMEAREAINFO + { + public int ShowFormat; //鏄剧ず鏍煎紡 0.xx澶﹛x鏃秞x鍒唜x绉� 1.xx澶﹛x鏅倄x鍒唜x绉� 2.xxDayxxHourxxMinxxSec 3.XXdXXhXXmXXs 4.xx:xx:xx:xx + public int nYear; //缁撴潫骞� + public int nMonth; //缁撴潫鏈� + public int nDay; //缁撴潫鏃� + public int nHour; //缁撴潫鏃� + public int nMinute; //缁撴潫鍒� + public int nSecond; //缁撴潫绉� + public int IsShowDay; //鏄惁鏄剧ず澶� + public int IsShowHour; //鏄惁鏄剧ず鏃� + public int IsShowMinute; //鏄惁鏄剧ず鍒� + public int IsShowSecond; //鏄惁鏄剧ず绉� + public int IsMutleLineShow; //鏄惁澶氳鏄剧ず锛屾寚鐨勬槸鑷畾涔夋枃瀛椾笌璁℃椂鏂囧瓧鏄惁鍒嗚鏄剧ず + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string ShowStr; //鑷畾涔夋枃瀛楀瓧绗︿覆 + public int TimeStrColor; //璁℃椂鏂囧瓧鐨勯鑹� + public FONTPROP ShowFont; //鑷畾涔夋枃瀛楀強璁℃椂鏂囧瓧棰滆壊锛屽叾涓璅ontColor鍙鏂囧畾涔夋枃瀛楁湁鏁堬紝璁℃椂鏂囧瓧棰滆壊涓篢imeStrColor + }; + //**************************************************************************************** + + + //**LED閫氳鍙傛暟淇敼缁撴瀯浣�***************************************************************** + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct LEDCOMMUNICATIONPARAMETER + { + public int dwMask; //瑕佷慨鏀归」鐨勬爣璁� 0.淇敼缃戠粶閫氳鍙傛暟 1.淇敼涓插彛閫氳鍙傛暟 2.淇敼缃戝彛鍜屼覆鍙i�氳鍙傛暟 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string IpStr; //鏂扮殑IP鍦板潃锛屽彧鏈塪wMask涓�0鎴�2鏃舵墠闇�璧嬪�硷紝鍏跺畠鍊兼棤闇�璧嬪�硷紝鏍煎紡渚嬪 192.168.1.100 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string NetMaskStr; //鏂扮殑瀛愮綉鎺╃爜锛屽彧鏈塪wMask涓�0鎴�2鏃舵墠闇�璧嬪�硷紝鍏跺畠鍊兼棤闇�璧嬪�硷紝鏍煎紡渚嬪 255.255.255.0 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string GatewayStr; //鏂扮殑缃戝叧锛屽彧鏈塪wMask涓�0鎴�2鏃舵墠闇�璧嬪�硷紝鍏跺畠鍊兼棤闇�璧嬪��,鏍煎紡渚嬪 192.168.1.1 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 18)] + public string MacStr; //鏂扮殑MAC鍦板潃锛屽彧鏈塪wMask涓�0鎴�2鏃舵墠闇�璧嬪�硷紝鍏跺畠鍊兼棤闇�璧嬪�硷紝鏍煎紡渚嬪 12-34-56-78-9a-bc,濡傛棤闇�淇敼璇疯涓� ff-ff-ff-ff-ff-ff + public int Baud; //娉㈢壒鐜囷紝鍙湁dwMask涓�1鎴�2鏃舵墠闇�璧嬪�硷紝鍏跺畠鍊兼棤闇�璧嬪�硷紝0.9600 1.57600 2.115200 + public int LedNumber; //LED灞忓彿 1~255,缃戠粶閫氳鍜�232閫氳璧嬪�� 1 鍗冲彲锛�485蹇呴渶鍜屾帶鍒跺崱鏄剧ず鐨勫睆鍙风浉鍚屾墠鍙�氳 + }; + //***************************************************************************************** + + + //**娴佹按杈规灞炴�х粨鏋勪綋************************************************************************ + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct WATERBORDERINFO + { + public int Flag; //娴佹按杈规鍔犺浇绫诲瀷鏍囧織锛�0.涓哄姩鎬佸簱棰勭疆鐨勮竟妗� 1.涓轰粠鏂囦欢鍔犺浇鐨勮竟妗� + public int BorderType; //杈规鐨勭被鍨嬶紝Flag涓�0鏄湁鏁堬紝0.鍗曡壊杈规 1.鍙屽熀鑹茶竟妗� 2.鍏ㄥ僵杈规 + public int BorderValue; //杈规鐨勫�硷紝Flag涓�0鏄湁鏁堬紝鍗曡壊杈规鍙栧�艰寖鍥存槸0~39,鍙屽熀鑹茶竟妗嗗彇鍊艰寖鍥存槸0~34,鍏ㄥ僵杈规鍙栧�艰寖鍥存槸0~21 + public int BorderColor; //杈规绾块鑹�,Flag涓�0骞朵笖BorderType涓�0鏄墠鏈夋晥 + public int BorderStyle; //杈规鏄剧ず鐨勬牱寮� 0.鍥哄畾 1.椤烘椂閽� 2.閫嗘椂閽� 3.闂儊 + public int BorderSpeed;//杈规娴佸姩鐨勯�熷害 + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string WaterBorderBmpPath; //杈规鍥剧墖鏂囦欢鐨勮矾寰勶紝娉ㄦ剰鍙兘鏄痓mp鍥剧墖锛屽浘鐗囧ぇ灏忓繀闇�鏄搴︿负32鐐癸紝鍙栭珮搴﹀皬浜庣瓑浜�8 + }; + //********************************************************************************************* + + + + //**瀹氭椂寮�鍏冲睆璁剧疆灞炴��************************************************************************ + public struct ONOFFTIMEINFO + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] TimeFlag; //鏀寔3涓畾鏃讹紝1浠h〃鎵撳紑 0鍏抽棴 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] StartHour; //寮�濮嬫椂閽� + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] StartMinute; //寮�濮嬪垎閽� + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] EndHour; //缁撴潫鏃堕挓 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] EndMinute; //缁撴潫鍒嗛挓 + }; + //******************************************************************************************** + + //**瀹氭椂浜害璁剧疆灞炴��************************************************************************** + public struct BRIGHTNESSTIMEINFO + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] TimeFlag; //鏀寔3涓畾鏃讹紝1浠h〃鎵撳紑 0鍏抽棴 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] StartHour; //寮�濮嬫椂閽� + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] StartMinute; //寮�濮嬪垎閽� + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] EndHour; //缁撴潫鏃堕挓 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] EndMinute; //缁撴潫鍒嗛挓 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public int[] BrightnessValue; //浜害鍊�0~15 + }; + //******************************************************************************************* + + [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)] + public delegate int SERVERINFOCALLBACK(int Msg, int wParam, IntPtr ptr); + + public enum LV_MSG + { + LV_MSG_NONE, + LV_MSG_CARD_ONLINE,//涓婄嚎閫氱煡锛岄�氳繃CARD_INFO缁撴瀯浣撴寚閽堣幏鍙栬缁嗕笂绾夸俊鎭� + LV_MSG_CARD_OFFLINE,//涓嬬嚎閫氱煡锛岄�氳繃CARD_INFO缁撴瀯浣撴寚閽堣幏鍙栬缁嗕笅绾夸俊鎭� + }; + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct CARD_INFO + { + public int port; //鎺у埗鍗$鍙� + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string ipStr; //鎺у埗鍗P + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)] + public string networkIdStr; //鎺у埗鍗″敮涓�缃戠粶ID锛堟瘡寮犲崱閮借创鏈夊敮涓�缃戠粶ID锛� + }; + + /******************************************************************************************** + * LV_CreateProgramEx 鍒涘缓鑺傜洰瀵硅薄锛岃繑鍥炵被鍨嬩负 HPROGRAM + * + * 鍙傛暟璇存槑 + * LedWidth 灞忕殑瀹藉害 + * LedHeight 灞忕殑楂樺害 + * ColorType 灞忕殑棰滆壊 1.鍗曡壊 2.鍙屽熀鑹� 3.涓夊熀鑹� 娉細C鍗″叏褰╁弬鏁颁负3 X绯诲垪鍗″弬鏁板浐瀹氫负 4 + * GrayLevel 鐏板害绛夌骇 璧嬪�� 1-5瀵瑰簲鐨勭伆搴︾瓑绾у垎鍒负 鏃�,4,8,16,32 娉細鐩墠C绯诲垪鐨勫崱鎵嶆敮鎸侊紝鍏跺畠鍨嬪彿锛圱,A,U,XC,W,E,X锛夊弬鏁板繀椤讳负0 + * SaveType 鑺傜洰淇濆瓨浣嶇疆锛岄粯璁や负0淇濆瓨瀛樹负flash鑺傜洰锛�3淇濆瓨涓簉am鑺傜洰 + * 娉細flash鑺傜洰鎺夌數涓嶆竻闄わ紝ram鑺傜洰鎺夌數娓呴櫎銆傚簲鐢ㄥ満鏅渶瑕佸疄鏃跺埛鏂扮殑锛屽缓璁繚瀛樹负ram鑺傜洰 + * 杩斿洖鍊� + * 0 鍒涘缓鑺傜洰瀵硅薄澶辫触 + * 闈�0 鍒涘缓鑺傜洰瀵硅薄鎴愬姛 + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_CreateProgramEx", CharSet = CharSet.Unicode)] + public static extern IntPtr LV_CreateProgramEx(int LedWidth, int LedHeight, int ColorType, int GrayLevel, int SaveType); + + /********************************************************************************************* + * LV_AddProgram 娣诲姞涓�涓妭鐩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * ProgramTime 鑺傜洰鎾斁鏃堕暱 0.鑺傜洰鎾斁鏃堕暱 闈�0.鎸囧畾鎾斁鏃堕暱 + * LoopCount 寰幆鎾斁娆℃暟 1-255 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddProgram", CharSet = CharSet.Unicode)] + public static extern int LV_AddProgram(IntPtr hProgram, int ProgramNo, int ProgramTime, int LoopCount); + + /********************************************************************************************* + * LV_SetProgramTime 璁剧疆鑺傜洰瀹氭椂 + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * pProgramTime 鑺傜洰瀹氭椂灞炴�э紝璁剧疆鏂瑰紡瑙丳ROGRAMTIME缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_SetProgramTime", CharSet = CharSet.Unicode)] + public static extern int LV_SetProgramTime(IntPtr hProgram, int ProgramNo, ref PROGRAMTIME pProgramTime); + + /********************************************************************************************* + * LV_AddImageTextArea 娣诲姞涓�涓浘鏂囧尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * nLayout 鍖哄煙灞傚彿锛�0.鍓嶆櫙鍖猴紙榛樿锛� 1.鑳屾櫙鍖� 娉細闄绯诲垪锛屽叾瀹冮粯璁や负1 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddImageTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, int nLayout); + + /********************************************************************************************* + * LV_AddFileToImageTextArea 娣诲姞涓�涓枃浠跺埌鍥炬枃鍖� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * FilePath 鏂囦欢璺緞锛屾敮鎸佺殑鏂囦欢绫诲瀷鏈� txt rtf bmp gif png jpg jpeg tiff + * pPlayProp 鏄剧ず鐨勫睘鎬э紝璁剧疆鏂瑰紡瑙丳LAYPROP缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddFileToImageTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddFileToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, string FilePath, ref PLAYPROP pPlayProp); + + /********************************************************************************************* + * LV_AddSingleLineTextToImageTextArea 娣诲姞涓�涓崟琛屾枃鏈埌鍥炬枃鍖� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * AddType 娣诲姞鐨勭被鍨� 0.涓哄瓧绗︿覆 1.鏂囦欢锛堝彧鏀寔txt鍜宺tf鏂囦欢锛� + * AddStr AddType涓�0鍒欎负瀛楃涓叉暟鎹�,AddType涓�1鍒欎负鏂囦欢璺緞 + * pFontProp 濡傛灉AddType涓哄瓧绗︿覆绫诲瀷鎴朅ddType涓烘枃浠剁被鍨嬩笖鏂囦欢涓簍xt鍒欏彲浼犲叆浠ヨ祴鍊肩殑璇ョ粨鏋勪綋锛屽叾瀹冨彲璧婲ULL + * pPlayProp 鏄剧ず鐨勫睘鎬э紝璁剧疆鏂瑰紡瑙丳LAYPROP缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddSingleLineTextToImageTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddSingleLineTextToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, ref PLAYPROP pPlayProp); + + /********************************************************************************************* + * LV_AddMultiLineTextToImageTextArea 娣诲姞涓�涓琛屾枃鏈埌鍥炬枃鍖� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * AddType 娣诲姞鐨勭被鍨� 0.涓哄瓧绗︿覆 1.鏂囦欢锛堝彧鏀寔txt鍜宺tf鏂囦欢锛� + * AddStr AddType涓�0鍒欎负瀛楃涓叉暟鎹�,AddType涓�1鍒欎负鏂囦欢璺緞 鎹㈣绗︼紙\n锛� + * pFontProp 濡傛灉AddType涓哄瓧绗︿覆绫诲瀷鎴朅ddType涓烘枃浠剁被鍨嬩笖鏂囦欢涓簍xt鍒欏彲浼犲叆浠ヨ祴鍊肩殑璇ョ粨鏋勪綋锛屽叾瀹冨彲璧婲ULL + * pPlayProp 鏄剧ず鐨勫睘鎬э紝璁剧疆鏂瑰紡瑙丳LAYPROP缁撴瀯浣撴敞绀� + * nAlignment 姘村钩瀵归綈鏍峰紡锛�0.宸﹀榻� 1.鍙冲榻� 2.姘村钩灞呬腑 锛堟敞鎰忥細鍙瀛楃涓插拰txt鏂囦欢鏈夋晥锛� + * IsVCenter 鏄惁鍨傜洿灞呬腑 0.缃《锛堥粯璁わ級 1.鍨傜洿灞呬腑 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddMultiLineTextToImageTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddMultiLineTextToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, ref PLAYPROP pPlayProp, int nAlignment, int IsVCenter); + + /********************************************************************************************* + * LV_AddStaticTextToImageTextArea 娣诲姞涓�涓潤姝㈡枃鏈埌鍥炬枃鍖� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * AddType 娣诲姞鐨勭被鍨� 0.涓哄瓧绗︿覆 1.鏂囦欢锛堝彧鏀寔txt鍜宺tf鏂囦欢锛� + * AddStr AddType涓�0鍒欎负瀛楃涓叉暟鎹�,AddType涓�1鍒欎负鏂囦欢璺緞 + * pFontProp 濡傛灉AddType涓哄瓧绗︿覆绫诲瀷鎴朅ddType涓烘枃浠剁被鍨嬩笖鏂囦欢涓簍xt鍒欏彲浼犲叆浠ヨ祴鍊肩殑璇ョ粨鏋勪綋锛屽叾瀹冨彲璧婲ULL + * DelayTime 鏄剧ず鐨勬椂闀� 1~65535 + * nAlignment 姘村钩瀵归綈鏍峰紡锛�0.宸﹀榻� 1.鍙冲榻� 2.姘村钩灞呬腑 锛堟敞鎰忥細鍙瀛楃涓插拰txt鏂囦欢鏈夋晥锛� + * IsVCenter 鏄惁鍨傜洿灞呬腑 0.缃《锛堥粯璁わ級 1.鍨傜洿灞呬腑 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddStaticTextToImageTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddStaticTextToImageTextArea(int hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, int DelayTime, int nAlignment, int IsVCenter); + + /********************************************************************************************* + * LV_QuickAddSingleLineTextArea 蹇�熸坊鍔犱竴涓悜宸︾Щ鐨勫崟琛屾枃鏈尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * AddType 娣诲姞鐨勭被鍨� 0.涓哄瓧绗︿覆 1.鏂囦欢锛堝彧鏀寔txt鍜宺tf鏂囦欢锛� + * AddStr AddType涓�0鍒欎负瀛楃涓叉暟鎹�,AddType涓�1鍒欎负鏂囦欢璺緞 + * pFontProp 濡傛灉AddType涓哄瓧绗︿覆绫诲瀷鎴朅ddType涓烘枃浠剁被鍨嬩笖鏂囦欢涓簍xt鍒欏彲浼犲叆浠ヨ祴鍊肩殑璇ョ粨鏋勪綋锛屽叾瀹冨彲璧婲ULL + * nSpeed 婊氬姩閫熷害 1~255 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_QuickAddSingleLineTextArea", CharSet = CharSet.Unicode)] + public static extern int LV_QuickAddSingleLineTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, int AddType, string AddStr, ref FONTPROP pFontProp, int nSpeed); + + /********************************************************************************************* + * LV_AddDigitalClockArea 娣诲姞涓�涓暟瀛楁椂閽熷尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * pDigitalClockAreaInfo 鏁板瓧鏃堕挓灞炴�э紝瑙丏IGITALCLOCKAREAINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddDigitalClockArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddDigitalClockArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref DIGITALCLOCKAREAINFO pDigitalClockAreaInfo); + + /********************************************************************************************* + * LV_AddTimeArea 娣诲姞涓�涓鏃跺尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙凤紙鍙栧�艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * pTimeAreaInfo 璁℃椂灞炴�э紝瑙乀IMEAREAINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddTimeArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddTimeArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref TIMEAREAINFO pTimeAreaInfo); + + /********************************************************************************************* + * LV_AddClockArea 娣诲姞涓�涓ā鎷熸椂閽熷尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * pClockAreaInfo 妯℃嫙鏃堕挓灞炴�э紝瑙丆LOCKAREAINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddClockArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddClockArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref CLOCKAREAINFO pClockAreaInfo); + + /********************************************************************************************* + * LV_AddNeiMaArea 娣诲姞涓�涓唴鐮佸尯鍩� + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 浠�0寮�濮�(0-255) + * AreaNo 鍖哄煙鍙� (1-255) + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * NeiMaStr 鏂囨湰瀛楃涓� 娉細瀛楃涓茬紪鐮佹槸GB2312 + * FontSize 瀛椾綋澶у皬 16 24 32 + * FontColor 鏂囧瓧棰滆壊 鏍煎紡BBGGRR 0xff 绾㈣壊 0xff00 缁胯壊 0xffff榛勮壊 + * pPlayProp 鏄剧ず鐨勫睘鎬э紝璁剧疆鏂瑰紡瑙丳LAYPROP缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddNeiMaArea", CharSet = CharSet.Unicode)] + public static extern int LV_AddNeiMaArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, string NeiMaStr, int FontSize, int FontColor, ref PLAYPROP pPlayProp); + + /********************************************************************************************* + * LV_AddWaterBorder 娣诲姞涓�涓祦姘磋竟妗嗗尯鍩� + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * ProgramNo 鑺傜洰鍙� 锛堝彇鍊艰寖鍥�0-255)锛堜粠0寮�濮嬶級 + * AreaNo 鍖哄煙鍙� 锛堝彇鍊艰寖鍥�1-255锛� + * pAreaRect 鍖哄煙鍧愭爣灞炴�э紝璁剧疆鏂瑰紡瑙丄REARECT缁撴瀯浣撴敞绀� + * pWaterBorderInfo 娴佹按杈规灞炴�э紝瑙乄ATERBORDERINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AddWaterBorder", CharSet = CharSet.Unicode)] + public static extern int LV_AddWaterBorder(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref WATERBORDERINFO pWaterBorderInfo); + + /********************************************************************************************* + * LV_DeleteProgram 閿�姣佽妭鐩璞�(娉ㄦ剰锛氬鏋滄鑺傜洰瀵硅薄涓嶅啀浣跨敤锛岃璋冪敤姝ゅ嚱鏁伴攢姣侊紝鍚﹀垯浼氶�犳垚鍐呭瓨娉勯湶) + * + * 鍙傛暟璇存槑 + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_DeleteProgram", CharSet = CharSet.Unicode)] + public static extern void LV_DeleteProgram(IntPtr hProgram); + + /********************************************************************************************* + * LV_Send 鍙戦�佽妭鐩紝姝ゅ彂閫佷负涓�瀵逛竴鍙戦�� + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * hProgram 鑺傜洰瀵硅薄鍙ユ焺 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_Send", CharSet = CharSet.Unicode)] + public static extern int LV_Send(ref COMMUNICATIONINFO pCommunicationInfo, IntPtr hProgram); + + /********************************************************************************************* + * LV_TestOnline 娴嬭瘯LED灞忔槸鍚﹀彲杩炴帴涓� + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_TestOnline", CharSet = CharSet.Unicode)] + public static extern int LV_TestOnline(ref COMMUNICATIONINFO pCommunicationInfo); + + /********************************************************************************************* + * LV_SetBasicInfoEx 璁剧疆鍩烘湰灞忓弬 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * ColorType 灞忕殑棰滆壊 1.鍗曡壊 2.鍙屽熀鑹� 3.涓夊熀鑹� 娉細C鍗″叏褰╁弬鏁颁负3 X绯诲垪鍗″弬鏁板浐瀹氫负 4 + * GrayLevel 鐏板害绛夌骇 璧嬪�� 1-5瀵瑰簲鐨勭伆搴︾瓑绾у垎鍒负 鏃�,4,8,16,32 娉細鐩墠C绯诲垪鐨勫崱鎵嶆敮鎸侊紝鍏跺畠鍨嬪彿锛圱,A,U,XC,W,E,X锛夊弬鏁板繀椤讳负0 + * LedWidth 灞忕殑瀹藉害鐐规暟 + * LedHeight 灞忕殑楂樺害鐐规暟 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_SetBasicInfoEx", CharSet = CharSet.Unicode)] + public static extern int LV_SetBasicInfoEx(ref COMMUNICATIONINFO pCommunicationInfo, int ColorType, int GrayLevel, int LedWidth, int LedHeight); + + /********************************************************************************************* + * LV_SetOEDA 璁剧疆OE DA + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * Oe OE 0.浣庢湁鏁� 1.楂樻湁鏁� + * Da DA 0.璐熸瀬鎬� 1.姝f瀬鎬� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_SetOEDA", CharSet = CharSet.Unicode)] + public static extern int LV_SetOEDA(ref COMMUNICATIONINFO pCommunicationInfo, int Oe, int Da); + + /********************************************************************************************* + * LV_AdjustTime 鏍℃椂 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_AdjustTime", CharSet = CharSet.Unicode)] + public static extern int LV_AdjustTime(ref COMMUNICATIONINFO pCommunicationInfo); + + /********************************************************************************************* + * LV_PowerOnOff 寮�鍏冲睆 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * OnOff 寮�鍏冲�� 0.鍏冲睆 1.寮�灞� 2.閲嶅惎 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_PowerOnOff", CharSet = CharSet.Unicode)] + public static extern int LV_PowerOnOff(ref COMMUNICATIONINFO pCommunicationInfo, int OnOff); + + /********************************************************************************************* + * LV_TimePowerOnOff 瀹氭椂寮�鍏冲睆 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * pTimeInfo 瀹氭椂寮�鍏冲睆灞炴�э紝璇﹁ONOFFTIMEINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_TimePowerOnOff", CharSet = CharSet.Unicode)] + public static extern int LV_TimePowerOnOff(ref COMMUNICATIONINFO pCommunicationInfo, ref ONOFFTIMEINFO pTimeInfo); + + /********************************************************************************************* + * LV_SetBrightness 璁剧疆浜害 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * BrightnessValue 浜害鍊� 0~15 + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_SetBrightness", CharSet = CharSet.Unicode)] + public static extern int LV_SetBrightness(ref COMMUNICATIONINFO pCommunicationInfo, int BrightnessValue); + + /********************************************************************************************* + * LV_TimeBrightness 瀹氭椂浜害 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * pBrightnessTimeInfo 瀹氭椂浜害灞炴�э紝璇﹁BRIGHTNESSTIMEINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_TimeBrightness", CharSet = CharSet.Unicode)] + public static extern int LV_TimeBrightness(ref COMMUNICATIONINFO pCommunicationInfo, ref BRIGHTNESSTIMEINFO pBrightnessTimeInfo); + + /********************************************************************************************* + * LV_LedTest LED娴嬭瘯 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * TestValue 娴嬭瘯鍊� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_LedTest", CharSet = CharSet.Unicode)] + public static extern int LV_LedTest(ref COMMUNICATIONINFO pCommunicationInfo, int TestValue); + + /********************************************************************************************* + * LV_TimeLocker LED瀹氭椂閿佸睆 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * LockerYear 閿佸睆骞� + * LockerMonth 閿佸睆鏈� + * LockerDay 閿佸睆鏃� + * LockerHour 閿佸睆鏃� + * LockerMinute 閿佸睆鍒� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_TimeLocker", CharSet = CharSet.Unicode)] + public static extern int LV_TimeLocker(ref COMMUNICATIONINFO pCommunicationInfo, int LockerYear, int LockerMonth, int LockerDay, int LockerHour, int LockerMinute); + + /********************************************************************************************* + * LV_CancelLocker 鍙栨秷瀹氭椂閿佸睆 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_CancelLocker", CharSet = CharSet.Unicode)] + public static extern int LV_CancelLocker(ref COMMUNICATIONINFO pCommunicationInfo); + + /********************************************************************************************* + * LV_SetLedCommunicationParameter 璁剧疆LED閫氳鍙傛暟 + * + * 鍙傛暟璇存槑 + * pCommunicationInfo 閫氳鍙傛暟锛岃祴鍊兼柟寮忚COMMUNICATIONINFO缁撴瀯浣撴敞绀� + * pLedCommunicationParameter 璇﹁LEDCOMMUNICATIONPARAMETER缁撴瀯浣撴敞绀� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_SetLedCommunicationParameter", CharSet = CharSet.Unicode)] + public static extern int LV_SetLedCommunicationParameter(ref COMMUNICATIONINFO pCommunicationInfo, ref LEDCOMMUNICATIONPARAMETER pLedCommunicationParameter); + /********************************************************************************************* + * LV_LedInitServer 鍚姩鎺у埗鍗″績璺冲寘鏈嶅姟 娉細C2M銆丆4M鎵嶆敮鎸� + * + * 鍙傛暟璇存槑 + * port 鐩戝惉鐨勭鍙� + * 杩斿洖鍊� + * 0 鎴愬姛 + * 闈�0 澶辫触锛岃皟鐢↙V_GetError鏉ヨ幏鍙栭敊璇俊鎭� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_LedInitServer", CharSet = CharSet.Unicode)] + public static extern int LV_LedInitServer(int port); + /********************************************************************************************* + * LV_LedShudownServer 鏂紑鎺у埗鍗″績璺冲寘鏈嶅姟 娉細C2M銆丆4M鎵嶆敮鎸� + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_LedShudownServer", CharSet = CharSet.Unicode)] + public static extern int LV_LedShudownServer(); + /********************************************************************************************* + * LV_RegisterLedServerCallback 娉ㄥ唽鍥炶皟鍑芥暟 娉細C2M銆丆4M鎵嶆敮鎸� + * + * 鍙傛暟璇存槑 + * serverCallback 鍥炶皟鍑芥暟 + ********************************************************************************************/ + [DllImport("lv_led_64.dll", EntryPoint = "LV_RegisterLedServerCallback", CharSet = CharSet.Unicode)] + public static extern int LV_RegisterLedServerCallback(SERVERINFOCALLBACK serverCallback); + + /********************************************************************************************* + * LV_GetError 鑾峰彇閿欒淇℃伅锛堝彧鏀寔涓枃锛� + * + * 鍙傛暟璇存槑 + * nErrCode 鍑芥暟鎵ц杩斿洖鐨勯敊璇唬鐮� + * 杩斿洖鍊� + * 閿欒淇℃伅瀛楃涓� + ********************************************************************************************/ + public static string LS_GetError(int nErrCode) + { + string ErrStr; + switch (nErrCode) + { + case -1: + ErrStr = "鏃犳晥鐨勮妭鐩彞鏌勩��"; break; + case -2: + ErrStr = "鑺傜洰宸茬粡瀛樺湪銆�"; break; + case -3: + ErrStr = "鎸囧畾鐨勮妭鐩笉瀛樺湪銆�"; break; + case -4: + ErrStr = "瀹氱殑鍖哄煙涓嶅瓨鍦ㄣ��"; break; + case -5: + ErrStr = "鍒涘缓socket澶辫触銆�"; break; + case -6: + ErrStr = "閿欒鐨勫洖澶嶅寘銆�"; break; + case -7: + ErrStr = "涓嶆敮鎸佺殑鏂囦欢绫诲瀷銆�"; break; + case -8: + ErrStr = "IP缃戝叧鎺╃爜鎴朚AC瀛楃涓叉牸寮忛敊璇��"; break; + case -9: + ErrStr = "閿欒鐨勬尝鐗圭巼銆�"; break; + case -10: + ErrStr = "鏂囦欢璺緞涓嶅瓨鍦ㄣ��"; break; + case -11: + ErrStr = "鍖哄煙閲嶅彔銆�"; break; + case -12: + ErrStr = "鎵撳紑鏂囦欢澶辫触銆�"; break; + case -14: + ErrStr = "鍖哄煙宸插瓨鍦ㄣ��"; break; + case -15: + ErrStr = "鏃犳晥鐨勫彂閫佺被鍨嬨��"; break; + case -16: + ErrStr = "缁樺浘澶辫触銆�"; break; + case -17: + ErrStr = "鍒涘缓鏂囦欢澶瑰け璐ャ��"; break; + case -30: + ErrStr = "鎵撳紑涓插彛澶辫触銆�"; break; + case -31: + ErrStr = "璁剧疆涓插彛瓒呮椂澶辫触銆�"; break; + case -32: + ErrStr = "璁剧疆涓插彛缂撳啿鍖哄け璐ャ��"; break; + case -33: + ErrStr = "涓插彛鍙戦�佹暟鎹け璐ャ��"; break; + case -34: + ErrStr = "涓插彛鎺ユ敹鏁版嵁澶辫触銆�"; break; + case -35: + ErrStr = "涓插彛璁剧疆澶辫触銆�"; break; + case -36: + ErrStr = "涓插彛鎺ユ敹鏁版嵁瓒呮椂銆�"; break; + case -37: + ErrStr = "USB涓嶆敮鎸佺兢鍙戙��"; break; + case -38: + ErrStr = "鍙戦�佸彇娑堛��"; break; + case -100: + ErrStr = "缃戠粶杩炴帴澶辫触銆�"; break; + case -101: + ErrStr = "缃戠粶鍙戦�佸け璐ャ��"; break; + case -102: + ErrStr = "缃戠粶鎺ユ敹鏁版嵁澶辫触銆�"; break; + case -103: + ErrStr = "bind澶辫触銆�"; break; + case -104: + ErrStr = "鏃犲彲鐢ㄧ綉鍗°��"; break; + case 0xc140: + ErrStr = "Logo涓庡弬灞忓ぇ灏忎笉閫傚簲銆�"; break; + case 0xdaa3: + ErrStr = "鎺у埗鍣ㄧ箒蹇欍��"; break; + case 0xd5b0: + ErrStr = "鍥轰欢绋嬪簭鍨嬪彿涓嶅尮閰嶃��"; break; + case 0xd5b4: + ErrStr = "涓嶆槸鏈夋晥鐨勫浐浠剁▼搴忋��"; break; + case 0xdab8: + ErrStr = "鑺傜洰棰滆壊鎴栧睆瀹介珮涓庢帶鍒跺崱灞忓弬璁惧畾鍊间笉涓�鑷淬��"; break; + case 0xc1ba: + ErrStr = "瓒呭嚭鎺у埗鍗″甫杞姐��"; break; + case 0xdab5: + ErrStr = "鑺傜洰鏁版嵁澶у皬瓒呰繃鍏佽鐨勬渶澶у�笺��"; break; + default: + ErrStr = "鏈畾涔夐敊璇��"; break; + } + return ErrStr; + } + + + #region 璋冪敤鏂规硶 + private int m_ledWidth; + private int m_ledHeight; + private int m_ledColor; + private int m_ledGrayLevel; + #region [led] + /// <summary> + /// 鍙戦�佺粰LED 涓変釜鍖哄煙鍚屾椂鏇存柊 + /// </summary> + /// <param name="m_ip">LED灞忓箷IP鍦板潃</param> + /// <param name="palno">鎵樼洏鍖烘樉绀哄唴瀹�</param> + /// <param name="palno1">涓棿鍖哄煙澶氭枃鏈�</param> + /// <param name="strType">杩愯鐘舵�佹樉绀哄唴瀹�</param> + public void LEDstr(string m_ip, string palno, string palno1, string strType) + { + m_ledWidth = 256; + m_ledHeight = 160; + m_ledColor = 1; + m_ledGrayLevel = 0; + + try + { + Logger logger = LogManager.GetCurrentClassLogger(); + int nResult; + LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO(); + CommunicationInfo.LEDType = 0; + //TCP閫氳******************************************************************************** + CommunicationInfo.SendType = 0; // 璁句负鍥哄畾IP閫氳妯″紡锛屽嵆TCP閫氳 + CommunicationInfo.IpStr = m_ip; // 缁橧pStr璧嬪�糒ED鎺у埗鍗$殑IP + CommunicationInfo.LedNumber = 1; // LED灞忓彿涓�1锛屾敞鎰弒ocket閫氳鍜�232閫氳涓嶈瘑鍒睆鍙凤紝榛樿璧�1灏辫浜嗭紝485蹇呴渶鏍规嵁灞忕殑瀹為檯灞忓彿杩涜璧嬪�� + #region 鍒涘缓涓�涓妭鐩� + IntPtr hProgram; // 鑺傜洰鍙ユ焺 + //娉ㄦ剰姝ゅ灞忓楂樺強棰滆壊鍙傛暟蹇呴渶涓庤缃睆鍙傜殑灞忓楂樺強棰滆壊涓�鑷达紝鍚﹀垯鍙戦�佹椂浼氭彁绀洪敊璇� + hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0); + + nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1); // 娣诲姞涓�涓妭鐩紝鍙傛暟璇存槑瑙佸嚱鏁板0鏄庢敞绀� + + //if (nResult != 0) + //{ + // string ErrStr; + // ErrStr = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�璁板綍Log + // logger.Error("杩斿洖閿欒淇℃伅A2锛�", ErrStr); + // return; + //} + #endregion + + #region 鍖哄煙灞炴�ц缃� + // 鍖哄煙鑼冨洿鍙橀噺 鍙傛暟璁惧畾 + LedDll.AREARECT AreaRect = new LedDll.AREARECT();//鍖哄煙鍧愭爣灞炴�х粨鏋勪綋鍙橀噺 + AreaRect.left = 0; + AreaRect.top = 0; + AreaRect.width = m_ledWidth; + AreaRect.height = 106; + + // 鍖哄煙瀛椾綋鍙橀噺 鍙傛暟璁惧畾 + LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//鏂囧瓧灞炴�� + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 12; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 0; + + // 鍖哄煙瀛椾綋杩愯閫熷害 甯﹀叆鏂瑰紡 + LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); + PlayProp.InStyle = 0; + PlayProp.DelayTime = 3; + PlayProp.Speed = 2; + #endregion + + + #region 鍒涘缓鍖哄煙 + AreaRect.left = 0; + AreaRect.top = 0; + AreaRect.width = m_ledWidth; + AreaRect.height = 36; + LedDll.LV_AddImageTextArea(hProgram, 0, 1, ref AreaRect, 1); + + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 14; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 1; + // 鎿嶄綔绫诲瀷 + nResult = LedDll.LV_AddMultiLineTextToImageTextArea(hProgram, 0, 1, LedDll.ADDTYPE_STRING, palno, ref FontProp, ref PlayProp, 0, 0); + + AreaRect.left = 0; + AreaRect.top = 36; + AreaRect.width = m_ledWidth; + AreaRect.height = 70; + LedDll.LV_AddImageTextArea(hProgram, 0, 2, ref AreaRect, 1); + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 16; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 1; + // 澶氭枃鏈尯鍩� 鐢ㄤ簬鏄剧ず鎵樼洏淇℃伅 + nResult = LedDll.LV_AddMultiLineTextToImageTextArea(hProgram, 0, 2, LedDll.ADDTYPE_STRING, palno1, ref FontProp, ref PlayProp, 0, 0); + + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 16; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 1; + + AreaRect.left = 0; + AreaRect.top = 106; + AreaRect.width = m_ledWidth; + AreaRect.height = 53; + // 瀛楀箷鍖哄煙 鐢ㄤ簬鏄剧ず杩愯鐘舵�� 14 鍖哄煙宸插瓨鍦� + nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, strType, ref FontProp, 32); + + // 鍙戦�佸埌LED灞忓箷 + nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram); + LedDll.LV_DeleteProgram(hProgram); + #endregion + + + if (nResult != 0) + { + string ErrStr; + ErrStr = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�瑕佹坊鍔爈og + logger.Error("杩斿洖閿欒淇℃伅A04锛�", ErrStr); + } + } + catch (Exception ex) + { + // 涓嶆姏鍑哄紓甯革紝闃叉闃荤涓荤▼搴忚繍琛岋紱 Liudl:姝ゅ闇�娣诲姞log + //throw ex; + Logger logger = LogManager.GetCurrentClassLogger(); + logger.Error("娴嬭瘯trycatch鎹曟崏鐨勪俊鎭細", ex.Message); + } + } + + /// <summary> + /// 鍙戦�佺粰LED 鍗曠嫭鏇存柊瀛楀箷鍖哄煙 + /// </summary> + /// <param name="m_ip">LED灞忓箷IP鍦板潃</param> + /// <param name="Mstr">杩愯鐘舵�佹樉绀哄唴瀹�</param> + public void LEDstr(string m_ip, string Mstr) + { + m_ledWidth = 256; + m_ledHeight = 160; + m_ledColor = 1; + m_ledGrayLevel = 0; + try + { + + int nResult; + LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO(); + CommunicationInfo.LEDType = 0; + //TCP閫氳******************************************************************************** + CommunicationInfo.SendType = 0; // 璁句负鍥哄畾IP閫氳妯″紡锛屽嵆TCP閫氳 + CommunicationInfo.IpStr = m_ip; // 缁橧pStr璧嬪�糒ED鎺у埗鍗$殑IP + CommunicationInfo.LedNumber = 1; // LED灞忓彿涓�1锛屾敞鎰弒ocket閫氳鍜�232閫氳涓嶈瘑鍒睆鍙凤紝榛樿璧�1灏辫浜嗭紝485蹇呴渶鏍规嵁灞忕殑瀹為檯灞忓彿杩涜璧嬪�� + + #region 鍒涘缓涓�涓妭鐩� + IntPtr hProgram; // 鑺傜洰鍙ユ焺 + //娉ㄦ剰姝ゅ灞忓楂樺強棰滆壊鍙傛暟蹇呴渶涓庤缃睆鍙傜殑灞忓楂樺強棰滆壊涓�鑷达紝鍚﹀垯鍙戦�佹椂浼氭彁绀洪敊璇� + hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0); + nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1); // 娣诲姞涓�涓妭鐩紝鍙傛暟璇存槑瑙佸嚱鏁板0鏄庢敞绀� + if (nResult != 0) + { + string ErrStr; + ErrStr = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�璁板綍Log + return; + } + #endregion + + #region 鍒涘缓鍖哄煙 + // 鍖哄煙瀛椾綋杩愯閫熷害 甯﹀叆鏂瑰紡 + LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); + PlayProp.InStyle = 0; + PlayProp.DelayTime = 3; + PlayProp.Speed = 2; + + // 鍖哄煙瀛椾綋鍙橀噺 鍙傛暟璁惧畾 + LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//鏂囧瓧灞炴�� + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 16; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 0; + + // 鍖哄煙鑼冨洿鍙橀噺 鍙傛暟璁惧畾 + LedDll.AREARECT AreaRect = new LedDll.AREARECT();//鍖哄煙鍧愭爣灞炴�х粨鏋勪綋鍙橀噺 + AreaRect.left = 0; + AreaRect.top = 106; + AreaRect.width = m_ledWidth; + AreaRect.height = 53; + // 瀛楀箷鍖哄煙 鐢ㄤ簬鏄剧ず杩愯鐘舵�� 14 鍖哄煙宸插瓨鍦� + nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, Mstr, ref FontProp, 32); + + // 鍙戦�佸埌LED灞忓箷 + nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram); + LedDll.LV_DeleteProgram(hProgram); + #endregion + + if (nResult != 0) + { + string ErrStr; + ErrStr = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�瑕佹坊鍔爈og + } + } + catch (Exception ex) + { + throw ex; + } + } + + /// <summary> + /// 璁剧疆led鏁村睆瀛楀箷婊氬姩 + /// </summary> + /// <param name="m_ip">LED灞忓箷IP鍦板潃</param> + /// <param name="palno">鎵樼洏鍖烘樉绀哄唴瀹�</param> + public void SetLEDText(string IPStr, string ledText) + { + m_ledWidth = 256; + m_ledHeight = 160; + m_ledColor = 1; + m_ledGrayLevel = 0; + + try + { + Logger logger = LogManager.GetCurrentClassLogger(); + int nResult; + LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO(); + CommunicationInfo.LEDType = 0; + //TCP閫氳******************************************************************************** + CommunicationInfo.SendType = 0; // 璁句负鍥哄畾IP閫氳妯″紡锛屽嵆TCP閫氳 + CommunicationInfo.IpStr = IPStr; // 缁橧pStr璧嬪�糒ED鎺у埗鍗$殑IP + CommunicationInfo.LedNumber = 1; // LED灞忓彿涓�1锛屾敞鎰弒ocket閫氳鍜�232閫氳涓嶈瘑鍒睆鍙凤紝榛樿璧�1灏辫浜嗭紝485蹇呴渶鏍规嵁灞忕殑瀹為檯灞忓彿杩涜璧嬪�� + #region 鍒涘缓涓�涓妭鐩� + IntPtr hProgram; // 鑺傜洰鍙ユ焺 + //娉ㄦ剰姝ゅ灞忓楂樺強棰滆壊鍙傛暟蹇呴渶涓庤缃睆鍙傜殑灞忓楂樺強棰滆壊涓�鑷达紝鍚﹀垯鍙戦�佹椂浼氭彁绀洪敊璇� + hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0); + + nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1); // 娣诲姞涓�涓妭鐩紝鍙傛暟璇存槑瑙佸嚱鏁板0鏄庢敞绀� + #endregion + + #region 鍖哄煙灞炴�ц缃� + // 鍖哄煙鑼冨洿鍙橀噺 鍙傛暟璁惧畾 + LedDll.AREARECT AreaRect = new LedDll.AREARECT();//鍖哄煙鍧愭爣灞炴�х粨鏋勪綋鍙橀噺 + AreaRect.left = 0; + AreaRect.top = 20; + AreaRect.width = m_ledWidth; + AreaRect.height = 106; + + // 鍖哄煙瀛椾綋鍙橀噺 鍙傛暟璁惧畾 + LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//鏂囧瓧灞炴�� + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 72; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 1; + + // 鍖哄煙瀛椾綋杩愯閫熷害 甯﹀叆鏂瑰紡 + LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); + PlayProp.InStyle = 0; + PlayProp.DelayTime = 3; + PlayProp.Speed = 2; + #endregion + + + #region 鍒涘缓鍖哄煙 + // 瀛楀箷鍖哄煙 鐢ㄤ簬鏄剧ず杩愯鐘舵�� 14 鍖哄煙宸插瓨鍦� + nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, ledText, ref FontProp, 32); + + // 鍙戦�佸埌LED灞忓箷 + nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram); + LedDll.LV_DeleteProgram(hProgram); + #endregion + + + if (nResult != 0) + { + string ErrStr; + ErrStr = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�瑕佹坊鍔爈og + logger.Error("杩斿洖閿欒淇℃伅A041锛�", ErrStr); + } + } + catch (Exception ex) + { + // 涓嶆姏鍑哄紓甯革紝闃叉闃荤涓荤▼搴忚繍琛岋紱 Liudl:姝ゅ闇�娣诲姞log + //throw ex; + Logger logger = LogManager.GetCurrentClassLogger(); + logger.Error("娴嬭瘯trycatch鎹曟崏鐨勪俊鎭�1锛�", ex.Message); + } + } + #endregion + + + #endregion +} diff --git a/Admin.NET/WCS.Application/WCS.Application.csproj b/Admin.NET/WCS.Application/WCS.Application.csproj index 0275db2..963419a 100644 --- a/Admin.NET/WCS.Application/WCS.Application.csproj +++ b/Admin.NET/WCS.Application/WCS.Application.csproj @@ -119,6 +119,7 @@ <ItemGroup> <PackageReference Include="IoTClient" Version="1.0.40" /> + <PackageReference Include="NLog" Version="5.3.4" /> </ItemGroup> <ItemGroup> -- Gitblit v1.8.0