diff --git a/DM_Weight/App.config b/DM_Weight/App.config
index 1c3a5d3..96ae4f6 100644
--- a/DM_Weight/App.config
+++ b/DM_Weight/App.config
@@ -16,7 +16,7 @@
-
+
diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs
index c6ca5dc..13eb8c7 100644
--- a/DM_Weight/App.xaml.cs
+++ b/DM_Weight/App.xaml.cs
@@ -247,6 +247,9 @@ namespace DM_Weight
//交接班
containerRegistry.RegisterForNavigation();
+ //手术取药
+ containerRegistry.RegisterForNavigation();
+
}
}
}
diff --git a/DM_Weight/Models/ChannelList.cs b/DM_Weight/Models/ChannelList.cs
index 0312f18..3be9191 100644
--- a/DM_Weight/Models/ChannelList.cs
+++ b/DM_Weight/Models/ChannelList.cs
@@ -176,21 +176,5 @@ namespace DM_Weight.Models
[Navigate(NavigateType.OneToMany, nameof(ChannelStock.Chnguid))]
public List channelStocks { get => _channelStocks; set => SetProperty(ref _channelStocks, value); }
- private DelegateCommand _addManunoCommand;
- [SugarColumn(IsIgnore = true)]
- public DelegateCommand AddManunoCommand
- {
- get
- {
- if (_addManunoCommand == null)
- _addManunoCommand = new DelegateCommand(o => DoDelete(o));
- return _addManunoCommand;
- }
- }
-
- private void DoDelete(ChannelList parameter)
- {
-
- }
}
}
diff --git a/DM_Weight/Models/DrugInfo.cs b/DM_Weight/Models/DrugInfo.cs
index ac90234..c6221c4 100644
--- a/DM_Weight/Models/DrugInfo.cs
+++ b/DM_Weight/Models/DrugInfo.cs
@@ -85,5 +85,7 @@ namespace DM_Weight.Models
public string drug_name_spec { get; set; }
//[SugarColumn(ColumnName = "drug_name_spec")]
//public string Name { get; set; }
+ [Navigate(NavigateType.OneToMany, nameof(DrugManuNo.DrugId))]//BookA表中的studenId
+ public DrugManuNo? drugManuNo { get; set; }
}
}
diff --git a/DM_Weight/Models/OrderDetail.cs b/DM_Weight/Models/OrderDetail.cs
index 109654c..e7c471d 100644
--- a/DM_Weight/Models/OrderDetail.cs
+++ b/DM_Weight/Models/OrderDetail.cs
@@ -127,5 +127,14 @@ namespace DM_Weight.Models
///
[SugarColumn(ColumnName = "use_dosage")]
public string UseDosage { get; set; }
+
+ [Navigate(NavigateType.ManyToOne, nameof(DrugId))]
+ public List DrugInfos { get; set; }
+
+ [Navigate(NavigateType.OneToMany, nameof(DrugId))]
+ public DrugManuNo drugManuNo { get; set; }
+
+ [Navigate(NavigateType.ManyToMany, nameof(DrugId))]
+ public List DrugManuNos { get; set; }
}
}
\ No newline at end of file
diff --git a/DM_Weight/ViewModels/AddDrugControlViewModel.cs b/DM_Weight/ViewModels/AddDrugControlViewModel.cs
index 340f728..e21a472 100644
--- a/DM_Weight/ViewModels/AddDrugControlViewModel.cs
+++ b/DM_Weight/ViewModels/AddDrugControlViewModel.cs
@@ -340,9 +340,28 @@ namespace DM_Weight.ViewModels
msg = "抽屉加药完成,库存已更新";
}
// 更新屏显库存
- List singleChannels = record.FindAll(it => it.BoardType != 1);
+ //List singleChannels = record.FindAll(it => it.BoardType != 1);
+ List singleChannels = record.Where(it => it.BoardType != 1)
+ .GroupBy(it => it.ColNo)
+ .Select(it =>
+ {
+ var ret = it.First();
+ ret.Quantity = it.Sum(itx => itx.Quantity);
+ ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
+ return ret;
+ }).ToList();
+ //var s = singleChannels.GroupBy(x=>x.ColNo)
+ // .Select(x => {
+ // var ret = x.First();
+ // ret.Quantity = x.Sum(xt => xt.Quantity);
+ // ret.AddQuantity = x.Sum(xt => xt.AddQuantity);
+ // return ret;
+ // }).ToList();
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
{
+ //将库位多批次的总库存数更新标签
+ //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
+
singleChannels.ForEach(it =>
{
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
diff --git a/DM_Weight/ViewModels/BindingChannelNewDialogViewModel.cs b/DM_Weight/ViewModels/BindingChannelNewDialogViewModel.cs
index 2598ab1..fda7715 100644
--- a/DM_Weight/ViewModels/BindingChannelNewDialogViewModel.cs
+++ b/DM_Weight/ViewModels/BindingChannelNewDialogViewModel.cs
@@ -346,14 +346,14 @@ namespace DM_Weight.ViewModels
_portUtil.WindowName = "BindingChannelDialog";
// 向显示屏写入库位信息
_portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
- //await Task.Delay(200);
- Thread.Sleep(200);
+ await Task.Delay(200);
+ //Thread.Sleep(200);
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
- //await Task.Delay(200);
- Thread.Sleep(200);
+ await Task.Delay(200);
+ //Thread.Sleep(200);
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
- //await Task.Delay(200);
- Thread.Sleep(200);
+ await Task.Delay(200);
+ //Thread.Sleep(200);
//_portUtil.WriteChannelInfo(6, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
//await Task.Delay(200);
//Thread.Sleep(200);
diff --git a/DM_Weight/ViewModels/LoginWindowViewModel.cs b/DM_Weight/ViewModels/LoginWindowViewModel.cs
index 7c40d56..3a791ec 100644
--- a/DM_Weight/ViewModels/LoginWindowViewModel.cs
+++ b/DM_Weight/ViewModels/LoginWindowViewModel.cs
@@ -310,7 +310,7 @@ _exitCommand ??= new DelegateCommand(Exit);
void LoginEvent(FingerprintMsg msg)
{
- logger.Info(msg.ToString());
+ logger.Info(msg.ToString()+ ";LoginBtnEnable:"+ LoginBtnEnable);
if (msg.Message.Equals("CONNECT"))
{
FingerMsg = !msg.Result;
diff --git a/DM_Weight/ViewModels/MainWindowViewModel.cs b/DM_Weight/ViewModels/MainWindowViewModel.cs
index a706190..dc01829 100644
--- a/DM_Weight/ViewModels/MainWindowViewModel.cs
+++ b/DM_Weight/ViewModels/MainWindowViewModel.cs
@@ -108,7 +108,14 @@ namespace DM_Weight.ViewModels
async Task BindStock()
{
List singleChannels = SqlSugarHelper.Db.Queryable().Where(cs => cs.BoardType == 5).Where(cs => cs.DrugId !=null).ToList();
-
+ singleChannels= singleChannels.GroupBy(cs =>new { cs.DrawerNo,cs.ColNo })
+ .Select(cs => {
+ var ret = cs.First();
+ ret.Quantity = cs.Sum(xt => xt.Quantity);
+ return ret;
+ }).ToList();
+
+
for (int i = 0; i < singleChannels.Count; i++)
{
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, singleChannels[i].Quantity);
diff --git a/DM_Weight/ViewModels/OperationTakeWindowViewModel.cs b/DM_Weight/ViewModels/OperationTakeWindowViewModel.cs
new file mode 100644
index 0000000..82b2be6
--- /dev/null
+++ b/DM_Weight/ViewModels/OperationTakeWindowViewModel.cs
@@ -0,0 +1,103 @@
+using DM_Weight.Models;
+using DM_Weight.util;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Weight.ViewModels
+{
+ public class OperationTakeWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
+ {
+ ///
+ /// 处方明细
+ ///
+ private ObservableCollection _orderDetails = new ObservableCollection();
+ public ObservableCollection OrderDetails
+ {
+ get { return _orderDetails; }
+ set { SetProperty(ref _orderDetails, value); }
+ }
+ ///
+ /// 药品集合
+ ///
+ private ObservableCollection _drugInfos=new ObservableCollection();
+ public ObservableCollection DrugInfos
+ {
+ get { return _drugInfos; }
+ set { SetProperty(ref _drugInfos, value); }
+ }
+ ///
+ /// 加药按钮操作
+ ///
+ public DelegateCommand AddBtnCommand => new DelegateCommand(AddBtnAction);
+
+ public bool KeepAlive => false;
+
+ private void AddBtnAction()
+ {
+ OrderDetail orderDetail = new OrderDetail();
+ orderDetail.PatientId = "123";
+ orderDetail.OrderNo = "123";
+ List dgs= DrugInfos.ToList();
+ orderDetail.DrugInfos = dgs;
+ orderDetail.DrugInfo = dgs?[0];
+ OrderDetails.Add(orderDetail);
+
+ }
+ public void RequestData()
+ {
+ //List queryData = SqlSugarHelper.Db.Queryable()
+ // .Includes(cl => cl.DrugInfo, di => di.DrugManuNos)
+ // .Where(cl => cl.DrawerNo == DrawerNo)
+ // .Where(cl => cl.DrawerType == 1)
+ // .Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
+ // .Where(cl => cl.DrugId != null)
+ // .OrderBy(cl => cl.ColNo)
+ // .ToList();
+ //ChannelLsts = queryData.Select(cl =>
+ //{
+ // cl.channelStocks = cl.channelStocks.Select(cs =>
+ // {
+ // cs.drugManuNo = cl.Drug.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
+ // return cs;
+ // }).ToList();
+ // return cl;
+ //}).ToList();
+ ////ChannelLsts = new ObservableCollection(queryData);
+ //ChannelLsts.ForEach(cl => cl.channelStocks.ForEach(cs => cs.DrugInfo = cl.Drug));
+
+ DrugInfos=new ObservableCollection(SqlSugarHelper.Db.Queryable()
+ .Includes(di=>di.DrugManuNos)
+ .OrderBy(cl=>cl.DrugId).ToList());
+
+
+
+ }
+
+ public void ConfirmNavigationRequest(NavigationContext navigationContext, Action continuationCallback)
+ {
+ continuationCallback(true);
+ }
+
+ public void OnNavigatedTo(NavigationContext navigationContext)
+ {
+ RequestData();
+ }
+
+ public bool IsNavigationTarget(NavigationContext navigationContext)
+ {
+ return true;
+ }
+
+ public void OnNavigatedFrom(NavigationContext navigationContext)
+ {
+
+ }
+ }
+}
diff --git a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs
index d0753e5..073db02 100644
--- a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs
+++ b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs
@@ -149,11 +149,18 @@ namespace DM_Weight.ViewModels
PremissionName = "取药记录",
PremissionPath = "TakeRecordWindow",
};
+ PremissionDm quyao6 = new PremissionDm
+ {
+ Id = 16,
+ PremissionName = "手术取药",
+ PremissionPath = "OperationTakeWindow",
+ };
quyaoChild.Add(quyao1);
quyaoChild.Add(quyao2);
quyaoChild.Add(quyao3);
quyaoChild.Add(quyao4);
quyaoChild.Add(quyao5);
+ quyaoChild.Add(quyao6);
quyao.Children = quyaoChild;
defaultAll.Add(quyao);
#endregion
diff --git a/DM_Weight/Views/Dialog/BindingChannelDialog.xaml b/DM_Weight/Views/Dialog/BindingChannelDialog.xaml
index ceaf642..1bacbc3 100644
--- a/DM_Weight/Views/Dialog/BindingChannelDialog.xaml
+++ b/DM_Weight/Views/Dialog/BindingChannelDialog.xaml
@@ -62,7 +62,7 @@
IsEditable="True"
ItemsSource="{Binding DrugInfos}"
SelectedItem="{Binding DrugInfo}"
- DisplayMemberPath="DrugName"
+ DisplayMemberPath="DrugName" IsTextSearchEnabled="False"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DM_Weight/Views/OperationTakeWindow.xaml.cs b/DM_Weight/Views/OperationTakeWindow.xaml.cs
new file mode 100644
index 0000000..39c9708
--- /dev/null
+++ b/DM_Weight/Views/OperationTakeWindow.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace DM_Weight.Views
+{
+ ///
+ /// OperationTakeWindow.xaml 的交互逻辑
+ ///
+ public partial class OperationTakeWindow : UserControl
+ {
+ public OperationTakeWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}