From 02c626d829d63ecae6430a0610aa7b16577a03a0 Mon Sep 17 00:00:00 2001
From: maqiao <625215135@qq.com>
Date: Thu, 19 Jun 2025 14:25:21 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=80=E6=9C=89=E5=87=BA=E3=80=81=E5=85=A5?=
=?UTF-8?q?=E5=BA=93=E9=A1=B5=E9=9D=A2=E5=9D=87=E4=BF=9D=E5=AD=98=E8=B4=A6?=
=?UTF-8?q?=E5=86=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
DM_Weight/App.config | 2 +-
.../ViewModels/AddToJiaoJieDialogViewModel.cs | 4 ++--
.../ViewModels/AddToJiaoJieWindowViewModel.cs | 16 +++++++++++++---
.../ViewModels/DrawerAddDrugWindowViewModel.cs | 9 +++++----
.../ViewModels/DrawerTakeDrugWindowViewModel.cs | 8 +++++---
.../ViewModels/InvoiceTakeDialogViewModel.cs | 6 ++++--
.../ViewModels/OrderReturnDialogViewModel.cs | 7 +++++--
DM_Weight/ViewModels/OrderTakeDialogViewModel.cs | 7 +++++--
.../ViewModels/ReturnDrugDialogViewModel.cs | 7 +++++--
DM_Weight/ViewModels/SelfAddDialogViewModel.cs | 6 ++++--
DM_Weight/ViewModels/SelfTakeDialogViewModel.cs | 9 ++++++---
11 files changed, 55 insertions(+), 26 deletions(-)
diff --git a/DM_Weight/App.config b/DM_Weight/App.config
index 094073c..9002993 100644
--- a/DM_Weight/App.config
+++ b/DM_Weight/App.config
@@ -37,7 +37,7 @@
-
+
diff --git a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
index 1374bcc..14d8cc1 100644
--- a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
+++ b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
@@ -459,7 +459,7 @@ namespace DM_Weight.ViewModels
//不够取
ChannelStock newStock = new ChannelStock();
//newStock.Chnguid = jiaoStock.Chnguid;
- //newStock.BaseQuantity = jiaoStock.BaseQuantity;
+ newStock.BaseQuantity = jiaoStock.BaseQuantity;
newStock.ManuNo = Jiaojie_ChannelStocks[i].ManuNo;
newStock.EffDate = Jiaojie_ChannelStocks[i].EffDate;
newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo;
@@ -485,7 +485,7 @@ namespace DM_Weight.ViewModels
ChannelStock newStock = new ChannelStock();
//newStock.Chnguid = jiaoStock.Chnguid;
- //newStock.BaseQuantity = jiaoStock.BaseQuantity;
+ newStock.BaseQuantity = jiaoStock.BaseQuantity;
newStock.ManuNo = Jiaojie_ChannelStocks[i].ManuNo;
newStock.EffDate = Jiaojie_ChannelStocks[i].EffDate;
newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo;
diff --git a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs
index aeeb3ab..f34baa7 100644
--- a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs
+++ b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs
@@ -125,7 +125,7 @@ namespace DM_Weight.ViewModels
ChannelStocks = SqlSugarHelper.Db.Queryable()
.Includes(cs => cs.ChannelLst)
.Includes(cs => cs.DrugInfo)
- .Where(cs => cs.MachineId == (ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5") && cs.NeedNum > 0)
+ .Where(cs => cs.MachineId == (ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5") && (cs.NeedNum > 0 || cs.AddToJJNum > 0))
.OrderBy(cs => cs.Chnguid)
.OrderBy(cs => cs.DrawerNo)
.ToList();
@@ -159,6 +159,8 @@ namespace DM_Weight.ViewModels
channelList.channelStocks.AddRange(ChannelStocks.Where(cs => cs.DrawerNo == DrawerNoList[i]&&(cs.NeedNum>0||cs.AddToJJNum>0)).ToList());
if (channelList != null)
{
+ if (channelList.channelStocks[0].AddToJJNum>0)
+ channelList.State=1; //表示有补药
channelLists.Add(channelList);
}
}
@@ -534,7 +536,7 @@ namespace DM_Weight.ViewModels
{
AlertMsg alertMsg = new AlertMsg
{
- Message = $"未选择药品,请先勾选要药箱号",
+ Message = $"未选择药品,请先点选药箱号",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent().Publish(alertMsg);
@@ -606,7 +608,15 @@ namespace DM_Weight.ViewModels
DialogServiceExtensions.ShowDialogHost(_dialogService, "AddToJiaoJieDialog", dialogParameters, DoDialogResult, "RootDialog");
}
-
+ if(_ChannelList!=null&& _ChannelList.State == 1)
+ {
+ AlertMsg alertMsg = new AlertMsg
+ {
+ Message = $"药品已取出,待入库",
+ Type = MsgType.ERROR,
+ };
+ _eventAggregator.GetEvent().Publish(alertMsg);
+ }
}
}
}
diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
index 6d3ff96..a5ce4a4 100644
--- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
+++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
@@ -194,7 +194,7 @@ namespace DM_Weight.ViewModels
List record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList();
if (record.Count > 0)
{
- string InvoiceId = "DRAWER_" + CurrentTimeMillis();
+ string InvoiceId = "DRAWER_Add_" + CurrentTimeMillis();
var f = SqlSugarHelper.Db.UseTran(() =>
{
@@ -215,7 +215,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -253,8 +253,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
-
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable()
diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
index 3df7c31..ce4b35d 100644
--- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
+++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
@@ -194,7 +194,7 @@ namespace DM_Weight.ViewModels
logger.Info("点击完成按钮,库位数据:" + JsonConvert.SerializeObject(record));
if (record.Count > 0)
{
- string InvoiceId = "DRAWER_" + CurrentTimeMillis();
+ string InvoiceId = "DRAWER_Take_" + CurrentTimeMillis();
var f = SqlSugarHelper.Db.UseTran(() =>
{
@@ -213,7 +213,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -251,7 +251,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
index 8a3f019..2ce137c 100644
--- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
@@ -318,7 +318,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -357,7 +357,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
index be7be6c..353e3d7 100644
--- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
+++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
@@ -314,7 +314,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -352,7 +352,10 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
+
}).ExecuteCommand();
//修改凌晨生成的日结存数据
diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
index 482a5fe..33b5e9d 100644
--- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
@@ -337,7 +337,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -375,7 +375,10 @@ namespace DM_Weight.ViewModels
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
CreateTime = DateTime.Now,
- InvoiceNo = OrderInfo.OrderNo
+ InvoiceNo = OrderInfo.OrderNo,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
+
}).ExecuteCommand();
//修改凌晨生成的日结存与总结存数据
diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
index c6717bf..4d7cbf9 100644
--- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
+++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
@@ -240,7 +240,7 @@ namespace DM_Weight.ViewModels
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
+ .Where(cs => cs.MachineId.Equals(ChannelStock.MachineId)|| cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -284,7 +284,10 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity)
+
}).ExecuteCommand();
//修改凌晨生成的日结存数据
diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
index f0fa610..cb4a3af 100644
--- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
+++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
@@ -245,7 +245,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -283,7 +283,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
index eb9029a..cf16785 100644
--- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
@@ -221,7 +221,7 @@ namespace DM_Weight.ViewModels
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List nowChannels = SqlSugarHelper.Db.Queryable()
- .Where(cs => cs.MachineId.Equals(it.MachineId))
+ .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"]))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
@@ -260,7 +260,10 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
+
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -343,7 +346,7 @@ namespace DM_Weight.ViewModels
{
singleChannels.ForEach(it =>
{
- _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
+ _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
Thread.Sleep(150);
});
}