绑定药品时同一药品不允许绑定同一抽屉限制去掉

This commit is contained in:
maqiao 2025-06-10 15:46:15 +08:00
parent a105928315
commit 26d1f2730a
5 changed files with 14 additions and 10 deletions

View File

@ -148,6 +148,7 @@ namespace DM_Weight.ViewModels
if (Status == 2) if (Status == 2)
{ {
Status = 3; Status = 3;
FinishContent = "完成";
} }
break; break;
// 数量变化 // 数量变化
@ -302,13 +303,13 @@ namespace DM_Weight.ViewModels
ColNo = it.ColNo, ColNo = it.ColNo,
DrawerType = it.DrawerType, DrawerType = it.DrawerType,
BoardType = it.BoardType, BoardType = it.BoardType,
FillTime=it.Quantity<=0?DateTime.Now:it.FillTime FillTime=it.Quantity<=0 || it.FillTime == null ? DateTime.Now:it.FillTime
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand(); }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId,it.FillTime }).ExecuteCommand();
} }
else else
{ {
//如果批号重复则不让添加 //如果批号重复则不让添加
List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList(); List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo&&cs.ColNo==it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
if (csCount.Count > 0) if (csCount.Count > 0)
{ {
//repeatList.Add(it.ManuNo); //repeatList.Add(it.ManuNo);
@ -470,6 +471,7 @@ namespace DM_Weight.ViewModels
} }
else else
{ {
FinishContent = "完成";
_isFinishClick = false; _isFinishClick = false;
AlertMsg alertMsg = new AlertMsg AlertMsg alertMsg = new AlertMsg
{ {
@ -488,6 +490,7 @@ namespace DM_Weight.ViewModels
} }
catch (Exception ex) catch (Exception ex)
{ {
FinishContent = "完成";
logger.Info($"AddDrugControlViewModel异常{ex.Message}"); logger.Info($"AddDrugControlViewModel异常{ex.Message}");
_isFinishClick = false; _isFinishClick = false;
AlertMsg alertMsg = new AlertMsg AlertMsg alertMsg = new AlertMsg

View File

@ -420,7 +420,7 @@ namespace DM_Weight.ViewModels
.Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())) .Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
.Where(cs => cs.DrawerType == 1) .Where(cs => cs.DrawerType == 1)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Where(cs => cs.DrawerNo == item.DrawerNo) .Where(cs => cs.DrawerNo == item.DrawerNo&&cs.ColNo==item.ColNo)
.Count(); .Count();
if (count > 0) if (count > 0)

View File

@ -317,8 +317,8 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo, ManuNo = it.ManuNo,
EffDate = it.EffDate, EffDate = it.EffDate,
Id = it.Id, Id = it.Id,
FillTime=it.Quantity<=0?DateTime.Now:it.FillTime FillTime=it.Quantity<=0 || it.FillTime == null ? DateTime.Now:it.FillTime
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.FillTime }).ExecuteCommand();
} }
else else
{ {
@ -348,7 +348,7 @@ namespace DM_Weight.ViewModels
ManuNo = recordList[0].ManuNo, ManuNo = recordList[0].ManuNo,
EffDate = recordList[0].EffDate, EffDate = recordList[0].EffDate,
Id = recordList[0].Id, Id = recordList[0].Id,
FillTime = recordList[0].Quantity<=0?DateTime.Now: recordList[0].FillTime FillTime = recordList[0].Quantity<=0 || recordList[0].FillTime == null ? DateTime.Now: recordList[0].FillTime
}).Where(item => item.Id == item.Id).ExecuteCommand(); }).Where(item => item.Id == item.Id).ExecuteCommand();
} }
else else

View File

@ -540,7 +540,8 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo, ManuNo = it.ManuNo,
EffDate = it.EffDate, EffDate = it.EffDate,
Id = it.Id, Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); FillTime=it.Quantity<=0||it.FillTime==null?DateTime.Now:it.FillTime
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.FillTime }).ExecuteCommand();
} }
else else
{ {

View File

@ -284,9 +284,9 @@ namespace DM_Weight.ViewModels
SqlSugarHelper.Db.Updateable(new ChannelStock() SqlSugarHelper.Db.Updateable(new ChannelStock()
{ {
Quantity = ChannelStock.Quantity + ReturnQuantity, Quantity = ChannelStock.Quantity + ReturnQuantity,
FillTime= ChannelStock.Quantity<=0 ? DateTime.Now : ChannelStock.FillTime, FillTime= ChannelStock.Quantity<=0 || ChannelStock.FillTime == null ? DateTime.Now : ChannelStock.FillTime,
Id = ChannelStock.Id, Id = ChannelStock.Id,
}).UpdateColumns(it => new { it.Quantity }).ExecuteCommand(); }).UpdateColumns(it => new { it.Quantity,it.FillTime }).ExecuteCommand();
// 获取更新完库存后的药品库存 // 获取更新完库存后的药品库存
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>() List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()