请领入库页面添加抽屉类型是35写标签数据

This commit is contained in:
maqiao 2024-11-18 14:51:09 +08:00
parent baf0747a74
commit 58174569e9
1 changed files with 36 additions and 1 deletions

View File

@ -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<ChannelStock> 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<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
.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);
}
}