修改一个处方对应多个药品信息

This commit is contained in:
maqiao 2024-09-20 11:26:33 +08:00
parent ece3d477a2
commit 25ec8fb290
1 changed files with 134 additions and 129 deletions

View File

@ -499,15 +499,18 @@ namespace DM_Weight.ViewModels
//Expression<Func<ChannelStock, bool>> updateExp = it => it.ManuNo == oi._OrderDetail.SetManuNo && it.EffDate == oi._OrderDetail.SetEffDate;
for (int j = 0; j < oi.OrderDetailList.Count; j++)
{
oi._OrderDetail = oi.OrderDetailList[j];
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.DrugId == oi._OrderDetail.DrugId
&& cs.ManuNo == oi._OrderDetail.SetManuNo
&& cs.EffDate == oi._OrderDetail.SetEffDate
&& cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
&& cs.DrawerNo == DrawerNo).First();
&& cs.DrawerNo == DrawerNo+1).First();
if (cs == null)
{
empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo},{oi._OrderDetail.SetEffDate}";
empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo},{oi._OrderDetail.SetEffDate};";
continue;
}
cs.Quantity = cs.Quantity - oi._OrderDetail.Quantity;
@ -650,6 +653,8 @@ namespace DM_Weight.ViewModels
logger.Info($"未写入总结存数据{oi._OrderDetail.DrugId}-{oi._OrderDetail.Quantity}");
}
}
}
}
if (!string.IsNullOrEmpty(empChannelStock))
{
@ -660,7 +665,7 @@ namespace DM_Weight.ViewModels
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
logger.Info($"所选处方对应药品批次效期无库存{empChannelStock}");
return false;
}
return true;
});