| | |
| | | private static readonly object OLock = new object(); |
| | | |
| | | private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); |
| | | private static decimal weight94 = 0; |
| | | private static decimal weight160 = 0; |
| | | private static decimal weight155 = 0; |
| | | |
| | | public static void OnChangeEvent(object sender, EventArgs e) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | |
| | | #region#实时显示重量到LED屏幕 |
| | | var modPosPalletWeightIng = modDevice.listStation.FirstOrDefault(m => m.Text == "实际重量"); |
| | | var (resPalletWeightIng, palletWeightValIng) = plcConn.GetPlcDBValue(modPosPalletWeightIng.PosType, modDevice.DbNumber, modPosPalletWeightIng.PlcPos); |
| | | switch (modDevice.StationNum) |
| | | { |
| | | case "094": |
| | | { |
| | | if (Convert.ToDecimal(palletWeightValIng) != weight94) |
| | | { |
| | | LedDisplay(modDevice.LedIP, $"当前重量(KG):{Convert.ToDecimal(palletWeightValIng)}"); |
| | | weight94 = Convert.ToDecimal(palletWeightValIng); |
| | | } |
| | | } |
| | | break; |
| | | case "160": |
| | | { |
| | | if (Convert.ToDecimal(palletWeightValIng) != weight160) |
| | | { |
| | | LedDisplay(modDevice.LedIP, $"当前重量(KG):{Convert.ToDecimal(palletWeightValIng)}"); |
| | | weight160 = Convert.ToDecimal(palletWeightValIng); |
| | | } |
| | | } |
| | | break; |
| | | case "155": |
| | | { |
| | | if (Convert.ToDecimal(palletWeightValIng) != weight155) |
| | | { |
| | | LedDisplay(modDevice.LedIP, $"当前重量(KG):{Convert.ToDecimal(palletWeightValIng)}"); |
| | | weight155 = Convert.ToDecimal(palletWeightValIng); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | var ledText = ""; |
| | | switch (modDevice.Value.ToString()) |
| | | { |
| | |
| | | break; |
| | | } |
| | | |
| | | string errorStr = "异常信息:"; |
| | | string errorStr = string.Empty; |
| | | //将异常信息显示到LED屏幕上 |
| | | var (errorRes0, errorVal0) = plcConn.GetPlcDBValue(PLCDataTypeEnum.Bit, $"M{dbStr}.0", ""); |
| | | if (errorRes0.IsSucceed && errorVal0 == true) |
| | |
| | | { |
| | | errorStr += " 扫码仪通讯报警"; |
| | | } |
| | | ledText += $"申请入库失败\n\n"; |
| | | ledText += $"{errorStr}"; |
| | | LedDisplay(modDevice.LedIP, ledText); |
| | | |
| | | if (!string.IsNullOrEmpty(errorStr)) |
| | | { |
| | | errorStr = "异常信息:" + errorStr; |
| | | |
| | | ledText += $"申请入库失败\n\n"; |
| | | ledText += $"{errorStr}"; |
| | | LedDisplay(modDevice.LedIP, ledText); |
| | | } |
| | | } |
| | | break; |
| | | case "320": |
| | |
| | | } |
| | | } |
| | | |
| | | private static void LedDisplay(string ip,string text) |
| | | private static void LedDisplay(string ip,string text,int type=0) |
| | | { |
| | | try |
| | | { |
| | | LedDll Led = new LedDll(); |
| | | Led.ConsoleLeds(ip, text); |
| | | if (type == 0) |
| | | { |
| | | Led.ConsoleLeds(ip, text); |
| | | } |
| | | else |
| | | { |
| | | Led.LEDstr(ip, text); |
| | | } |
| | | |
| | | // 设置实例 |
| | | //Led.ConsoleLeds("10.18.51.238", $"任务类型:{TaskTypeEnum.Move.GetDescription()}\n\n任务号:TK2024102100001\n托盘号:LN000145\n\n起始位:033\n目标位:R01-02010102"); |
| | | } |