报表去掉批号是空的(空瓶),报表1添加上月结存及批次,修复盘点时sql错误
This commit is contained in:
		
							parent
							
								
									c83b5b51b1
								
							
						
					
					
						commit
						663f9799d1
					
				| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
  <connectionStrings>
 | 
					  <connectionStrings>
 | 
				
			||||||
	<!-- 数据库连接字符串 -->
 | 
						<!-- 数据库连接字符串 -->
 | 
				
			||||||
	<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
 | 
						<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
 | 
				
			||||||
	<add name="database" connectionString="server=127.0.0.1;port=3306;database=sanya_xianchang2;userid=root;password=root" />
 | 
						<add name="database" connectionString="server=127.0.0.1;port=3306;database=sanya_xx;userid=root;password=root" />
 | 
				
			||||||
  </connectionStrings>
 | 
					  </connectionStrings>
 | 
				
			||||||
	<!--<runtime>
 | 
						<!--<runtime>
 | 
				
			||||||
		--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
 | 
							--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@
 | 
				
			||||||
		<!-- 抽屉串口使用的协议232或者485 -->
 | 
							<!-- 抽屉串口使用的协议232或者485 -->
 | 
				
			||||||
		<add key="DrawerProtocol" value="485" />
 | 
							<add key="DrawerProtocol" value="485" />
 | 
				
			||||||
		<!-- 抽屉串口的串口号 -->
 | 
							<!-- 抽屉串口的串口号 -->
 | 
				
			||||||
		<add key="DrawerPortPath" value="COM3" />
 | 
							<add key="DrawerPortPath" value="COM1" />
 | 
				
			||||||
		<!-- can总线串口的串口号 -->
 | 
							<!-- can总线串口的串口号 -->
 | 
				
			||||||
		<add key="CanBusPortPath" value="COM9" />
 | 
							<add key="CanBusPortPath" value="COM9" />
 | 
				
			||||||
		<!-- 条码枪串口的串口号 -->
 | 
							<!-- 条码枪串口的串口号 -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -385,7 +385,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();
 | 
				
			||||||
            for (int i = 0; i < tableList.Count; i++)
 | 
					            for (int i = 0; i < tableList.Count; i++)
 | 
				
			||||||
| 
						 | 
					@ -401,19 +401,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}' and Type<>32  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 Type<>32 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 Type<>32 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 Type<>32 and  DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'";
 | 
				
			||||||
                        StackTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(stockQuantitySQL).First();
 | 
					                        StackTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(stockQuantitySQL).First();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -299,6 +299,7 @@
 | 
				
			||||||
				"Name":"Group1",
 | 
									"Name":"Group1",
 | 
				
			||||||
				"ByFields":"drugId",
 | 
									"ByFields":"drugId",
 | 
				
			||||||
				"GroupHeader":{
 | 
									"GroupHeader":{
 | 
				
			||||||
 | 
										"Height":2.01083,
 | 
				
			||||||
					"PrintGridBorder":false,
 | 
										"PrintGridBorder":false,
 | 
				
			||||||
					"Control":[
 | 
										"Control":[
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
| 
						 | 
					@ -481,6 +482,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.00542,
 | 
				
			||||||
 | 
												"Height":0.98,
 | 
				
			||||||
 | 
												"Font":{
 | 
				
			||||||
 | 
													"Name":"宋体",
 | 
				
			||||||
 | 
													"Size":105000,
 | 
				
			||||||
 | 
													"Bold":true,
 | 
				
			||||||
 | 
													"Charset":134
 | 
				
			||||||
 | 
												},
 | 
				
			||||||
 | 
												"Text":"批号:"
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					],
 | 
										],
 | 
				
			||||||
					"NewPageColumn":"Before"
 | 
										"NewPageColumn":"Before"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 = 96, UseName = "不入账册" },
 | 
				
			||||||
            new UseFor { UseId = 96, UseName = "不入账册" }
 | 
					            new UseFor{UseId=0,UseName="入账册"}
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        private List<UseFor> _selectsUseFor = SelectUseList;
 | 
					        private List<UseFor> _selectsUseFor = SelectUseList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -482,7 +482,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                        string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
					                        string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
				
			||||||
                        string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
 | 
					                        string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
 | 
				
			||||||
                          di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
 | 
					                          di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
 | 
				
			||||||
                          cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId  FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` =  '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
 | 
					                          cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId  FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` =  '{machine_id}' AND cl.`drawer_type` = 1 ";
 | 
				
			||||||
                        if (App.SingleModel)
 | 
					                        if (App.SingleModel)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            strSql += " AND ROW_NO<=8";
 | 
					                            strSql += " AND ROW_NO<=8";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue