From 696b87e0f494eff98e1646fbde133430f22b1543 Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期日, 20 十月 2024 18:48:44 +0800 Subject: [PATCH] bug修复 --- Admin.NET/WCS.Application/Util/LedDll.cs | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 87 insertions(+), 0 deletions(-) diff --git a/Admin.NET/WCS.Application/Util/LedDll.cs b/Admin.NET/WCS.Application/Util/LedDll.cs index f881361..372a9fa 100644 --- a/Admin.NET/WCS.Application/Util/LedDll.cs +++ b/Admin.NET/WCS.Application/Util/LedDll.cs @@ -988,6 +988,93 @@ } /// <summary> + /// LED鏄剧ず + /// </summary> + /// <param name="m_Ip">LED灞忓箷IP鍦板潃</param> + /// <param name="m_text">鏄剧ず鍐呭</param> + public void ConsoleLeds(string m_Ip, string m_text) + { + 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 = LedDll.LS_GetError(nResult); // liudl 姝ゅ闇�璁板綍Log + throw new Exception(ErrStr); + } + #endregion + + + #region 鍒涘缓鍖哄煙 + // 鍖哄煙鑼冨洿鍙橀噺 鍙傛暟璁惧畾 + LedDll.AREARECT AreaRect = new LedDll.AREARECT();//鍖哄煙鍧愭爣灞炴�х粨鏋勪綋鍙橀噺 + AreaRect.left = 0; + AreaRect.top = 0; + AreaRect.width = m_ledWidth; + AreaRect.height = 106; + LedDll.LV_AddImageTextArea(hProgram, 0, 2, ref AreaRect, 1); + + // 鍖哄煙瀛椾綋鍙橀噺 鍙傛暟璁惧畾 + LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//鏂囧瓧灞炴�� + FontProp.FontName = "瀹嬩綋"; + FontProp.FontSize = 20; + FontProp.FontColor = LedDll.COLOR_RED; + FontProp.FontBold = 1; + + // 鍖哄煙瀛椾綋杩愯閫熷害 甯﹀叆鏂瑰紡 + LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); + PlayProp.InStyle = 0; + PlayProp.DelayTime = 3; + PlayProp.Speed = 2; + + + // 澶氭枃鏈尯鍩� 鐢ㄤ簬鏄剧ず鎵樼洏淇℃伅 + nResult = LedDll.LV_AddMultiLineTextToImageTextArea(hProgram, 0, 2, LedDll.ADDTYPE_STRING, m_text, ref FontProp, ref PlayProp, 0, 0); + + // 鍙戦�佸埌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> -- Gitblit v1.8.0