交接柜补药:交接柜中有该药品及批次的数据则更新;没有则插入一条

This commit is contained in:
maqiao 2024-11-29 19:20:28 +08:00
parent 7f8190e39f
commit 32bc9f5ffb
1 changed files with 11 additions and 3 deletions

View File

@ -358,12 +358,20 @@ namespace DM_Weight.ViewModels
{
for (int j = 0; j < jiaojieStock.Count; j++)
{
List<ChannelStock> stockManuList = jiaojieStock.Where(cs => cs.ManuNo == it.ManuNo).ToList();
if (stockManuList == null)
if (stockManuList == null||stockManuList.Count<=0)
{
jiaojieStock[j].ManuNo= it.ManuNo;
SqlSugarHelper.Db.Insertable(jiaojieStock[j]).ExecuteCommand();
if (jiaojieStock[j].Quantity <= 0)
{
SqlSugarHelper.Db.Updateable(jiaojieStock[j]).ExecuteCommand();
}
else
{
jiaojieStock[j].ManuNo= it.ManuNo;
jiaojieStock[j].Chnguid = Guid.NewGuid().ToString();
SqlSugarHelper.Db.Insertable(jiaojieStock).ExecuteCommand();
}
}
}
}