修改报表查询赋值方式
This commit is contained in:
		
							parent
							
								
									25ec8fb290
								
							
						
					
					
						commit
						2c4267d100
					
				| 
						 | 
				
			
			@ -502,12 +502,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        for (int j = 0; j < oi.OrderDetailList.Count; j++)
 | 
			
		||||
                        {
 | 
			
		||||
                            oi._OrderDetail = oi.OrderDetailList[j];
 | 
			
		||||
                            int drawerNo= DrawerNo+1;
 | 
			
		||||
                            ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                             .Where(cs => cs.DrugId == oi._OrderDetail.DrugId
 | 
			
		||||
                                                    && cs.ManuNo == oi._OrderDetail.SetManuNo
 | 
			
		||||
                                                    && cs.EffDate == oi._OrderDetail.SetEffDate
 | 
			
		||||
                                                    && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
 | 
			
		||||
                                                    && cs.DrawerNo == DrawerNo+1).First();
 | 
			
		||||
                                                    && cs.DrawerNo == drawerNo).First();
 | 
			
		||||
                            if (cs == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo},{oi._OrderDetail.SetEffDate};";
 | 
			
		||||
| 
						 | 
				
			
			@ -539,31 +540,34 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
                                #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();
 | 
			
		||||
                                //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();
 | 
			
		||||
 | 
			
		||||
                                //发药信息
 | 
			
		||||
                                RejectionReport rejectionReport = new RejectionReport();
 | 
			
		||||
                                rejectionReport.SendDate = SendMachineRecord.OperationTime;
 | 
			
		||||
                                rejectionReport.SendUser = SendMachineRecord.Operator.ToString();
 | 
			
		||||
                                rejectionReport.ReceiveUser = retUser;
 | 
			
		||||
                                //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;
 | 
			
		||||
                                rejectionReport.ReturnUser = retUser;
 | 
			
		||||
                                rejectionReport.ReturnReceiveUser = SendMachineRecord.Operator.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.Insertable(rejectionReport).ExecuteCommand();
 | 
			
		||||
                                int iRejectionReport = SqlSugarHelper.Db.Updateable(rejectionReport).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                                #endregion
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue