添加账册报表
This commit is contained in:
		
							parent
							
								
									88f7ccc7f8
								
							
						
					
					
						commit
						bf4db0096a
					
				| 
						 | 
					@ -42,7 +42,7 @@
 | 
				
			||||||
		<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
							<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
				
			||||||
		<add key="stopRecord" value="180"/>
 | 
							<add key="stopRecord" value="180"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<add key="gridConnectionString" value="MYSQL; Database=xiangxiang; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
 | 
							<add key="gridConnectionString" value="MYSQL; Database=xiangtan_mazuike_xx; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
 | 
				
			||||||
		<!-- 查询处方是orderNo还是orderGroupNo -->
 | 
							<!-- 查询处方是orderNo还是orderGroupNo -->
 | 
				
			||||||
		<add key="OrderNoName" value="orderNo" />
 | 
							<add key="OrderNoName" value="orderNo" />
 | 
				
			||||||
		<!-- 后门耗材板地址 没有则填写0-->
 | 
							<!-- 后门耗材板地址 没有则填写0-->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -294,6 +294,9 @@ namespace DM_Weight
 | 
				
			||||||
            containerRegistry.RegisterDialog<ConfirmDialog>();
 | 
					            containerRegistry.RegisterDialog<ConfirmDialog>();
 | 
				
			||||||
            containerRegistry.RegisterForNavigation<ConfirmDialog, ConfirmDialogViewModel>();
 | 
					            containerRegistry.RegisterForNavigation<ConfirmDialog, ConfirmDialogViewModel>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //账册
 | 
				
			||||||
 | 
					            containerRegistry.RegisterForNavigation<AccountWindow, AccountWindowViewModel>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //药品转移药箱
 | 
					            //药品转移药箱
 | 
				
			||||||
            containerRegistry.RegisterForNavigation<ExchangeWindow, ExchangeWindowViewModel>();
 | 
					            containerRegistry.RegisterForNavigation<ExchangeWindow, ExchangeWindowViewModel>();
 | 
				
			||||||
            containerRegistry.RegisterForNavigation<ExchangeDialog, ExchangeDialogViewModel>();
 | 
					            containerRegistry.RegisterForNavigation<ExchangeDialog, ExchangeDialogViewModel>();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,6 +98,9 @@
 | 
				
			||||||
    <None Update="log4net.config">
 | 
					    <None Update="log4net.config">
 | 
				
			||||||
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
					      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
				
			||||||
    </None>
 | 
					    </None>
 | 
				
			||||||
 | 
					    <None Update="ReportTemp\account_book_new.grf">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
    <None Update="ReportTemp\account_book_temp.grf">
 | 
					    <None Update="ReportTemp\account_book_temp.grf">
 | 
				
			||||||
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
					      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
				
			||||||
    </None>
 | 
					    </None>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,5 +148,11 @@ namespace DM_Weight.Models
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [SugarColumn(IsIgnore =true)]
 | 
					        [SugarColumn(IsIgnore =true)]
 | 
				
			||||||
        public string ReviewerName { get;set; }
 | 
					        public string ReviewerName { get;set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 手术间
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [SugarColumn(ColumnName = "shoushuJian")]
 | 
				
			||||||
 | 
					        public string ShoushuJian { get;set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -365,5 +365,41 @@ namespace DM_Weight.Report
 | 
				
			||||||
            Report.PrintPreview(true);
 | 
					            Report.PrintPreview(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, string drug_id)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // 定义Grid++Report报表主对象
 | 
				
			||||||
 | 
					            GridppReport Report = new GridppReport();
 | 
				
			||||||
 | 
					            // 加载模板文件
 | 
				
			||||||
 | 
					            Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_new.grf");
 | 
				
			||||||
 | 
					            Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
 | 
				
			||||||
 | 
					            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 SQL = $@"  select ab.drug_id, ab.type,
 | 
				
			||||||
 | 
							                      di.drug_name AS DrugName,di.Drug_spec AS DrugSpec,di.big_unit AS BigUnit,di.small_unit AS SmallUnit, 
 | 
				
			||||||
 | 
							                      DATE_FORMAT(ab.create_date,'%Y/%m/%d') AS YearMD,ab.manu_no AS ManuNo,DATE_FORMAT(ab.eff_date,'%Y%m%d') AS effDate,IF(ab.type=1,ab.add_quantity,'') AS InQuantity,ab.shoushuJian AS shoushuJian,
 | 
				
			||||||
 | 
							                      re.Patient_name AS PName,re.sex AS Sex,re.age AS Age,re.use_dose AS UseDose,re.residual_dose AS ResidualDose,re.create_time AS DiposalTime
 | 
				
			||||||
 | 
					                              ,re.operator_name, ab.manu_stock AS Stock,ab.total_stock AS empty,ab.total_stock,UL.User_name  AS SendUser,
 | 
				
			||||||
 | 
												  UL2.User_name AS InCheckUser,
 | 
				
			||||||
 | 
					                                re.supervisor_name AS CheckUser,ab.manu_stock,ab.total_stock,ab.user_id1,ab.user_id2,ab.out_Quantity 
 | 
				
			||||||
 | 
					                              ,DB.BASEQUANTITY AS BaseQuantity,oi.Patient_id AS ZYH,oi.dept_name AS KS,re.anaesthetist_name AS YS,
 | 
				
			||||||
 | 
					                              IF(ab.`type`=1,'',UL.User_name) AS emptyUser
 | 
				
			||||||
 | 
							                      from account_book_g2 ab inner join drug_info di on ab.drug_id=di.Drug_ID 
 | 
				
			||||||
 | 
					                              LEFT JOIN DRUG_BASE DB ON di.DRUG_ID=DB.DRUGID AND DB.MACHINE_ID='DM3'
 | 
				
			||||||
 | 
					                              LEFT JOIN order_info_sm oi on ab.invoice_no=oi.order_no
 | 
				
			||||||
 | 
							                      LEFT JOIN user_list UL ON ab.user_id1=UL.ID  
 | 
				
			||||||
 | 
							                      LEFT JOIN user_list UL2 ON ab.user_id2=UL.ID 
 | 
				
			||||||
 | 
							                      LEFT JOIN surgical_residual re on ab.invoice_no=re.order_no  WHERE ab.machine_id='DM3' and ab.type in(1,2) and 		                      
 | 
				
			||||||
 | 
							                      ab.create_time>'{p_startDate}' AND ab.create_time<'{p_endDate}' ";
 | 
				
			||||||
 | 
					            if (!string.IsNullOrEmpty(drug_id))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                SQL += " AND ab.drug_id='" + drug_id + "' ";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            SQL += " ORDER BY ab.drug_id,ab.Manu_No,ab.create_time asc,ab.id ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Report.DetailGrid.Recordset.QuerySQL = SQL;
 | 
				
			||||||
 | 
					            Report.PrintPreview(true);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,656 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						"Version":"6.8.1.1",
 | 
				
			||||||
 | 
						"Font":{
 | 
				
			||||||
 | 
							"Name":"宋体",
 | 
				
			||||||
 | 
							"Size":105000,
 | 
				
			||||||
 | 
							"Weight":400,
 | 
				
			||||||
 | 
							"Charset":134
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"Printer":{
 | 
				
			||||||
 | 
							"Oriention":"Landscape",
 | 
				
			||||||
 | 
							"TopMargin":0.3175,
 | 
				
			||||||
 | 
							"RightMargin":1,
 | 
				
			||||||
 | 
							"BottomMargin":0.3969
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"DetailGrid":{
 | 
				
			||||||
 | 
							"CenterView":true,
 | 
				
			||||||
 | 
							"Recordset":{
 | 
				
			||||||
 | 
								"QuerySQL":"SELECT \r\n  dmr.`drawer_no` AS drawerNo,\r\n  dmr.`col_no` AS colNo,\r\n  dmr.`type` AS `type`,\r\n  CONCAT(dmr.`quantity`,IF(dmr.`type`=32,\"(空瓶)\",\"\")) AS quantity,\r\n  dmr.`manu_no` AS manuNo,\r\n  dmr.`eff_date` AS effDate,\r\n  dmr.`operation_time` AS operationTime,\r\n  di.`drug_name` AS drugName,\r\n  di.`drug_spec` AS drugSpec,\r\n  di.`pack_unit` AS packUnit,\r\n  di.`manufactory` AS manuFactory,\r\n  di.`max_stock` AS baseQuantity,\r\n  dmr.`drug_id` AS drugId,\r\n  ul.`user_name` AS nickname\r\nFROM\r\n  dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` in (31, 32)\r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
 | 
				
			||||||
 | 
								"Field":[
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"药品名称",
 | 
				
			||||||
 | 
										"DBFieldName":"DrugName"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"日期",
 | 
				
			||||||
 | 
										"DBFieldName":"YearMD"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"批号",
 | 
				
			||||||
 | 
										"DBFieldName":"ManuNo"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"效期",
 | 
				
			||||||
 | 
										"Type":"DateTime",
 | 
				
			||||||
 | 
										"Format":"yyyy/MM/dd",
 | 
				
			||||||
 | 
										"DBFieldName":"effDate"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"领入",
 | 
				
			||||||
 | 
										"DBFieldName":"InQuantity"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"规格",
 | 
				
			||||||
 | 
										"DBFieldName":"DrugSpec"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"大单位",
 | 
				
			||||||
 | 
										"DBFieldName":"BigUnit"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"小单位",
 | 
				
			||||||
 | 
										"DBFieldName":"SmallUnit"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"基数",
 | 
				
			||||||
 | 
										"DBFieldName":"BaseQuantity"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"手术间",
 | 
				
			||||||
 | 
										"DBFieldName":"shoushuJian"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"患者姓名",
 | 
				
			||||||
 | 
										"DBFieldName":"PName"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"性别",
 | 
				
			||||||
 | 
										"DBFieldName":"Sex"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"年龄",
 | 
				
			||||||
 | 
										"DBFieldName":"Age"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"住院号",
 | 
				
			||||||
 | 
										"DBFieldName":"ZYH"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"科室",
 | 
				
			||||||
 | 
										"DBFieldName":"KS"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"使用剂量",
 | 
				
			||||||
 | 
										"DBFieldName":"UseDose"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"剩余剂量",
 | 
				
			||||||
 | 
										"DBFieldName":"ResidualDose"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"余液处理时间",
 | 
				
			||||||
 | 
										"DBFieldName":"DiposalTime"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"医师",
 | 
				
			||||||
 | 
										"DBFieldName":"YS"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"复核人",
 | 
				
			||||||
 | 
										"DBFieldName":"CheckUser"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"实物",
 | 
				
			||||||
 | 
										"DBFieldName":"Stock"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"空瓶",
 | 
				
			||||||
 | 
										"DBFieldName":"empty"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"发药人",
 | 
				
			||||||
 | 
										"DBFieldName":"SendUser"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"领药人",
 | 
				
			||||||
 | 
										"DBFieldName":"InUser"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"领药复核人",
 | 
				
			||||||
 | 
										"DBFieldName":"InCheckUser"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Name":"空瓶回收人",
 | 
				
			||||||
 | 
										"DBFieldName":"emptyUser"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								]
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"Column":[
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"日期",
 | 
				
			||||||
 | 
									"Width":2.77813
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"批次",
 | 
				
			||||||
 | 
									"Width":2.19604
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"有效期",
 | 
				
			||||||
 | 
									"Width":2.77813
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"领入",
 | 
				
			||||||
 | 
									"Width":0.820208
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"手术间",
 | 
				
			||||||
 | 
									"Width":0.79375
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"患者姓名",
 | 
				
			||||||
 | 
									"Width":1.61396
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"性别",
 | 
				
			||||||
 | 
									"Width":1.00542
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"年龄",
 | 
				
			||||||
 | 
									"Width":0.79375
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"住院号",
 | 
				
			||||||
 | 
									"Width":1.5875
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"科室",
 | 
				
			||||||
 | 
									"Width":2.2225
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"使用剂量",
 | 
				
			||||||
 | 
									"Width":1.82563
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"剩余剂量",
 | 
				
			||||||
 | 
									"Width":1.5875
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"余液处理时间",
 | 
				
			||||||
 | 
									"Width":2.59292
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"医师",
 | 
				
			||||||
 | 
									"Width":1.5875
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"复核人",
 | 
				
			||||||
 | 
									"Width":1.79917
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"空瓶回收人",
 | 
				
			||||||
 | 
									"Width":1.61396
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"实物",
 | 
				
			||||||
 | 
									"Width":1.40229
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"空瓶",
 | 
				
			||||||
 | 
									"Width":1.19063
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"发药人",
 | 
				
			||||||
 | 
									"Width":1.79917
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"Name":"Column2",
 | 
				
			||||||
 | 
									"Width":1.79917
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							],
 | 
				
			||||||
 | 
							"ColumnContent":{
 | 
				
			||||||
 | 
								"Height":2.01083,
 | 
				
			||||||
 | 
								"ColumnContentCell":[
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"日期",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"日期"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"批次",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"批号"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"有效期",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"效期"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"领入",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"领入"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"手术间",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"手术间"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"患者姓名",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"患者姓名"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"性别",
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"DataField":"性别"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"年龄",
 | 
				
			||||||
 | 
										"DataField":"年龄"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"住院号",
 | 
				
			||||||
 | 
										"DataField":"住院号"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"科室",
 | 
				
			||||||
 | 
										"DataField":"科室"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"使用剂量",
 | 
				
			||||||
 | 
										"DataField":"使用剂量"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"剩余剂量",
 | 
				
			||||||
 | 
										"DataField":"剩余剂量"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"余液处理时间",
 | 
				
			||||||
 | 
										"DataField":"余液处理时间"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"医师",
 | 
				
			||||||
 | 
										"DataField":"医师"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"复核人",
 | 
				
			||||||
 | 
										"DataField":"复核人"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"空瓶回收人",
 | 
				
			||||||
 | 
										"DataField":"空瓶回收人"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"实物",
 | 
				
			||||||
 | 
										"DataField":"实物"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"空瓶",
 | 
				
			||||||
 | 
										"DataField":"空瓶"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"发药人",
 | 
				
			||||||
 | 
										"DataField":"发药人"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Column":"Column2",
 | 
				
			||||||
 | 
										"DataField":"领药复核人"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								]
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"ColumnTitle":{
 | 
				
			||||||
 | 
								"Height":2.59292,
 | 
				
			||||||
 | 
								"RepeatStyle":"OnPage",
 | 
				
			||||||
 | 
								"ColumnTitleCell":[
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":false,
 | 
				
			||||||
 | 
										"Column":"日期",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"日期"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":false,
 | 
				
			||||||
 | 
										"Column":"批次",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"批号"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":false,
 | 
				
			||||||
 | 
										"Column":"有效期",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"有效期"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":false,
 | 
				
			||||||
 | 
										"Column":"领入",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"领\r\n入"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":true,
 | 
				
			||||||
 | 
										"Name":"Column1",
 | 
				
			||||||
 | 
										"ColumnTitleCell":[
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"手术间",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"手\r\n术\r\n间"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"患者姓名",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"患者\r\n姓名"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"性别",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"性\r\n别"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"年龄",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"年\r\n龄"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"住院号",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"住院号"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"科室",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"科室"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"使用剂量",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"使用\r\n剂量"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"剩余剂量",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"剩余\r\n剂量"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"余液处理时间",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"余液\r\n处理\r\n时间"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"医师",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"医师"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"复核人",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"复核人"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"空瓶回收人",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"空瓶\r\n回收人"
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"使用"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":true,
 | 
				
			||||||
 | 
										"Name":"Column3",
 | 
				
			||||||
 | 
										"ColumnTitleCell":[
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"实物",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"实物"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"空瓶",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"空瓶"
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"结存数"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":true,
 | 
				
			||||||
 | 
										"Name":"Column4",
 | 
				
			||||||
 | 
										"ColumnTitleCell":[
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"GroupTitle":false,
 | 
				
			||||||
 | 
												"Column":"发药人",
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":120000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
												"Text":"发药人"
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"领药人"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"GroupTitle":false,
 | 
				
			||||||
 | 
										"Column":"Column2",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"复核人"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								]
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"PageHeader":{
 | 
				
			||||||
 | 
							"Height":0
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"Parameter":[
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"Name":"startDate",
 | 
				
			||||||
 | 
								"DataType":"DateTime",
 | 
				
			||||||
 | 
								"Format":"yyyy-MM-dd hh:mm:ss",
 | 
				
			||||||
 | 
								"Value":"2023/1/1"
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"Name":"endDate",
 | 
				
			||||||
 | 
								"DataType":"DateTime",
 | 
				
			||||||
 | 
								"Format":"yyyy-MM-dd hh:mm:ss",
 | 
				
			||||||
 | 
								"Value":"2023/4/28 23:59:59"
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"Name":"machine_id",
 | 
				
			||||||
 | 
								"Value":"DM1"
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						],
 | 
				
			||||||
 | 
						"ReportHeader":[
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"Name":"ReportHeader1",
 | 
				
			||||||
 | 
								"Height":1.5875,
 | 
				
			||||||
 | 
								"Control":[
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Type":"MemoBox",
 | 
				
			||||||
 | 
										"Name":"MemoBox2",
 | 
				
			||||||
 | 
										"Dock":"Fill",
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":217500,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"TextAlign":"MiddleCenter",
 | 
				
			||||||
 | 
										"Text":"湘谭县人民医院麻醉药品、麻精神药品专用账本(手术室)"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								],
 | 
				
			||||||
 | 
								"RepeatOnPage":true
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"Name":"ReportHeader2",
 | 
				
			||||||
 | 
								"Height":1.00542,
 | 
				
			||||||
 | 
								"Control":[
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"Type":"MemoBox",
 | 
				
			||||||
 | 
										"Name":"MemoBox3",
 | 
				
			||||||
 | 
										"Dock":"Fill",
 | 
				
			||||||
 | 
										"Border":{
 | 
				
			||||||
 | 
											"Styles":"[DrawLeft|DrawTop|DrawRight]"
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"Font":{
 | 
				
			||||||
 | 
											"Name":"宋体",
 | 
				
			||||||
 | 
											"Size":120000,
 | 
				
			||||||
 | 
											"Bold":true,
 | 
				
			||||||
 | 
											"Charset":134
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
										"Text":"药品名称:[#药品名称#]                          规格:[#规格#]         单位:[#大单位#]   基数:[#基数#]"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								],
 | 
				
			||||||
 | 
								"RepeatOnPage":true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,144 @@
 | 
				
			||||||
 | 
					using DM_Weight.Models;
 | 
				
			||||||
 | 
					using DM_Weight.msg;
 | 
				
			||||||
 | 
					using DM_Weight.Report;
 | 
				
			||||||
 | 
					using DM_Weight.util;
 | 
				
			||||||
 | 
					using Prism.Commands;
 | 
				
			||||||
 | 
					using Prism.Events;
 | 
				
			||||||
 | 
					using Prism.Mvvm;
 | 
				
			||||||
 | 
					using Prism.Regions;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class AccountWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static AccountWindowViewModel vm;
 | 
				
			||||||
 | 
					        private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private DateTime? nowDate = 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? _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);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        IEventAggregator _eventAggregator;
 | 
				
			||||||
 | 
					        public AccountWindowViewModel(IEventAggregator eventAggregator)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            _eventAggregator = eventAggregator;
 | 
				
			||||||
 | 
					            vm = this;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 导出账册
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public DelegateCommand DownloadAccountBook
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => new DelegateCommand(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if(DrugInfo==null||string.IsNullOrEmpty(DrugInfo.DrugId))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    AlertMsg alertMsg = new AlertMsg
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        Message = $"请选择药品!",
 | 
				
			||||||
 | 
					                        Type = MsgType.ERROR,
 | 
				
			||||||
 | 
					                    };
 | 
				
			||||||
 | 
					                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                GridReportUtil.PrintReportAccountBook(StartDate, EndDate, DrugInfo.DrugId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public bool KeepAlive => false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
				
			||||||
 | 
					        {  
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //药品信息
 | 
				
			||||||
 | 
					            GetAllDrugInfos();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 药品
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        private List<DrugInfo>? _drugInfos;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<DrugInfo>? DrugInfos
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _drugInfos;
 | 
				
			||||||
 | 
					            set => SetProperty(ref _drugInfos, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private DrugInfo? _drugInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public DrugInfo? DrugInfo
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _drugInfo;
 | 
				
			||||||
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                SetProperty(ref _drugInfo, value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private void GetAllDrugInfos()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
				
			||||||
 | 
					            DrugInfos = list;
 | 
				
			||||||
 | 
					            DrugInfo = list[0];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        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)as DrugName FROM `drug_info` d";
 | 
				
			||||||
 | 
					            if (string.IsNullOrEmpty(text))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (DrugInfos != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                DrugInfos.Clear();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -316,8 +316,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                               .Where(oi => oi.DmStatus == 1)
 | 
					                               .Where(oi => oi.DmStatus == 1)
 | 
				
			||||||
                               .Where(oi => oi.HisDispFlag == 0)
 | 
					                               .Where(oi => oi.HisDispFlag == 0)
 | 
				
			||||||
                               .Where(oi => oi.CancelFlag == 0)
 | 
					                               .Where(oi => oi.CancelFlag == 0)
 | 
				
			||||||
                               .Where(oi => oi.DrawerCode==DrawerNo+1)
 | 
					                               .Where(oi => oi.DrawerCode == DrawerNo + 1)
 | 
				
			||||||
                               .Where(oi=>oi._OrderDetail.SetManuNo!=null && oi._OrderDetail.SetManuNo != "null")
 | 
					                               .Where(oi => oi._OrderDetail.SetManuNo != null)
 | 
				
			||||||
                               .Where(oi => oi._OrderDetail.Quantity > 0)
 | 
					                               .Where(oi => oi._OrderDetail.Quantity > 0)
 | 
				
			||||||
                               .OrderBy(oi => oi.OrderId)
 | 
					                               .OrderBy(oi => oi.OrderId)
 | 
				
			||||||
                               .ToPageList(PageNum, PageSize, ref totalCount);
 | 
					                               .ToPageList(PageNum, PageSize, ref totalCount);
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    OrderInfoList.ForEach(oi => oi.ItemIsChecked = true);
 | 
					                    OrderInfoList.ForEach(oi => oi.ItemIsChecked = true);
 | 
				
			||||||
                    //OrderInfoList.ForEach(oi => oi.OrderDetailList.ForEach(od => od.DrugInfo = od.DrugInfo ?? new DrugInfo()));
 | 
					                    //OrderInfoList.ForEach(oi => oi.OrderDetailList.ForEach(od => od.DrugInfo = od.DrugInfo ?? new DrugInfo()));
 | 
				
			||||||
                    OrderInfoList.ForEach(oi => oi._OrderDetail.DrugInfo= oi._OrderDetail.DrugInfo ?? new DrugInfo());
 | 
					                    OrderInfoList.ForEach(oi => oi._OrderDetail.DrugInfo = oi._OrderDetail.DrugInfo ?? new DrugInfo());
 | 
				
			||||||
                    //TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).GroupBy(oi => oi.OrderDetailList.DrugInfo.DrugName).Select(oi => new TotalDrug { DrugName = oi.Key, TotalCount = oi.Sum(item => item.OrderDetailList.Quantity) }).ToList();
 | 
					                    //TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).GroupBy(oi => oi.OrderDetailList.DrugInfo.DrugName).Select(oi => new TotalDrug { DrugName = oi.Key, TotalCount = oi.Sum(item => item.OrderDetailList.Quantity) }).ToList();
 | 
				
			||||||
                    TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).Select(OrderDetailList => OrderDetailList._OrderDetail).GroupBy(item => item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
 | 
					                    TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).Select(OrderDetailList => OrderDetailList._OrderDetail).GroupBy(item => item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -485,7 +485,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                PatientId = oi.PatientId,
 | 
					                                PatientId = oi.PatientId,
 | 
				
			||||||
                                Pharmacy = oi.Pharmacy,
 | 
					                                Pharmacy = oi.Pharmacy,
 | 
				
			||||||
                                State = 2,
 | 
					                                State = 2,
 | 
				
			||||||
                                WinNo= DrawerNo+1+"号手术间",
 | 
					                                WinNo = DrawerNo + 1 + "号手术间",
 | 
				
			||||||
                                Operator = HomeWindowViewModel.Operator?.Nickname,
 | 
					                                Operator = HomeWindowViewModel.Operator?.Nickname,
 | 
				
			||||||
                            }).ExecuteCommand();
 | 
					                            }).ExecuteCommand();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -495,79 +495,92 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                        //for (int j = 0; j < oi._OrderDetail.Count; j++)
 | 
					                        //for (int j = 0; j < oi._OrderDetail.Count; j++)
 | 
				
			||||||
                        //{
 | 
					                        //{
 | 
				
			||||||
                        //    oi._OrderDetail = oi.OrderDetailList[j];
 | 
					                        //    oi._OrderDetail = oi.OrderDetailList[j];
 | 
				
			||||||
                            int drawerNo = DrawerNo + 1;
 | 
					                        int drawerNo = DrawerNo + 1;
 | 
				
			||||||
                            ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
					                        ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
				
			||||||
                                             .Where(cs => cs.DrugId == oi._OrderDetail.DrugId
 | 
					                                         .Where(cs => cs.DrugId == oi._OrderDetail.DrugId
 | 
				
			||||||
                                                    && cs.ManuNo == oi._OrderDetail.SetManuNo
 | 
					                                                && cs.ManuNo == oi._OrderDetail.SetManuNo
 | 
				
			||||||
                                                    // && cs.EffDate == oi._OrderDetail.SetEffDate
 | 
					                                                // && cs.EffDate == oi._OrderDetail.SetEffDate
 | 
				
			||||||
                                                    && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
 | 
					                                                && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
 | 
				
			||||||
                                                    && cs.DrawerNo == drawerNo
 | 
					                                                && cs.DrawerNo == drawerNo
 | 
				
			||||||
                                                    && cs.Quantity >= oi._OrderDetail.Quantity).First();
 | 
					                                                && cs.Quantity >= oi._OrderDetail.Quantity).First();
 | 
				
			||||||
                            if (cs == null)
 | 
					                        if (cs == null)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo};";
 | 
				
			||||||
 | 
					                            continue;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        cs.Quantity = cs.Quantity - oi._OrderDetail.Quantity;
 | 
				
			||||||
 | 
					                        cs.NeedNum = cs.NeedNum + oi._OrderDetail.Quantity;
 | 
				
			||||||
 | 
					                        // 更新数据 库存信息
 | 
				
			||||||
 | 
					                        SqlSugarHelper.Db.Updateable(cs).UpdateColumns(it => new { it.Quantity, it.NeedNum }).ExecuteCommand();
 | 
				
			||||||
 | 
					                       
 | 
				
			||||||
 | 
					                        // 获取更新完库存后的药品库存
 | 
				
			||||||
 | 
					                        List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
				
			||||||
 | 
					                            .Where(it => it.MachineId.Equals(cs.MachineId) || it.MachineId.Equals(ConfigurationManager.AppSettings["dm_machineId"]))
 | 
				
			||||||
 | 
					                            .Where(it => it.DrugId.Equals(cs.DrugId))
 | 
				
			||||||
 | 
					                            .Where(it => it.ManuNo.Equals(cs.ManuNo))
 | 
				
			||||||
 | 
					                            .Where(it => it.DrawerType == 1)
 | 
				
			||||||
 | 
					                            .ToList();
 | 
				
			||||||
 | 
					                        if (cs != null)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo};";
 | 
					                                MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
 | 
				
			||||||
                                continue;
 | 
					                                DrawerNo = cs.DrawerNo,
 | 
				
			||||||
                            }
 | 
					                                ColNo = cs.ColNo,
 | 
				
			||||||
                            cs.Quantity = cs.Quantity - oi._OrderDetail.Quantity;
 | 
					                                DrugId = cs.DrugId,
 | 
				
			||||||
                            cs.NeedNum = cs.NeedNum + oi._OrderDetail.Quantity;
 | 
					                                ManuNo = cs.ManuNo,
 | 
				
			||||||
                            // 更新数据 库存信息
 | 
					                                EffDate = !String.IsNullOrEmpty(cs.EffDate) ? DateTime.ParseExact(cs.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
 | 
				
			||||||
                            SqlSugarHelper.Db.Updateable(cs).UpdateColumns(it => new { it.Quantity, it.NeedNum }).ExecuteCommand();
 | 
					                                Operator = HomeWindowViewModel.Operator?.Id,
 | 
				
			||||||
 | 
					                                Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
				
			||||||
 | 
					                                OperationTime = DateTime.Now,
 | 
				
			||||||
 | 
					                                Quantity = oi._OrderDetail.Quantity,
 | 
				
			||||||
 | 
					                                Type = 2,
 | 
				
			||||||
 | 
					                                InvoiceId = oi.OrderNo
 | 
				
			||||||
 | 
					                                //, StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
				
			||||||
 | 
					                            }).ExecuteCommand();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            if (cs != null)
 | 
					                            #region 记录 注射剂使用与交接记录报表
 | 
				
			||||||
 | 
					                            //查询发药时间
 | 
				
			||||||
 | 
					                            //MachineRecord SendMachineRecord = SqlSugarHelper.Db.Queryable<MachineRecord>().Where(mr => mr.DrawerNo == cs.DrawerNo && mr.Type == 2)
 | 
				
			||||||
 | 
					                            //.OrderByDescending(mr => mr.OperationTime)
 | 
				
			||||||
 | 
					                            //.First();
 | 
				
			||||||
 | 
					                            //string retUser = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM5") && cl.DrawerNo == cs.DrawerNo)
 | 
				
			||||||
 | 
					                            //.Select(cl => cl.BelongUser).First();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            RejectionReport rejectionReport = SqlSugarHelper.Db.Queryable<RejectionReport>().Where(rp => rp.DrugId == cs.DrugId && rp.DrawerNo == cs.DrawerNo).OrderByDescending(rp => rp.SendDate).First();
 | 
				
			||||||
 | 
					                            if (rejectionReport != null)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
 | 
					                                //发药信息
 | 
				
			||||||
 | 
					                                //RejectionReport rejectionReport = new RejectionReport();
 | 
				
			||||||
 | 
					                                //rejectionReport.SendDate = SendMachineRecord.OperationTime;
 | 
				
			||||||
 | 
					                                //rejectionReport.SendUser = SendMachineRecord.Operator.ToString();
 | 
				
			||||||
 | 
					                                //rejectionReport.ReceiveUser = retUser;
 | 
				
			||||||
 | 
					                                rejectionReport.RealNum = cs.BaseQuantity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
					                                //还药信息
 | 
				
			||||||
                                {
 | 
					                                rejectionReport.InfactNum = cs.BaseQuantity - oi._OrderDetail.Quantity;
 | 
				
			||||||
                                    MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
 | 
					                                rejectionReport.EmptyNum = oi._OrderDetail.Quantity;
 | 
				
			||||||
                                    DrawerNo = cs.DrawerNo,
 | 
					                                rejectionReport.ReturnTime = DateTime.Now.ToString();
 | 
				
			||||||
                                    ColNo = cs.ColNo,
 | 
					                                rejectionReport.ReturnUser = rejectionReport.SendUser;
 | 
				
			||||||
                                    DrugId = cs.DrugId,
 | 
					                                rejectionReport.ReturnReceiveUser = rejectionReport.ReceiveUser;// SendMachineRecord.Operator.ToString();
 | 
				
			||||||
                                    ManuNo = cs.ManuNo,
 | 
					                                rejectionReport.DrugId = oi._OrderDetail.DrugId;
 | 
				
			||||||
                                    EffDate = !String.IsNullOrEmpty(cs.EffDate) ? DateTime.ParseExact(cs.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
 | 
					                                rejectionReport.DrugName = oi._OrderDetail.DrugInfo.DrugName;
 | 
				
			||||||
                                    Operator = HomeWindowViewModel.Operator?.Id,
 | 
					                                rejectionReport.DrugSpec = oi._OrderDetail.DrugInfo.DrugSpec;
 | 
				
			||||||
                                    Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
					 | 
				
			||||||
                                    OperationTime = DateTime.Now,
 | 
					 | 
				
			||||||
                                    Quantity = oi._OrderDetail.Quantity,
 | 
					 | 
				
			||||||
                                    Type = 2,
 | 
					 | 
				
			||||||
                                    InvoiceId = oi.OrderNo
 | 
					 | 
				
			||||||
                                    //, StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
					 | 
				
			||||||
                                }).ExecuteCommand();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                #region 记录 注射剂使用与交接记录报表
 | 
					                                rejectionReport.OperationTime = DateTime.Now;
 | 
				
			||||||
                                //查询发药时间
 | 
					 | 
				
			||||||
                                //MachineRecord SendMachineRecord = SqlSugarHelper.Db.Queryable<MachineRecord>().Where(mr => mr.DrawerNo == cs.DrawerNo && mr.Type == 2)
 | 
					 | 
				
			||||||
                                //.OrderByDescending(mr => mr.OperationTime)
 | 
					 | 
				
			||||||
                                //.First();
 | 
					 | 
				
			||||||
                                //string retUser = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM5") && cl.DrawerNo == cs.DrawerNo)
 | 
					 | 
				
			||||||
                                //.Select(cl => cl.BelongUser).First();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                RejectionReport rejectionReport = SqlSugarHelper.Db.Queryable<RejectionReport>().Where(rp => rp.DrugId == cs.DrugId && rp.DrawerNo == cs.DrawerNo).OrderByDescending(rp => rp.SendDate).First();
 | 
					 | 
				
			||||||
                                if (rejectionReport != null)
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    //发药信息
 | 
					 | 
				
			||||||
                                    //RejectionReport rejectionReport = new RejectionReport();
 | 
					 | 
				
			||||||
                                    //rejectionReport.SendDate = SendMachineRecord.OperationTime;
 | 
					 | 
				
			||||||
                                    //rejectionReport.SendUser = SendMachineRecord.Operator.ToString();
 | 
					 | 
				
			||||||
                                    //rejectionReport.ReceiveUser = retUser;
 | 
					 | 
				
			||||||
                                    rejectionReport.RealNum = cs.BaseQuantity;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                    //还药信息
 | 
					 | 
				
			||||||
                                    rejectionReport.InfactNum = cs.BaseQuantity - oi._OrderDetail.Quantity;
 | 
					 | 
				
			||||||
                                    rejectionReport.EmptyNum = oi._OrderDetail.Quantity;
 | 
					 | 
				
			||||||
                                    rejectionReport.ReturnTime = DateTime.Now.ToString();
 | 
					 | 
				
			||||||
                                    rejectionReport.ReturnUser = rejectionReport.SendUser;
 | 
					 | 
				
			||||||
                                    rejectionReport.ReturnReceiveUser = rejectionReport.ReceiveUser;// SendMachineRecord.Operator.ToString();
 | 
					 | 
				
			||||||
                                    rejectionReport.DrugId = oi._OrderDetail.DrugId;
 | 
					 | 
				
			||||||
                                    rejectionReport.DrugName = oi._OrderDetail.DrugInfo.DrugName;
 | 
					 | 
				
			||||||
                                    rejectionReport.DrugSpec = oi._OrderDetail.DrugInfo.DrugSpec;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                    rejectionReport.OperationTime = DateTime.Now;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                    int iRejectionReport = SqlSugarHelper.Db.Updateable(rejectionReport).ExecuteCommand();
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                #endregion
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                int iRejectionReport = SqlSugarHelper.Db.Updateable(rejectionReport).ExecuteCommand();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					                            #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            //}
 | 
				
			||||||
 | 
					                            //查询上一条账册中的空瓶数
 | 
				
			||||||
 | 
					                            AccountBookG2 accountBookEmpty = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
				
			||||||
 | 
					                            .Where(ab => ab.MachineId.Equals(ConfigurationManager.AppSettings["dm_machineId"].ToString()))
 | 
				
			||||||
 | 
					                            .Where(ab => ab.Type == 1 || ab.Type == 2)
 | 
				
			||||||
 | 
					                            .Where(ab => ab.DrugId == oi._OrderDetail.DrugId)
 | 
				
			||||||
 | 
					                            .Where(ab => ab.ManuNo == cs.ManuNo).OrderByDescending(ab =>  ab.Id).First();
 | 
				
			||||||
                            //保存账册
 | 
					                            //保存账册
 | 
				
			||||||
                            int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
					                            int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
| 
						 | 
					@ -583,8 +596,10 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
 | 
					                                MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
 | 
				
			||||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
					                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
				
			||||||
                                CreateTime = DateTime.Now,
 | 
					                                CreateTime = DateTime.Now,
 | 
				
			||||||
                                InvoiceNo = oi.OrderNo
 | 
					                                InvoiceNo = oi.OrderNo,
 | 
				
			||||||
 | 
					                                ManuStock = nowChannels.Sum(it => it.Quantity),
 | 
				
			||||||
 | 
					                                TotalStock = (accountBookEmpty != null ? (accountBookEmpty.TotalStock > 0 ? accountBookEmpty.TotalStock : 0) : 0) + oi._OrderDetail.Quantity,
 | 
				
			||||||
 | 
					                                ShoushuJian= drawerNo.ToString()
 | 
				
			||||||
                            }).ExecuteCommand();
 | 
					                            }).ExecuteCommand();
 | 
				
			||||||
                            //修改凌晨生成的日结存与总结存数据
 | 
					                            //修改凌晨生成的日结存与总结存数据
 | 
				
			||||||
                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
					                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
				
			||||||
| 
						 | 
					@ -654,7 +669,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        //}
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (!string.IsNullOrEmpty(empChannelStock))
 | 
					                    if (!string.IsNullOrEmpty(empChannelStock))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -745,7 +760,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    //ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
 | 
					                    //ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
 | 
				
			||||||
                    try
 | 
					                    try
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        _socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo) }); 
 | 
					                        _socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo) });
 | 
				
			||||||
                        _socketHelper.dateTime = DateTime.Now;
 | 
					                        _socketHelper.dateTime = DateTime.Now;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    catch (Exception ex)
 | 
					                    catch (Exception ex)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -532,6 +532,12 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                PremissionName = "药箱药品调整",
 | 
					                PremissionName = "药箱药品调整",
 | 
				
			||||||
                PremissionPath = "ExchangeWindow",
 | 
					                PremissionPath = "ExchangeWindow",
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					            PremissionDm sysset6 = new PremissionDm
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Id = 59,
 | 
				
			||||||
 | 
					                PremissionName = "账册",
 | 
				
			||||||
 | 
					                PremissionPath = "AccountWindow",
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
            syssetChild.Add(sysset1);
 | 
					            syssetChild.Add(sysset1);
 | 
				
			||||||
            syssetChild.Add(sysset2);
 | 
					            syssetChild.Add(sysset2);
 | 
				
			||||||
            syssetChild.Add(syssetLogin);
 | 
					            syssetChild.Add(syssetLogin);
 | 
				
			||||||
| 
						 | 
					@ -541,6 +547,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            syssetChild.Add(sysset3);
 | 
					            syssetChild.Add(sysset3);
 | 
				
			||||||
            syssetChild.Add(sysset4);
 | 
					            syssetChild.Add(sysset4);
 | 
				
			||||||
            syssetChild.Add(sysset5);
 | 
					            syssetChild.Add(sysset5);
 | 
				
			||||||
 | 
					            syssetChild.Add(sysset6);
 | 
				
			||||||
            sysset.Children = syssetChild;
 | 
					            sysset.Children = syssetChild;
 | 
				
			||||||
            defaultAll.Add(sysset);
 | 
					            defaultAll.Add(sysset);
 | 
				
			||||||
            #endregion
 | 
					            #endregion
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,65 @@
 | 
				
			||||||
 | 
					<UserControl x:Class="DM_Weight.Views.AccountWindow"
 | 
				
			||||||
 | 
					             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
				
			||||||
 | 
					             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
				
			||||||
 | 
					             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
 | 
				
			||||||
 | 
					             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
 | 
				
			||||||
 | 
					             xmlns:local="clr-namespace:DM_Weight.Views"
 | 
				
			||||||
 | 
					             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
 | 
				
			||||||
 | 
					            xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
				
			||||||
 | 
					            xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
				
			||||||
 | 
					            xmlns:prism="http://prismlibrary.com/"
 | 
				
			||||||
 | 
					            xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
				
			||||||
 | 
					            mc:Ignorable="d" 
 | 
				
			||||||
 | 
					            d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
 | 
				
			||||||
 | 
					    <Grid>
 | 
				
			||||||
 | 
					        <Grid.RowDefinitions>
 | 
				
			||||||
 | 
					            <RowDefinition Height="Auto" />
 | 
				
			||||||
 | 
					            <RowDefinition />
 | 
				
			||||||
 | 
					            <RowDefinition Height="Auto" />
 | 
				
			||||||
 | 
					        </Grid.RowDefinitions>
 | 
				
			||||||
 | 
					        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
				
			||||||
 | 
					            <Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="2*" />
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="2*" />
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="2*" />
 | 
				
			||||||
 | 
					                <ColumnDefinition Width="5*"/>
 | 
				
			||||||
 | 
					            </Grid.ColumnDefinitions>
 | 
				
			||||||
 | 
					            <DatePicker
 | 
				
			||||||
 | 
					             Grid.Column="0"
 | 
				
			||||||
 | 
					             SelectedDate="{Binding StartDate, TargetNullValue=''}"
 | 
				
			||||||
 | 
					             Margin="6 0 0 0"
 | 
				
			||||||
 | 
					             materialDesign:HintAssist.Hint="开始时间"
 | 
				
			||||||
 | 
					             Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
				
			||||||
 | 
					         />
 | 
				
			||||||
 | 
					            <DatePicker
 | 
				
			||||||
 | 
					             Grid.Column="1"
 | 
				
			||||||
 | 
					             SelectedDate="{Binding EndDate}"
 | 
				
			||||||
 | 
					             Margin="6 0 0 0"
 | 
				
			||||||
 | 
					             materialDesign:HintAssist.Hint="结束时间"
 | 
				
			||||||
 | 
					             Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
				
			||||||
 | 
					         />
 | 
				
			||||||
 | 
					            <ComboBox
 | 
				
			||||||
 | 
					                 Margin="6 0 6 0"
 | 
				
			||||||
 | 
					                 Grid.Column="2"
 | 
				
			||||||
 | 
					                 materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
 | 
				
			||||||
 | 
					                 ItemsSource="{Binding DrugInfos}"
 | 
				
			||||||
 | 
					                 SelectedItem="{Binding DrugInfo}"
 | 
				
			||||||
 | 
					                 DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
				
			||||||
 | 
					             />
 | 
				
			||||||
 | 
					            <StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
				
			||||||
 | 
					                <Button
 | 
				
			||||||
 | 
					                 Margin="0 0 3 0"
 | 
				
			||||||
 | 
					                 VerticalAlignment="Center"
 | 
				
			||||||
 | 
					                 Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
				
			||||||
 | 
					                 ToolTip="导出" Command="{Binding DownloadAccountBook}">
 | 
				
			||||||
 | 
					                    <StackPanel Orientation="Horizontal">
 | 
				
			||||||
 | 
					                        <materialDesign:PackIcon Kind="download" />
 | 
				
			||||||
 | 
					                        <TextBlock Text="导出账册" />
 | 
				
			||||||
 | 
					                    </StackPanel>
 | 
				
			||||||
 | 
					                </Button>
 | 
				
			||||||
 | 
					            </StackPanel>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        </Grid>
 | 
				
			||||||
 | 
					    </Grid>
 | 
				
			||||||
 | 
					</UserControl>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// AccountWindow.xaml 的交互逻辑
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public partial class AccountWindow : UserControl
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        AccountWindowViewModel vms;
 | 
				
			||||||
 | 
					        public AccountWindow()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            InitializeComponent();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 药品名称下拉框
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="sender"></param>
 | 
				
			||||||
 | 
					        /// <param name="e"></param>
 | 
				
			||||||
 | 
					        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;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void UserControl_Loaded(object sender, RoutedEventArgs e)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            vms = AccountWindowViewModel.vm;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue