diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs index 8370a2a..e717a20 100644 --- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs @@ -541,7 +541,7 @@ namespace DM_Weight.ViewModels private bool _isFinishClick = false; public DelegateCommand TakeFinish { get => new DelegateCommand(TakeFinishAction); } - private void TakeFinishAction() + private async void TakeFinishAction() { if (!_isFinishClick) { @@ -776,6 +776,41 @@ namespace DM_Weight.ViewModels //} } } + List singleChannelsBoxSmart = record.Where(it => it.BoardType == 35) + .GroupBy(it => new { it.DrawerNo, it.ColNo }) + .Select(it => + { + var ret = it.First(); + //ret.Quantity = it.Sum(itx => itx.Quantity); + //ret.AddQuantity = it.Sum(itx => itx.AddQuantity); + return ret; + }) + .ToList(); + + if (singleChannelsBoxSmart != null && singleChannelsBoxSmart.Count > 0) + { + for (int i = 0; i < singleChannelsBoxSmart.Count; i++) + { + List channelStockEffDate = SqlSugarHelper.Db.Queryable() + .Where(cs => cs.MachineId == singleChannelsBoxSmart[i].MachineId) + .Where(cs => cs.DrawerNo == singleChannelsBoxSmart[i].DrawerNo) + .Where(cs => cs.ColNo == singleChannelsBoxSmart[i].ColNo) + .Where(cs => cs.Quantity > 0) + .OrderBy(cs => cs.EffDate).ToList(); + int totalQuantity = channelStockEffDate.Sum(it => it.Quantity); + + //将库位多批次的总库存数更新标签 + + await Task.Delay(200); + await _portUtil.WriteChannelInfoMethod(2, totalQuantity.ToString(), channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo); + await Task.Delay(200); + await _portUtil.WriteChannelInfoMethod(5, channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo); + await Task.Delay(200); + await _portUtil.WriteChannelInfoMethod(6, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo); + await Task.Delay(200); + await _portUtil.ShowContentMethod(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo); + } + }