diff --git a/DM_Weight/App.config b/DM_Weight/App.config
index 756f704..094073c 100644
--- a/DM_Weight/App.config
+++ b/DM_Weight/App.config
@@ -3,7 +3,7 @@
-
+
-
+
diff --git a/DM_Weight/Port/PortUtil.cs b/DM_Weight/Port/PortUtil.cs
index 1d82d86..4a87ef2 100644
--- a/DM_Weight/Port/PortUtil.cs
+++ b/DM_Weight/Port/PortUtil.cs
@@ -1363,7 +1363,8 @@ namespace DM_Weight.Port
}
logger.Info($"开始写标签指令:{Convert.ToHexString(buffer)}");
canBusSerial.Write(buffer, 0, 8);
- logger.Info($"写标签指令:{Convert.ToHexString(buffer)}");
+ byte[] retBuffer= await GetBufferByPort(canBusSerial, 8);
+ logger.Info($"收到写标签回复:{Convert.ToHexString(retBuffer)}");
}
catch (Exception ex)
{
diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs
index 3d7416d..96fdc59 100644
--- a/DM_Weight/Report/GridReportUtil.cs
+++ b/DM_Weight/Report/GridReportUtil.cs
@@ -370,7 +370,7 @@ namespace DM_Weight.Report
/// 使用登记册
/// 能按麻醉师名字、时间结合起来查找
///
- public static void UserAccount(DateTime? startDate, DateTime? endDate, string Name)
+ public static void UserAccount(DateTime? startDate, DateTime? endDate, string Name, string box)
{
// 定义Grid++Report报表主对象
@@ -385,7 +385,7 @@ namespace DM_Weight.Report
SELECT re.create_time as OptDate, di.drug_name as DrugName,di.Drug_spec as DrugSpec,dt.Set_manu_no as ManuNo,re.patient_name as PName,
CONCAT(use_dose,dose_unit) as UDose,CONCAT(residual_dose,dose_unit) as ReDose,if(residual_dose>0,'是','否') as Disposal,
re.anaesthetist_name as AName,re.operator_name as OName,re.supervisor_name as CName,of.operator as EmpRecive,'彭蕾' as EmpMedicRecive,re.disposal_time as DisposalTime,of.win_no as WinNo
- from surgical_residual re inner join drug_info di on re.drug_id=di.drug_id left join hkc_order_finish of on re.order_no=of.order_no left join order_detail_sm dt on re.order_no=dt.order_no
+ from surgical_residual re inner join drug_info di on re.drug_id=di.drug_id left join hkc_order_finish of on re.order_no=of.order_no and of.state=2 left join order_detail_sm dt on re.order_no=dt.order_no
where re.create_time > '{startDate}' and re.create_time< '{endDate}'";
@@ -394,6 +394,10 @@ namespace DM_Weight.Report
{
SQL += " AND re.anaesthetist_name='" + Name + "' ";
}
+ if (!string.IsNullOrEmpty(box))
+ {
+ SQL += " AND of.win_no='" + box + "' ";
+ }
SQL += " ORDER BY re.create_time";
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
diff --git a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
index 74934f4..1374bcc 100644
--- a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
+++ b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs
@@ -316,7 +316,7 @@ namespace DM_Weight.ViewModels
}
}
- enumerable = ChannelStocks.Where(cs=>cs.TakeQuantity>0).GroupBy(cs => cs.DrawerNo, cs => cs);
+ enumerable = ChannelStocks.Where(cs => cs.TakeQuantity > 0).GroupBy(cs => cs.DrawerNo, cs => cs);
enumerator = enumerable.GetEnumerator();
enumerator.MoveNext();
Status = 1;
@@ -367,7 +367,7 @@ namespace DM_Weight.ViewModels
// 完成按钮
public DelegateCommand TakeFinish
{
- get => new DelegateCommand(() =>
+ get => new DelegateCommand(async () =>
{
if (!_isFinishClick)
{
@@ -398,8 +398,8 @@ namespace DM_Weight.ViewModels
}
}
}
-
-
+
+
string InvoiceId = "AddJiaoJie_" + CurrentTimeMillis();
var f = SqlSugarHelper.Db.UseTran(() =>
@@ -487,7 +487,7 @@ namespace DM_Weight.ViewModels
//newStock.Chnguid = jiaoStock.Chnguid;
//newStock.BaseQuantity = jiaoStock.BaseQuantity;
newStock.ManuNo = Jiaojie_ChannelStocks[i].ManuNo;
- newStock.EffDate=Jiaojie_ChannelStocks[i].EffDate;
+ newStock.EffDate = Jiaojie_ChannelStocks[i].EffDate;
newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo;
newStock.DrugId = Jiaojie_ChannelStocks[i].DrugId;
newStock.AddToJJNum = Jiaojie_ChannelStocks[i].NeedNum;
@@ -533,7 +533,7 @@ namespace DM_Weight.ViewModels
newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo;
newStock.DrugId = Jiaojie_ChannelStocks[i].DrugId;
newStock.ManuNo = csStock.ManuNo;
- newStock.EffDate=csStock.EffDate;
+ newStock.EffDate = csStock.EffDate;
newStock.AddToJJNum = Jiaojie_ChannelStocks[i].NeedNum;
newStock.NeedNum = 0;
newStock.Id = Guid.NewGuid().ToString();
@@ -627,25 +627,25 @@ namespace DM_Weight.ViewModels
{
//Task.Factory.StartNew(() =>
//{
- // 更新屏显库存
- //List singleChannels = record.FindAll(it => it.BoardType == 5);
- //if (singleChannels.Count > 0)
- //{
- // singleChannels.ForEach(it =>
- // {
- // _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
- // Thread.Sleep(150);
- // });
- //}
- List singleChannelsBoxSmart = record.FindAll(it => it.BoardType == 35);
- if ((singleChannelsBoxSmart.Count > 0 ? singleChannelsBoxSmart[0].BoardType : 1) == 35)
+ // 更新屏显库存
+ //List singleChannels = record.FindAll(it => it.BoardType == 5);
+ //if (singleChannels.Count > 0)
+ //{
+ // singleChannels.ForEach(it =>
+ // {
+ // _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
+ // Thread.Sleep(150);
+ // });
+ //}
+ List singleChannelsBoxSmart = record.FindAll(it => it.BoardType == 35);
+ if ((singleChannelsBoxSmart.Count > 0 ? singleChannelsBoxSmart[0].BoardType : 1) == 35)
+ {
+ for (int i = 0; i < singleChannelsBoxSmart.Count; i++)
{
- singleChannelsBoxSmart.ForEach(async it =>
- {
- await _portUtil.WriteQuantityMethod((it.Quantity - it.CheckQuantity), it.DrawerNo, it.ColNo);
- await Task.Delay(20);
- });
+ ChannelStock it = singleChannelsBoxSmart[i];
+ await _portUtil.WriteQuantityMethod((it.Quantity - it.CheckQuantity), it.DrawerNo, it.ColNo);
}
+ }
//});
AlertMsg alertMsg = new AlertMsg
{
diff --git a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs
index 7eb9049..f68a8c6 100644
--- a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs
+++ b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs
@@ -267,6 +267,7 @@ namespace DM_Weight.ViewModels
Task.Delay(200);
_portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
Task.Delay(200);
+ Task.Delay(200);
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
Task.Delay(200);
}
diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs
index 1f8d920..5b9cb61 100644
--- a/DM_Weight/ViewModels/HomeWindowViewModel.cs
+++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs
@@ -564,6 +564,10 @@ namespace DM_Weight.ViewModels
stop();
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
+ if (DialogHost.IsDialogOpen("RootDialog"))
+ {
+ DialogHost.Close("RootDialog");
+ }
_regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
}));
diff --git a/DM_Weight/ViewModels/InvoiceInWindowViewModel.cs b/DM_Weight/ViewModels/InvoiceInWindowViewModel.cs
index fa29142..7c53cd1 100644
--- a/DM_Weight/ViewModels/InvoiceInWindowViewModel.cs
+++ b/DM_Weight/ViewModels/InvoiceInWindowViewModel.cs
@@ -8,6 +8,7 @@ using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Services.Dialogs;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -198,10 +199,32 @@ namespace DM_Weight.ViewModels
if (SelectedInvoice != null)
{
var invoices = SqlSugarHelper.Db.Queryable()
- .Includes(i => i.DrugInfo)
- .LeftJoin(SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
- .Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo&&i.Status==1&&i.Type==2&&i.CancelFlag==0)
- .ToList();
+ .LeftJoin(
+ SqlSugarHelper.Db.Queryable()
+ .Where(cs => cs.DrawerType == 1)
+ .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
+ .GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId
+ )
+ .Includes(i => i.DrugInfo)
+ .Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo && i.Status == 1 && i.Type == 2 && i.CancelFlag == 0)
+ .MergeTable().GroupBy(i => new { i.DrugId, i.DrugManuNo })
+ .Select(i => new InOutInvoice
+ {
+ DrugId = i.DrugId,
+ DrugEffDate = i.DrugEffDate,
+ DrugManuNo = i.DrugManuNo,
+ quantity = SqlFunc.AggregateSum(i.quantity),
+ DrugInfo=i.DrugInfo
+ })
+ .ToList();
+ //.Select((i, t) => new InOutInvoice
+ // {
+ // DrugId = i.DrugId,
+ // DrugEffDate = i.DrugEffDate,
+ // DrugManuNo = i.DrugManuNo,
+ // quantity = i.quantity,
+ // DrugInfo = i.DrugInfo
+ // }).ToList();
foreach (var invoice in invoices)
{
List q = SqlSugarHelper.Db.Queryable()
@@ -219,10 +242,10 @@ namespace DM_Weight.ViewModels
if (q.Count <= 0)
{
//strMsg += $"药品{invoice.DrugInfo.DrugName}未绑定;";
- ChannelStock cs= new ChannelStock();
+ ChannelStock cs = new ChannelStock();
cs.ColNo = -1;
cs.EffDate = invoice.DrugEffDate;
- cs.ManuNo=invoice.DrugManuNo;
+ cs.ManuNo = invoice.DrugManuNo;
cs.DrugInfo = invoice.DrugInfo;
cs.Quantity = 0;
q.Add(cs);
@@ -284,7 +307,7 @@ namespace DM_Weight.ViewModels
if (flag)
{
AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0 && it.Location != "未绑定");
- if (AddChannels == null|| AddChannels.Count<=0)
+ if (AddChannels == null || AddChannels.Count <= 0)
{
AlertMsg alertMsg = new AlertMsg
{
diff --git a/DM_Weight/ViewModels/UseAccountWindowViewModel.cs b/DM_Weight/ViewModels/UseAccountWindowViewModel.cs
index fb19bf2..23ae54a 100644
--- a/DM_Weight/ViewModels/UseAccountWindowViewModel.cs
+++ b/DM_Weight/ViewModels/UseAccountWindowViewModel.cs
@@ -74,6 +74,21 @@ namespace DM_Weight.ViewModels
set { SetProperty(ref _User, value); }
}
+ private static List boxDefine =
+ new List { "1号手术间", "2号手术间", "3号手术间", "4号手术间", "5号手术间", "6号手术间", "7号手术间", "8号手术间", "9号手术间", "10号手术间", "11号手术间", "12号手术间", "13号手术间", "14号手术间", "15号手术间", "16号手术间", "17号手术间", "18号手术间" };
+
+ private List _Boxs = boxDefine;
+ public List Boxs
+ {
+ get => _Boxs;
+ set { SetProperty(ref _Boxs, value); }
+ }
+ private string _Box;
+ public string Box
+ {
+ get => _Box;
+ set { SetProperty(ref _Box, value); }
+ }
private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public long CurrentTimeMillis()
{
@@ -95,7 +110,6 @@ namespace DM_Weight.ViewModels
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
-
///
/// 导出账册
///
@@ -103,7 +117,7 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(() =>
{
- GridReportUtil.UserAccount(StartDate, EndDate, User == null ? "" : User.Nickname);
+ GridReportUtil.UserAccount(StartDate, EndDate, User == null ? "" : User.Nickname, Box);
});
}
diff --git a/DM_Weight/Views/UseAccountWindow.xaml b/DM_Weight/Views/UseAccountWindow.xaml
index bd8d711..4676a92 100644
--- a/DM_Weight/Views/UseAccountWindow.xaml
+++ b/DM_Weight/Views/UseAccountWindow.xaml
@@ -55,7 +55,13 @@
ItemsSource="{Binding UserInfos}"
SelectedItem="{Binding User}"
DisplayMemberPath="Nickname" IsEditable="True" IsTextSearchEnabled="False"/>
-
+