From 58174569e9cf669f6d605eeeeabd1dd8a23495aa Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Mon, 18 Nov 2024 14:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E9=A2=86=E5=85=A5=E5=BA=93=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E6=8A=BD=E5=B1=89=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=98=AF35=E5=86=99=E6=A0=87=E7=AD=BE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ApplyInStockWindowViewModel.cs | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) 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); + } + }