diff --git a/DM_Weight/App.config b/DM_Weight/App.config index d81b521..1e3fa45 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -3,7 +3,7 @@ - + - + diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs index 2a3dd77..a7e4a67 100644 --- a/DM_Weight/Report/GridReportUtil.cs +++ b/DM_Weight/Report/GridReportUtil.cs @@ -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`, 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` - 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"; List> tableList = SqlSugarHelper.Db.SqlQueryable(SQL).ToDictionaryList(); for (int i = 0; i < tableList.Count; i++) @@ -401,19 +401,19 @@ namespace DM_Weight.Report string strValue = kvp.Value.ToString(); 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 - 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"; InTotalModel = SqlSugarHelper.Db.SqlQueryable(inQuantitySQL).First(); 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 - 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"; OutTotalModel = SqlSugarHelper.Db.SqlQueryable(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 (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}'"; StackTotalModel = SqlSugarHelper.Db.SqlQueryable(stockQuantitySQL).First(); } diff --git a/DM_Weight/ReportTemp/account_book_temp-01.grf b/DM_Weight/ReportTemp/account_book_temp-01.grf index 864ee56..f11cf97 100644 --- a/DM_Weight/ReportTemp/account_book_temp-01.grf +++ b/DM_Weight/ReportTemp/account_book_temp-01.grf @@ -299,6 +299,7 @@ "Name":"Group1", "ByFields":"drugId", "GroupHeader":{ + "Height":2.01083, "PrintGridBorder":false, "Control":[ { @@ -481,6 +482,35 @@ "Charset":134 }, "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" diff --git a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs index c571784..ccc1dc9 100644 --- a/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockNewWindowViewModel.cs @@ -29,8 +29,8 @@ namespace DM_Weight.ViewModels public static List SelectUseList = new() { - new UseFor{UseId=0,UseName="入账册"}, - new UseFor { UseId = 96, UseName = "不入账册" } + new UseFor { UseId = 96, UseName = "不入账册" }, + new UseFor{UseId=0,UseName="入账册"} }; private List _selectsUseFor = SelectUseList; @@ -482,7 +482,7 @@ namespace DM_Weight.ViewModels 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, 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) { strSql += " AND ROW_NO<=8";