diff --git a/DM_Weight/Models/UserList.cs b/DM_Weight/Models/UserList.cs index fd91bb4..9317195 100644 --- a/DM_Weight/Models/UserList.cs +++ b/DM_Weight/Models/UserList.cs @@ -74,7 +74,7 @@ namespace DM_Weight.Models return "userList = [UserName:" + Nickname + ", UserId:" + UserName + "]"; } //保存用户已取药箱的药箱号 - [SugarColumn(ColumnName = "Box_Num")] - public string BoxNumber { get; set; } + //[SugarColumn(ColumnName = "Box_Num")] + //public string BoxNumber { get; set; } } } diff --git a/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs b/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs index 55fba7a..783cce7 100644 --- a/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs @@ -524,23 +524,6 @@ namespace DM_Weight.ViewModels .Where(it => it.DrawerType == 1) .ToList(); - SqlSugarHelper.Db.Insertable(new MachineRecord() - { - MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(), - DrawerNo = cs.DrawerNo, - ColNo = cs.ColNo, - DrugId = cs.DrugId, - ManuNo = cs.ManuNo, - EffDate = !String.IsNullOrEmpty(cs.EffDate) ? DateTime.ParseExact(cs.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, - Operator = HomeWindowViewModel.Operator?.Id, - Reviewer = HomeWindowViewModel.Reviewer?.Id, - OperationTime = DateTime.Now, - Quantity = oi._OrderDetail.Quantity, - Type = 2, - InvoiceId = oi.OrderNo - //, StockQuantity = nowChannels.Sum(it => it.Quantity) - }).ExecuteCommand(); - #region 记录 注射剂使用与交接记录报表 //查询发药时间 //MachineRecord SendMachineRecord = SqlSugarHelper.Db.Queryable().Where(mr => mr.DrawerNo == cs.DrawerNo && mr.Type == 2) @@ -594,10 +577,10 @@ namespace DM_Weight.ViewModels { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - oi._OrderDetail.Quantity; accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + oi._OrderDetail.Quantity; - SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); accountBookG2Day.UseDose = (Convert.ToInt32(accountBookG2Day.UseDose) + Convert.ToInt32(oi._OrderDetail.surgicalResidual.UseDose)).ToString(); accountBookG2Day.ResidualDose = (Convert.ToInt32(accountBookG2Day.ResidualDose) + Convert.ToInt32(oi._OrderDetail.surgicalResidual.ResidualDose)).ToString(); accountBookG2Day.TotalStock = (accountBookEmpty != null ? (accountBookEmpty.TotalStock > 0 ? accountBookEmpty.TotalStock : 0) : 0) + oi._OrderDetail.Quantity; + SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); manuStock = accountBookG2Day.ManuStock; } else @@ -610,7 +593,7 @@ namespace DM_Weight.ViewModels ManuNo = cs.ManuNo, EffDate = cs.EffDate, YQuantity = 0, - ManuStock = nowChannels.Sum(it => it.Quantity), //oi._OrderDetail.Quantity, + ManuStock = manuStock > 0 ? manuStock :nowChannels.Sum(it => it.Quantity), //oi._OrderDetail.Quantity, TotalStock = oi._OrderDetail.Quantity, UserId1 = HomeWindowViewModel.Operator?.Id, UserId2 = HomeWindowViewModel.Reviewer?.Id, @@ -686,6 +669,25 @@ namespace DM_Weight.ViewModels logger.Info($"未写入总结存数据{oi._OrderDetail.DrugId}-{oi._OrderDetail.Quantity}"); } } + + SqlSugarHelper.Db.Insertable(new MachineRecord() + { + MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(), + DrawerNo = cs.DrawerNo, + ColNo = cs.ColNo, + DrugId = cs.DrugId, + ManuNo = cs.ManuNo, + EffDate = !String.IsNullOrEmpty(cs.EffDate) ? DateTime.ParseExact(cs.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null, + Operator = HomeWindowViewModel.Operator?.Id, + Reviewer = HomeWindowViewModel.Reviewer?.Id, + OperationTime = DateTime.Now, + Quantity = oi._OrderDetail.Quantity, + Type = 2, + InvoiceId = oi.OrderNo, + GetId= manuStock, + DepartmentId=$"当前库存:{nowChannels.Sum(it => it.Quantity)},空瓶数:{(accountBookEmpty != null ? (accountBookEmpty.TotalStock > 0 ? accountBookEmpty.TotalStock : 0) : 0) + oi._OrderDetail.Quantity}" + //, StockQuantity = nowChannels.Sum(it => it.Quantity) + }).ExecuteCommand(); } if (!string.IsNullOrEmpty(empChannelStock)) {