Commit 01df7a66 LN

/rest/api/v1/shelf/allPosOff 增加 shelf参数 表示料架号

1 个父辈 5695894c
......@@ -181,6 +181,7 @@ namespace SmartShelf.DeviceLibrary
public static string Param_posId = "posId";
public static string Param_color = "color";
public static string Param_shelf = "shelf";
public static char PosId_SpiltChar = ';';
public static char PosId_Color_SpiltChar = '@';
......@@ -232,15 +233,25 @@ namespace SmartShelf.DeviceLibrary
{
bool result = true;
string color = "";
string shelf = "";
if (paramMap.ContainsKey(Param_color) && (paramMap[Param_color] != ""))
{
color = paramMap[Param_color];
result = ProcessCloseByColor(color);
}
if (paramMap.ContainsKey(Param_shelf) && paramMap[Param_shelf] != "")
{
shelf = paramMap[Param_shelf];
}
else
if(String.IsNullOrEmpty(color)&&String.IsNullOrEmpty(shelf))
{
result = ProcessCloseAll();
}
else
{
result = ProcessCloseByParam(color,shelf);
}
return GetResult(result, "allPosOff");
}
else
......@@ -349,22 +360,31 @@ namespace SmartShelf.DeviceLibrary
return true;
}
public static bool ProcessCloseByColor(string color, string proMsg = "Revice ", string ip = "")
public static bool ProcessCloseByParam(string color, string shelf, string proMsg = "Revice ", string ip = "")
{
LogUtil.info(BoxName + proMsg + " ProcessCloseByColor 命令:" + color);
List<string> posIdList = new List<string>(PositionMap.Keys);
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()))
string shelfStr = shelf + "_";
if (String.IsNullOrEmpty(shelf) || key.StartsWith(shelfStr))
{
BoxPosition position = PositionMap[key];
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);
string status = GetPosIdColor(key);
if (String.IsNullOrEmpty(status))
{
continue;
}
if (String.IsNullOrEmpty(color) || status.ToLower().Equals(color.ToLower()))
{
BoxPosition position = PositionMap[key];
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)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!