报表1中去掉空瓶(无批次)数据;值班柜修改为1、2号抽屉可操作
This commit is contained in:
		
							parent
							
								
									5ab35c846c
								
							
						
					
					
						commit
						27d5886dda
					
				| 
						 | 
					@ -399,7 +399,7 @@ namespace DM_Weight.Report
 | 
				
			||||||
               manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as  reviewerName,di.`drug_name` AS `drugName`,
 | 
					               manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as  reviewerName,di.`drug_name` AS `drugName`,
 | 
				
			||||||
               di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`
 | 
					               di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`
 | 
				
			||||||
               FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id  LEFT JOIN  user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
 | 
					               FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id  LEFT JOIN  user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
 | 
				
			||||||
              WHERE mr.`machine_id` = '{machine_id}' and type in(1,2,31,4,5) and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999
 | 
					              WHERE mr.`machine_id` = '{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999
 | 
				
			||||||
              GROUP BY drugId,DMYear,DMMonth,DMDay,manuNo  ORDER BY mr.drug_id,operation_time) t on dmr.id=t.id";
 | 
					              GROUP BY drugId,DMYear,DMMonth,DMDay,manuNo  ORDER BY mr.drug_id,operation_time) t on dmr.id=t.id";
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            List<Dictionary<string, object>> tableList = SqlSugarHelper.Db.SqlQueryable<dynamic>(SQL).ToDictionaryList();
 | 
					            List<Dictionary<string, object>> tableList = SqlSugarHelper.Db.SqlQueryable<dynamic>(SQL).ToDictionaryList();
 | 
				
			||||||
| 
						 | 
					@ -416,19 +416,19 @@ namespace DM_Weight.Report
 | 
				
			||||||
                        string strValue = kvp.Value.ToString();
 | 
					                        string strValue = kvp.Value.ToString();
 | 
				
			||||||
                        string inQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
 | 
					                        string inQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
 | 
				
			||||||
                                        (SELECT  sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)))  as  SumInQuantity,manu_no
 | 
					                                        (SELECT  sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)))  as  SumInQuantity,manu_no
 | 
				
			||||||
										from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) 
 | 
															from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL 
 | 
				
			||||||
                                        and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no  ORDER BY drug_id,operation_time) as t";
 | 
					                                        and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no  ORDER BY drug_id,operation_time) as t";
 | 
				
			||||||
                        InTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(inQuantitySQL).First();
 | 
					                        InTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(inQuantitySQL).First();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        string outQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
 | 
					                        string outQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
 | 
				
			||||||
                                              (SELECT sum(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) as SumInQuantity ,manu_no
 | 
					                                              (SELECT sum(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) as SumInQuantity ,manu_no
 | 
				
			||||||
											  from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) 
 | 
																  from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL 
 | 
				
			||||||
                                        and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no  ORDER BY drug_id,operation_time) as t";
 | 
					                                        and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no  ORDER BY drug_id,operation_time) as t";
 | 
				
			||||||
                        OutTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(outQuantitySQL).First();
 | 
					                        OutTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(outQuantitySQL).First();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        string stockQuantitySQL = $@"SELECT GROUP_CONCAT(a.Manu_No) as StrTotalManuNo,GROUP_CONCAT(a.manunoQuantity) as StrTotalQuantity  from dm_machine_record a inner join
 | 
					                        string stockQuantitySQL = $@"SELECT GROUP_CONCAT(a.Manu_No) as StrTotalManuNo,GROUP_CONCAT(a.manunoQuantity) as StrTotalQuantity  from dm_machine_record a inner join
 | 
				
			||||||
                                    (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record  
 | 
					                                    (select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record  
 | 
				
			||||||
                                    WHERE  DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no  ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no
 | 
					                                    WHERE  DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}'and manu_no is not NULL  GROUP BY drug_id,manu_no  ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no
 | 
				
			||||||
                                    and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE a.drug_id='{strValue}' and  DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'";
 | 
					                                    and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE a.drug_id='{strValue}' and  DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'";
 | 
				
			||||||
                        StackTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(stockQuantitySQL).First();
 | 
					                        StackTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(stockQuantitySQL).First();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -294,6 +294,7 @@
 | 
				
			||||||
				"Name":"Group1",
 | 
									"Name":"Group1",
 | 
				
			||||||
				"ByFields":"drugId",
 | 
									"ByFields":"drugId",
 | 
				
			||||||
				"GroupHeader":{
 | 
									"GroupHeader":{
 | 
				
			||||||
 | 
										"Height":2.01083,
 | 
				
			||||||
					"PrintGridBorder":false,
 | 
										"PrintGridBorder":false,
 | 
				
			||||||
					"Control":[
 | 
										"Control":[
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
| 
						 | 
					@ -476,6 +477,35 @@
 | 
				
			||||||
								"Charset":134
 | 
													"Charset":134
 | 
				
			||||||
							},
 | 
												},
 | 
				
			||||||
							"DataField":"月"
 | 
												"DataField":"月"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"Type":"StaticBox",
 | 
				
			||||||
 | 
												"Name":"StaticBox37",
 | 
				
			||||||
 | 
												"Top":1,
 | 
				
			||||||
 | 
												"Width":1.8,
 | 
				
			||||||
 | 
												"Height":0.98,
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":105000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"Text":"上月结存:"
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												"Type":"StaticBox",
 | 
				
			||||||
 | 
												"Name":"StaticBox38",
 | 
				
			||||||
 | 
												"Left":6.2177,
 | 
				
			||||||
 | 
												"Top":1,
 | 
				
			||||||
 | 
												"Width":1.08,
 | 
				
			||||||
 | 
												"Height":0.98,
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":105000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"Text":"批号:"
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					],
 | 
										],
 | 
				
			||||||
					"NewPageColumn":"Before"
 | 
										"NewPageColumn":"Before"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,8 +229,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
					            var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
				
			||||||
        .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
					        .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
				
			||||||
        .WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
 | 
					        .WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
 | 
				
			||||||
        .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					        .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
        .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					        .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
        .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					        .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
        .OrderBy(cs => cs.DrawerNo)
 | 
					        .OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
        .OrderBy(cs => cs.ColNo)
 | 
					        .OrderBy(cs => cs.ColNo)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,8 +258,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            int totalCount = 0;
 | 
					            int totalCount = 0;
 | 
				
			||||||
            var list = SqlSugarHelper.Db.Queryable<ChannelList>()
 | 
					            var list = SqlSugarHelper.Db.Queryable<ChannelList>()
 | 
				
			||||||
                .Includes<DrugInfo>(cl => cl.Drug)
 | 
					                .Includes<DrugInfo>(cl => cl.Drug)
 | 
				
			||||||
                .WhereIF(App.SingleModel, cl => cl.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cl => cl.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cl => cl.DrawerNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cl => cl.DrawerNo > 2)
 | 
				
			||||||
                .Includes<ChannelStock>(cs => cs.channelStocks)
 | 
					                .Includes<ChannelStock>(cs => cs.channelStocks)
 | 
				
			||||||
                .WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo)
 | 
					                .WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo)
 | 
				
			||||||
                .Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					                .Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,8 +159,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
 | 
					            List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
 | 
				
			||||||
                .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
					                .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
				
			||||||
                .Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate)
 | 
					                .Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate)
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.rowNo <= 1) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.rowNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.rowNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.rowNo > 2)
 | 
				
			||||||
                .ToList();
 | 
					                .ToList();
 | 
				
			||||||
            ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
 | 
					            ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
 | 
				
			||||||
            vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
 | 
					            vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -574,8 +574,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                .Where(cs => cs.DrawerType == 1)
 | 
					                .Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                .Where(cs => cs.DrugId != null)
 | 
					                .Where(cs => cs.DrugId != null)
 | 
				
			||||||
                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
 | 
				
			||||||
                .OrderBy(cs => cs.DrawerNo)
 | 
					                .OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                .OrderBy(cs => cs.ColNo)
 | 
					                .OrderBy(cs => cs.ColNo)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,8 +29,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        public static List<UseFor> SelectUseList = new()
 | 
					        public static List<UseFor> SelectUseList = new()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            new UseFor{UseId=0,UseName="入账册"},
 | 
					            new UseFor{UseId=0,UseName="不入账册"},
 | 
				
			||||||
            new UseFor { UseId = 96, UseName = "不入账册" }
 | 
					            new UseFor { UseId = 96, UseName = "入账册" }
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        private List<UseFor> _selectsUseFor = SelectUseList;
 | 
					        private List<UseFor> _selectsUseFor = SelectUseList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -722,8 +722,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                .Where(cs => cs.DrawerType == 1)
 | 
					                .Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                .Where(cs => cs.DrugId != null)
 | 
					                .Where(cs => cs.DrugId != null)
 | 
				
			||||||
                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
 | 
				
			||||||
                .OrderBy(cs => cs.DrawerNo)
 | 
					                .OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                //.OrderByDescending(cs => cs.DrawerNo)
 | 
					                //.OrderByDescending(cs => cs.DrawerNo)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -198,8 +198,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
 | 
					                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
 | 
				
			||||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
					                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
				
			||||||
                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
					                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
				
			||||||
                     .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
					                     .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
				
			||||||
                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                    .OrderBy(cs => cs.EffDate)
 | 
					                    .OrderBy(cs => cs.EffDate)
 | 
				
			||||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
					                    .OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                    .OrderBy(cs => cs.ManuNo)
 | 
					                    .OrderBy(cs => cs.ManuNo)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,8 +207,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
 | 
					                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
 | 
				
			||||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
					                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
				
			||||||
                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
					                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
				
			||||||
                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
					                    .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
 | 
				
			||||||
                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                    .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                    .OrderBy(cs => cs.EffDate)
 | 
					                    .OrderBy(cs => cs.EffDate)
 | 
				
			||||||
                    .OrderBy(cs => cs.DrawerNo)
 | 
					                    .OrderBy(cs => cs.DrawerNo)
 | 
				
			||||||
                    .OrderBy(cs => cs.ManuNo)
 | 
					                    .OrderBy(cs => cs.ManuNo)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -219,8 +219,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
					            List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
				
			||||||
                .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
					                .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
				
			||||||
                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1)
 | 
					                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                                                                      .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                                                                      .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                                                                      .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                                                                      .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                                                                      .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
 | 
					                                                                      .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
 | 
				
			||||||
                .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
					                .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,8 +184,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue))
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue))
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue))
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                .OrderBy(mr => mr.OperationTime)
 | 
					                .OrderBy(mr => mr.OperationTime)
 | 
				
			||||||
                .ToList();
 | 
					                .ToList();
 | 
				
			||||||
            MachineRecords = queryData;
 | 
					            MachineRecords = queryData;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,8 +105,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
					            Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
				
			||||||
                .LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
 | 
					                .LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
 | 
				
			||||||
                .Where((cs) => cs.DrawerType != 1)
 | 
					                .Where((cs) => cs.DrawerType != 1)
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
					                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
				
			||||||
                .Select((cs, di) => new ChannelStock{
 | 
					                .Select((cs, di) => new ChannelStock{
 | 
				
			||||||
                    CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId&&mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)) ,
 | 
					                    CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId&&mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)) ,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -212,8 +212,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            //ChannelStocks = queryData;
 | 
					            //ChannelStocks = queryData;
 | 
				
			||||||
            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
					            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
				
			||||||
                .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
					                .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                                                              .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                                                              .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                                                              .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                                                              .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                                                              .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
					                                                              .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -197,8 +197,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            //ChannelStocks = queryData;
 | 
					            //ChannelStocks = queryData;
 | 
				
			||||||
            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
					            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
				
			||||||
                .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
					                .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1 ) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2 ) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1 )
 | 
					                .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2 )
 | 
				
			||||||
                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
					                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
				
			||||||
             .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
					             .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
				
			||||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
					                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,8 +243,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
					            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
				
			||||||
               .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
					               .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
 | 
				
			||||||
                                                             .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 1) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
					                                                             .WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
 | 
				
			||||||
                                                             .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 1)
 | 
					                                                             .WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
 | 
				
			||||||
                                                             .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
					                                                             .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
				
			||||||
               .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
					               .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
				
			||||||
               .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
					               .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue