交接柜补药按药品分组
This commit is contained in:
parent
32bc9f5ffb
commit
5e567836e4
|
@ -358,23 +358,19 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
for (int j = 0; j < jiaojieStock.Count; j++)
|
for (int j = 0; j < jiaojieStock.Count; j++)
|
||||||
{
|
{
|
||||||
List<ChannelStock> stockManuList = jiaojieStock.Where(cs => cs.ManuNo == it.ManuNo).ToList();
|
List<ChannelStock> searchStock = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
if (stockManuList == null||stockManuList.Count<=0)
|
.Where(cs => cs.DrawerNo == jiaojieStock[j].DrawerNo && cs.DrugId == jiaojieStock[j].DrugId && cs.DrugId == it.DrugId && cs.ManuNo == it.ManuNo)
|
||||||
|
.ToList();
|
||||||
|
//List<ChannelStock> stockManuList = jiaojieStock.Where(cs => cs.ManuNo == it.ManuNo).ToList();
|
||||||
|
if (searchStock == null || searchStock.Count <= 0)
|
||||||
{
|
{
|
||||||
jiaojieStock[j].ManuNo= it.ManuNo;
|
SqlSugarHelper.Db.Deleteable<ChannelStock>().Where(cs=>cs.DrawerNo== jiaojieStock[j].DrawerNo&&cs.DrugId== jiaojieStock[j].DrugId&&cs.ManuNo==null).ExecuteCommand();
|
||||||
if (jiaojieStock[j].Quantity <= 0)
|
jiaojieStock[j].ManuNo = it.ManuNo;
|
||||||
{
|
jiaojieStock[j].Id = Guid.NewGuid().ToString();
|
||||||
SqlSugarHelper.Db.Updateable(jiaojieStock[j]).ExecuteCommand();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jiaojieStock[j].ManuNo= it.ManuNo;
|
|
||||||
jiaojieStock[j].Chnguid = Guid.NewGuid().ToString();
|
|
||||||
SqlSugarHelper.Db.Insertable(jiaojieStock).ExecuteCommand();
|
SqlSugarHelper.Db.Insertable(jiaojieStock).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//if (jiaojieStock != null && jiaojieStock.Count > 0)
|
//if (jiaojieStock != null && jiaojieStock.Count > 0)
|
||||||
//{
|
//{
|
||||||
// for (int j = 0; j < jiaojieStock.Count; j++)
|
// for (int j = 0; j < jiaojieStock.Count; j++)
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -76,6 +77,14 @@ namespace DM_Weight.ViewModels
|
||||||
.OrderBy(cs => cs.Chnguid)
|
.OrderBy(cs => cs.Chnguid)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
ChannelStocks = ChannelStocks.GroupBy(it => new { it.DrawerNo, it.DrugId })
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
var ret = it.First();
|
||||||
|
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
|
return ret;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity);
|
ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity);
|
||||||
|
|
||||||
ICollectionView vw = CollectionViewSource.GetDefaultView(ChannelStocks);
|
ICollectionView vw = CollectionViewSource.GetDefaultView(ChannelStocks);
|
||||||
|
|
Loading…
Reference in New Issue