From a10592831593bd6bc1048952660968b116be9805 Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Tue, 10 Jun 2025 14:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E8=8D=AF=E6=97=B6=E6=8C=89=E5=85=88?= =?UTF-8?q?=E5=85=A5=E5=85=88=E5=87=BA=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/Models/ChannelStock.cs | 6 ++++++ DM_Weight/ViewModels/AddDrugControlViewModel.cs | 6 ++++-- DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs | 5 ++++- DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs | 3 ++- DM_Weight/ViewModels/OrderTakeDialogViewModel.cs | 5 +++-- DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs | 1 + 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/DM_Weight/Models/ChannelStock.cs b/DM_Weight/Models/ChannelStock.cs index 80c14c5..059d0ce 100644 --- a/DM_Weight/Models/ChannelStock.cs +++ b/DM_Weight/Models/ChannelStock.cs @@ -91,6 +91,12 @@ namespace DM_Weight.Models /// [SugarColumn(ColumnName = "state")] public int? State { get; set; } + /// + /// + /// 入库时间:用于先入先出 + /// + [SugarColumn(ColumnName = "fill_time")] + public DateTime? FillTime { get; set; } [SugarColumn(IsIgnore = true)] public bool IsSelected { get; set; } diff --git a/DM_Weight/ViewModels/AddDrugControlViewModel.cs b/DM_Weight/ViewModels/AddDrugControlViewModel.cs index 0232500..ef1ef03 100644 --- a/DM_Weight/ViewModels/AddDrugControlViewModel.cs +++ b/DM_Weight/ViewModels/AddDrugControlViewModel.cs @@ -301,7 +301,8 @@ namespace DM_Weight.ViewModels DrawerNo = it.DrawerNo, ColNo = it.ColNo, DrawerType = it.DrawerType, - BoardType = it.BoardType + BoardType = it.BoardType, + FillTime=it.Quantity<=0?DateTime.Now:it.FillTime }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId }).ExecuteCommand(); } else @@ -328,7 +329,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(); } // 获取更新完库存后的药品库存 diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs index e90c31d..eb2007b 100644 --- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs @@ -317,6 +317,7 @@ namespace DM_Weight.ViewModels ManuNo = it.ManuNo, EffDate = it.EffDate, Id = it.Id, + FillTime=it.Quantity<=0?DateTime.Now:it.FillTime }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).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?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(); } } diff --git a/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs index e2efcc3..40eaff1 100644 --- a/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/MultiOrderTakeDialogViewModel.cs @@ -198,7 +198,8 @@ namespace DM_Weight.ViewModels .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo)) .Where(cs => cs.DrugId == orderDetail.DrugId) .OrderBy(cs => cs.EffDate) - .OrderBy(cs => cs.DrawerNo) + //.OrderBy(cs => cs.DrawerNo) + .OrderBy(cs => cs.FillTime) .ToList(); int total = HasQChannels.Sum(it => it.Quantity); int TakeQ = orderDetail.Quantity; diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 5dce7a2..8de8bf7 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -219,8 +219,9 @@ namespace DM_Weight.ViewModels .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 8) //单人登录开前8个抽屉,双人登录开后8个抽屉 .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 8) .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; diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index dde2c90..847dcc9 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -284,6 +284,7 @@ namespace DM_Weight.ViewModels SqlSugarHelper.Db.Updateable(new ChannelStock() { Quantity = ChannelStock.Quantity + ReturnQuantity, + FillTime= ChannelStock.Quantity<=0 ? DateTime.Now : ChannelStock.FillTime, Id = ChannelStock.Id, }).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();