diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs index 8255fd9c..f15d0d42 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs @@ -1,4 +1,5 @@ -using System; +using Dapper; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -14,6 +15,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public ErpSumOutputDapperRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { + } + public virtual async void InsertWmsSum(List p_list) + { + + + //DbConnection.Execute("INSERT ") + + } } } 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 080e3cf4..55dc3a14 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 @@ -14,6 +14,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public class WmsOutputSum { + [ExporterHeader(DisplayName = "行号")] + public string 行号 { set; get; } [ExporterHeader(DisplayName = "客户")] public string 客户 { set; get; } [ExporterHeader(DisplayName = "出库类型")] @@ -90,491 +92,514 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { var _sql = "SELECT\n" + - " ROW_NUMBER() OVER ( ORDER BY Type DESC ) 行号,\n" + - " Client 客户,\n" + - " Type 出库类型,\n" + - " BillNum 结算单,\n" + - " CODE 结算编码,\n" + - " SaleCode 销售渠道,\n" + - " ClientCode 客户代码,\n" + - " MaterialCode 物料号,\n" + - " MaterialDesc 物料描述,\n" + - " BillNum 结算单号,\n" + - " MaterialGroup 物料组,\n" + - " ISnull([ 0 ], 2 ) 结算数量,\n" + - " ISNULL([ 2 ], 0 ) 实际出库数量,\n" + - " isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ) 数量差异,\n" + - " Price 开票单价,\n" + - " Round( ISnull([ 0 ], 2 )* Price, 2 ) 结算金额,\n" + - " Round( ISNULL([ 2 ], 0 )* Price, 2 ) 已出库金额,\n" + - " ROUND(( isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ))* Price, 2 ) WMS待出库金额 \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " temp.Client,\n" + - " temp.CODE,\n" + - " temp.SaleCode,\n" + - " temp.ClientCode,\n" + - " temp.Type,\n" + - " temp.BillNum,\n" + - " temp.MaterialCode,\n" + - " temp2.MaterialDesc,\n" + - " temp.Qty,\n" + - " 0 STATE,\n" + - " EstimateTypeDesc MaterialGroup,\n" + - " EstimateType,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " '大众准时化出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z11' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsJitOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众看板出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z12' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众无看板出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z12' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众备件汇总出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z13' CODE,\n" + - " '20' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 1 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsSharePartOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众备件条码出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z13' CODE,\n" + - " '20' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 1 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsSharePart90OutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗看板出库' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z34' CODE,\n" + - " '10' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQHKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '一轿手工出库' AS Type,\n" + - " '一轿' Client,\n" + - " 'Z32' CODE,\n" + - " '10' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 0 \n" + - " AND VERSION = '{0}' \n" + - " AND Extend = '100113' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '一轿手工出库(备件)' AS Type,\n" + - " '一轿' Client,\n" + - " 'Z33' CODE,\n" + - " '20' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 1 \n" + - " AND VERSION = '{0}' \n" + - " AND Extend = '100113' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗手工出库' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z34' CODE,\n" + - " '10' SaleCode,\n" + - " '100053' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 0 \n" + - " AND VERSION = '{0}' \n" + - " AND Extend = '100053' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗手工出库(备件)' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z35' CODE,\n" + - " '20' SaleCode,\n" + - " '100053' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 1 \n" + - " AND VERSION = '{0}' \n" + - " AND Extend = '100053' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price \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" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " temp.Client,\n" + - " temp.CODE,\n" + - " temp.SaleCode,\n" + - " temp.ClientCode,\n" + - " temp.Type,\n" + - " temp.BillNum,\n" + - " temp.MaterialCode,\n" + - " temp2.MaterialDesc,\n" + - " temp.Qty,\n" + - " 2 STATE,\n" + - " EstimateTypeDesc MaterialGroup,\n" + - " EstimateType,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " '大众准时化出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z11' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsJitOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众看板出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z12' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众无看板出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z12' CODE,\n" + - " '10' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode MaterialCode,\n" + - " SUM( RealityNumber ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众备件汇总出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z13' CODE,\n" + - " '20' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( RealityNumber ) Qty,\n" + - " 1 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsSharePartOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '大众备件条码出库' AS Type,\n" + - " '大众' Client,\n" + - " 'Z13' CODE,\n" + - " '20' SaleCode,\n" + - " '10001' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 1 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsSharePart90OutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗看板出库' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z34' CODE,\n" + - " '10' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " 0 IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQHKanbanOutPutDetial \n" + - " WHERE\n" + - " VERSION = '{0}' \n" + - " AND State = 2 \n" + - " GROUP BY\n" + - " BillNum,\n" + - " MaterialCode,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '一轿手工出库' AS Type,\n" + - " '一轿' Client,\n" + - " 'Z32' CODE,\n" + - " '10' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( RealityNumber ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 0 \n" + - " AND VERSION = '{0}' \n" + - " AND State = 2 \n" + - " AND Extend = '100113' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '一轿手工出库(备件)' AS Type,\n" + - " '一轿' Client,\n" + - " 'Z33' CODE,\n" + - " '20' SaleCode,\n" + - " '100113' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( Qty ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 1 \n" + - " AND VERSION = '{0}' \n" + - " AND State = 2 \n" + - " AND Extend = '100113' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗手工出库' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z34' CODE,\n" + - " '10' SaleCode,\n" + - " '100053' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( RealityNumber ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 0 \n" + - " AND VERSION = '{0}' \n" + - " AND State = 2 \n" + - " AND Extend = '100053' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price UNION ALL\n" + - " SELECT\n" + - " '红旗手工出库(备件)' AS Type,\n" + - " '红旗' Client,\n" + - " 'Z35' CODE,\n" + - " '20' SaleCode,\n" + - " '100053' ClientCode,\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " SUM( RealityNumber ) Qty,\n" + - " IsBack,\n" + - " Price \n" + - " FROM\n" + - " Set_WmsHQWithOutKanbanOutPutDetial \n" + - " WHERE\n" + - " IsBack = 1 \n" + - " AND VERSION = '{0}' \n" + - " AND State = 2 \n" + - " AND Extend = '100053' \n" + - " GROUP BY\n" + - " BillNum,\n" + - " SapMaterialCode,\n" + - " IsBack,\n" + - " Price \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" + - "ORDER BY\n" + - " 客户,出库类型,结算单;"; +" ROW_NUMBER() OVER ( ORDER BY Type DESC ) 行号,\n" + +" Client 客户,\n" + +" Type 出库类型,\n" + +" BillNum 结算单,\n" + +" CODE 结算编码,\n" + +" SaleCode 销售渠道,\n" + +" ClientCode 客户代码,\n" + +" LOGN 寄售类别,\n" + +" MaterialCode 物料号,\n" + +" MaterialDesc 物料描述,\n" + +" BillNum 结算单号,\n" + +" MaterialGroup 物料组,\n" + +" ISnull([ 0 ], 2 ) 结算数量,\n" + +" ISNULL([ 2 ], 0 ) 实际出库数量,\n" + +" isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ) 数量差异,\n" + +" Price 开票单价,\n" + +" Round( ISnull([ 0 ], 2 )* Price, 2 ) 结算金额,\n" + +" Round( ISNULL([ 2 ], 0 )* Price, 2 ) 已出库金额,\n" + +" ROUND(( isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ))* Price, 2 ) WMS待出库金额 \n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" * \n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" temp.Client,\n" + +" temp.CODE,\n" + +" temp.SaleCode,\n" + +" temp.ClientCode,\n" + +" temp.Type,\n" + +" temp.BillNum,\n" + +" temp.MaterialCode,\n" + +" temp2.MaterialDesc,\n" + +" temp.Qty,\n" + +" 0 STATE,\n" + +" EstimateTypeDesc MaterialGroup,\n" + +" EstimateType,\n" + +" IsBack,\n" + +" Price ,\n" + +" LOGN\n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众准时化出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z11' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsJitOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众看板出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z12' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众无看板出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z12' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '大众备件汇总出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z13' CODE,\n" + +" '20' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 1 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsSharePartOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '大众备件条码出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z13' CODE,\n" + +" '20' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 1 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsSharePart90OutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '红旗看板出库' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z34' CODE,\n" + +" '10' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQHKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '一轿手工出库' AS Type,\n" + +" '一轿' Client,\n" + +" 'Z32' CODE,\n" + +" '10' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 0 \n" + +" AND VERSION = '{0}' \n" + +" AND Extend = '100113' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '一轿手工出库(备件)' AS Type,\n" + +" '一轿' Client,\n" + +" 'Z33' CODE,\n" + +" '20' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 1 \n" + +" AND VERSION = '{0}' \n" + +" AND Extend = '100113' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '红旗手工出库' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z34' CODE,\n" + +" '10' SaleCode,\n" + +" '100053' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 0 \n" + +" AND VERSION = '{0}' \n" + +" AND Extend = '100053' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '红旗手工出库(备件)' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z35' CODE,\n" + +" '20' SaleCode,\n" + +" '100053' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 1 \n" + +" AND VERSION = '{0}' \n" + +" AND Extend = '100053' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price \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" + +" SELECT\n" + +" * \n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" temp.Client,\n" + +" temp.CODE,\n" + +" temp.SaleCode,\n" + +" temp.ClientCode,\n" + +" temp.Type,\n" + +" temp.BillNum,\n" + +" temp.MaterialCode,\n" + +" temp2.MaterialDesc,\n" + +" temp.Qty,\n" + +" 2 STATE,\n" + +" EstimateTypeDesc MaterialGroup,\n" + +" EstimateType,\n" + +" IsBack,\n" + +" Price ,\n" + +" LOGN\n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众准时化出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z11' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsJitOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众看板出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z12' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '大众无看板出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z12' CODE,\n" + +" '10' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode MaterialCode,\n" + +" SUM( RealityNumber ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '大众备件汇总出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z13' CODE,\n" + +" '20' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( RealityNumber ) Qty,\n" + +" 1 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsSharePartOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '大众备件条码出库' AS Type,\n" + +" '大众' Client,\n" + +" 'Z13' CODE,\n" + +" '20' SaleCode,\n" + +" '10001' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 1 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsSharePart90OutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '红旗看板出库' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z34' CODE,\n" + +" '10' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" 0 IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQHKanbanOutPutDetial \n" + +" WHERE\n" + +" VERSION = '{0}' \n" + +" AND State = 2 \n" + +" GROUP BY\n" + +" BillNum,\n" + +" MaterialCode,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '一轿手工出库' AS Type,\n" + +" '一轿' Client,\n" + +" 'Z32' CODE,\n" + +" '10' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( RealityNumber ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 0 \n" + +" AND VERSION = '{0}' \n" + +" AND State = 2 \n" + +" AND Extend = '100113' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '一轿手工出库(备件)' AS Type,\n" + +" '一轿' Client,\n" + +" 'Z33' CODE,\n" + +" '20' SaleCode,\n" + +" '100113' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( Qty ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 1 \n" + +" AND VERSION = '{0}' \n" + +" AND State = 2 \n" + +" AND Extend = '100113' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4007' LOGN,\n" + +" '红旗手工出库' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z34' CODE,\n" + +" '10' SaleCode,\n" + +" '100053' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( RealityNumber ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 0 \n" + +" AND VERSION = '{0}' \n" + +" AND State = 2 \n" + +" AND Extend = '100053' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price UNION ALL\n" + +" SELECT\n" + +" '4009' LOGN,\n" + +" '红旗手工出库(备件)' AS Type,\n" + +" '红旗' Client,\n" + +" 'Z35' CODE,\n" + +" '20' SaleCode,\n" + +" '100053' ClientCode,\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" SUM( RealityNumber ) Qty,\n" + +" IsBack,\n" + +" Price \n" + +" FROM\n" + +" Set_WmsHQWithOutKanbanOutPutDetial \n" + +" WHERE\n" + +" IsBack = 1 \n" + +" AND VERSION = '{0}' \n" + +" AND State = 2 \n" + +" AND Extend = '100053' \n" + +" GROUP BY\n" + +" BillNum,\n" + +" SapMaterialCode,\n" + +" IsBack,\n" + +" Price \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" + +" ORDER BY\n" + +" 客户,出库类型,结算单;"; _sql = string.Format(_sql, version); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); @@ -582,6 +607,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + + + + + + public virtual List GetWmsSumReportList(string version,string state) { @@ -739,10 +770,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) temp1"; - - - - _sql = string.Format(_sql, version,state); var _query = DbConnection.Query(_sql,null,null,true,1200,null);