Commit 3618c65e LN

bug修改:多个灯一起亮。

1 个父辈 2bfce709
......@@ -47,14 +47,14 @@ namespace SmartShelf.DeviceLibrary
{
List<Light> sLed = new List<Light>();
for (int index = 0; index <= module.Max_Light; index++)
for (int index = 0; index < module.Max_Light; index++)
{
if ("green" == color)
if ("green".Equals(color))
{
CurrLedStatus = 1;
sLed.Add(Light.GreenLight(StatusLedDmx, index));
}
else if ("yellow" == color)
else if ("yellow".Equals(color))
{
CurrLedStatus = 2;
sLed.Add(Light.YellowLight(StatusLedDmx, index));
......@@ -62,7 +62,6 @@ namespace SmartShelf.DeviceLibrary
}
module.LightOn(sLed.ToArray());
}
}
......
......@@ -34,7 +34,7 @@ namespace SmartShelf.DeviceLibrary
}
return "";
}
public static void UpdatePosIdColor(string posId, string color="")
public static void UpdatePosIdColor(string posId, string color = "")
{
if (StatusColorMap.ContainsKey(posId))
{
......@@ -157,14 +157,14 @@ namespace SmartShelf.DeviceLibrary
{
if (!LEDManager.CurrLedStatus.Equals(2))
{
// LEDManager.OpenStatusLights("green");
// LEDManager.OpenStatusLights("green");
}
}
else
{
if (!LEDManager.CurrLedStatus.Equals(1))
{
// LEDManager.OpenStatusLights("yellow");
// LEDManager.OpenStatusLights("yellow");
}
}
......@@ -360,16 +360,27 @@ namespace SmartShelf.DeviceLibrary
led.AllLightOff();
}
}
Dictionary<string, List<Light>> lightsMap = new Dictionary<string, List<Light>>();
foreach (string key in posIdList)
{
string status = GetPosIdColor(key);
if (status.ToLower().Equals(color.ToLower()))
{
BoxPosition position = PositionMap[key];
LEDManager.GetLedModule(position.DeviceIp).LightOff(Light.GetLights(position.DmxId, position.GetLedList(), 0));
Light[] lightArray = Light.GetLights(position.DmxId, position.GetLedList(), 0);
SaveLightToMap(lightsMap, position.DeviceIp, lightArray);
// LEDManager.GetLedModule(position.DeviceIp).LightOff(Light.GetLights(position.DmxId, position.GetLedList(), 0));
UpdatePosIdColor(key);
}
}
foreach (string dip in lightsMap.Keys)
{
List<Light> lights = lightsMap[dip];
if (lights.Count > 0)
{
LEDManager.GetLedModule(dip).LightOff(lights.ToArray());
}
}
return true;
}
......@@ -378,6 +389,7 @@ namespace SmartShelf.DeviceLibrary
LogUtil.info(BoxName + proMsg + " open命令:" + posids);
string[] posArray = posids.Split(PosId_SpiltChar);
Dictionary<string, List<Light>> lightsMap = new Dictionary<string, List<Light>>();
foreach (string posStr in posArray)
{
string posid = posStr;
......@@ -392,8 +404,10 @@ namespace SmartShelf.DeviceLibrary
if (PositionMap.ContainsKey(posid))
{
BoxPosition position = PositionMap[posid];
Light[] lights = Light.GetLights(position.DmxId, color, position.GetLedList().ToArray());
LEDManager.GetLedModule(position.DeviceIp).LightOn(lights);
Light[] lightArray = Light.GetLights(position.DmxId, color, position.GetLedList().ToArray());
SaveLightToMap(lightsMap, position.DeviceIp, lightArray);
// LEDManager.GetLedModule(position.DeviceIp).LightOn(lights);
UpdatePosIdColor(posid, color);
}
......@@ -409,14 +423,42 @@ namespace SmartShelf.DeviceLibrary
}
}
}
foreach (string dip in lightsMap.Keys)
{
List<Light> lights = lightsMap[dip];
if (lights.Count > 0)
{
LEDManager.GetLedModule(dip).LightOn(lights.ToArray());
}
}
return true;
}
private static void SaveLightToMap(Dictionary<string, List<Light>> lightsMap, string ip, Light[] lightArray)
{
if (lightArray != null && lightArray.Length > 0)
{
List<Light> lights = new List<Light>();
if (lightsMap.ContainsKey(ip))
{
lights = lightsMap[ip];
}
lights.AddRange(lightArray);
if (lightsMap.ContainsKey(ip))
{
lightsMap[ip] = lights;
}
else
{
lightsMap.Add(ip, lights);
}
}
}
public static bool ProcessCloseLed(string posids, string proMsg = "Revice ")
{
LogUtil.info(BoxName + proMsg + " close命令:" + posids);
string[] posArray = posids.Split(PosId_SpiltChar);
Dictionary<string, List<Light>> lightsMap = new Dictionary<string, List<Light>>();
foreach (string posid in posArray)
{
......@@ -429,8 +471,9 @@ namespace SmartShelf.DeviceLibrary
if (PositionMap.ContainsKey(posName))
{
BoxPosition position = PositionMap[posName];
LEDManager.GetLedModule(position.DeviceIp).LightOff(Light.GetLights(position.DmxId, position.GetLedList(), 0));
// StatusColorMap[posName] = "";
Light[] lightArray = Light.GetLights(position.DmxId, position.GetLedList());
SaveLightToMap(lightsMap, position.DeviceIp, lightArray);
// LEDManager.GetLedModule(position.DeviceIp).LightOff(Light.GetLights(position.DmxId, position.GetLedList(), 0));
UpdatePosIdColor(posName);
}
else
......@@ -438,6 +481,14 @@ namespace SmartShelf.DeviceLibrary
LogUtil.error(BoxName + "关闭灯败,未找到库位号:" + posName);
}
}
foreach (string dip in lightsMap.Keys)
{
List<Light> lights = lightsMap[dip];
if (lights.Count > 0)
{
LEDManager.GetLedModule(dip).LightOff(lights.ToArray());
}
}
return true;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!