7fb9d8f51979ae9df697a434e1a8c80533695904..01503b2809977ecdab703695c8e4bd70324f3c62
2025-03-25 wxw
LED屏幕增加实时显示称重重量
01503b 对比 | 目录
2025-03-22 wxw
修改LED显示异常入库信息问题
533a8a 对比 | 目录
2个文件已修改
68 ■■■■ 已修改文件
Admin.NET/WCS.Application/PLC/PLCService.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -23,6 +23,9 @@
    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)
    {
@@ -1192,6 +1195,43 @@
        {
            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())
        {
@@ -1236,7 +1276,7 @@
                            break;
                    }
                    string errorStr = "异常信息:";
                    string errorStr = string.Empty;
                    //将异常信息显示到LED屏幕上
                    var (errorRes0, errorVal0) = plcConn.GetPlcDBValue(PLCDataTypeEnum.Bit, $"M{dbStr}.0", "");
                    if (errorRes0.IsSucceed && errorVal0 == true)
@@ -1283,9 +1323,15 @@
                    {
                        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":
@@ -2882,12 +2928,20 @@
        }
    }
    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");
        }
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -166,7 +166,7 @@
                            {
                                //Console.WriteLine($"{modPlc.IP}读取{modDevice.DbNumber}.{modDevice.PlcPos}的值为:{value}");
                                //无流程跳出
                                if (value == 0 && modPlc.Type != PLCTypeEnum.BoxConveyorLine)//
                                if (value == 0 && modPlc.Type != PLCTypeEnum.BoxConveyorLine && modDevice.StationNum != "094" && modDevice.StationNum != "160" && modDevice.StationNum != "155")//
                                    continue;
                                var dto = modDevice.Adapt<WcsDeviceDto>();
                                dto.Value = value;