diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs index d93fcf81..b6516f52 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs @@ -57,6 +57,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " '' DeliveryOrderNo,--出库单号\n" + " ISNULL ( temp3.Qty, 0 ) ReturnQty,\n" + " WMSDeliveryQty - ISNULL ( temp3.Qty, 0 ) RealQty \n" + + "FROM\n" + " (\n" + " SELECT ROW_NUMBER\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs index 70306950..09b4ca55 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs @@ -594,7 +594,30 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " BillNum,\n" + " SapMaterialCode,\n" + " Price, \n" + -" Extend\n" + +" Extend union all\n " + + +"SELECT\n" + +"'4007' LOGN,\n" + +"'其他出库' AS Type,\n" + +"'其他出库' Client,\n" + +"'Z37' CODE,\n" + +"'10' SaleCode,\n" + +"CustomerCode ClientCode,\n" + +"BillNum,\n" + +"MaterialCode,\n" + +"SUM( Qty ) Qty,\n" + +"0 IsBack,\n" + +"Price\n" + +"FROM\n" + +"Set_WmsCustomerKanbanOutPutDetial\n" + +"WHERE\n" + +"VERSION = '{0}' AND STATE<>4\n" + +"GROUP BY\n" + +"BillNum,\n" + +"MaterialCode,\n" + +"Price ,\n" + +"CustomerCode\n" + + " ) temp\n" + " LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" + " ) t1 UNION ALL\n" + @@ -865,14 +888,40 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " BillNum,\n" + " SapMaterialCode,\n" + " Price, \n" + -" Extend \n"+ +" Extend union all\n"+ + + +"SELECT\n" + +"'4007' LOGN,\n" + +"'其他出库' AS Type,\n" + +"'其他出库' Client,\n" + +"'Z37' CODE,\n" + +"'10' SaleCode,\n" + +"CustomerCode ClientCode,\n" + +"BillNum,\n" + +"MaterialCode,\n" + +"SUM( Qty ) Qty,\n" + +"0 IsBack,\n" + +"Price\n" + +"FROM\n" + +"Set_WmsCustomerKanbanOutPutDetial\n" + +"WHERE\n" + +"VERSION = '{0}' AND STATE<>4\n" + +"AND State = 2\n" + +"GROUP BY\n" + +"BillNum,\n" + +"MaterialCode,\n" + +"Price ,\n" + +"CustomerCode\n"+ -" ) temp\n" + + + + " ) temp\n" + " LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" + " ) t2 \n" + " ) TEMP PIVOT ( SUM( QTY ) FOR STATE IN ([ 0 ],[ 1 ],[ 2 ],[ 3 ]) ) A \n" + @@ -1057,12 +1106,23 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQWithOutKanbanOutPutDetial \n" + "WHERE\n" + " VERSION = '{0}' \n" + -" AND STATE = 3"+ - - - - - +" AND STATE = 3 union all \n"+ +"SELECT\n" + +"'其他结算' AS Type,\n" + +"customercode Client,\n" + +"BillNum,\n" + +"SapMaterialCode,\n" + +"Qty Qty,\n" + +"Qty OutputQty,\n" + +"'0' IsBack,\n" + +"Price,\n" + +"Kanban CNumber,\n" + +"Remark\n" + +"FROM\n" + +"Set_WmsCustomerKanbanOutPutDetial\n" + +"WHERE\n" + +"VERSION = '{0}'\n" + +"AND State =3\n"+ @@ -1238,7 +1298,29 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " IsBack = 1 \n" + " AND VERSION = '{0}' \n" + " AND State =2 \n" + - " ) temp1\n" + + + + "Union All\n"+ + + "SELECT\n" + +"'其他结算' AS Type,\n" + +"customercode Client,\n" + +"BillNum,\n" + +"SapMaterialCode,\n" + +"Qty Qty,\n" + +"Qty OutputQty,\n" + +"'0' IsBack,\n" + +"Price,\n" + +"Kanban CNumber,\n" + +"Remark\n" + +"FROM\n" + +"Set_WmsCustomerKanbanOutPutDetial\n" + +"WHERE\n" + +"VERSION = '{0}'\n" + +"AND State =2\n" + + + + " ) temp1\n" + " LEFT JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp1.MaterialCode = temp2.MaterialCode"; //var _sql = "SELECT\n" + // " ROW_NUMBER ( ) OVER ( ORDER BY Type DESC ) 行号 ,\n" +