出药时按先入先出规则

This commit is contained in:
maqiao 2025-06-10 16:14:33 +08:00
parent 6a9d8e0aeb
commit d009de4de7
6 changed files with 24 additions and 11 deletions

View File

@ -92,6 +92,12 @@ namespace DM_Weight.Models
[SugarColumn(ColumnName = "state")]
public int? State { get; set; }
/// <summary>
/// 入库时间:针对先入先出操作
/// </summary>
[SugarColumn(ColumnName = "fill_time")]
public DateTime? FillTime { get; set; }
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }

View File

@ -302,13 +302,14 @@ namespace DM_Weight.ViewModels
DrawerNo = it.DrawerNo,
ColNo = it.ColNo,
DrawerType = it.DrawerType,
BoardType = it.BoardType
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand();
BoardType = it.BoardType,
FillTime=it.Quantity<=0||it.FillTime==null ? DateTime.Now : it.FillTime,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId,it.FillTime }).ExecuteCommand();
}
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)
{
//repeatList.Add(it.ManuNo);
@ -329,7 +330,8 @@ namespace DM_Weight.ViewModels
DrawerType = it.DrawerType,
BoardType = it.BoardType,
Id = Guid.NewGuid().ToString(),
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
FillTime = DateTime.Now
}).ExecuteCommand();
}
// 获取更新完库存后的药品库存

View File

@ -420,7 +420,7 @@ namespace DM_Weight.ViewModels
.Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
.Where(cs => cs.DrawerType == 1)
.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();
if (count > 0)

View File

@ -317,7 +317,8 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
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
{
@ -347,6 +348,7 @@ namespace DM_Weight.ViewModels
ManuNo = recordList[0].ManuNo,
EffDate = recordList[0].EffDate,
Id = recordList[0].Id,
FillTime=recordList[0].Quantity <= 0 || recordList[0].FillTime == null ? DateTime.Now : recordList[0].FillTime
}).Where(item => item.Id == item.Id).ExecuteCommand();
}
else
@ -364,7 +366,8 @@ namespace DM_Weight.ViewModels
DrawerType = it.DrawerType,
BoardType = it.BoardType,
Id = Guid.NewGuid().ToString(),
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
FillTime = DateTime.Now
}).ExecuteCommand();
}
}

View File

@ -216,8 +216,9 @@ namespace DM_Weight.ViewModels
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉双人登录开后14个抽屉
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
.OrderBy(cs => cs.EffDate)
.OrderBy(cs => cs.DrawerNo)
.OrderBy(cs => cs.ManuNo)
//.OrderBy(cs => cs.DrawerNo)
//.OrderBy(cs => cs.ManuNo)
.OrderBy(cs=>cs.FillTime)
.ToList();
int total = HasQChannels.Sum(it => it.Quantity);

View File

@ -220,8 +220,9 @@ namespace DM_Weight.ViewModels
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉双人登录开后14个抽屉
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
.OrderBy(cs => cs.EffDate)
.OrderBy(cs => cs.DrawerNo)
.OrderBy(cs => cs.ManuNo)
//.OrderBy(cs => cs.DrawerNo)
//.OrderBy(cs => cs.ManuNo)
.OrderBy(cs=>cs.FillTime)
.ToList();
int total = HasQChannels.Sum(it => it.Quantity);
int TakeQ = orderDetail.Quantity;