diff --git a/DM_Weight/Port/PortUtil.cs b/DM_Weight/Port/PortUtil.cs index aaf3364..e8c17f7 100644 --- a/DM_Weight/Port/PortUtil.cs +++ b/DM_Weight/Port/PortUtil.cs @@ -1029,6 +1029,7 @@ namespace DM_Weight.Port #region 2.4寸汉显屏 // 基础数据写入方法 + //三色灯标签写标签type:1药品名称;2规格;5批次;6效期;8厂家 public void WriteChannelInfo(int type, string content, int drawerNo, int colNo) { try diff --git a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs index abf0e1c..98981cc 100644 --- a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs @@ -550,7 +550,7 @@ namespace DM_Weight.ViewModels { // 更新屏显库存 //List singleChannels = record.FindAll(it => it.BoardType != 1); - List singleChannels = record.FindAll(it => it.BoardType == 5) + List singleChannels = record.FindAll(it => it.BoardType == 5&&it.CheckQuantity>0).OrderBy(it=>it.EffDate) .GroupBy(it => new { it.DrawerNo, @@ -566,9 +566,16 @@ namespace DM_Weight.ViewModels { singleChannels.ForEach(it => { + //将库位多批次的总库存数更新标签 + _portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo); + Thread.Sleep(200); + _portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo); + Thread.Sleep(200); // 将库位多批次的总库存数更新标签 _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity); Thread.Sleep(200); + _portUtil.ShowContent(it.DrawerNo, it.ColNo); + Thread.Sleep(200); }); } diff --git a/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs index 1462f1a..e2efcc3 100644 --- a/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs @@ -479,14 +479,38 @@ namespace DM_Weight.ViewModels //}); // 更新屏显库存 - List singleChannels = record.FindAll(it => it.BoardType != 1); - if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5) + List singleChannels = record.FindAll(it => it.BoardType == 5); + if (singleChannels!=null&&singleChannels.Count > 0) { - singleChannels.ForEach(it => + for (int i = 0; i < singleChannels.Count; i++) { - _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity); - Thread.Sleep(200); - }); + + + List csList = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.MachineId == singleChannels[i].MachineId) + .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList(); + + if (csList != null && csList.Count > 0) + { + int totalQuantity = csList.Sum(c => c.Quantity); + + _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + //将库位多批次的总库存数更新标签 + _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity); + Thread.Sleep(200); + } + } + //singleChannels.ForEach(it => + //{ + // _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity); + // Thread.Sleep(200); + //}); } AlertMsg alertMsg = new AlertMsg { diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index d9c96df..4a18323 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -433,14 +433,32 @@ namespace DM_Weight.ViewModels { if (singleChannels[i].BoardType == 5) { - int totalQuantity = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId == singleChannels[i].MachineId) - .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) - .Where(cs => cs.ColNo == singleChannels[i].ColNo) - .Sum(it => it.Quantity); - //将库位多批次的总库存数更新标签 - _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); - Thread.Sleep(200); + List csList = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.MachineId == singleChannels[i].MachineId) + .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList(); + + if (csList != null && csList.Count > 0) + { + int totalQuantity = csList.Sum(c => c.Quantity); + _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + //将库位多批次的总库存数更新标签 + _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity); + Thread.Sleep(200); + } + //int totalQuantity = SqlSugarHelper.Db.Queryable() + // .Where(cs => cs.MachineId == singleChannels[i].MachineId) + // .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + // .Where(cs => cs.ColNo == singleChannels[i].ColNo) + // .Sum(it => it.Quantity); + ////将库位多批次的总库存数更新标签 + //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); + //Thread.Sleep(200); } } } diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index bce456c..5dce7a2 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -454,14 +454,32 @@ namespace DM_Weight.ViewModels { if (singleChannels[i].BoardType == 5) { - int totalQuantity = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId == singleChannels[i].MachineId) - .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) - .Where(cs => cs.ColNo == singleChannels[i].ColNo) - .Sum(it => it.Quantity); - //将库位多批次的总库存数更新标签 - _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); - Thread.Sleep(200); + List csList = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.MachineId == singleChannels[i].MachineId) + .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList(); + + if (csList != null && csList.Count > 0) + { + int totalQuantity = csList.Sum(c => c.Quantity); + _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + //将库位多批次的总库存数更新标签 + _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity); + Thread.Sleep(200); + } + //int totalQuantity = SqlSugarHelper.Db.Queryable() + // .Where(cs => cs.MachineId == singleChannels[i].MachineId) + // .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + // .Where(cs => cs.ColNo == singleChannels[i].ColNo) + // .Sum(it => it.Quantity); + ////将库位多批次的总库存数更新标签 + //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); + //Thread.Sleep(200); } } } diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index 63e5ffd..99f51f3 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -376,14 +376,32 @@ namespace DM_Weight.ViewModels { if (singleChannels[i].BoardType == 5) { - int totalQuantity = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId == singleChannels[i].MachineId) - .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) - .Where(cs => cs.ColNo == singleChannels[i].ColNo) - .Sum(it => it.Quantity); - //将库位多批次的总库存数更新标签 - _portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); - Thread.Sleep(200); + List csList = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.MachineId == singleChannels[i].MachineId) + .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + .Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList(); + + if (csList != null && csList.Count > 0) + { + int totalQuantity = csList.Sum(c => c.Quantity); + _portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + _portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo); + Thread.Sleep(200); + //将库位多批次的总库存数更新标签 + _portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity); + Thread.Sleep(200); + } + //int totalQuantity = SqlSugarHelper.Db.Queryable() + // .Where(cs => cs.MachineId == singleChannels[i].MachineId) + // .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) + // .Where(cs => cs.ColNo == singleChannels[i].ColNo) + // .Sum(it => it.Quantity); + ////将库位多批次的总库存数更新标签 + //_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity); + //Thread.Sleep(200); } } }