diff --git a/DM_Weight/App.config b/DM_Weight/App.config index 7064398..a8bf66e 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -42,7 +42,7 @@ - + @@ -73,9 +73,9 @@ - + - + + + + \ No newline at end of file diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index 4a9d65d..269d384 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -248,6 +248,9 @@ namespace DM_Weight containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); + + //报表信息录入 + containerRegistry.RegisterForNavigation(); #endregion #region 系统设置 diff --git a/DM_Weight/DM_Weight.csproj b/DM_Weight/DM_Weight.csproj index 4c2e17c..ceb6a87 100644 --- a/DM_Weight/DM_Weight.csproj +++ b/DM_Weight/DM_Weight.csproj @@ -135,6 +135,9 @@ Always + + Always + diff --git a/DM_Weight/Models/DrugInfo.cs b/DM_Weight/Models/DrugInfo.cs index ef9e55d..926005e 100644 --- a/DM_Weight/Models/DrugInfo.cs +++ b/DM_Weight/Models/DrugInfo.cs @@ -90,7 +90,7 @@ namespace DM_Weight.Models public int? StockQuantity { get; set; } private DrugBase _base; - [Navigate(NavigateType.OneToOne, nameof(DrugBase.DrugId), nameof(DrugId))] + [Navigate(NavigateType.OneToOne, nameof(DrugBase.DrugId), nameof(DrugId), whereSql: "machine_id='DM3'")] public DrugBase drugBase { get=> _base; diff --git a/DM_Weight/Models/RejectionReport.cs b/DM_Weight/Models/RejectionReport.cs index f01cda4..d27924d 100644 --- a/DM_Weight/Models/RejectionReport.cs +++ b/DM_Weight/Models/RejectionReport.cs @@ -100,5 +100,20 @@ namespace DM_Weight.Models /// [SugarColumn(ColumnName = "DrawerNo")] public int DrawerNo { get; set; } + /// + /// 日消耗总计--安瓿 + /// + [SugarColumn(ColumnName = "useBottle")] + public int UseBottle { get; set; } + /// + /// 日消耗总计--处方 + /// + [SugarColumn(ColumnName = "useOrderNo")] + public int UseOrderNo { get; set; } + /// + /// 日消耗总计--补充 + /// + [SugarColumn(ColumnName = "useAdd")] + public int UseAdd { get; set; } } } diff --git a/DM_Weight/Models/UserList.cs b/DM_Weight/Models/UserList.cs index 3c3d2a0..280f488 100644 --- a/DM_Weight/Models/UserList.cs +++ b/DM_Weight/Models/UserList.cs @@ -8,7 +8,7 @@ namespace DM_Weight.Models /// /// [SugarTable("user_list")] - public class UserList + public class UserList:ICloneable { /// /// @@ -69,6 +69,11 @@ namespace DM_Weight.Models [SugarColumn(ColumnName="sign" )] public byte[] Sign { get; set; } + public object Clone() + { + return this.MemberwiseClone(); + } + public override string ToString() { return "userList = [UserName:" + Nickname + ", UserId:" + UserName + "]"; diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs index 5bd593c..5f40e53 100644 --- a/DM_Weight/Report/GridReportUtil.cs +++ b/DM_Weight/Report/GridReportUtil.cs @@ -366,23 +366,26 @@ namespace DM_Weight.Report Report.PrintPreview(true); } - public static void RejectionReport(string date) + public static void RejectionReport(DateTime? startDate, DateTime? endDate) { // 定义Grid++Report报表主对象 GridppReport Report = new GridppReport(); - //DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); - //DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); - string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1"); + string p_startDate = startDate==null? DateTime.Now.ToString("yyyy-MM-dd"): ((DateTime)startDate).ToString("yyyy-MM-dd") ; + string p_endDate = endDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : ((DateTime)endDate).ToString("yyyy-MM-dd"); + string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM3"); string SQL = string.Empty; - Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "use_jiaojie.grf"); + Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "use_jiaojie_New.grf"); SQL = $@" - SELECT YEAR(operationtime) as DMYear,MONTH(operationtime) DMMonth,DAY(operationtime) DMDay, 0 as TotalBaseNum, + SELECT ID,DATE_FORMAT(Senddate,'%Y/%m/%d') as SenddateMonthDay,YEAR(Senddate) as DMYear,MONTH(Senddate) DMMonth,DAY(Senddate) DMDay, 0 as TotalBaseNum, DATE_FORMAT(Senddate,'%Y/%m/%d %H:%i:%s') as Senddate,SendUser as SendUser,receiveuser as ReceiveUser,realnum as SendNum,infactnum as InfactNum,emptynum as EmptyNum, - IF(returnTime is null,'',DATE_FORMAT(returnTime,'%H:%i')) as ReturnDate,returnuser as ReturnUser,returnreceiveuser as ReturnReceiveUser, - adduser as AddUser,addcheckuser as AddCheckUser,DATE_FORMAT(operationtime,'%Y/%m/%d %H:%i:%s') as OperationTime,drugid as drugId,drugname as drugName,drugspec,basenum as TotalNum,drawerno - from rejection_report -- where DATE_FORMAT(operationtime,'%Y-%m-%d')= '2024-09-19' - GROUP BY Senddate,drugId order by Senddate,drugId"; + returnTime as ReturnDate,returnuser as ReturnUser,returnreceiveuser as ReturnReceiveUser, + IF(adduser is null,'',adduser) as AddUser,IF(addcheckuser is null,'',addcheckuser) as AddCheckUser,DATE_FORMAT(operationtime,'%Y/%m/%d %H:%i:%s') as OperationTime,drugid as drugId,drugname as drugName,drugspec,basenum as TotalNum,drawerno + + from rejection_report ";// -- where DATE_FORMAT(operationtime,'%Y-%m-%d')= '2024-09-19' + //-- GROUP BY Senddate,drugId order by Senddate,drugId"; + SQL += $" where DATE_FORMAT(Senddate,'%Y-%m-%d')>= '{p_startDate}' and DATE_FORMAT(Senddate,'%Y-%m-%d')<= '{p_endDate}'"; + SQL += " GROUP BY Senddate,returnTime,drugId order by Senddate,returnTime,drugId"; Dictionary>> records = new Dictionary>>(); List> tableList=SqlSugarHelper.Db.SqlQueryable(SQL).ToDictionaryList(); diff --git a/DM_Weight/ReportTemp/use_jiaojie - 副本.grf b/DM_Weight/ReportTemp/use_jiaojie - 副本.grf deleted file mode 100644 index 23ab40f..0000000 --- a/DM_Weight/ReportTemp/use_jiaojie - 副本.grf +++ /dev/null @@ -1,561 +0,0 @@ -{ - "Version":"6.8.1.1", - "Font":{ - "Name":"宋体", - "Size":105000, - "Weight":400, - "Charset":134 - }, - "Printer":{ - "Oriention":"Landscape", - "LeftMargin":1, - "TopMargin":1.42875, - "RightMargin":1, - "BottomMargin":1.8 - }, - "DetailGrid":{ - "CenterView":true, - "IsCrossTab":true, - "FixCols":2, - "AppendBlankRow":true, - "Recordset":{ - "Field":[ - { - "Name":"DMYear", - "Type":"Integer" - }, - { - "Name":"DMMonth", - "Type":"Integer" - }, - { - "Name":"DMDay", - "Type":"Integer" - }, - { - "Name":"TotalNum", - "Type":"Integer" - }, - { - "Name":"Senddate", - "Type":"DateTime", - "Format":"HH:mm" - }, - { - "Name":"SendUser" - }, - { - "Name":"ReceiveUser" - }, - { - "Name":"SendNum", - "Type":"Integer" - }, - { - "Name":"InfactNum", - "Type":"Integer" - }, - { - "Name":"EmptyNum", - "Type":"Integer" - }, - { - "Name":"ReturnTime", - "Type":"DateTime", - "Format":"HH:mm" - }, - { - "Name":"ReturnUser" - }, - { - "Name":"ReturnReceiveUser" - }, - { - "Name":"AddUser" - }, - { - "Name":"AddCheckUser" - }, - { - "Name":"drugId" - }, - { - "Name":"drugName" - }, - { - "Name":"drugSpec" - }, - { - "Name":"drawerno", - "Type":"Integer" - } - ] - }, - "Column":[ - { - "Name":"Column4" - }, - { - "Name":"Column6" - }, - { - "Name":"Column31" - }, - { - "Name":"Column14" - }, - { - "Name":"Column19" - }, - { - "Name":"Column20" - }, - { - "Name":"Column22" - }, - { - "Name":"Column23" - }, - { - "Name":"Column24" - } - ], - "ColumnContent":{ - "Height":2.19604, - "ColumnContentCell":[ - { - "Column":"Column4", - "TextAlign":"MiddleCenter", - "DataField":"Senddate" - }, - { - "Column":"Column6", - "TextAlign":"MiddleCenter", - "DataField":"SendUser" - }, - { - "Column":"Column31", - "TextAlign":"MiddleCenter", - "DataField":"ReceiveUser" - }, - { - "Column":"Column14", - "TextAlign":"MiddleCenter", - "DataField":"SendNum" - }, - { - "Column":"Column19", - "TextAlign":"MiddleCenter", - "DataField":"InfactNum" - }, - { - "Column":"Column20", - "TextAlign":"MiddleCenter", - "DataField":"EmptyNum" - }, - { - "Column":"Column22", - "TextAlign":"MiddleCenter", - "DataField":"ReturnTime" - }, - { - "Column":"Column23", - "TextAlign":"MiddleCenter", - "DataField":"ReturnUser" - }, - { - "Column":"Column24", - "DataField":"ReturnReceiveUser" - } - ] - }, - "ColumnTitle":{ - "Height":4.10104, - "RepeatStyle":"OnGroupHeaderPage", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column3", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column12", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column25", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column26", - "ColumnTitleCell":[ - { - "GroupTitle":false, - "Column":"Column4", - "TextAlign":"BottomCenter", - "Text":"发药\r\n时间" - }, - { - "GroupTitle":false, - "Column":"Column6", - "TextAlign":"BottomCenter", - "Text":"发药者" - } - ], - "TextAlign":"MiddleRight", - "Text":"交接状态", - "BorderCustom":true, - "Border":{ - "Styles":"[DrawBottom]" - } - } - ] - } - ], - "TextAlign":"MiddleCenter", - "Text":"药品信息", - "BorderCustom":true, - "Border":{ - "Styles":"[DrawRight]" - } - } - ], - "BorderCustom":true, - "Border":{ - "Styles":"[DrawRight]" - } - }, - { - "GroupTitle":true, - "Name":"Column27", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column28", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column29", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column30", - "ColumnTitleCell":[ - { - "GroupTitle":false, - "Column":"Column31", - "TextAlign":"BottomCenter", - "Text":"领药者" - } - ] - } - ], - "TextAlign":"MiddleCenter", - "Text":"总基数" - } - ], - "TextAlign":"MiddleCenter", - "Text":"规格" - } - ], - "TextAlign":"MiddleCenter", - "Text":"品名" - }, - { - "GroupTitle":true, - "Name":"Column32", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column33", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"Column34", - "ColumnTitleCell":[ - { - "GroupTitle":true, - "Name":"发药", - "ColumnTitleCell":[ - { - "GroupTitle":false, - "Column":"Column14", - "TextAlign":"BottomCenter", - "Text":"实发数" - } - ], - "TextAlign":"MiddleCenter", - "Text":"发药" - }, - { - "GroupTitle":true, - "Name":"Column35", - "ColumnTitleCell":[ - { - "GroupTitle":false, - "Column":"Column19", - "TextAlign":"BottomCenter", - "Text":"实物数" - }, - { - "GroupTitle":false, - "Column":"Column20", - "TextAlign":"BottomCenter", - "Text":"空安瓿" - } - ], - "TextAlign":"MiddleCenter", - "Text":"还药" - } - ], - "TextAlign":"MiddleCenter", - "Text":"[#TotalNum#]" - } - ], - "TextAlign":"MiddleCenter", - "Text":"[#drugSpec#]" - } - ], - "TextAlign":"MiddleCenter", - "Text":"[#drugName#]" - }, - { - "GroupTitle":false, - "Column":"Column22", - "TextAlign":"BottomCenter", - "Text":"还药\r\n时间" - }, - { - "GroupTitle":false, - "Column":"Column23", - "TextAlign":"BottomCenter", - "Text":"还药者" - }, - { - "GroupTitle":false, - "Column":"Column24", - "TextAlign":"BottomCenter", - "Text":"接收者" - } - ] - }, - "Group":[ - { - "Name":"Group1", - "GroupHeader":{ - "Height":0.79375, - "PrintGridBorder":false, - "Control":[ - { - "Type":"MemoBox", - "Name":"MemoBox7", - "AlignColumnSide":"Right", - "Left":19.394, - "Top":0.211667, - "Width":7.59354, - "Height":0.396875, - "TextAlign":"MiddleRight", - "Text":"[#DMMonth#]月[#DMDay#]日" - } - ] - }, - "GroupFooter":{ - "Height":2, - "Control":[ - { - "Type":"StaticBox", - "Name":"StaticBox4", - "AlignColumn":"Column31", - "AlignColumnEx":"Column4", - "Width":8.96938, - "Height":2, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"日消耗总计(支)" - }, - { - "Type":"StaticBox", - "Name":"StaticBox5", - "AlignColumn":"Column14", - "Left":8.96938, - "Width":2.98979, - "Height":1, - "Border":{ - "Styles":"[DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"安瓿" - }, - { - "Type":"StaticBox", - "Name":"StaticBox6", - "AlignColumn":"Column19", - "Left":11.9592, - "Width":2.99, - "Height":1, - "Border":{ - "Styles":"[DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"处方" - }, - { - "Type":"StaticBox", - "Name":"StaticBox7", - "AlignColumn":"Column20", - "Left":14.949, - "Width":2.99, - "Height":1, - "Border":{ - "Styles":"[DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"补充" - }, - { - "Type":"MemoBox", - "Name":"MemoBox2", - "AlignColumn":"Column14", - "Left":8.96938, - "Top":1.00542, - "Width":2.9898, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#Sum(EmptyNum)#]" - }, - { - "Type":"MemoBox", - "Name":"MemoBox3", - "AlignColumn":"Column19", - "Left":11.9592, - "Top":1.0054, - "Width":2.98979, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#Sum(SendNum-InfactNum)#]" - }, - { - "Type":"MemoBox", - "Name":"MemoBox4", - "AlignColumn":"Column20", - "Left":14.949, - "Top":1.0054, - "Width":2.98979, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#Sum(SendNum-InfactNum)#]" - }, - { - "Type":"StaticBox", - "Name":"StaticBox8", - "AlignColumn":"Column23", - "AlignColumnEx":"Column22", - "Left":17.9388, - "Width":5.95313, - "Height":1, - "Border":{ - "Styles":"[DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"补充者" - }, - { - "Type":"StaticBox", - "Name":"StaticBox9", - "AlignColumn":"Column24", - "Left":23.8919, - "Width":3.01625, - "Height":1, - "Border":{ - "Styles":"[DrawLeft|DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"核对者" - }, - { - "Type":"MemoBox", - "Name":"MemoBox5", - "AlignColumn":"Column23", - "AlignColumnEx":"Column22", - "Left":17.9388, - "Top":1.0054, - "Width":5.95313, - "Height":1, - "TextAlign":"MiddleCenter", - "Text":"[#AddUser#]" - }, - { - "Type":"MemoBox", - "Name":"MemoBox6", - "AlignColumn":"Column24", - "Left":23.8919, - "Top":1.00542, - "Width":3.01625, - "Height":1, - "Border":{ - "Styles":"[DrawLeft|DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#AddCheckUser#]" - } - ] - } - } - ], - "CrossTab":{ - "PercentFormat":"0.##%", - "HCrossFields":"drugId", - "VCrossFields":"Senddate", - "ListCols":3, - "TotalCols":3 - } - }, - "Parameter":[ - { - "Name":"machine_id" - }, - { - "Name":"startDate", - "DataType":"DateTime" - }, - { - "Name":"endDate", - "DataType":"DateTime" - } - ], - "ReportHeader":[ - { - "Name":"ReportHeader1", - "Height":1.79917, - "Control":[ - { - "Type":"MemoBox", - "Name":"MemoBox1", - "Dock":"Fill", - "Center":"Both", - "Font":{ - "Name":"宋体", - "Size":217500, - "Bold":true, - "Charset":134 - }, - "ShrinkFontToFit":true, - "TextAlign":"MiddleCenter", - "Text":"麻醉科小药箱麻醉、精神药品(注射剂)使用与交接记录([#DMYear#])年" - } - ], - "RepeatOnPage":true - } - ] -} \ No newline at end of file diff --git a/DM_Weight/ReportTemp/use_jiaojie.grf b/DM_Weight/ReportTemp/use_jiaojie.grf index 6a797e7..a008cb5 100644 --- a/DM_Weight/ReportTemp/use_jiaojie.grf +++ b/DM_Weight/ReportTemp/use_jiaojie.grf @@ -280,7 +280,7 @@ "GroupTitle":false, "Column":"Column14", "TextAlign":"BottomCenter", - "Text":"实发数" + "Text":"实\r\n发\r\n数" } ], "TextAlign":"MiddleCenter", @@ -294,13 +294,13 @@ "GroupTitle":false, "Column":"Column19", "TextAlign":"BottomCenter", - "Text":"实物数" + "Text":"实\r\n物\r\n数" }, { "GroupTitle":false, "Column":"Column20", "TextAlign":"BottomCenter", - "Text":"空安瓿" + "Text":"空\r\n安\r\n瓿" } ], "TextAlign":"MiddleCenter", diff --git a/DM_Weight/ReportTemp/use_jiaojie - 副本 (2).grf b/DM_Weight/ReportTemp/use_jiaojie_New.grf similarity index 62% rename from DM_Weight/ReportTemp/use_jiaojie - 副本 (2).grf rename to DM_Weight/ReportTemp/use_jiaojie_New.grf index d7bbe66..6cf2302 100644 --- a/DM_Weight/ReportTemp/use_jiaojie - 副本 (2).grf +++ b/DM_Weight/ReportTemp/use_jiaojie_New.grf @@ -18,6 +18,7 @@ "IsCrossTab":true, "FixCols":2, "AppendBlankRow":true, + "AppendBlankRowAtLast":true, "Recordset":{ "Field":[ { @@ -86,6 +87,36 @@ { "Name":"drawerno", "Type":"Integer" + }, + { + "Name":"安瓿", + "Type":"Integer", + "DBFieldName":"usebottle" + }, + { + "Name":"处方", + "Type":"Integer", + "DBFieldName":"useorderno" + }, + { + "Name":"补充", + "Type":"Integer", + "DBFieldName":"useadd" + }, + { + "Name":"补充者", + "DBFieldName":"AddUser" + }, + { + "Name":"核对者", + "DBFieldName":"AddCheckUser" + }, + { + "Name":"SenddateMonthDay" + }, + { + "Name":"ID", + "DBFieldName":" ID" } ] }, @@ -103,7 +134,8 @@ "Name":"Column14" }, { - "Name":"Column19" + "Name":"Column19", + "Width":3.01625 }, { "Name":"Column20" @@ -280,7 +312,7 @@ "GroupTitle":false, "Column":"Column14", "TextAlign":"BottomCenter", - "Text":"实发数" + "Text":"实\r\n发\r\n数" } ], "TextAlign":"MiddleCenter", @@ -294,13 +326,13 @@ "GroupTitle":false, "Column":"Column19", "TextAlign":"BottomCenter", - "Text":"实物数" + "Text":"实\r\n物\r\n数" }, { "GroupTitle":false, "Column":"Column20", "TextAlign":"BottomCenter", - "Text":"空安瓿" + "Text":"空\r\n安\r\n瓿" } ], "TextAlign":"MiddleCenter", @@ -341,15 +373,16 @@ "Group":[ { "Name":"Group1", + "ByFields":"SenddateMonthDay", "GroupHeader":{ "Height":0.79375, "PrintGridBorder":false, "Control":[ { "Type":"MemoBox", - "Name":"MemoBox7", + "Name":"MemoBox17", "AlignColumnSide":"Right", - "Left":19.394, + "Left":19.3675, "Top":0.211667, "Width":7.59354, "Height":0.396875, @@ -360,6 +393,7 @@ }, "GroupFooter":{ "Height":2, + "RepeatOnPage":true, "Control":[ { "Type":"StaticBox", @@ -372,7 +406,7 @@ "Styles":"[DrawRight]" }, "TextAlign":"MiddleCenter", - "Text":"日消耗总计(支)" + "Text":"日消耗总计(支)" }, { "Type":"StaticBox", @@ -392,7 +426,7 @@ "Name":"StaticBox6", "AlignColumn":"Column19", "Left":11.9592, - "Width":2.99, + "Width":3.01625, "Height":1, "Border":{ "Styles":"[DrawRight|DrawBottom]" @@ -404,8 +438,8 @@ "Type":"StaticBox", "Name":"StaticBox7", "AlignColumn":"Column20", - "Left":14.949, - "Width":2.99, + "Left":14.9754, + "Width":2.98979, "Height":1, "Border":{ "Styles":"[DrawRight|DrawBottom]" @@ -413,13 +447,43 @@ "TextAlign":"BottomCenter", "Text":"补充" }, + { + "Type":"StaticBox", + "Name":"StaticBox9", + "Anchor":"[Left|Top|Right]", + "ShiftMode":"Never", + "AlignColumn":"Column24", + "Left":23.9448, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"核对者" + }, + { + "Type":"FieldBox", + "Name":"FieldBox5", + "ShiftMode":"Never", + "AlignColumn":"Column24", + "Left":23.9448, + "Top":1.00542, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight]" + }, + "TextAlign":"MiddleCenter", + "DataField":"核对者" + }, { "Type":"MemoBox", - "Name":"MemoBox2", + "Name":"MemoBox18", "AlignColumn":"Column14", "Left":8.96938, "Top":1.00542, - "Width":2.9898, + "Width":2.99, "Height":1, "Border":{ "Styles":"[DrawRight]" @@ -429,99 +493,98 @@ }, { "Type":"MemoBox", - "Name":"MemoBox3", + "Name":"MemoBox19", "AlignColumn":"Column19", "Left":11.9592, - "Top":1.0054, - "Width":2.98979, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#Sum(SendNum-InfactNum)#]" - }, - { - "Type":"MemoBox", - "Name":"MemoBox4", - "AlignColumn":"Column20", - "Left":14.949, - "Top":1.0054, - "Width":2.98979, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#Sum(SendNum-InfactNum)#]" - }, - { - "Type":"StaticBox", - "Name":"StaticBox8", - "Anchor":"[Left|Top|Right|Bottom]", - "AlignColumn":"Column36", - "AlignColumnEx":"Column23", - "Left":17.9388, - "Width":5.95313, - "Height":1, - "Border":{ - "Styles":"[DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"补充者" - }, - { - "Type":"StaticBox", - "Name":"StaticBox9", - "AlignColumn":"Column24", - "Left":23.8919, - "Width":3.01625, - "Height":1, - "Border":{ - "Styles":"[DrawLeft|DrawRight|DrawBottom]" - }, - "TextAlign":"BottomCenter", - "Text":"核对者" - }, - { - "Type":"MemoBox", - "Name":"MemoBox5", - "AlignColumn":"Column36", - "AlignColumnEx":"Column23", - "Left":17.9388, - "Top":1.0054, - "Width":5.95313, - "Height":1, - "Border":{ - "Styles":"[DrawRight]" - }, - "TextAlign":"MiddleCenter", - "Text":"[#AddUser#]" - }, - { - "Type":"MemoBox", - "Name":"MemoBox6", - "AlignColumn":"Column24", - "Left":23.8919, "Top":1.00542, "Width":3.01625, "Height":1, "Border":{ - "Styles":"[DrawLeft|DrawRight]" + "Styles":"[DrawRight]" }, "TextAlign":"MiddleCenter", - "Text":"[#AddCheckUser#]" + "Text":"[#Sum(EmptyNum)#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox20", + "AlignColumn":"Column20", + "Left":14.9754, + "Top":1.00542, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#Sum(EmptyNum)#]" + }, + { + "Type":"StaticBox", + "Name":"StaticBox17", + "Anchor":"[]", + "ShiftMode":"Never", + "AlignColumn":"Column36", + "AlignColumnEx":"Column23", + "Left":17.9652, + "Width":5.95313, + "Height":1.00542, + "Border":{ + "Styles":"[DrawBottom]" + }, + "TextAlign":"BottomRight", + "Text":"补充者" + }, + { + "Type":"FieldBox", + "Name":"FieldBox6", + "ShiftMode":"Never", + "AlignColumn":"Column36", + "AlignColumnEx":"Column23", + "Left":17.9652, + "Top":1.00542, + "Width":5.95313, + "Height":1.01, + "TextAlign":"MiddleRight", + "DataField":"补充者" + }, + { + "Type":"MemoBox", + "Name":"MemoBox21", + "AlignColumn":"Column23", + "Left":20.955, + "Width":2.98979, + "Height":1.01, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter" + }, + { + "Type":"StaticBox", + "Name":"StaticBox18", + "AlignColumn":"Column23", + "Left":20.955, + "Top":1.00542, + "Width":2.98979, + "Height":1.01, + "Border":{ + "Styles":"[DrawRight]" + }, + "TextAlign":"MiddleCenter" } - ] + ], + "AppendBlankRowExclude":true } } ], "CrossTab":{ "PercentFormat":"0.##%", - "HCrossFields":"drugId;ReturnDate;ReturnUser;ReturnReceiveUser;AddUser;AddCheckUser", - "VCrossFields":"Senddate;drawerno", + "HCrossFields":"drugId", + "VCrossFields":"Senddate;ReturnDate", "ListCols":3, - "TotalCols":3 + "TotalCols":3, + "TotalExcludeColumns":"Column36;Column23;Column24" } }, "Parameter":[ @@ -559,6 +622,184 @@ } ], "RepeatOnPage":true + }, + { + "Name":"ReportHeader2", + "Height":0, + "Control":[ + { + "Type":"MemoBox", + "Name":"MemoBox7", + "AlignColumnSide":"Right", + "Left":19.394, + "Top":0.211667, + "Width":7.59354, + "Height":0.396875, + "TextAlign":"MiddleRight", + "Text":"[#DMMonth#]月[#DMDay#]日" + } + ] + } + ], + "ReportFooter":[ + { + "Name":"ReportFooter1", + "Visible":false, + "KeepTogether":false, + "Height":0, + "Control":[ + { + "Type":"StaticBox", + "Name":"StaticBox11", + "AlignColumn":"Column31", + "AlignColumnEx":"Column4", + "Width":8.99583, + "Height":2, + "Border":{ + "Styles":"[DrawLeft|DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"日消耗总计(支)" + }, + { + "Type":"StaticBox", + "Name":"StaticBox12", + "AlignColumn":"Column24", + "Left":23.9448, + "Width":3.01625, + "Height":1, + "Border":{ + "Styles":"[DrawLeft|DrawRight|DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"核对者" + }, + { + "Type":"StaticBox", + "Name":"StaticBox13", + "AlignColumn":"Column14", + "Left":8.99583, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"安瓿" + }, + { + "Type":"MemoBox", + "Name":"MemoBox12", + "AlignColumn":"Column14", + "Left":8.99583, + "Top":1.00542, + "Width":2.9898, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#安瓿#]" + }, + { + "Type":"StaticBox", + "Name":"StaticBox14", + "AlignColumn":"Column19", + "Left":11.9856, + "Width":3.01625, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"处方" + }, + { + "Type":"MemoBox", + "Name":"MemoBox13", + "AlignColumn":"Column19", + "Left":11.9856, + "Top":1.00542, + "Width":3.01625, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#处方#]" + }, + { + "Type":"StaticBox", + "Name":"StaticBox15", + "AlignColumn":"Column20", + "Left":15.0019, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"补充" + }, + { + "Type":"MemoBox", + "Name":"MemoBox14", + "AlignColumn":"Column20", + "Left":15.0019, + "Top":1.00542, + "Width":2.98979, + "Height":1, + "Border":{ + "Styles":"[DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#补充#]" + }, + { + "Type":"StaticBox", + "Name":"StaticBox16", + "AlignColumn":"Column36", + "AlignColumnEx":"Column23", + "Left":17.9917, + "Width":5.95313, + "Height":1, + "Border":{ + "Styles":"[DrawBottom]" + }, + "TextAlign":"BottomCenter", + "Text":"补充者" + }, + { + "Type":"MemoBox", + "Name":"MemoBox15", + "AlignColumn":"Column36", + "AlignColumnEx":"Column23", + "Left":17.9917, + "Top":1.00542, + "Width":5.95313, + "Height":1, + "Border":{ + "Styles":"[DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#补充者#]" + }, + { + "Type":"MemoBox", + "Name":"MemoBox16", + "AlignColumn":"Column24", + "Left":23.9448, + "Top":1.00542, + "Width":3.02, + "Height":1, + "Border":{ + "Styles":"[DrawLeft|DrawRight|DrawBottom]" + }, + "TextAlign":"MiddleCenter", + "Text":"[#核对者#]" + } + ], + "CenterWithDetailGrid":false } ] } \ No newline at end of file diff --git a/DM_Weight/ViewModels/AddReportDateViewModel.cs b/DM_Weight/ViewModels/AddReportDateViewModel.cs new file mode 100644 index 0000000..9ab0f03 --- /dev/null +++ b/DM_Weight/ViewModels/AddReportDateViewModel.cs @@ -0,0 +1,735 @@ +using DM_Weight.Models; +using DM_Weight.msg; +using DM_Weight.Port; +using DM_Weight.Report; +using DM_Weight.select; +using DM_Weight.util; +using Prism.Commands; +using Prism.Events; +using Prism.Mvvm; +using Prism.Regions; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.ViewModels +{ + public class AddReportDateViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime + { + //private int _pageNum = 1; + //public int PageNum + //{ + // get => _pageNum; + // set + // { + // SetProperty(ref _pageNum, value); + // RequestData(); + // } + //} + + //private int _pageCount = 1; + //public int PageCount + //{ + // get => _pageCount; + // set + // { + // SetProperty(ref _pageCount, value); + // } + //} + + //private int _pageSize = 8; + //public int PageSize + //{ + // get => _pageSize; + // set + // { + // SetProperty(ref _pageSize, value); + // } + //} + + //private int _totalCount = 0; + //public int TotalCount + //{ + // get => _totalCount; + // set + // { + // SetProperty(ref _totalCount, value); + // } + + //查询9种药品 + + + private List _rejectionReportList = new List();//= staticRejectionReportList; + public List RejectionReportList + { + get => _rejectionReportList; + set + { + SetProperty(ref _rejectionReportList, value); + } + } + + //public static AddReportDateViewModel vm; + //操作人(第一个人) + private List _sendUserList = new List(); + public List SendUserList + { + get => _sendUserList; + set + { + SetProperty(ref _sendUserList, value); + } + } + private UserList _sendUser = new UserList(); + public UserList SendUser + { + get => _sendUser; + set + { + SetProperty(ref _sendUser, value); + } + } + //复核人(第二个人) + private List _sendUserCheckList = new List(); + public List SendUserCheckList + { + get => _sendUserCheckList; + set + { + SetProperty(ref _sendUserCheckList, value); + } + } + private UserList _sendUserCheck = new UserList(); + public UserList SendUserCheck + { + get => _sendUserCheck; + set + { + SetProperty(ref _sendUserCheck, value); + } + } + //还药人 + private List _returnUserList = new List(); + public List ReturnUserList + { + get => _returnUserList; + set + { + SetProperty(ref _returnUserList, value); + } + } + private UserList _returnUser = new UserList(); + public UserList ReturnUser + { + get => _returnUser; + set + { + SetProperty(ref _returnUser, value); + } + } + //还药(第二个人)接收者 + private List _returnUserCheckList = new List(); + public List ReturnUserCheckList + { + get => _returnUserCheckList; + set + { + SetProperty(ref _returnUserCheckList, value); + } + } + private UserList _returnUserCheck = new UserList(); + public UserList ReturnUserCheck + { + get => _returnUserCheck; + set + { + SetProperty(ref _returnUserCheck, value); + } + } + //补充者 + private List _addUserList = new List(); + public List AddUserList + { + get => _addUserList; + set + { + SetProperty(ref _addUserList, value); + } + } + private UserList _addUser = new UserList(); + public UserList AddUser + { + get => _addUser; + set + { + SetProperty(ref _addUser, value); + } + } + //补充者(第二个人)核对者 + private List _addUserCheckList = new List(); + public List AddUserCheckList + { + get => _addUserCheckList; + set + { + SetProperty(ref _addUserCheckList, value); + } + } + private UserList _addUserCheck = new UserList(); + public UserList AddUserCheck + { + get => _addUserCheck; + set + { + SetProperty(ref _addUserCheck, value); + } + } + //private RejectionReport _Report = new RejectionReport() { SendDate = DateTime.Now, ReturnTime = DateTime.Now.ToString(), }; + //public RejectionReport RejReport + //{ + // get => _Report; + // set + // { + // SetProperty(ref _Report, value); + // } + //} + IEventAggregator _eventAggregator; + public AddReportDateViewModel(IEventAggregator eventAggregator) + { + _eventAggregator = eventAggregator; + //vm = this; + } + + + //private List _drugInfos; + //public List DrugInfos + //{ + // get { return _drugInfos; } + // set { SetProperty(ref _drugInfos, value); } + //} + + //private DrugInfo _selectedDrug = new(); + //public DrugInfo SelectedDrug + //{ + // get + // { + // return _selectedDrug; + // } + // set + // { + + // if (value != null) + // { + // SetProperty(ref _selectedDrug, value); + // GetManuNos(); + // } + // else + // { + // SetProperty(ref _selectedDrug, new()); + // Manunos = null; + // SelectedDrug.drugBase = new(); + // } + + // } + //} + //public static List StaticSelects = new() + //{ + // new OrderTakeSelect + // { + // Code = "DrugName", + // Name = "药品名称" + // }, + // new OrderTakeSelect + // { + // Code = "PyCode", + // Name = "拼音码" + // }, + // new OrderTakeSelect + // { + // Code = "DrugBarcode", + // Name = "药品条码" + // }, + // new OrderTakeSelect + // { + // Code = "DrugId", + // Name = "药品编码" + // } + //}; + + //private List _selects = StaticSelects; + + //public List Selects + //{ + // get { return _selects; } + // set + // { + // SetProperty(ref _selects, value); + // } + //} + + //private OrderTakeSelect _selectedItem = StaticSelects[0]; + ///// + ///// 查询条件 查询字段 + ///// + //public OrderTakeSelect SelectedItem + //{ + // get { return _selectedItem; } + // set + // { + // SetProperty(ref _selectedItem, value); + // RequestData(); + // } + //} + + //private string? _searchValue; + + ///// + ///// 查询条件 查询字段值 + ///// + //public string? SearchValue + //{ + // get { return _searchValue; } + // set + // { + // SetProperty(ref _searchValue, value); + // RequestData(); + // } + //} + + + private List _manunos; + public List Manunos + { + get { return _manunos; } + set { SetProperty(ref _manunos, value); } + } + + private DrugManuNo _selectedManuno = new DrugManuNo(); + public DrugManuNo SelectedManuno + { + get { return _selectedManuno; } + set { SetProperty(ref _selectedManuno, value ?? new()); } + } + + public bool KeepAlive => false; + + private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + + public DateTime? StartDate + { + get => _startDate; + set + { + if (value != null) + { + SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0)); + } + else + { + SetProperty(ref _startDate, value); + } + } + } + //发药时间 + private DateTime _sendDate = DateTime.Now; + + public DateTime SendDate + { + get => _sendDate; + set + { + SetProperty(ref _sendDate, value); + } + } + + //还药时间 + private string _returnTime = string.Empty; + public string ReturnTime + { + get => _returnTime; + set + { + SetProperty(ref _returnTime, value); + } + } + + private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); + + public DateTime? EndDate + { + get => _endDate; + set + { + if (value != null) + { + TimeSpan ershisi = new TimeSpan(23, 59, 59); + SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59)); + } + else + { + SetProperty(ref _endDate, value); + } + } + } + + public DelegateCommand Download + { + get => new DelegateCommand(() => + { + GridReportUtil.RejectionReport(StartDate, EndDate); + }); + } + ////发药数据添加 + //public DelegateCommand AddSendReportDateCommand + //{ + // get => new DelegateCommand(() => + // { + // if (SelectedDrug != null) + // { + // int iRet=SqlSugarHelper.Db.Insertable(new RejectionReport() + // { + // SendDate = DateTime.Parse(RejReport.SendDate.ToString("yyyy-MM-dd HH:mm")), + // SendUser = SendUser.Nickname, + // ReceiveUser = SendUserCheck.Nickname,//Jiaojie_ChannelStocks + // RealNum= RejReport.RealNum, + // DrugId = SelectedDrug.DrugId, + // DrugName = SelectedDrug.DrugName, + // DrugSpec = SelectedDrug.DrugSpec, + // BaseNum = SelectedDrug.drugBase.BaseQuantity + "支",//总基数 + // OperationTime=DateTime.Now, + + // }).ExecuteCommand(); + // if (iRet > 0) + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "保存成功", + // Type = MsgType.INFO + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "发药数据保存失败,数据异常", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "请先选择药品", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // }); + //} + ////还药数据添加 + //public DelegateCommand AddReturnReportDateCommand + //{ + // get => new DelegateCommand(() => + // { + // if (SelectedDrug != null) + // { + // int iRet= SqlSugarHelper.Db.Insertable(new RejectionReport() + // { + // ReturnTime = DateTime.Parse(RejReport.ReturnTime).ToString("yyyy-MM-dd HH:mm"), + // ReturnUser = User.UserName, + // ReturnReceiveUser = UserCheck.Nickname,//Jiaojie_ChannelStocks + // InfactNum= RejReport.InfactNum, + // EmptyNum= RejReport.EmptyNum, + // DrugId = SelectedDrug.DrugId, + // DrugName = SelectedDrug.DrugName, + // DrugSpec = SelectedDrug.DrugSpec, + // BaseNum = SelectedDrug + "支", + // }).ExecuteCommand(); + // if (iRet > 0) + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "保存成功", + // Type = MsgType.INFO + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "还药数据保存失败,数据异常", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "请先选择药品", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // }); + //} + ////日消耗数据添加 + //public DelegateCommand AddUseReportDateCommand + //{ + // get => new DelegateCommand(() => + // { + // if (SelectedDrug != null) + // { + // int iRet= SqlSugarHelper.Db.Insertable(new RejectionReport() + // { + // //ReturnTime = DateTime.Parse(RejReport.ReturnTime).ToString("yyyy-MM-dd HH:mm"), + // AddUser = User.UserName, + // AddCheckUser = UserCheck.Nickname,//Jiaojie_ChannelStocks + // UseBottle = RejReport.UseBottle, + // UseOrderNo = RejReport.UseOrderNo, + // UseAdd=RejReport.UseAdd, + // DrugId = SelectedDrug.DrugId, + // DrugName = SelectedDrug.DrugName, + // DrugSpec = SelectedDrug.DrugSpec, + // BaseNum = SelectedDrug + "支", + // }).ExecuteCommand(); + // if(iRet>0) + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "保存成功", + // Type = MsgType.INFO + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "日消耗保存失败,数据异常", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // } + // else + // { + // AlertMsg alertMsg = new AlertMsg + // { + // Message = "请先选择药品", + // Type = MsgType.ERROR + // }; + // _eventAggregator.GetEvent().Publish(alertMsg); + // } + // }); + //} + public DelegateCommand AddReportDateCommand + { + get => new DelegateCommand(() => + { + try + { + var f = SqlSugarHelper.Db.UseTran(() => + { + if (RejectionReportList != null && RejectionReportList.Count > 0) + { + int iRet = 0; + for (int i = 0; i < RejectionReportList.Count; i++) + { + RejectionReport report = RejectionReportList[i]; + iRet = SqlSugarHelper.Db.Insertable(new RejectionReport() + { + SendDate = SendDate, + SendUser = SendUser.Nickname, + ReceiveUser = SendUserCheck.Nickname,//Jiaojie_ChannelStocks + RealNum = report.RealNum, + ReturnTime = ReturnTime, + ReturnUser = ReturnUser.UserName, + ReturnReceiveUser = ReturnUserCheck.Nickname,//Jiaojie_ChannelStocks + InfactNum = report.InfactNum, + EmptyNum = report.EmptyNum, + AddUser = AddUser.UserName, + AddCheckUser = AddUserCheck.Nickname,//Jiaojie_ChannelStocks + UseBottle = report.UseBottle, + UseOrderNo = report.UseOrderNo, + UseAdd = report.UseAdd, + DrugId = report.DrugId, + DrugName = report.DrugName, + DrugSpec = report.DrugSpec, + BaseNum = report.BaseNum + "支", + OperationTime = DateTime.Now + }).ExecuteCommand(); + } + } + else + { + AlertMsg alertMsg = new AlertMsg + { + Message = "请输入数据", + Type = MsgType.ERROR + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return false; + } + return true; + }); + if (f.Data) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "保存成功", + Type = MsgType.INFO + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } + if (!f.IsSuccess) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "日消耗保存失败,数据异常", + Type = MsgType.ERROR + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } + } + catch (Exception ex) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "日消耗保存失败,抛出异常", + Type = MsgType.ERROR + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } + }); + } + //这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作 + public void ConfirmNavigationRequest(NavigationContext navigationContext, Action continuationCallback) + { + continuationCallback(true); + } + //public void UpdateComboBoxItems(string text) + //{ + // string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit, + // d.manufactory,d.max_stock,CONCAT(drug_name,' / ',drug_spec,' / ',manufactory) as drug_name_spec FROM `drug_info` d"; + // if (string.IsNullOrEmpty(text)) + // { + // DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + // return; + // } + // if (DrugInfos != null) + // { + // DrugInfos.Clear(); + // } + // DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + //} + + //接收导航传过来的参数 + public void OnNavigatedTo(NavigationContext navigationContext) + { + //查询表格数据 + //RequestData(); + //获取用户数据 + GetUsers(); + GetAllDrugInfos(); + } + private void GetAllDrugInfos() + { + //var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); + //DrugInfos = list; + string str = "SELECT d.drug_id,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' / ',drug_spec,' / ',manufactory) as drug_name_spec,db.baseQuantity as PyCode FROM `drug_info` d left join drug_base db on d.drug_id=db.drugid and db.machine_id='DM3'"; + if (ConfigurationManager.AppSettings["DrugNames"] != null) + { + str += " where d.drug_name in (" + ConfigurationManager.AppSettings["DrugNames"] + ")"; + } + List DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + if (DrugInfos != null && DrugInfos.Count > 0) + { + for (int i = 0; i < DrugInfos.Count; i++) + { + RejectionReport report = new RejectionReport(); + report.DrugId = DrugInfos[i].DrugId; + report.DrugName = DrugInfos[i].DrugName; + report.DrugSpec = DrugInfos[i].DrugSpec; + report.InfactNum = 0; + report.RealNum = 0; + report.BaseNum = DrugInfos[i].PyCode; + RejectionReportList.Add(report); + } + } + } + //void GetManuNos() + //{ + // Manunos = SqlSugarHelper.Db.Queryable() + // .WhereIF(SelectedDrug != null, (di) => di.DrugId.Equals(SelectedDrug.DrugId)) + // .Select(di => di) + // .ToList(); + //} + + //void RequestData() + //{ + // int totalCount = 0; + // DrugInfos = SqlSugarHelper.Db.Queryable() + // .Includes(di => di.drugBase) + // .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (di) => di.DrugId.ToString().Contains(SearchValue)) + // .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (di) => di.DrugName.Contains(SearchValue)) + // .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (di) => di.PyCode.Contains(SearchValue)) + // .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (di) => di.DrugBarcode.Contains(SearchValue)) + // //.Select(di => di) + // .ToPageList(PageNum, PageSize, ref totalCount); + // foreach (DrugInfo di in DrugInfos) + // { + + // if (di.drugBase == null) + // { + // di.drugBase = new DrugBase(); + // } + // } + + // TotalCount = totalCount; + // PageCount = (int)Math.Ceiling((double)TotalCount / PageSize); + //} + + void GetUsers() + { + //获取用户数据 + SendUserList = SqlSugarHelper.Db.Queryable() + .Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"])) + .ToList(); + //获取用户数据 + SendUserCheckList = SendUserList.Select(item => (UserList)item.Clone()).ToList(); + + ReturnUserList = SendUserList.Select(item => (UserList)item.Clone()).ToList(); + + ReturnUserCheckList = SendUserList.Select(item => (UserList)item.Clone()).ToList(); + + AddUserList = SendUserList.Select(item => (UserList)item.Clone()).ToList(); + + AddUserCheckList = SendUserList.Select(item => (UserList)item.Clone()).ToList(); + } + + //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建 + public bool IsNavigationTarget(NavigationContext navigationContext) + { + return true; + } + + //这个方法用于拦截请求 + public void OnNavigatedFrom(NavigationContext navigationContext) + { + + } + } +} diff --git a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs index 8de0391..e731c02 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs @@ -399,12 +399,12 @@ namespace DM_Weight.ViewModels } - public DelegateCommand RejectReport_Download - { - get => new DelegateCommand(() => { - GridReportUtil.RejectionReport(""); - }); - } + //public DelegateCommand RejectReport_Download + //{ + // get => new DelegateCommand(() => { + // GridReportUtil.RejectionReport(""); + // }); + //} public DelegateCommand Account_Download { get => new DelegateCommand(() => diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index a1c771f..5862565 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -25,6 +25,7 @@ using DM_Weight.msg; using System.Threading; using DM_Weight.Common; using System.Windows.Media; +using MaterialDesignThemes.Wpf; namespace DM_Weight.ViewModels { @@ -589,6 +590,8 @@ namespace DM_Weight.ViewModels stop(); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => { + + DialogHost.Close("RootDialog"); _regionManager.RequestNavigate("MainRegion", "LoginWindow"); })); //}); diff --git a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs index bdecefa..10820ee 100644 --- a/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs +++ b/DM_Weight/ViewModels/RoleManagerWindowViewModel.cs @@ -525,12 +525,19 @@ namespace DM_Weight.ViewModels PremissionName = "账册", PremissionPath = "AccountWindow", }; + PremissionDm kuguan7 = new PremissionDm + { + Id = 47, + PremissionName = "报表数据录入", + PremissionPath = "AddReportDate", + }; kuguanChild.Add(kuguan1); kuguanChild.Add(kuguan2); kuguanChild.Add(kuguan4); kuguanChild.Add(kuguan6); kuguanChild.Add(kuguan3); kuguanChild.Add(kuguan5); + kuguanChild.Add(kuguan7); kuguan.Children = kuguanChild; defaultAll.Add(kuguan); #endregion diff --git a/DM_Weight/Views/AddReportDate.xaml b/DM_Weight/Views/AddReportDate.xaml new file mode 100644 index 0000000..878d581 --- /dev/null +++ b/DM_Weight/Views/AddReportDate.xaml @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/AddReportDate.xaml.cs b/DM_Weight/Views/AddReportDate.xaml.cs new file mode 100644 index 0000000..92a88c3 --- /dev/null +++ b/DM_Weight/Views/AddReportDate.xaml.cs @@ -0,0 +1,48 @@ +using DM_Weight.ViewModels; +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 +{ + /// + /// AddReportDate.xaml 的交互逻辑 + /// + public partial class AddReportDate : UserControl + { + //AddReportDateViewModel vms; + public AddReportDate() + { + InitializeComponent(); + //vms = AddReportDateViewModel.vm; + } + + ///// + ///// 药品名称触发事件 + ///// + ///// + ///// + //private void ComboBox_KeyUp(object sender, KeyEventArgs e) + //{ + // ComboBox comboBox = sender as ComboBox; + // vms.UpdateComboBoxItems(comboBox.Text); + // if (this.vms.DrugInfos.Count > 0) + // { + // comboBox.IsDropDownOpen = true; + // } + // TextBox textBox = (TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox); + // textBox.SelectionStart = textBox.Text.Length; + //} + } +} diff --git a/DM_Weight/Views/AddToJiaoJieWindow.xaml b/DM_Weight/Views/AddToJiaoJieWindow.xaml index 5d9303b..3ac2e54 100644 --- a/DM_Weight/Views/AddToJiaoJieWindow.xaml +++ b/DM_Weight/Views/AddToJiaoJieWindow.xaml @@ -58,7 +58,7 @@ Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="取消" />--> -