抽屉打开 订阅事件里设置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())
@ -339,7 +340,7 @@ namespace DM_Weight.ViewModels
// .Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList(); // .Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
List<ChannelStock> stockList = _mysqlHelper.GetInvoiceStock(invoicesManuNo[j].DrugId, invoicesManuNo[j].DrugManuNo); List<ChannelStock> stockList = _mysqlHelper.GetInvoiceStock(invoicesManuNo[j].DrugId, invoicesManuNo[j].DrugManuNo);
// List <DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList(); // List <DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
// DrugManuNo manuNoList = _mysqlHelper.GetManuNoList(invoicesManuNo[j].DrugId, invoicesManuNo[j].DrugManuNo); // DrugManuNo manuNoList = _mysqlHelper.GetManuNoList(invoicesManuNo[j].DrugId, invoicesManuNo[j].DrugManuNo);
if (stockList == null || stockList.Count <= 0) if (stockList == null || stockList.Count <= 0)
{ {
//if (manuNoList == null||manuNoList.Id==null) //if (manuNoList == null||manuNoList.Id==null)
@ -388,7 +389,7 @@ namespace DM_Weight.ViewModels
stock.ColNo = channelL[k].ColNo; stock.ColNo = channelL[k].ColNo;
stock.DrugId = channelL[k].DrugId; stock.DrugId = channelL[k].DrugId;
stock.ManuNo = invoicesManuNo[j].DrugManuNo; stock.ManuNo = invoicesManuNo[j].DrugManuNo;
stock.EffDate =Convert.ToDateTime(invoicesManuNo[j].DrugEffDate).ToString("yyyy-MM-dd"); stock.EffDate = Convert.ToDateTime(invoicesManuNo[j].DrugEffDate).ToString("yyyy-MM-dd");
stock.Chnguid = channelL[k].Id; stock.Chnguid = channelL[k].Id;
stockList.Add(stock); stockList.Add(stock);
} }
@ -550,7 +551,7 @@ namespace DM_Weight.ViewModels
_isFinishClick = true; _isFinishClick = true;
List<ChannelStock> record = ChannelStocks.Where(cs=>cs.AddQuantity>0).ToList(); List<ChannelStock> record = ChannelStocks.Where(cs => cs.AddQuantity > 0).ToList();
string InvoiceId = SelectedInvoice.InvoiceNo; string InvoiceId = SelectedInvoice.InvoiceNo;
//var f = SqlSugarHelper.Db.UseTran(() => //var f = SqlSugarHelper.Db.UseTran(() =>
//{ //{

View File

@ -61,24 +61,25 @@ 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())