diff --git a/DM_Dal/DM_Dal.csproj b/DM_Dal/DM_Dal.csproj
new file mode 100644
index 0000000..40b2367
--- /dev/null
+++ b/DM_Dal/DM_Dal.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ AnyCPU;x86
+
+
+
+
+
+
+
+
+ dll\SCHelper.dll
+
+
+ dll\SCHelper.Database.dll
+
+
+
+
diff --git a/DM_Dal/Models/AccountModel.cs b/DM_Dal/Models/AccountModel.cs
new file mode 100644
index 0000000..ff50c6f
--- /dev/null
+++ b/DM_Dal/Models/AccountModel.cs
@@ -0,0 +1,87 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ ///
+ /// 账册
+ ///
+ public class AccountModel
+ {
+ ///
+ /// 总结存
+ ///
+ public int StockQuantity { get; set; }
+ ///
+ /// 借入数量
+ ///
+ public int InQuantity { get; set; }
+ ///
+ /// 发出数量
+ ///
+ public int OutQuantity { get; set; }
+ ///
+ /// 日期
+ ///
+ public string OperationTime { get; set; }
+ ///
+ /// 凭证号
+ ///
+ public string InvoiceId { get;set; }
+ ///
+ /// 药品名称
+ ///
+ public string DrugName { get; set; }
+ ///
+ /// 药品ID
+ ///
+ public string DrugId { get; set; }
+ ///
+ /// 单位
+ ///
+ public string PackUnit { get; set; }
+ ///
+ /// 剂型
+ ///
+ public string Dosage { get; set; }
+ ///
+ /// 厂家
+ ///
+ public string Manufactory { get; set; }
+ ///
+ /// 批次
+ ///
+ public string ManuNo { get;set; }
+ ///
+ /// 效期
+ ///
+ public string EffDate { get; set; }
+ ///
+ /// 操作人
+ ///
+ public string OperatorName { get;set; }
+ ///
+ /// 复核人
+ ///
+ public string ReviewerName { get; set; }
+ ///
+ /// 规格
+ ///
+ public string DrugSpec { get; set; }
+
+ public DrugInfo DrugInfo { get; set; }
+
+ ///
+ /// 供应单位
+ ///
+ public string SupplierDept { get; set; }
+ ///
+ /// 领用部门
+ ///
+ public string ReceiveDept { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/AccountType.cs b/DM_Dal/Models/AccountType.cs
new file mode 100644
index 0000000..3ccb860
--- /dev/null
+++ b/DM_Dal/Models/AccountType.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ ///
+ /// 账册类型
+ ///
+ public class AccountType
+ {
+ ///
+ /// 账册类型名称
+ ///
+ public string AccountTypeName { get; set; }
+ ///
+ /// 账册类型值
+ ///
+ public int AccountTypeValue { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/ChannelList.cs b/DM_Dal/Models/ChannelList.cs
new file mode 100644
index 0000000..ff4e5f4
--- /dev/null
+++ b/DM_Dal/Models/ChannelList.cs
@@ -0,0 +1,176 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ //[SugarTable("channel_list")]
+ public class ChannelList
+ {
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName = "chnguid", IsPrimaryKey = true)]
+ //[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
+ public string Id { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ /////
+ //[SugarColumn(ColumnName = "machine_id")]
+ public string MachineId { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "row_no")]
+ public int DrawerNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int ColNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int PosNo { get; set; }
+
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string DrugId { get; set; }
+
+ /////
+ /////
+ ///// 默认值: NULL
+ /////
+ //[SugarColumn(ColumnName = "manu_no")]
+ //public string ManuNo { get; set; }
+ /////
+ /////
+ ///// 默认值: NULL
+ /////
+ //[SugarColumn(ColumnName = "eff_date")]
+ //public string EffDate { get; set; }
+ /////
+ /////
+ ///// 默认值: NULL
+ /////
+ //[SugarColumn(ColumnName = "quantity")]
+ //public int Quantity { get; set; }
+
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int DrawerType { get; set; }
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int BoardType { get; set; }
+ ///
+ ///
+ /// 默认值: 1
+ ///
+
+ public int? State { get; set; }
+
+
+ public bool IsSelected { get; set; }
+
+ public InOutInvoice Invoice { get; set; }
+
+
+ public string Location
+ {
+ get => DrawerNo + "-" + ColNo;
+ }
+ //private int _addQuantity = 0;
+ //[SugarColumn(IsIgnore = true)]
+ //public int AddQuantity
+ //{
+ // get => _addQuantity;
+ // set
+ // {
+ // SetProperty(ref _addQuantity, value);
+ // }
+ //}
+
+ //private int _takeQuantity = 0;
+
+ //[SugarColumn(IsIgnore = true)]
+ //public int TakeQuantity
+ //{
+ // get => _takeQuantity;
+ // set
+ // {
+ // if (value > Quantity)
+ // {
+ // throw new ArgumentException("取药数量不能大于库存");
+ // }
+ // SetProperty(ref _takeQuantity, value);
+ // }
+ //}
+ //private int _returnQuantity = 0;
+
+ //[SugarColumn(IsIgnore = true)]
+ //public int ReturnQuantity
+ //{
+ // get => _returnQuantity;
+ // set
+ // {
+ // SetProperty(ref _returnQuantity, value);
+ // }
+ //}
+
+ //private int _checkQuantity = 0;
+
+
+ //[SugarColumn(IsIgnore = true)]
+ //public int CheckQuantity
+ //{
+ // get => _checkQuantity;
+ // set
+ // {
+ // if (value < 0)
+ // {
+ // throw new ArgumentException("盘点数量不能是负数");
+ // }
+ // SetProperty(ref _checkQuantity, value);
+ // }
+ //}
+
+
+ //[SugarColumn(IsIgnore = true)]
+ //public int? CanReturnQuantity { get; set; }
+
+ //private DrugInfo? _DrugInfo;
+ //[Navigate(NavigateType.ManyToOne, nameof(DrugId))]
+ //public DrugInfo Drug { get => _DrugInfo; set => SetProperty(ref _DrugInfo, value); }
+
+ ////[SugarColumn(IsIgnore = true)]
+ ////public int process { get; set; } = 0;
+
+
+ //private DrugManuNo? _drugManuNo;
+ //[SugarColumn(IsIgnore = true)]
+ //public DrugManuNo? drugManuNo { get => _drugManuNo; set => SetProperty(ref _drugManuNo, value); }
+
+ //private List? _channelStocks;
+ //[Navigate(NavigateType.OneToMany, nameof(ChannelStock.Chnguid))]
+ //public List channelStocks { get => _channelStocks; set => SetProperty(ref _channelStocks, value); }
+
+ //public int _totalCount;
+ //[SugarColumn(IsIgnore = true)]
+ //public int totalCount { get => _totalCount;set=> SetProperty(ref _totalCount, value); }
+
+ }
+}
diff --git a/DM_Dal/Models/ChannelStock.cs b/DM_Dal/Models/ChannelStock.cs
new file mode 100644
index 0000000..aac9065
--- /dev/null
+++ b/DM_Dal/Models/ChannelStock.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ [Serializable]
+ public class ChannelStock
+ {
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
+ public string Id { get; set; }
+
+ public string Chnguid { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string MachineId { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int DrawerNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int ColNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int PosNo { get; set; }
+
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string DrugId { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string ManuNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string EffDate { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public int Quantity { get; set; }
+
+
+
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int DrawerType { get; set; }
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int BoardType { get; set; }
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int? State { get; set; }
+
+ public bool IsSelected { get; set; }
+
+ public InOutInvoice Invoice { get; set; }
+
+ public string Location
+ {
+ get => DrawerNo + "-" + ColNo;
+ }
+ private int _addQuantity = 0;
+ public int AddQuantity
+ {
+ get;
+ set;
+ }
+
+ private int _takeQuantity = 0;
+
+ public int TakeQuantity
+ {
+ get;
+ set;
+ }
+ //private string _tipMessage=string.Empty;
+ //[SugarColumn(IsIgnore = true)]
+ //public string TipMessage
+ //{
+ // get => _tipMessage;
+ // set
+ // {
+ // SetProperty(ref _tipMessage, value);
+ // }
+ //}
+ private int _returnQuantity = 0;
+
+ public int ReturnQuantity
+ {
+ get;
+ set;
+ }
+
+ private int _checkQuantity = 0;
+
+
+ public int CheckQuantity
+ {
+ get;
+ set;
+ }
+
+
+ public int? CanReturnQuantity { get; set; }
+
+ private DrugInfo? _DrugInfo;
+ public DrugInfo DrugInfo { get; set; }
+
+ public int process { get; set; } = 0;
+
+
+ private DrugManuNo? _drugManuNo;
+ public DrugManuNo? drugManuNo { get; set; }
+
+ //private string _manuNoEffDate;
+ //[SugarColumn(IsIgnore = true)]
+ //public string ManuNoEffDate { get => _manuNoEffDate; set => SetProperty(ref _manuNoEffDate, value); }
+
+
+ private ChannelList? _channelList;
+ public ChannelList ChannelLst { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DM_Dal/Models/ChannelStockCount.cs b/DM_Dal/Models/ChannelStockCount.cs
new file mode 100644
index 0000000..97e41ab
--- /dev/null
+++ b/DM_Dal/Models/ChannelStockCount.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Weight.Models
+{
+ public class ChannelStockCount
+ {
+ public int DrawerNo { get; set; }
+ public int ColNo { get; set; }
+ public string DrugId { get; set; }
+ public string ManuNo { get;set; }
+ public int Quantity { get;set; }
+ public string EffDate { get; set; }
+ public string DrugName { get; set; }
+ public string DrugSpec { get; set; }
+ public string Dosage { get;set; }
+ public string ManuFactory { get;set; }
+ public string SmallUnit { get;set; }
+ public string PackUnit { get; set; }
+ public string MachineId { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/CheckRecordStock.cs b/DM_Dal/Models/CheckRecordStock.cs
new file mode 100644
index 0000000..5817bd9
--- /dev/null
+++ b/DM_Dal/Models/CheckRecordStock.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ ///
+ /// 盘点后药品库存数
+ ///
+ public class CheckRecordStock
+ {
+ public int ID { get; set; }
+ ///
+ /// 抽屉号
+ ///
+ public int rowNo { get; set; }
+ ///
+ /// 列号
+ ///
+ public int colNo { get; set; }
+ ///
+ /// 数量
+ ///
+ public int quantity { get; set; }
+ ///
+ /// 批次
+ ///
+ public string manuNo { get; set; }
+ ///
+ /// 效期
+ ///
+ public string effDate { get; set; }
+ ///
+ /// 药品名称
+ ///
+ public string drugName { get; set; }
+ ///
+ /// 规格
+ ///
+ public string drugSpec { get; set; }
+ //
+ public string packUnit { get; set; }
+ ///
+ /// 厂商
+ ///
+ public string manufactory { get; set; }
+ public int maxStock { get; set; }
+ public string drugId { get; set; }
+ public string MachineId { get; set; }
+ ///
+ /// 批次总库存
+ ///
+ public int ManuQuantity { get; set; }
+ ///
+ /// 操作时间
+ ///
+ public string optdate { get; set; }
+ ///
+ /// 操作人
+ ///
+ public string operatorUser { get; set; }
+ ///
+ /// 审核人
+ ///
+ public string reviewerUser { get; set; }
+
+ public List manuNoDetails { get;set; }
+
+ public DrugInfo DrugInfo { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/Class1.cs b/DM_Dal/Models/Class1.cs
new file mode 100644
index 0000000..e03f93d
--- /dev/null
+++ b/DM_Dal/Models/Class1.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Weight.Models
+{
+ internal class Class1
+ {
+ }
+ /// /// 行政区表
+ /// ///
+ public class DistrictModel
+ { /// /// 主键 ///
+ private int id; /// /// 代码 ///
+ private int code; /// /// 名称 ///
+ private string name;
+ public int Id { get { return id; } set { id = value; } }
+ /// /// 代码 ///
+ public int Code { get { return code; } set { code = value; } }
+ /// /// 名称 ///
+ public string Name { get { return name; } set { name = value; } }
+ }
+ /// /// 表 ///
+ public class MapSpotModel
+ {
+ private int id; //名称
+
+ private string name; //代码
+ private int code; //个数
+ private int allNumber; //面积
+ private double allArea;
+
+
+ private int hCTureNumber;
+
+ private double hCTrueArea;
+
+ ///
+ /// 通过个数
+ ///
+ private int hCTruePassNumber; //不通过个数
+ private int hCTrueNoPassNumber; //通过率
+ private string hCTruePassingRate; //个数
+ private int jLTureNumber; //面积
+ private double jLTrueArea; //通过个数
+ private int jLTruePassNumber; //不通过个数
+ private int jLTrueNoPassNumber; //通过率
+ private string jLTruePassingRate;
+ private DistrictModel districtModels;
+ public int Id { get { return id; } set { id = value; } }
+ /// /// 名称 ///
+ public string Name { get { return name; } set { name = value; } } /// /// 代码 ///
+ public int Code { get { return code; } set { code = value; } } /// /// 个数 ///
+ public int AllNumber { get { return allNumber; } set { allNumber = value; } } /// /// 面积 ///
+ public double AllArea { get { return allArea; } set { allArea = value; } } /// /// 个数 ///
+ public int HCTureNumber { get { return hCTureNumber; } set { hCTureNumber = value; } } /// /// 面积 ///
+ public double HCTrueArea { get { return hCTrueArea; } set { hCTrueArea = value; } }
+ /// /// 通过个数 ///
+ public int HCTruePassNumber { get { return hCTruePassNumber; } set { hCTruePassNumber = value; } }
+ /// /// /// 不通过个数 ///
+ public int HCTrueNoPassNumber { get { return hCTrueNoPassNumber; } set { hCTrueNoPassNumber = value; } }
+ /// /// /// 通过率 ///
+ public string HCTruePassingRate { get { return hCTruePassingRate; } set { hCTruePassingRate = value; } } /// /// 个数 ///
+ public int JLTureNumber { get { return jLTureNumber; } set { jLTureNumber = value; } }
+ /// /// 面积 ///
+ public double JLTrueArea { get { return jLTrueArea; } set { jLTrueArea = value; } }
+ /// /// /// 通过个数 ///
+ public int JLTruePassNumber { get { return jLTruePassNumber; } set { jLTruePassNumber = value; } }
+ /// /// /// 不通过个数 ///
+ public int JLTrueNoPassNumber { get { return jLTrueNoPassNumber; } set { jLTrueNoPassNumber = value; } }
+ /// /// /// 监理单位已审核图斑-通过率 ///
+ public string JLTruePassingRate { get { return jLTruePassingRate; } set { jLTruePassingRate = value; } }
+ public DistrictModel DistrictModels { get { return districtModels; } set { districtModels = value; } }
+ }
+}
diff --git a/DM_Dal/Models/DrugInfo.cs b/DM_Dal/Models/DrugInfo.cs
new file mode 100644
index 0000000..8dee21b
--- /dev/null
+++ b/DM_Dal/Models/DrugInfo.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ public class DrugInfo
+ {
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName = "pharmacy")]
+ //public string Pharmacy { get; set; }
+ ///
+ /// ҩƷID
+ ///
+ public string DrugId { get; set; }
+ ///
+ /// ƴ
+ ///
+ public string PyCode { get; set; }
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName = "BD_code")]
+ //public string BdCode { get; set; }
+ ///
+ /// ҩƷ
+ ///
+ public string DrugBarcode { get; set; }
+
+ ///
+ /// ҩƷ����
+ ///
+ public string DrugName { get; set; }
+ ///
+ ///
+ ///
+ public string DrugBrandname { get; set; }
+ ///
+ /// ҩƷ���
+ ///
+ public string DrugSpec { get; set; }
+ ///
+ /// ����
+ ///
+ public string Dosage { get; set; }
+ ///
+ /// ��װ��λ
+ ///
+ public string PackUnit { get; set; }
+ ///
+ /// ��������
+ ///
+ public string Manufactory { get; set; }
+ ///
+ /// ���ҩ��
+ ///
+ public int? MaxStock { get; set; }
+ //[SugarColumn(IsIgnore=true)]
+ public List channelStocks { get; set; }
+
+
+ public List? DrugManuNos { get; set; }
+ public int? StockQuantity { get; set; }
+
+ public string drug_name_spec { get; set; }
+ //[SugarColumn(ColumnName = "drug_name_spec")]
+ //public string Name { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/DrugManuNo.cs b/DM_Dal/Models/DrugManuNo.cs
new file mode 100644
index 0000000..24f3aa0
--- /dev/null
+++ b/DM_Dal/Models/DrugManuNo.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ public class DrugManuNo
+ {
+ private string _id;
+ public string Id { get; set; }
+
+ private string _drugId;
+ public string DrugId { get; set; }
+
+ private string _manuNo;
+ public string ManuNo { get; set; }
+
+ private string _manuDate;
+ public string ManuDate { get; set; }
+
+
+ private string _effDate;
+ public string EffDate { get; set; }
+
+ //private string _manuNoEffDate;
+ //[SugarColumn(IsIgnore = true)]
+ //public string ManuNoEffDate { get => _manuNoEffDate; set => SetProperty(ref _manuNoEffDate, value); }
+ }
+}
diff --git a/DM_Dal/Models/HkcChangeShifts.cs b/DM_Dal/Models/HkcChangeShifts.cs
new file mode 100644
index 0000000..dc548e2
--- /dev/null
+++ b/DM_Dal/Models/HkcChangeShifts.cs
@@ -0,0 +1,32 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ //交接班表
+ public class HkcChangeShifts
+ {
+ public int Id { get; set; }
+
+ public DateTime? OptDate { get; set; }
+
+ public string FromOperator { get; set; }
+
+ public string FromRviewer { get; set; }
+ public string ToOperator { get;set; }
+
+ public string ToReviewer { get; set; }
+
+ public DateTime? ToDate { get; set; }
+
+ public string State { get; set; }
+
+ public string OptState { get; set; }
+
+ public string Machineid { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/InOutInvoice.cs b/DM_Dal/Models/InOutInvoice.cs
new file mode 100644
index 0000000..dbfab98
--- /dev/null
+++ b/DM_Dal/Models/InOutInvoice.cs
@@ -0,0 +1,125 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ public class InOutInvoice
+ {
+ ///
+ /// 主键(序号)
+ ///
+ public int Id { get; set; }
+
+ public string InPharmacyId { get; set; }
+
+ public string OutPharmacyId { get; set; }
+
+ ///
+ /// 库存管理单位(入库单位代码)
+ ///
+ public string storage { get; set; }
+
+ ///
+ /// 单据号
+ ///
+ public string InvoiceNo { get; set; }
+
+ public string InvoiceDate { get; set; }
+
+ ///
+ /// 药品id
+ ///
+ public string DrugId { get; set; }
+
+
+
+ public DrugInfo DrugInfo { get; set; }
+
+ ///
+ /// 药品规格
+ ///
+ public string DrugSpec { get; set; }
+
+ ///
+ /// 计算单位
+ ///
+ public string Units { get; set; }
+
+ ///
+ /// 厂商标识
+ ///
+ public string FirmId { get; set; }
+
+ ///
+ /// 包装规格(反映药品含量及包装信息,如0.25g*30)
+ ///
+ public string PackageSpec { get; set; }
+
+ ///
+ /// 数量(以包装单位所计的数量)
+ ///
+ public int quantity { get; set; }
+
+ ///
+ /// 计量单位,可使用任一级管理上方便的包装
+ ///
+ public string PackageUnits { get; set; }
+
+ ///
+ /// 药品批次
+ ///
+ public string DrugManuNo { get; set; }
+
+ ///
+ /// 创建时间(入库日期)
+ ///
+ public DateTime CreateTime { get; set; }
+
+ ///
+ /// 1.请领入库 0.其它
+ ///
+ public int Type { get; set; }
+
+ ///
+ /// 类型描述
+ ///
+ public string TypeDescribe { get; set; }
+
+ ///
+ /// 供货方
+ ///
+ public string Supplier { get; set; }
+
+ ///
+ /// 操作人
+ ///
+ public string Operator { get; set; }
+
+ ///
+ /// 存放库房
+ ///
+ public string SubStorage { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Memos { get; set; }
+
+ public int Status { get; set; }
+
+ public string DrugEffDate { get; set; }
+
+ public string HisId { get; set; }
+
+ public int CancelFlag { get; set; }
+
+ public int CountNum { get; set; }
+
+ public int SumQuantity { get; set; }
+
+ }
+}
diff --git a/DM_Dal/Models/Invoice.cs b/DM_Dal/Models/Invoice.cs
new file mode 100644
index 0000000..c944cb2
--- /dev/null
+++ b/DM_Dal/Models/Invoice.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ [Serializable]
+ public class Invoice
+ {
+ public string InvoiceNo { get; set; }
+ public string InvoiceDate { get; set; }
+ public int Count { get; set; }
+ public int Quantity { get; set; }
+ public int Status { get; set; }
+ public string PharmacyName1 { get; set; }
+ public string PharmacyName2 { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/MachineRecord.cs b/DM_Dal/Models/MachineRecord.cs
new file mode 100644
index 0000000..a7b071b
--- /dev/null
+++ b/DM_Dal/Models/MachineRecord.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Principal;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ public class MachineRecord
+ {
+ ///
+ /// 主键
+ ///
+ public int Id { get; set; }
+ ///
+ /// 设备id
+ ///
+ public string MachineId { get; set; }
+ ///
+ /// 药品id
+ ///
+ public string DrugId { get; set; }
+
+ public DrugInfo DrugInfo { get; set; }
+ ///
+ /// 数量
+ ///
+ public int Quantity { get; set; }
+
+
+ public int? StockQuantity { get; set; }
+
+ public int? CheckQuantity { get; set; }
+
+ ///
+ /// 批号
+ ///
+ public string ManuNo { get; set; }
+ ///
+ /// 操作人id
+ ///
+ public int? Operator { get; set; }
+
+ public UserList User { get; set; }
+ ///
+ /// 审核人id
+ ///
+ public int? Reviewer { get; set; }
+ ///
+ /// 操作时间
+ /// 默认值: CURRENT_TIMESTAMP
+ ///
+ public DateTime OperationTime { get; set; }
+ ///
+ /// 效期
+ ///
+ public DateTime? EffDate { get; set; }
+ ///
+ /// 出库入库类型(1入库2出库31还药32还空瓶4盘点5日结存)
+ ///
+ public int Type { get; set; }
+ ///
+ /// 出入库调拨单id
+ ///
+ public string InvoiceId { get; set; }
+ ///
+ /// 列号
+ ///
+ public int ColNo { get; set; }
+ ///
+ /// 抽屉号
+ ///
+ public int DrawerNo { get; set; }
+ ///
+ /// 取药科室
+ ///
+ public string DepartmentId { get; set; }
+ ///
+ /// 是否已经退药(0:没有1:还了部分2:完成)
+ /// 默认值: 0
+ ///
+ public int Status { get; set; }
+ ///
+ /// 退药量
+ /// 默认值: 0
+ ///
+ //[SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
+ public int ReturnQuantity1 { get; set; }
+ ///
+ /// 退空瓶量
+ /// 默认值: 0
+ ///
+ //[SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true
+ public int ReturnQuantity2 { get; set; }
+ ///
+ /// 取药记录id
+ ///
+ public int? GetId { get; set; }
+ ///
+ /// 是否已经销毁
+ /// 默认值: 0
+ ///
+ public int? IsDestroy { get; set; }
+
+
+
+ public int CanReturnQuantity
+ {
+ get => Quantity - ReturnQuantity1 - ReturnQuantity2;
+
+ }
+
+ public bool IsSelected { get; set; }
+
+ ///
+ /// 药品对应批号库存
+ ///
+ public int? ManunoQuantity { get; set; }
+ ///
+ /// 供应单位
+ ///
+ public string SupplierDept { get; set; }
+ ///
+ /// 领用部门
+ ///
+ public string ReceiveDept { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/OrderDetail.cs b/DM_Dal/Models/OrderDetail.cs
new file mode 100644
index 0000000..b274161
--- /dev/null
+++ b/DM_Dal/Models/OrderDetail.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ public class OrderDetail
+ {
+ ///
+ ///
+ ///
+ public int Id { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "order_id")]
+ //public int? OrderId { get; set; }
+ ///
+ ///
+ ///
+ public string PatientId { get; set; }
+ ///
+ ///
+ ///
+ public string OrderNo { get; set; }
+ ///
+ ///
+ ///
+ public DateTime ChargeDate { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "serial_no")]
+ //public int? SerialNo { get; set; }
+ ///
+ ///
+ ///
+ public string DrugId { get; set; }
+
+ public DrugInfo DrugInfo { get; set; }
+ ///
+ ///
+ ///
+ public int Quantity { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string OrderUnit { get; set; }
+ ///
+ ///
+ /// 默认值: 1
+ ///
+ public int? UnitConvercoef { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string SetManuNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string SetEffDate { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "price")]
+ //public string Price { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "total_price")]
+ //public string TotalPrice { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string UseDiscrip { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string UseFrequ { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string UseOnce { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string UseBy { get; set; }
+ ///
+ ///
+ /// 默认值: '0'
+ ///
+ public string UseSelf { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string UseDosage { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DM_Dal/Models/OrderFinish.cs b/DM_Dal/Models/OrderFinish.cs
new file mode 100644
index 0000000..c1424ad
--- /dev/null
+++ b/DM_Dal/Models/OrderFinish.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ public class OrderFinish
+ {
+ public int Id { get; set; }
+
+ public string Pharmacy { get; set; }
+
+ public string PatientId { get; set; }
+
+ public string OrderNo { get; set; }
+
+ public int State { get; set; }
+
+ public string Operator { get; set; }
+
+ }
+}
diff --git a/DM_Dal/Models/OrderInfo.cs b/DM_Dal/Models/OrderInfo.cs
new file mode 100644
index 0000000..52c9d47
--- /dev/null
+++ b/DM_Dal/Models/OrderInfo.cs
@@ -0,0 +1,166 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ public class OrderInfo
+ {
+ ///
+ ///
+ ///
+ public int OrderId { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string Pharmacy { get; set; }
+ ///
+ ///
+ ///
+ public string OrderNo { get; set; }
+ ///
+ ///
+ ///
+ public string PatientId { get; set; }
+ ///
+ ///
+ ///
+ public string PName { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string Sex { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string Age { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string IdNumber { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string PatientCard { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string InvoiceNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string DoctorName { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public DateTime OrderDate { get; set; }
+ ///
+ ///
+ ///
+ public DateTime ChargeDate { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public DateTime RecvDate { get; set; }
+
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string DeptName { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string Disease { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string OrderType { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public string ChargeType { get; set; }
+ ///
+ ///
+ ///
+ public int State { get; set; }
+ ///
+ ///
+ /// 默认值: 0
+ ///
+ public int? HisDispFlag { get; set; }
+
+ ///
+ ///
+ /// 默认值: 0
+ ///
+ public int? CancelFlag { get; set; }
+
+
+ ///
+ ///
+ /// 默认值: 0
+ ///
+ public int? DmStatus { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "agent_name")]
+ //public string AgentName { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "agent_id_no")]
+ //public string AgentIdNo { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ public decimal? Costs { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "payments")]
+ //public decimal? Payments { get; set; }
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "dispensary")]
+ //public string Dispensary { get; set; }
+
+ ///
+ ///
+ /// 默认值: NULL
+ ///
+ //[SugarColumn(ColumnName = "identity")]
+ //public string Identity { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DM_Dal/Models/PremissionDm.cs b/DM_Dal/Models/PremissionDm.cs
new file mode 100644
index 0000000..70e5029
--- /dev/null
+++ b/DM_Dal/Models/PremissionDm.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ [Serializable]
+ public class PremissionDm
+ {
+ ///
+ /// 主键
+ ///
+ public int Id { get; set; }
+ ///
+ /// 菜单名
+ ///
+ public string PremissionName { get; set; }
+ ///
+ /// 菜单路径
+ ///
+ public string PremissionPath { get; set; }
+ ///
+ /// 图片source
+ ///
+ public string PremissionImage { get; set; }
+
+
+ public ObservableCollection? Children { get; set; }
+
+ }
+}
diff --git a/DM_Dal/Models/RoleDm.cs b/DM_Dal/Models/RoleDm.cs
new file mode 100644
index 0000000..504e8ae
--- /dev/null
+++ b/DM_Dal/Models/RoleDm.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ public class RoleDm
+ {
+ ///
+ ///
+ ///
+ public int? Id { get; set; }
+ ///
+ ///
+ ///
+ public string RoleName { get; set; }
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName="role_des" )]
+ //public string RoleDes { get; set; }
+ ///
+ ///
+ ///
+ ///[SugarColumn(ColumnName="permissions" )]
+ public List Permissions { get; set; }
+ ///
+ ///
+ ///
+ public string MachineId { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/ShiftsReport.cs b/DM_Dal/Models/ShiftsReport.cs
new file mode 100644
index 0000000..e527da0
--- /dev/null
+++ b/DM_Dal/Models/ShiftsReport.cs
@@ -0,0 +1,40 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Dal.Models
+{
+ public class ShiftsReport
+ {
+ public int Id { get; set; }
+
+ public string DrugName { get; set; }
+
+ public string DrugSpec { get; set; }
+
+ public int? BeforeNum { get; set; }
+
+ public int? GetNum { get; set; }
+
+ public int? UseNum { get; set; }
+
+ public string ManuNo { get; set; }
+
+ public int? Surplus { get; set; }
+
+ public DateTime OptDate { get; set; }
+
+ public string FromOperator { get; set; }
+
+ public string FromReviewer { get; set; }
+
+ public string ToOperator { get; set; }
+
+ public string ToReviewer { get; set; }
+
+ public string MachineId { get; set; }
+ }
+}
diff --git a/DM_Dal/Models/UserList.cs b/DM_Dal/Models/UserList.cs
new file mode 100644
index 0000000..d72da62
--- /dev/null
+++ b/DM_Dal/Models/UserList.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace DM_Dal.Models
+{
+ ///
+ ///
+ ///
+ public class UserList
+ {
+ ///
+ ///
+ ///
+ public int Id { get; set; }
+ ///
+ ///
+ ///
+ public string UserName { get; set; }
+ ///
+ ///
+ ///
+ public string Nickname { get; set; }
+ ///
+ ///
+ ///
+ public string PassWord { get; set; }
+
+ ///
+ ///
+ ///
+ public string UserBarcode { get; set; }
+
+
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName="status" )]
+ //public int? Status { get; set; }
+ ///
+ ///
+ ///
+ public int? RoleId { get; set; }
+
+
+ public RoleDm? Role { get; set; }
+ ///
+ ///
+ ///
+ //[SugarColumn(ColumnName="user_card" )]
+ // public string UserCard { get; set; }
+
+ ///
+ ///
+ ///
+ public string MachineId { get; set; }
+ ///
+ ///
+ ///
+ public byte[] Sign { get; set; }
+
+ public override string ToString()
+ {
+ return "userList = [UserName:" + Nickname + ", UserId:" + UserName + "]";
+ }
+ }
+}
diff --git a/DM_Dal/MysqlHelperDal.cs b/DM_Dal/MysqlHelperDal.cs
new file mode 100644
index 0000000..2a1281b
--- /dev/null
+++ b/DM_Dal/MysqlHelperDal.cs
@@ -0,0 +1,419 @@
+using DM_Dal.Models;
+using Newtonsoft.Json;
+using SCHelper.Database;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Xml;
+
+namespace DM_Dal
+{
+ public class MysqlHelperDal
+ {
+ static string machine_id = ConfigurationManager.AppSettings["machineId"].ToString();
+ #region 公共
+ ////获取抽屉数量
+ public int FindDrawerCount()
+ {
+ int count = 0;
+ string sql = $@"SELECT COUNT(1) FROM (SELECT COUNT(row_no) FROM channel_list WHERE ( drawer_type <> 3 ) AND (machine_id = '{machine_id}') GROUP BY row_no ) CountTable";
+
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(sql);
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+
+ count = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
+ }
+
+
+ return count;
+ }
+ #endregion
+
+ #region 用户登录
+ //指纹登录
+ public UserList CheckUserByFingerPrinter(int fingerPrinterId)
+ {
+ UserList? user = null;
+ int id = fingerPrinterId;
+
+ string sql = $@"select ul.id as id,ul.User_name as userName,r.id as roleId,r.role_name,r.permissions,r.machine_id from user_list ul
+ INNER JOIN role r on ul.machine_role_id=r.id where ul.Id={fingerPrinterId} and ul.machine_id='{machine_id}' and r.machine_id='{machine_id}'";
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(sql);
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+
+ user = new UserList();
+ user.Id = ds.Tables[0].Rows[0]["id"] is DBNull ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);
+ user.UserName = ds.Tables[0].Rows[0]["userName"] is DBNull ? "" : ds.Tables[0].Rows[0]["userName"].ToString();
+ user.Nickname = ds.Tables[0].Rows[0]["userName"] is DBNull ? "" : ds.Tables[0].Rows[0]["userName"].ToString();
+ user.MachineId = ds.Tables[0].Rows[0]["machine_id"] is DBNull ? "" : ds.Tables[0].Rows[0]["machine_id"].ToString();
+ RoleDm role = new RoleDm();
+ role.Id = ds.Tables[0].Rows[0]["roleId"] is DBNull ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["roleId"]);
+ role.RoleName = ds.Tables[0].Rows[0]["role_name"] is DBNull ? "" : ds.Tables[0].Rows[0]["role_name"].ToString();
+ role.Permissions = JsonConvert.DeserializeObject>(ds.Tables[0].Rows[0]["permissions"] is DBNull ? "" : ds.Tables[0].Rows[0]["permissions"].ToString()); // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
+ user.Role = role;
+ }
+
+ return user;
+
+ }
+ //用户名密码登录
+ public UserList CheckUserForLogin(string userName)
+ {
+ UserList user = null;
+ string sql = $@"select ul.id as id,ul.User_name as userName,ul.pass_word,r.id as roleId,r.role_name,r.permissions,r.machine_id from user_list ul
+ INNER JOIN role r on ul.machine_role_id=r.id where ul.user_ID='{userName}' and ul.machine_id='{machine_id}' and r.machine_id='{machine_id}'";
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(sql);
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+
+ user = new UserList();
+ user.Id = ds.Tables[0].Rows[0]["id"] is DBNull ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);
+ user.UserName = ds.Tables[0].Rows[0]["userName"] is DBNull ? "" : ds.Tables[0].Rows[0]["userName"].ToString();
+ user.Nickname = ds.Tables[0].Rows[0]["userName"] is DBNull ? "" : ds.Tables[0].Rows[0]["userName"].ToString();
+ user.MachineId = ds.Tables[0].Rows[0]["machine_id"] is DBNull ? "" : ds.Tables[0].Rows[0]["machine_id"].ToString();
+ RoleDm role = new RoleDm();
+ role.Id = ds.Tables[0].Rows[0]["roleId"] is DBNull ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["roleId"]);
+ role.RoleName = ds.Tables[0].Rows[0]["role_name"] is DBNull ? "" : ds.Tables[0].Rows[0]["role_name"].ToString();
+ role.Permissions = JsonConvert.DeserializeObject>(ds.Tables[0].Rows[0]["permissions"] is DBNull ? "" : ds.Tables[0].Rows[0]["permissions"].ToString()); // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
+ user.Role = role;
+ user.PassWord = ds.Tables[0].Rows[0]["pass_word"] is DBNull ? "" : ds.Tables[0].Rows[0]["pass_word"].ToString();
+ }
+
+ return user;
+
+ }
+
+ #endregion
+
+ #region 处方取药
+ ///
+ /// 处方取药
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List GetOrderInfos(string Code, string SearchValue, string OrderDate, int pageNum, int pageSize, ref int totalCount)
+ {
+ List orderInfos = new List();
+ totalCount = 0;
+ pageNum = (pageNum - 1) * pageSize;
+ string countSql = $@" SELECT COUNT(1) FROM (SELECT oi.order_id FROM order_info oi Inner JOIN order_detail od ON ( oi.order_no = od.order_no )
+ Inner JOIN (SELECT chnguid,machine_id,row_no,col_no,pos_no,drug_id,drawer_type,board_type,state FROM channel_list
+ WHERE ( drawer_type = 1 ) AND (machine_id = '{machine_id}') GROUP BY drug_id ) t
+ ON ( od.drug_id = t.drug_id ) WHERE ( oi.dm_status = 0 )
+ AND ( oi.his_disp_flag = 0 ) AND ( oi.cancel_flag = 0 ) ";
+ if (!string.IsNullOrEmpty(OrderDate))
+ {
+ countSql += $" AND (DATE_FORMAT(oi.recv_date, '%Y-%m-%d') = '{OrderDate}' ) ";
+ }
+ if (!string.IsNullOrEmpty(Code) && !string.IsNullOrEmpty(SearchValue))
+ {
+ if (Code.Equals("OrderNo"))
+ countSql += $" AND ( oi.order_no = '{SearchValue}' ) ";
+ else
+ countSql += $" AND ( oi.patient_id = '{SearchValue}' ) ";
+ }
+ countSql += " GROUP BY oi.order_no ) CountTable ";
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(countSql);
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+
+ totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
+ }
+
+
+
+ string sql = $@"SELECT oi.order_id,oi.pharmacy,oi.order_no,oi.patient_id,oi.p_name,oi.sex,oi.age,oi.id_number,
+ oi.patient_card, oi.invoice_no,oi.patient_no,oi.doctor_name,oi.order_date,oi.charge_date,oi.recv_date,
+ oi.dept_name,oi.disease,oi.order_type,oi.charge_type,oi.state,oi.his_disp_flag,oi.cancel_flag,oi.dm_status,oi.costs FROM order_info oi Inner JOIN order_detail od ON ( oi.order_no = od.order_no ) Inner JOIN
+ (SELECT chnguid,machine_id,row_no,col_no,pos_no,drug_id,drawer_type,board_type,state FROM channel_list
+ WHERE ( drawer_type = 1 ) AND (machine_id = '{machine_id}') GROUP BY drug_id ) t
+ ON ( od.drug_id = t.drug_id )
+ WHERE ( oi.dm_status = 0 ) AND ( oi.his_disp_flag = 0 ) AND ( oi.cancel_flag = 0 ) ";
+
+ if (!string.IsNullOrEmpty(OrderDate))
+ {
+ sql += $" AND (DATE_FORMAT(oi.recv_date, '%Y-%m-%d') = '{OrderDate}' ) ";
+ }
+ if (!string.IsNullOrEmpty(Code) && !string.IsNullOrEmpty(SearchValue))
+ {
+ if (Code.Equals("OrderNo"))
+ sql += $" AND ( oi.order_no = '{SearchValue}' ) ";
+ else
+ sql += $" AND ( oi.patient_id = '{SearchValue}' ) ";
+ }
+ sql += $" GROUP BY oi.order_no LIMIT {pageNum},{pageSize}";
+
+ DataSet dsTable = DBHelper.GetInstance().ExecuteQuery(sql);
+ if (dsTable != null && dsTable.Tables[0].Rows.Count > 0)
+ {
+ for (int i = 0; i < dsTable.Tables[0].Rows.Count; i++)
+ {
+
+
+ OrderInfo order = new OrderInfo();
+ order.OrderId = Convert.ToInt32(dsTable.Tables[0].Rows[i]["order_id"]);
+ order.Pharmacy = dsTable.Tables[0].Rows[i]["pharmacy"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["pharmacy"].ToString();
+ order.OrderNo = dsTable.Tables[0].Rows[i]["order_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["order_no"].ToString();
+ order.PatientId = dsTable.Tables[0].Rows[i]["patient_id"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["patient_id"].ToString();
+ order.PName = dsTable.Tables[0].Rows[i]["p_name"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["p_name"].ToString();
+ order.Sex = dsTable.Tables[0].Rows[i]["sex"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["sex"].ToString();
+ order.Age = dsTable.Tables[0].Rows[i]["age"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["age"].ToString();
+ order.IdNumber = dsTable.Tables[0].Rows[i]["id_number"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["id_number"].ToString();
+ order.PatientCard = dsTable.Tables[0].Rows[i]["patient_card"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["patient_card"].ToString();
+ order.InvoiceNo = dsTable.Tables[0].Rows[i]["invoice_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["invoice_no"].ToString();
+ order.PatientNo = dsTable.Tables[0].Rows[i]["patient_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["patient_no"].ToString();
+ order.DoctorName = dsTable.Tables[0].Rows[i]["doctor_name"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["doctor_name"].ToString();
+ order.OrderDate = dsTable.Tables[0].Rows[i]["order_date"] is DBNull ? DateTime.Now.AddYears(-1) : Convert.ToDateTime(dsTable.Tables[0].Rows[i]["order_date"]);
+ order.ChargeDate = dsTable.Tables[0].Rows[i]["charge_date"] is DBNull ? DateTime.Now.AddYears(-1) : Convert.ToDateTime(dsTable.Tables[0].Rows[i]["charge_date"]);
+ order.RecvDate = dsTable.Tables[0].Rows[i]["recv_date"] is DBNull ? DateTime.Now.AddYears(-1) : Convert.ToDateTime(dsTable.Tables[0].Rows[i]["recv_date"]);
+ order.DeptName = dsTable.Tables[0].Rows[i]["dept_name"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["dept_name"].ToString();
+ order.Disease = dsTable.Tables[0].Rows[i]["disease"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["disease"].ToString();
+ order.OrderType = dsTable.Tables[0].Rows[i]["order_type"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["order_type"].ToString();
+ order.ChargeType = dsTable.Tables[0].Rows[i]["charge_type"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["charge_type"].ToString();
+ order.State = Convert.ToInt32(dsTable.Tables[0].Rows[i]["state"]);
+ order.HisDispFlag = Convert.ToInt32(dsTable.Tables[0].Rows[i]["his_disp_flag"]);
+ order.CancelFlag = Convert.ToInt32(dsTable.Tables[0].Rows[i]["cancel_flag"]);
+ order.DmStatus = Convert.ToInt32(dsTable.Tables[0].Rows[i]["dm_status"]);
+ order.Costs = dsTable.Tables[0].Rows[i]["costs"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["costs"]);
+ orderInfos.Add(order);
+ }
+ }
+ return orderInfos;
+ }
+
+ ///
+ /// 根据处方号获取处方详情
+ ///
+ ///
+ ///
+ public List GetOrderDetails(string orderNo)
+ {
+
+ List orderDetails = new List();
+
+ string strSql = $@"SELECT od.id,od.patient_id,od.order_no,od.charge_date,od.drug_id,od.quantity,od.order_unit,
+ od.unit_convercoef,od.set_manu_no,od.set_eff_date,od.use_discrip,od.use_frequ,od.use_once,od.use_by,
+ od.use_self,od.use_dosage,D.drug_name
+ FROM order_detail od
+ INNER JOIN DRUG_INFO D ON od.DRUG_ID=D.DRUG_ID
+ Inner JOIN
+ (SELECT chsguid,chnguid,machine_id,row_no,col_no,pos_no,drug_id,manu_no,eff_date,quantity,drawer_type,board_type,state
+ FROM channel_stock WHERE ( drawer_type = 1 ) AND (machine_id = '{machine_id}') GROUP BY drug_id ) t
+
+ ON ( od.drug_id = t.drug_id ) WHERE ( od.order_no = '{orderNo}' )";
+
+
+ DataSet dsTable = DBHelper.GetInstance().ExecuteQuery(strSql);
+ if (dsTable != null && dsTable.Tables[0].Rows.Count > 0)
+ {
+
+ for (int i = 0; i < dsTable.Tables[0].Rows.Count; i++)
+ {
+ OrderDetail od = new OrderDetail();
+ DrugInfo oi = new DrugInfo();
+ od.Id = Convert.ToInt32(dsTable.Tables[0].Rows[i]["id"]);
+ od.PatientId = dsTable.Tables[0].Rows[i]["patient_id"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["patient_id"].ToString();
+ od.OrderNo = dsTable.Tables[0].Rows[i]["order_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["order_no"].ToString();
+ od.ChargeDate = dsTable.Tables[0].Rows[i]["charge_date"] is DBNull ? DateTime.Now.AddYears(-1) : Convert.ToDateTime(dsTable.Tables[0].Rows[i]["charge_date"]);
+ od.DrugId = dsTable.Tables[0].Rows[i]["drug_id"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["drug_id"].ToString();
+ od.Quantity = dsTable.Tables[0].Rows[i]["quantity"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["quantity"]);
+ od.OrderUnit = dsTable.Tables[0].Rows[i]["order_unit"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["order_unit"].ToString();
+ od.SetEffDate = dsTable.Tables[0].Rows[i]["set_eff_date"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["set_eff_date"].ToString();
+ od.SetManuNo = dsTable.Tables[0].Rows[i]["set_manu_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["set_manu_no"].ToString();
+ oi.DrugName = dsTable.Tables[0].Rows[i]["drug_name"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["drug_name"].ToString();
+ od.DrugInfo = oi;
+ orderDetails.Add(od);
+ }
+ }
+ return orderDetails;
+ }
+
+ ///
+ /// 获取药品对应库存信息
+ ///
+ ///
+ public List GetChannelStocks(string drugId)
+ {
+ List channelStocks = new List();
+ string strSql = $@"SELECT cs.chsguid,cs.chnguid,cs.machine_id,cs.row_no,cs.col_no,cs.pos_no,cs.drug_id,cs.manu_no,
+ cs.eff_date,cs.quantity,cs.drawer_type,cs.board_type,cs.state,D.Drug_Name,D.drug_spec FROM channel_stock cs Inner JOIN channel_list cl ON (( cs.chnguid = cl.chnguid ) AND ( cs.drug_id = cl.drug_id ))
+ INNER JOIN DRUG_INFO D ON cs.drug_id=D.drug_id
+ WHERE ( cs.quantity > 0 ) AND ( cs.drawer_type = 1 ) AND (cs.machine_id = '{machine_id}')
+ AND ( cs.drug_id = '{drugId}' )ORDER BY cs.eff_date ASC,cs.row_no ASC,cs.manu_no ASC ";
+ DataSet dsTable = DBHelper.GetInstance().ExecuteQuery(strSql);
+ if (dsTable != null && dsTable.Tables[0].Rows.Count > 0)
+ {
+ for (int i = 0; i < dsTable.Tables[0].Rows.Count; i++)
+ {
+ ChannelStock channelStock = new ChannelStock();
+ DrugInfo drugInfo = new DrugInfo();
+ channelStock.Id = dsTable.Tables[0].Rows[i]["chsguid"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["chsguid"].ToString();
+ channelStock.Chnguid = dsTable.Tables[0].Rows[i]["chnguid"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["chnguid"].ToString();
+ channelStock.MachineId = dsTable.Tables[0].Rows[i]["machine_id"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["machine_id"].ToString();
+ channelStock.DrawerNo = dsTable.Tables[0].Rows[i]["row_no"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["row_no"]);
+ channelStock.ColNo = dsTable.Tables[0].Rows[i]["col_no"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["col_no"]);
+ channelStock.DrugId = dsTable.Tables[0].Rows[i]["drug_id"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["drug_id"].ToString();
+ channelStock.ManuNo = dsTable.Tables[0].Rows[i]["manu_no"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["manu_no"].ToString();
+ channelStock.EffDate = dsTable.Tables[0].Rows[i]["eff_date"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["eff_date"].ToString();
+ channelStock.Quantity = dsTable.Tables[0].Rows[i]["quantity"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["quantity"]);
+ channelStock.DrawerType = dsTable.Tables[0].Rows[i]["drawer_type"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["drawer_type"]);
+ channelStock.BoardType = dsTable.Tables[0].Rows[i]["board_type"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["board_type"]);
+ channelStock.State = dsTable.Tables[0].Rows[i]["state"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[i]["state"]);
+
+ drugInfo.DrugName = dsTable.Tables[0].Rows[i]["Drug_Name"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["Drug_Name"].ToString();
+ drugInfo.DrugSpec = dsTable.Tables[0].Rows[i]["drug_spec"] is DBNull ? "" : dsTable.Tables[0].Rows[i]["drug_spec"].ToString();
+ channelStock.DrugInfo = drugInfo;
+
+ channelStocks.Add(channelStock);
+ }
+ }
+ return channelStocks;
+ }
+ ///
+ /// 完成处方取药
+ ///
+ ///
+ public bool SaveOrderTakeInfo(string orderNo, string orderDeptName, List record, int? operatorUser, int? reviewerUser)
+ {
+ bool bFlag = false;
+
+ try
+ {
+ string strSql = $"UPDATE order_info SET dm_status=1 WHERE ORDER_NO='{orderNo}'";
+ int iResult = DBHelper.GetInstance().ExecuteNonQuery(strSql);
+ if (iResult > 0)
+ {
+ for (int i = 0; i < record.Count; i++)
+ {
+ ChannelStock it = record[i];
+
+ int quantity = it.Quantity - it.TakeQuantity;
+ // 更新数据 库存信息
+ strSql = $"UPDATE channel_stock SET quantity={quantity},manu_no='{it.ManuNo}',eff_date='{it.EffDate}' WHERE chsguid='{it.Id}'";
+
+
+ iResult = DBHelper.GetInstance().ExecuteNonQuery(strSql);
+
+ if (iResult > 0)
+ {
+
+
+ // 获取更新完库存后的药品库存
+ List nowChannels = new List();
+ string querySql = $@"SELECT Quantity,Manu_No,drug_id FROM channel_stock WHERE drawer_type=1 and machine_id='{machine_id}' AND drug_id='{it.DrugId}' ";
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(querySql);
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
+ {
+ ChannelStock stock = new ChannelStock();
+ stock.Quantity = ds.Tables[0].Rows[j]["Quantity"] is DBNull ? 0 : Convert.ToInt32(ds.Tables[0].Rows[j]["Quantity"]); ;
+ stock.DrugId = ds.Tables[0].Rows[j]["drug_id"] is DBNull ? "" : ds.Tables[0].Rows[j]["drug_id"].ToString();
+ stock.ManuNo = ds.Tables[0].Rows[j]["Manu_No"] is DBNull ? "" : ds.Tables[0].Rows[j]["Manu_No"].ToString();
+ nowChannels.Add(stock);
+ }
+ }
+ DateTime EFFDATE = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : DateTime.Now;
+
+ int stockQuantity = nowChannels.Sum(it => it.Quantity);
+ int manunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity);
+ string supplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString();
+ string insertSql = $"INSERT INTO dm_machine_record " +
+ $"SET MACHINE_ID='{it.MachineId}',drawer_no='{it.DrawerNo}',COL_NO='{it.ColNo}',DRUG_ID='{it.DrugId}',MANU_NO='{it.ManuNo}'," +
+ $"EFF_DATE='{EFFDATE}',Operator={operatorUser},reviewer={reviewerUser}," +
+ $"operation_time=NOW(),quantity={it.TakeQuantity},type=2,invoice_id='{orderNo}',stock_quantity={stockQuantity}," +
+ $"manunoQuantity={manunoQuantity},supplierDept='{supplierDept}',receiveDept='{orderDeptName}'";
+ iResult = DBHelper.GetInstance().ExecuteNonQuery(insertSql);
+ if (iResult > 0)
+ {
+ bFlag = true;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ bFlag = false;
+ }
+ return bFlag;
+ }
+ ///
+ /// 根据抽屉号、库位号查询库存信息
+ ///
+ ///
+ ///
+ ///
+ public List GetChannelStockList(int rowNo, int colNo)
+ {
+ List channel = new List();
+
+
+ string strSql = $"SELECT ROW_NO,COL_NO,eff_date,quantity FROM CHANNEL_STOCK WHERE MACHINE_ID='{ConfigurationManager.AppSettings["machineId"] ?? "DM1"}' AND ROW_NO={rowNo} AND COL_NO={colNo} ORDER BY EFF_DATE";
+ DataSet dsTable = DBHelper.GetInstance().ExecuteQuery(strSql);
+ if (dsTable != null && dsTable.Tables[0].Rows.Count > 0)
+ {
+ for (int i = 0; i < dsTable.Tables[0].Rows.Count; i++)
+ {
+
+ ChannelStock cs = new ChannelStock();
+ cs.DrawerNo = dsTable.Tables[0].Rows[0]["row_no"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[0]["row_no"]);
+ cs.ColNo = dsTable.Tables[0].Rows[0]["col_no"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[0]["col_no"]);
+ cs.EffDate = dsTable.Tables[0].Rows[0]["eff_date"] is DBNull ? "" : dsTable.Tables[0].Rows[0]["eff_date"].ToString();
+ cs.Quantity = dsTable.Tables[0].Rows[0]["quantity"] is DBNull ? 0 : Convert.ToInt32(dsTable.Tables[0].Rows[0]["quantity"]);
+ channel.Add(cs);
+ }
+ }
+ return channel;
+ }
+ #endregion
+
+
+ #region 调拨出库
+
+ #endregion
+
+ #region 抽屉取药
+ ///
+ /// 通过抽屉号获取库存信息
+ ///
+ ///
+ public List GetChannelStockByDrawer(int row_no)
+ {
+ List channelStocks = new List();
+ string strSql = $@"SELECT chsguid,chnguid,machine_id,row_no,col_no,pos_no,drug_id,manu_no,eff_date,quantity,drawer_type,board_type,state FROM channel_stock
+ WHERE ( row_no = {row_no} ) AND ( drug_id IS NOT NULL ) AND (machine_id = '{machine_id}') AND ( drawer_type = 1 ) AND ( quantity > 0 )ORDER BY col_no ASC,eff_date ASC";
+ DataSet ds = DBHelper.GetInstance().ExecuteQuery(strSql);
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ ChannelStock stock = new ChannelStock();
+ stock.Id = ds.Tables[0].Rows[i]["chsguid"].ToString();
+ stock.Chnguid = ds.Tables[0].Rows[i]["chnguid"].ToString();
+ stock.DrawerNo = row_no;
+ stock.ColNo = Convert.ToInt32(ds.Tables[0].Rows[i]["col_no"]);
+ stock.ManuNo = ds.Tables[0].Rows[i]["chnguid"].ToString();
+ stock.EffDate = ds.Tables[0].Rows[i]["eff_date"].ToString();
+ stock.Quantity = Convert.ToInt32(ds.Tables[0].Rows[i]["quantity"]);
+ stock.BoardType = Convert.ToInt32(ds.Tables[0].Rows[i]["board_type"]);
+ stock.MachineId = ds.Tables[0].Rows[i]["machine_id"].ToString();
+ channelStocks.Add(stock);
+ }
+ }
+ return channelStocks;
+ }
+
+ #endregion
+ }
+}
diff --git a/DM_Dal/dll/SCHelper.Database.dll b/DM_Dal/dll/SCHelper.Database.dll
new file mode 100644
index 0000000..5de3ea3
Binary files /dev/null and b/DM_Dal/dll/SCHelper.Database.dll differ
diff --git a/DM_Dal/dll/SCHelper.dll b/DM_Dal/dll/SCHelper.dll
new file mode 100644
index 0000000..af3e8ef
Binary files /dev/null and b/DM_Dal/dll/SCHelper.dll differ
diff --git a/DM_Weight.sln b/DM_Weight.sln
new file mode 100644
index 0000000..c3a9b49
--- /dev/null
+++ b/DM_Weight.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32922.545
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DM_Weight", "DM_Weight\DM_Weight.csproj", "{439FA76B-F874-40DB-BAF2-E3647CD55B10}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x86.ActiveCfg = Debug|x86
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x86.Build.0 = Debug|x86
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.Build.0 = Release|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.ActiveCfg = Release|x86
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E50E8179-1102-41F1-92F5-2905C75898A6}
+ EndGlobalSection
+EndGlobal
diff --git a/DM_Weight/App.config b/DM_Weight/App.config
new file mode 100644
index 0000000..3f827c0
--- /dev/null
+++ b/DM_Weight/App.config
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DM_Weight/App.xaml b/DM_Weight/App.xaml
new file mode 100644
index 0000000..704fc50
--- /dev/null
+++ b/DM_Weight/App.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs
new file mode 100644
index 0000000..4aeeac5
--- /dev/null
+++ b/DM_Weight/App.xaml.cs
@@ -0,0 +1,367 @@
+using DM_Weight.Finger;
+using DM_Weight.Port;
+using DM_Weight.util.TabTip;
+using DM_Weight.util;
+using DM_Weight.ViewModels;
+using DM_Weight.Views.Dialog;
+using DM_Weight.Views;
+using log4net.Config;
+using Prism.Ioc;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using Prism.Unity;
+using log4net;
+using System.Windows.Interop;
+using System.Windows.Threading;
+using System.Timers;
+using SqlSugar;
+using Microsoft.Extensions.DependencyInjection;
+using DM_Weight.Services;
+using DM_Weight.Models;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+//using DM_Dal;
+//using DM_Dal.Models;
+
+namespace DM_Weight
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : PrismApplication
+ {
+ #region 当前登录用户的发药人信息
+ private static UserList _currentFaUserList = new UserList();
+ public static UserList CurrentFaUserList
+ {
+ get => _currentFaUserList;
+ set => _currentFaUserList = value;
+ }
+
+ #endregion 当前登录用户的发药人信息
+
+ #region 当前登录用户的审核人信息
+ private static UserList _currentShenUserList = new UserList();
+ public static UserList CurrentShenUserList
+ {
+ get => _currentShenUserList;
+ set => _currentShenUserList = value;
+ }
+ #endregion 当前登录用户的审核人信息
+
+ private readonly ILog logger = LogManager.GetLogger(typeof(App));
+ public App()
+ {
+ TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
+ TabTipAutomation.BindTo();
+ TabTipAutomation.BindTo();
+ }
+
+
+
+ protected override Window CreateShell()
+ {
+ //UI线程未捕获异常处理事件
+ this.DispatcherUnhandledException += OnDispatcherUnhandledException;
+ //Task线程内未捕获异常处理事件
+ TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
+ //多线程异常
+ AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
+
+ return Container.Resolve();
+ }
+
+ void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
+ logger.Error($"发生错误:{e.Exception.Message}");
+ e.Handled = true;
+ }
+
+ void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
+ {
+
+ foreach (Exception item in e.Exception.InnerExceptions)
+ {
+ logger.Error($"异常类型:{item.StackTrace};{item.GetType()}{Environment.NewLine}来自:{item.Source}{Environment.NewLine}异常内容:{item.Message}");
+ if (item.GetType() == typeof(SqlSugar.SqlSugarException))
+ {
+ //UserList userList = new SqlHelperService().CheckUserByFingerPrinter(1);
+ }
+ }
+
+ //将异常标识为已经观察到
+ e.SetObserved();
+ }
+
+ void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ logger.Error($"Unhandled exception.{e.ToString()}");
+ }
+
+
+ protected override void InitializeShell(Window shell)
+ {
+
+ base.InitializeShell(shell);
+ }
+
+ protected override void RegisterTypes(IContainerRegistry containerRegistry)
+ {
+ // 注入日志
+ XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
+ //containerRegistry.RegisterInstance(LogManager.GetLogger(""));
+
+ // 串口工具
+ containerRegistry.RegisterSingleton();
+ // 指纹机工具
+ containerRegistry.RegisterSingleton();
+ // 组态屏工具
+ containerRegistry.RegisterSingleton();
+ containerRegistry.RegisterSingleton();
+
+ containerRegistry.Register();
+
+ // 主窗口
+ containerRegistry.Register();
+ containerRegistry.RegisterForNavigation();
+
+ // 分页
+ //containerRegistry.Register();
+ //containerRegistry.Register();
+
+ // 登录页面
+ containerRegistry.RegisterForNavigation();
+
+ // 布局页面
+ containerRegistry.RegisterForNavigation();
+
+ // 录入指纹模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+
+
+ #region 取药
+ // 处方取药页面
+ containerRegistry.RegisterForNavigation();
+ // 处方取药模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 调拨取药页面
+ containerRegistry.RegisterForNavigation();
+ // 调拨取药模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 抽屉取药页面
+ containerRegistry.RegisterForNavigation();
+ // 自选取药模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 自选取药页面
+ containerRegistry.RegisterForNavigation();
+ #endregion
+
+ #region 加药
+ // 自选加药页面
+ containerRegistry.RegisterForNavigation();
+ // 调拨加药页面
+ //containerRegistry.RegisterForNavigation();
+ // 调拨加药页面
+ containerRegistry.RegisterForNavigation();
+
+ // 调拨取药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ // 抽屉加药页面
+ containerRegistry.RegisterForNavigation();
+ // 自选加药模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ //多批次抽屉加药
+ containerRegistry.RegisterForNavigation();
+ #endregion
+
+ #region 还药
+ // 还药页面
+ containerRegistry.RegisterForNavigation();
+ // 按记录归还药品模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+
+ // 还药页面2
+ containerRegistry.RegisterForNavigation();
+ // 按处方归还药品模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 还空瓶页面
+ containerRegistry.RegisterForNavigation();
+ // 归还空瓶模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ #endregion
+
+ #region 库存管理
+ // 库存列表页面
+ containerRegistry.RegisterForNavigation();
+ // 库位绑定模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+ // 库位绑定模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 库存盘点页面
+ //containerRegistry.RegisterForNavigation();
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 库存盘点页面--新(类似库存列表页面)
+ containerRegistry.RegisterForNavigation();
+ // 库存盘点页面--新(类似库存列表页面)
+ //containerRegistry.RegisterForNavigation();
+ // 库存盘点页面--新(类似库存列表页面)
+ containerRegistry.RegisterForNavigation();
+ // 药品列表页面
+ containerRegistry.RegisterForNavigation();
+ //库存列表导出账册弹窗
+ //containerRegistry.RegisterForNavigation();
+ #endregion
+
+ #region 系统设置
+ // 用户管理页面
+ containerRegistry.RegisterForNavigation();
+ // 编辑用户模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 角色管理页面
+ containerRegistry.RegisterForNavigation();
+ // 系统设置
+ containerRegistry.RegisterForNavigation();
+ // 调试页面
+ containerRegistry.RegisterForNavigation();
+
+ #endregion
+
+ // 设备记录页面
+ containerRegistry.RegisterForNavigation();
+
+ containerRegistry.RegisterForNavigation();
+
+ //交接班
+ //containerRegistry.RegisterForNavigation();
+ //交接班记录
+ containerRegistry.RegisterForNavigation();
+
+ containerRegistry.RegisterForNavigation();
+
+ //交接班
+ containerRegistry.RegisterForNavigation();
+
+ //containerRegistry.RegisterSingleton(() => SqlSugarHelperNew.GetInstance());
+
+ #region SqlSugar-IOC单例
+ //containerRegistry.RegisterSingleton(s =>
+ // {
+ // SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
+ // {
+ // ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
+ // DbType = SqlSugar.DbType.MySql,
+ // IsAutoCloseConnection = true
+ // },
+ // db =>
+ // {
+ // //单例参数配置,所有上下文生效
+ // db.Aop.OnLogExecuting = (sql, pars) =>
+ // {
+ // //获取IOC对象不要求在一个上下文
+ // //vra log=s.GetService()
+
+ // //获取IOC对象要求在一个上下文
+ // //var appServive = s.GetService();
+ // //var log= appServive?.HttpContext?.RequestServices.GetService();
+ // };
+ // });
+ // return sqlSugar;
+ // });
+ #endregion
+
+ //账册页面
+ containerRegistry.RegisterForNavigation();
+ //账册服务类
+ containerRegistry.Register();
+
+
+ //containerRegistry.Register();
+ // 配置数据库信息
+ //SCHelper.Database.DBHelper.GetInstance().SetConnectionConfig(SCHelper.Database.SCDbType.MySQL,
+ // ConfigurationManager.AppSettings["DataBaseIP"],
+ // ConfigurationManager.AppSettings["DataBaseName"],
+ // "root",
+ // ConfigurationManager.AppSettings["Password"]);
+
+ }
+
+ private void PrismApplication_Startup(object sender, StartupEventArgs e)
+ {
+ // 配置数据库信息
+ SCHelper.Database.DBHelper.GetInstance().SetConnectionConfig(SCHelper.Database.SCDbType.MySQL,
+ "127.0.0.1",
+ "hunanxianchang_db",
+ "root",
+ "root");
+ //获取欲启动程序名
+ string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
+ //检查程序是否已经启动,已经启动则显示提示退出程序
+ if (System.Diagnostics.Process.GetProcessesByName(processName).Length > 1)
+ {
+ //系统在运行
+ RaiseOtherProcess();
+ Application.Current.Shutdown();
+ return;
+ }
+ }
+ private static void RaiseOtherProcess()
+ {
+ Process proc = Process.GetCurrentProcess();
+ foreach (Process otherProc in Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName))
+ {
+ if (proc.Id != otherProc.Id)
+ {
+ IntPtr hWnd = otherProc.MainWindowHandle;
+ if (IsIconic(hWnd))
+ {
+ ShowWindowAsync(hWnd, 9);
+ }
+ SetForegroundWindow(hWnd);
+ break;
+ }
+ }
+ }
+ [DllImport("user32.dll")]
+ private static extern bool SetForegroundWindow(IntPtr hWnd);
+ [DllImport("user32.dll")]
+ private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
+ [DllImport("user32.dll")]
+ private static extern bool IsIconic(IntPtr hWnd);
+ //protected IServiceProvider ConfigureServices(IServiceCollection services)
+ //{
+ // // 创建 SqlSugar 实例
+ // var db = new SqlSugarClient(new ConnectionConfig()
+ // {
+ // ConnectionString = "server=127.0.0.1;uid=root;pwd=123456;database=mydb",
+ // DbType = DbType.MySql,
+ // IsAutoCloseConnection = true,
+ // InitKeyType = InitKeyType.Attribute
+ // });
+ // // 将实例注册到 IServiceCollection 中
+ // services.AddSingleton(db);
+ //}
+ }
+}
diff --git a/DM_Weight/AssemblyInfo.cs b/DM_Weight/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/DM_Weight/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/DM_Weight/CommonDal/LoginDal.cs b/DM_Weight/CommonDal/LoginDal.cs
new file mode 100644
index 0000000..08e2f49
--- /dev/null
+++ b/DM_Weight/CommonDal/LoginDal.cs
@@ -0,0 +1,37 @@
+using DM_Weight.Models;
+using Newtonsoft.Json;
+using SCHelper.Database;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection.PortableExecutable;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DM_Weight.CommonDal
+{
+ public class LoginDal
+ {
+ public UserList GetLoginInfo(string userName,string passWord)
+ {
+ UserList user = new UserList(); ;
+ string sql = @"select ul.id as id,ul.User_name as userName,r.id as rId,r.role_name,r.permissions,r.machine_id from user_list ul
+ INNER JOIN role r on ul.machine_role_id=r.id where ul.Id=@ID and ul.machine_id=@machine_id and r.machine_id=@machine_id";
+ DataSet ds= DBHelper.GetInstance().ExecuteQuery(sql);
+ if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count>0)
+ {
+ user.Id =Convert.ToInt32(ds.Tables[0].Rows[0]["id"] ??0);
+ user.UserName = ds.Tables[0].Rows[0]["userName"].ToString() ?? "";
+ user.Nickname = ds.Tables[0].Rows[0]["userName"].ToString()??"";
+ user.MachineId = ds.Tables[0].Rows[0]["machine_id"].ToString()??"";
+ RoleDm role = new RoleDm();
+ role.Id = Convert.ToInt32(ds.Tables[0].Rows[0]["rId"] ?? 0);
+ role.RoleName = ds.Tables[0].Rows[0]["role_name"].ToString() ?? ""; ;
+ role.Permissions = JsonConvert.DeserializeObject>(ds.Tables[0].Rows[0]["permissions"] is DBNull ? "" : ds.Tables[0].Rows[0]["permissions"].ToString()); // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
+ user.Role = role;
+ }
+ return user;
+ }
+ }
+}
diff --git a/DM_Weight/Components/pagination/Pagination.xaml b/DM_Weight/Components/pagination/Pagination.xaml
new file mode 100644
index 0000000..8b3eee6
--- /dev/null
+++ b/DM_Weight/Components/pagination/Pagination.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DM_Weight/Components/pagination/Pagination.xaml.cs b/DM_Weight/Components/pagination/Pagination.xaml.cs
new file mode 100644
index 0000000..4024568
--- /dev/null
+++ b/DM_Weight/Components/pagination/Pagination.xaml.cs
@@ -0,0 +1,265 @@
+//using NetTaste;
+using Prism.Commands;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+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.Components.pagination
+{
+ ///
+ /// Pagination.xaml 的交互逻辑
+ ///
+ public partial class Pagination : UserControl
+ {
+ public Pagination()
+ {
+ InitializeComponent();
+ ResetInfoText();
+ ResetCurrentPageText();
+ }
+
+ static Pagination()
+ {
+ InitializeCommands();
+
+ }
+
+ private static readonly Type _typeofSelf = typeof(Pagination);
+
+
+ private static void InitializeCommands()
+ {
+ FirstCommand = new RoutedCommand("First", _typeofSelf);
+ PrevCommand = new RoutedCommand("Prev", _typeofSelf);
+ NextCommand = new RoutedCommand("Next", _typeofSelf);
+ EndCommand = new RoutedCommand("End", _typeofSelf);
+
+
+ CommandManager.RegisterClassCommandBinding(_typeofSelf,
+ new CommandBinding(FirstCommand, OnFirstComman, OnCanFirstComman));
+ CommandManager.RegisterClassCommandBinding(_typeofSelf,
+ new CommandBinding(PrevCommand, OnPrevCommand, OnCanPrevCommand));
+ CommandManager.RegisterClassCommandBinding(_typeofSelf,
+ new CommandBinding(NextCommand, OnNextCommand, OnCanNextCommand));
+ CommandManager.RegisterClassCommandBinding(_typeofSelf,
+ new CommandBinding(EndCommand, OnEndCommand, OnCanEndCommand));
+ }
+
+
+
+ public static RoutedCommand FirstCommand { get; private set; }
+ private static void OnFirstComman(object sender, RoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ ctrl.CurrentPage = 1;
+ }
+
+ private static void OnCanFirstComman(object sender, CanExecuteRoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ e.CanExecute = ctrl.CurrentPage > 1;
+ }
+
+ public static RoutedCommand PrevCommand { get; private set; }
+ private static void OnPrevCommand(object sender, RoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ ctrl.CurrentPage--;
+ }
+
+ private static void OnCanPrevCommand(object sender, CanExecuteRoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ e.CanExecute = ctrl.CurrentPage > 1;
+ }
+
+ public static RoutedCommand NextCommand { get; private set; }
+
+ private static void OnNextCommand(object sender, RoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ ctrl.CurrentPage++;
+ }
+
+ private static void OnCanNextCommand(object sender, CanExecuteRoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ e.CanExecute = ctrl.CurrentPage < ctrl.PageCount;
+ }
+ public static RoutedCommand EndCommand { get; private set; }
+ private static void OnEndCommand(object sender, RoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ ctrl.CurrentPage = ctrl.PageCount;
+ }
+
+ private static void OnCanEndCommand(object sender, CanExecuteRoutedEventArgs e)
+ {
+ var ctrl = sender as Pagination;
+ e.CanExecute = ctrl.CurrentPage < ctrl.PageCount;
+ }
+
+
+
+ // 默认当前页码
+ public static int DefaultCurrentPage = 1;
+ // 默认总条数
+ public static int DefaultTotalPages = 0;
+ // 默认每页条数列表
+ public static List DefaultPageSizeList = new List { 10, 20, 50, 100 };
+ // 是否显示页码条数信息
+ public static bool DefaultInfoTextIsEnabel = true;
+ // 默认每页条数
+ public static int DefaultPageSize = 10;
+
+
+ public static readonly DependencyProperty CurrentPageProperty = DependencyProperty
+ .Register("CurrentPage",
+ typeof(int),
+ typeof(Pagination),
+ new FrameworkPropertyMetadata(DefaultCurrentPage, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+ public static readonly DependencyProperty PageSizeProperty = DependencyProperty
+ .Register("PageSize",
+ typeof(int),
+ typeof(Pagination),
+ new FrameworkPropertyMetadata(DefaultPageSize, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+ public static readonly DependencyProperty TotalPagesProperty = DependencyProperty
+ .Register("TotalPages",
+ typeof(int),
+ typeof(Pagination),
+ new FrameworkPropertyMetadata(DefaultTotalPages, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnItemsSourceChanged)));
+ public static readonly DependencyProperty InfoTextIsEnabelProperty = DependencyProperty
+ .Register("InfoTextIsEnabel",
+ typeof(bool),
+ typeof(Pagination),
+ new FrameworkPropertyMetadata(DefaultInfoTextIsEnabel, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+ private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ Pagination p = (Pagination)d;
+
+ p.ResetInfoText();
+ }
+
+ [Bindable(true)]
+ [Category("Appearance")]
+ public int CurrentPage
+ {
+ get { return (int)GetValue(CurrentPageProperty); }
+ set
+ {
+ SetValue(CurrentPageProperty, value);
+ if (InfoTextIsEnabel)
+ {
+ ResetInfoText();
+ }
+ ResetCurrentPageText();
+ }
+ }
+
+
+ //private static void OnCurrentPageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ // Pagination p = d as Pagination;
+
+ // if (p != null)
+ // {
+ // Console.WriteLine(e.NewValue);
+ // }
+ //}
+
+ [Bindable(true)]
+ [Category("Appearance")]
+ public int PageSize
+ {
+ get { return (int)GetValue(PageSizeProperty); }
+ set
+ {
+ SetValue(PageSizeProperty, value);
+ if (InfoTextIsEnabel)
+ {
+ ResetInfoText();
+ }
+ ResetCurrentPageText();
+ }
+ }
+
+
+ [Bindable(true)]
+ [Category("Appearance")]
+ public int TotalPages
+ {
+ get { return (int)GetValue(TotalPagesProperty); }
+ set
+ {
+ SetValue(TotalPagesProperty, value);
+ if (InfoTextIsEnabel)
+ {
+ ResetInfoText();
+ }
+ ResetCurrentPageText();
+ }
+ }
+
+ public bool InfoTextIsEnabel
+ {
+ get { return (bool)GetValue(InfoTextIsEnabelProperty); }
+ set { SetValue(InfoTextIsEnabelProperty, value); }
+ }
+
+ public int PageCount
+ {
+ get => (int)Math.Ceiling((double)TotalPages / PageSize);
+ }
+
+
+ public void ResetInfoText()
+ {
+ this.Dispatcher.BeginInvoke(() =>
+ {
+ if (InfoTextIsEnabel)
+ {
+ if (TotalPages <= PageSize)
+ {
+ this.InfoBlock.Text = $"1-{TotalPages}/{TotalPages}";
+ if (TotalPages == 0)
+ {
+ this.InfoBlock.Text = $"0-{TotalPages}/{TotalPages}";
+ }
+ } else
+ {
+ this.InfoBlock.Text = ((CurrentPage - 1) * PageSize + 1) + "-" + (CurrentPage * PageSize > TotalPages ? TotalPages : CurrentPage * PageSize) + "/" + TotalPages;
+ }
+
+ } else
+ {
+ this.InfoBlock.Visibility = Visibility.Visible;
+ }
+
+ });
+
+ }
+
+ public void ResetCurrentPageText()
+ {
+ this.Dispatcher.BeginInvoke(() =>
+ {
+ this.CurrentPageText.Text = CurrentPage + "";
+ });
+
+ }
+
+ }
+}
diff --git a/DM_Weight/Components/pagination/PaginationViewModel.cs b/DM_Weight/Components/pagination/PaginationViewModel.cs
new file mode 100644
index 0000000..00a7f0b
--- /dev/null
+++ b/DM_Weight/Components/pagination/PaginationViewModel.cs
@@ -0,0 +1,81 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace DM_Weight.Components.pagination
+{
+ public class PaginationViewModel: BindableBase, IRegionMemberLifetime
+ {
+ public static readonly DependencyProperty PageSizeProperty = DependencyProperty
+ .Register("CurrentPage",
+ typeof(int),
+ typeof(Pagination),
+ new FrameworkPropertyMetadata(10));
+
+ // 每页条数
+ private int _pageSize = 10;
+ // 当前页码
+ private int _currentPage = 1;
+ // 总条数
+ private int _totalPages = 0;
+
+ public int PageSize { get=> _pageSize; set => SetProperty(ref _pageSize, value); }
+ public int CurrentPage { get => _currentPage; set => SetProperty(ref _currentPage, value); }
+ public int TotalPages { get => _totalPages; set => SetProperty(ref _totalPages, value); }
+ // 总页数
+ public int PageCount
+ {
+ get => (int)Math.Ceiling((double)TotalPages/ PageSize);
+ }
+
+ public string InfoText
+ {
+ get => ((CurrentPage - 1) * PageSize + 1) + "-" + (CurrentPage * PageSize > TotalPages ? TotalPages : CurrentPage * PageSize) + "/" + TotalPages;
+ }
+
+ public bool KeepAlive => false;
+
+
+ public DelegateCommand ToFirst
+ {
+ get => new(() =>
+ {
+ CurrentPage = 1;
+ });
+ }
+
+
+
+ public DelegateCommand ToPrve
+ {
+ get => new(() =>
+ {
+ CurrentPage -= 1;
+ });
+ }
+
+ public DelegateCommand ToNext
+ {
+ get => new(() =>
+ {
+ CurrentPage += 1;
+ });
+ }
+
+ public DelegateCommand ToEnd
+ {
+ get => new(() =>
+ {
+ CurrentPage = PageCount;
+ });
+ }
+
+
+ }
+}
diff --git a/DM_Weight/Converter/BoardTypeConverter.cs b/DM_Weight/Converter/BoardTypeConverter.cs
new file mode 100644
index 0000000..64b8f0f
--- /dev/null
+++ b/DM_Weight/Converter/BoardTypeConverter.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class BoardTypeConverter : IMultiValueConverter
+ {
+ public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
+ {
+ int BoardType, DrawerType;
+ bool boardBool = int.TryParse(value[0].ToString(), out BoardType);
+ bool drawerBool = int.TryParse(value[1].ToString(), out DrawerType);
+ //int BoardType = int.Parse(value[0].ToString());
+ //int DrawerType = int.Parse(value[1].ToString());
+ switch (BoardType)
+ {
+ case 1:
+ if (DrawerType == 1)
+ {
+ return "物理隔断";
+ }
+ else if(DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 2:
+ if (DrawerType == 1)
+ {
+ return "单支计数";
+ }
+ else if (DrawerType == 2)
+ {
+ return "计数回收(内置)";
+ }
+ else
+ {
+ return "计数回收(外置)";
+ }
+ case 3:
+ if (DrawerType == 1)
+ {
+ return "管控药盒";
+ }
+ else if (DrawerType == 2)
+ {
+ return "药盒回收(内置)";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 4:
+ if (DrawerType == 1)
+ {
+ return "冰箱";
+ }
+ else if (DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 5:
+ if (DrawerType == 1)
+ {
+ return "智能显示";
+ }
+ else if (DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 6:
+ if (DrawerType == 1)
+ {
+ return "称重计数";
+ }
+ else if (DrawerType == 2)
+ {
+ return "称重回收(内置)";
+ }
+ else
+ {
+ return "计数回收(外置)";
+ }
+ }
+ return "";
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/ChangeShiftsStatusConverter.cs b/DM_Weight/Converter/ChangeShiftsStatusConverter.cs
new file mode 100644
index 0000000..42faa14
--- /dev/null
+++ b/DM_Weight/Converter/ChangeShiftsStatusConverter.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class ChangeShiftsStatusConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ //bool status = bool.Parse(value.ToString());
+ return false;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/DrawerSelectConverter.cs b/DM_Weight/Converter/DrawerSelectConverter.cs
new file mode 100644
index 0000000..007947a
--- /dev/null
+++ b/DM_Weight/Converter/DrawerSelectConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ internal class DrawerSelectConverter : IMultiValueConverter
+ {
+ public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null && value.Length > 0)
+ {
+ //int ButtonDrawerNo = int.Parse(value[0].ToString());
+ //int SelectedDrawerNo = int.Parse(value[1].ToString());
+ int ButtonDrawerNo, SelectedDrawerNo;
+ int.TryParse(value[0].ToString(), out ButtonDrawerNo);
+ int.TryParse(value[1].ToString(), out SelectedDrawerNo);
+ return ButtonDrawerNo == SelectedDrawerNo;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/ForeColorConverter.cs b/DM_Weight/Converter/ForeColorConverter.cs
new file mode 100644
index 0000000..6d4f00a
--- /dev/null
+++ b/DM_Weight/Converter/ForeColorConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class ForeColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if((bool)value)
+ {
+ return "#3ECFED";
+ }
+ else
+ {
+ return "#808080";
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/GroupSumConverter.cs b/DM_Weight/Converter/GroupSumConverter.cs
new file mode 100644
index 0000000..9917c8b
--- /dev/null
+++ b/DM_Weight/Converter/GroupSumConverter.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using DM_Weight.Models;
+
+namespace DM_Weight.Converter
+{
+ public class GroupSumConverter : IValueConverter
+ {
+ #region 分组组内求和
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var total = 0;
+ // DataGrid分组后对应的组及组内元素CollectionViewGroup.Items 类型是ReadOnlyObservableCollection