抽屉打开 订阅事件里设置channelStocks[0].process字段去掉

This commit is contained in:
maqiao 2024-07-19 15:36:27 +08:00
parent 7cbf366a98
commit f43e691ee0
8 changed files with 90 additions and 83 deletions

View File

@ -824,6 +824,7 @@ namespace DM_Weight.Port
private bool DrawerState(int[] r) private bool DrawerState(int[] r)
{ {
logger.Info($"DrawerState DrawerNo:{DrawerNo};r.length:{r.Length}");
int index = DrawerNo > 8 ? DrawerNo - 7 : DrawerNo + 1; int index = DrawerNo > 8 ? DrawerNo - 7 : DrawerNo + 1;
return r[index] == 0; return r[index] == 0;
} }

View File

@ -221,25 +221,25 @@ namespace DM_Weight.ViewModels
// 抽屉打开 // 抽屉打开
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
if (Status == 1) //if (Status == 1)
{ //{
if (channelStocks[0].process == 1) // if (channelStocks!=null&& channelStocks[0]!=null&&channelStocks[0].process == 1)
{ // {
channelStocks.ForEach(it => it.process = 2); // channelStocks.ForEach(it => it.process = 2);
} // }
//Status = 2; // //Status = 2;
} //}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-'))); int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -104,24 +104,25 @@ namespace DM_Weight.ViewModels
// 抽屉打开 // 抽屉打开
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
if (Status == 1) //if (Status == 1)
{ //{
if (channelStocks[0].process == 1) // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
{ // {
channelStocks.ForEach(it => it.process = 2); // channelStocks.ForEach(it => it.process = 2);
} // }
} //}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -62,23 +62,24 @@ namespace DM_Weight.ViewModels
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
if (Status == 1) logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
{ //if (Status == 1)
if (channelStocks[0].process == 1) //{
{ // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
channelStocks.ForEach(it => it.process = 2); // {
} // channelStocks.ForEach(it => it.process = 2);
} // }
//}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -66,23 +66,24 @@ namespace DM_Weight.ViewModels
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
if (Status == 1) logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
{ //if (Status == 1)
if (channelStocks[0].process == 1) //{
{ // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
channelStocks.ForEach(it => it.process = 2); // {
} // channelStocks.ForEach(it => it.process = 2);
} // }
//}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -65,23 +65,24 @@ namespace DM_Weight.ViewModels
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
if (Status == 1) logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
{ //if (Status == 1)
if (channelStocks[0].process == 1) //{
{ // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
channelStocks.ForEach(it => it.process = 2); // {
} // channelStocks.ForEach(it => it.process = 2);
} // }
//}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
//IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; //IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
//int DrawerNoBefore = groupingBefore.Key; //int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -70,23 +70,24 @@ namespace DM_Weight.ViewModels
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
if (Status == 1) logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
{ //if (Status == 1)
if (channelStocks[0].process == 1) //{
{ // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
channelStocks.ForEach(it => it.process = 2); // {
} // channelStocks.ForEach(it => it.process = 2);
} // }
//}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())

View File

@ -62,23 +62,24 @@ namespace DM_Weight.ViewModels
case EventType.DRAWEROPEN: case EventType.DRAWEROPEN:
if (Status == 1) logger.Info($"抽屉打开,channelStocks{channelStocks != null}");
{ //if (Status == 1)
if (channelStocks[0].process == 1) //{
{ // if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 1)
channelStocks.ForEach(it => it.process = 2); // {
} // channelStocks.ForEach(it => it.process = 2);
} // }
//}
break; break;
// 抽屉关闭 // 抽屉关闭
case EventType.DRAWERCLOSE: case EventType.DRAWERCLOSE:
if (Status == 1) if (Status == 1)
{ {
if (channelStocks[0].process == 2) //if (channelStocks != null && channelStocks[0] != null && channelStocks[0].process == 2)
{ //{
channelStocks.ForEach(it => it.process = 3); // channelStocks.ForEach(it => it.process = 3);
} //}
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current; IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
int DrawerNoBefore = groupingBefore.Key; int DrawerNoBefore = groupingBefore.Key;
if (enumerator.MoveNext()) if (enumerator.MoveNext())