Browse Source

更新编码

FoShanPG
Administrator 3 years ago
parent
commit
f1ca48a9bd
  1. 880
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

880
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

@ -18,6 +18,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "出库类型")] [ExporterHeader(DisplayName = "出库类型")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "结算编码")]
public string { set; get; }
[ExporterHeader(DisplayName = "销售渠道")]
public string { set; get; }
[ExporterHeader(DisplayName = "客户代码")]
public string { set; get; }
[ExporterHeader(DisplayName = "结算单")] [ExporterHeader(DisplayName = "结算单")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "物料号")] [ExporterHeader(DisplayName = "物料号")]
@ -25,42 +31,27 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "通用代码号")] [ExporterHeader(DisplayName = "通用代码号")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "结算数量")] [ExporterHeader(DisplayName = "结算数量")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "实际出库数量")] [ExporterHeader(DisplayName = "实际出库数量")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "差异数量")] [ExporterHeader(DisplayName = "差异数量")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "开票单价")] [ExporterHeader(DisplayName = "开票单价")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")] [ExporterHeader(DisplayName = "结算金额")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "已出库金额")] [ExporterHeader(DisplayName = "已出库金额")]
public string { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "WMS待出库金额")] [ExporterHeader(DisplayName = "WMS待出库金额")]
public string WMS待出库金额 { set; get; } public decimal WMS待出库金额 { set; get; }
[ExporterHeader(DisplayName = "物料组编码")] [ExporterHeader(DisplayName = "物料组编码")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "物料组车型")] [ExporterHeader(DisplayName = "物料组车型")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "物料描述")] [ExporterHeader(DisplayName = "物料描述")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "备注")] [ExporterHeader(DisplayName = "备注")]
public string { set; get; } public string { set; get; }
} }
public class WmsOutPutSumExtend public class WmsOutPutSumExtend
@ -98,365 +89,492 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<WmsOutputSum> GetWmsSumExtendList(string version) public virtual List<WmsOutputSum> GetWmsSumExtendList(string version)
{ {
var _sql= "SELECT\n" + var _sql = "SELECT\n" +
" ROW_NUMBER()OVER(ORDER BY Type DESC) 行号 ,\n" + " ROW_NUMBER() OVER ( ORDER BY Type DESC ) 行号,\n" +
" Client 客户,\n" + " Client 客户,\n" +
" Type 出库类型,\n" + " Type 出库类型,\n" +
" BillNum 结算单,\n" + " BillNum 结算单,\n" +
" MaterialCode 物料号,\n" + " CODE 结算编码,\n" +
" MaterialDesc 物料描述,\n" + " SaleCode 销售渠道,\n" +
" BillNum 结算单号,\n" + " ClientCode 客户代码,\n" +
" MaterialGroup 物料组,\n" + " MaterialCode 物料号,\n" +
" ISnull([0], 2 ) 结算数量,\n" + " MaterialDesc 物料描述,\n" +
" ISNULL([2], 0 ) 实际出库数量,\n" + " BillNum 结算单号,\n" +
" isnull([0], 2 ) - ISNULL([2], 0 ) 数量差异,\n" + " MaterialGroup 物料组,\n" +
" Price 开票单价,\n" + " ISnull([ 0 ], 2 ) 结算数量,\n" +
" Round( ISnull([0], 2 )* Price, 2 ) 结算金额,\n" + " ISNULL([ 2 ], 0 ) 实际出库数量,\n" +
" Round( ISNULL([2], 0 )* Price, 2 ) 已出库金额,\n" + " isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ) 数量差异,\n" +
" ROUND(( isnull([0], 2 ) - ISNULL([2], 0 ))* Price, 2 ) WMS待出库金额 \n" + " Price 开票单价,\n" +
"FROM\n" + " Round( ISnull([ 0 ], 2 )* Price, 2 ) 结算金额,\n" +
" (\n" + " Round( ISNULL([ 2 ], 0 )* Price, 2 ) 已出库金额,\n" +
" SELECT\n" + " ROUND(( isnull([ 0 ], 2 ) - ISNULL([ 2 ], 0 ))* Price, 2 ) WMS待出库金额 \n" +
" * \n" + "FROM\n" +
" FROM\n" + " (\n" +
" (\n" + " SELECT\n" +
" SELECT\n" + " * \n" +
" temp.Client,\n" + " FROM\n" +
" temp.Type,\n" + " (\n" +
" temp.BillNum,\n" + " SELECT\n" +
" temp.MaterialCode,\n" + " temp.Client,\n" +
" temp2.MaterialDesc,\n" + " temp.CODE,\n" +
" temp.Qty,\n" + " temp.SaleCode,\n" +
" 0 STATE,\n" + " temp.ClientCode,\n" +
" EstimateTypeDesc MaterialGroup,\n" + " temp.Type,\n" +
" EstimateType,\n" + " temp.BillNum,\n" +
" IsBack,\n" + " temp.MaterialCode,\n" +
" Price \n" + " temp2.MaterialDesc,\n" +
" FROM\n" + " temp.Qty,\n" +
" (\n" + " 0 STATE,\n" +
" SELECT\n" + " EstimateTypeDesc MaterialGroup,\n" +
" '大众准时化出库' AS Type,\n" + " EstimateType,\n" +
" '大众' Client,\n" + " IsBack,\n" +
" BillNum,\n" + " Price \n" +
" MaterialCode,\n" + " FROM\n" +
" SUM( Qty ) Qty,\n" + " (\n" +
" 0 IsBack,\n" + " SELECT\n" +
" Price,\n" + " '大众准时化出库' AS Type,\n" +
" ChassisNumber CNumber \n" + " '大众' Client,\n" +
" FROM\n" + " 'Z11' CODE,\n" +
" Set_WmsJitOutPutDetial \n" + " '10' SaleCode,\n" +
" WHERE\n" + " '10001' ClientCode,\n" +
" VERSION = '{0}' \n" + " BillNum,\n" +
" GROUP BY\n" + " MaterialCode,\n" +
" BillNum,\n" + " SUM( Qty ) Qty,\n" +
" MaterialCode,\n" + " 0 IsBack,\n" +
" Price,\n" + " Price \n" +
" ChassisNumber UNION ALL\n" + " FROM\n" +
" SELECT\n" + " Set_WmsJitOutPutDetial \n" +
" '大众看板出库' AS Type,\n" + " WHERE\n" +
" '大众' Client,\n" + " VERSION = '{0}' \n" +
" BillNum,\n" + " GROUP BY\n" +
" MaterialCode,\n" + " BillNum,\n" +
" SUM( Qty ) Qty,\n" + " MaterialCode,\n" +
" 0 IsBack,\n" + " Price UNION ALL\n" +
" Price,\n" + " SELECT\n" +
" Kanban CNumber \n" + " '大众看板出库' AS Type,\n" +
" FROM\n" + " '大众' Client,\n" +
" Set_WmsKanbanOutPutDetial \n" + " 'Z12' CODE,\n" +
" WHERE\n" + " '10' SaleCode,\n" +
" VERSION = '{0}' \n" + " '10001' ClientCode,\n" +
" GROUP BY\n" + " BillNum,\n" +
" BillNum,\n" + " MaterialCode,\n" +
" MaterialCode,\n" + " SUM( Qty ) Qty,\n" +
" Price,\n" + " 0 IsBack,\n" +
" Kanban UNION ALL\n" + " Price \n" +
" SELECT\n" + " FROM\n" +
" '大众无看板出库' AS Type,\n" + " Set_WmsKanbanOutPutDetial \n" +
" '大众' Client,\n" + " WHERE\n" +
" BillNum,\n" + " VERSION = '{0}' \n" +
" SapMaterialCode MaterialCode,\n" + " GROUP BY\n" +
" SUM( Qty ) Qty,\n" + " BillNum,\n" +
" 0 IsBack,\n" + " MaterialCode,\n" +
" Price,\n" + " Price UNION ALL\n" +
" '' CNumber \n" + " SELECT\n" +
" FROM\n" + " '大众无看板出库' AS Type,\n" +
" Set_WmsWithOutKanbanOutPutDetial \n" + " '大众' Client,\n" +
" WHERE\n" + " 'Z12' CODE,\n" +
" VERSION = '{0}' \n" + " '10' SaleCode,\n" +
" GROUP BY\n" + " '10001' ClientCode,\n" +
" BillNum,\n" + " BillNum,\n" +
" SapMaterialCode,\n" + " SapMaterialCode MaterialCode,\n" +
" Price UNION ALL\n" + " SUM( Qty ) Qty,\n" +
" SELECT\n" + " 0 IsBack,\n" +
" '大众备件汇总出库' AS Type,\n" + " Price \n" +
" '大众' Client,\n" + " FROM\n" +
" BillNum,\n" + " Set_WmsWithOutKanbanOutPutDetial \n" +
" MaterialCode,\n" + " WHERE\n" +
" SUM( Qty ) Qty,\n" + " VERSION = '{0}' \n" +
" 1 IsBack,\n" + " GROUP BY\n" +
" Price,\n" + " BillNum,\n" +
" '' CNumber \n" + " SapMaterialCode,\n" +
" FROM\n" + " Price UNION ALL\n" +
" Set_WmsSharePartOutPutDetial \n" + " SELECT\n" +
" WHERE\n" + " '大众备件汇总出库' AS Type,\n" +
" VERSION = '{0}' \n" + " '大众' Client,\n" +
" GROUP BY\n" + " 'Z13' CODE,\n" +
" BillNum,\n" + " '20' SaleCode,\n" +
" MaterialCode,\n" + " '10001' ClientCode,\n" +
" Price UNION ALL\n" + " BillNum,\n" +
" SELECT\n" + " MaterialCode,\n" +
" '大众备件条码出库' AS Type,\n" + " SUM( Qty ) Qty,\n" +
" '大众' Client,\n" + " 1 IsBack,\n" +
" BillNum,\n" + " Price \n" +
" MaterialCode,\n" + " FROM\n" +
" SUM( Qty ) Qty,\n" + " Set_WmsSharePartOutPutDetial \n" +
" 1 IsBack,\n" + " WHERE\n" +
" Price,\n" + " VERSION = '{0}' \n" +
" OrderBillNum CNumber \n" + " GROUP BY\n" +
" FROM\n" + " BillNum,\n" +
" Set_WmsSharePart90OutPutDetial \n" + " MaterialCode,\n" +
" WHERE\n" + " Price UNION ALL\n" +
" VERSION = '{0}' \n" + " SELECT\n" +
" GROUP BY\n" + " '大众备件条码出库' AS Type,\n" +
" BillNum,\n" + " '大众' Client,\n" +
" MaterialCode,\n" + " 'Z13' CODE,\n" +
" Price,\n" + " '20' SaleCode,\n" +
" OrderBillNum UNION ALL\n" + " '10001' ClientCode,\n" +
" SELECT\n" + " BillNum,\n" +
" '红旗看板出库' AS Type,\n" + " MaterialCode,\n" +
" '红旗' Client,\n" + " SUM( Qty ) Qty,\n" +
" BillNum,\n" + " 1 IsBack,\n" +
" MaterialCode,\n" + " Price \n" +
" SUM( Qty ) Qty,\n" + " FROM\n" +
" 0 IsBack,\n" + " Set_WmsSharePart90OutPutDetial \n" +
" Price,\n" + " WHERE\n" +
" Kanban CNumber \n" + " VERSION = '{0}' \n" +
" FROM\n" + " GROUP BY\n" +
" Set_WmsHQHKanbanOutPutDetial \n" + " BillNum,\n" +
" WHERE\n" + " MaterialCode,\n" +
" VERSION = '{0}' \n" + " Price UNION ALL\n" +
" GROUP BY\n" + " SELECT\n" +
" BillNum,\n" + " '红旗看板出库' AS Type,\n" +
" MaterialCode,\n" + " '红旗' Client,\n" +
" Price,\n" + " 'Z34' CODE,\n" +
" Kanban UNION ALL\n" + " '10' SaleCode,\n" +
" SELECT\n" + " '100113' ClientCode,\n" +
" '红旗一轿手工出库' AS Type,\n" + " BillNum,\n" +
" '红旗' Client,\n" + " MaterialCode,\n" +
" BillNum,\n" + " SUM( Qty ) Qty,\n" +
" SapMaterialCode,\n" + " 0 IsBack,\n" +
" SUM( Qty ) Qty,\n" + " Price \n" +
" IsBack,\n" + " FROM\n" +
" Price,\n" + " Set_WmsHQHKanbanOutPutDetial \n" +
" '' CNumber \n" + " WHERE\n" +
" FROM\n" + " VERSION = '{0}' \n" +
" Set_WmsHQWithOutKanbanOutPutDetial \n" + " GROUP BY\n" +
" WHERE\n" + " BillNum,\n" +
" IsBack = 0 \n" + " MaterialCode,\n" +
" AND VERSION = '{0}' \n" + " Price UNION ALL\n" +
" GROUP BY\n" + " SELECT\n" +
" BillNum,\n" + " '一轿手工出库' AS Type,\n" +
" SapMaterialCode,\n" + " '一轿' Client,\n" +
" IsBack,\n" + " 'Z32' CODE,\n" +
" Price UNION ALL\n" + " '10' SaleCode,\n" +
" SELECT\n" + " '100113' ClientCode,\n" +
" '红旗一轿手工出库(备件)' AS Type,\n" + " BillNum,\n" +
" '红旗' Client,\n" + " SapMaterialCode,\n" +
" BillNum,\n" + " SUM( Qty ) Qty,\n" +
" SapMaterialCode,\n" + " IsBack,\n" +
" SUM( Qty ) Qty,\n" + " Price \n" +
" IsBack,\n" + " FROM\n" +
" Price,\n" + " Set_WmsHQWithOutKanbanOutPutDetial \n" +
" '' CNumber \n" + " WHERE\n" +
" FROM\n" + " IsBack = 0 \n" +
" Set_WmsHQWithOutKanbanOutPutDetial \n" + " AND VERSION = '{0}' \n" +
" WHERE\n" + " AND Extend = '100113' \n" +
" IsBack = 1 \n" + " GROUP BY\n" +
" AND VERSION = '{0}' \n" + " BillNum,\n" +
" GROUP BY\n" + " SapMaterialCode,\n" +
" BillNum,\n" + " IsBack,\n" +
" SapMaterialCode,\n" + " Price UNION ALL\n" +
" IsBack,\n" + " SELECT\n" +
" Price \n" + " '一轿手工出库(备件)' AS Type,\n" +
" ) temp\n" + " '一轿' Client,\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" + " 'Z33' CODE,\n" +
" ) t1 UNION ALL\n" + " '20' SaleCode,\n" +
" SELECT\n" + " '100113' ClientCode,\n" +
" * \n" + " BillNum,\n" +
" FROM\n" + " SapMaterialCode,\n" +
" (\n" + " SUM( Qty ) Qty,\n" +
" SELECT\n" + " IsBack,\n" +
" temp.Client,\n" + " Price \n" +
" temp.Type,\n" + " FROM\n" +
" temp.BillNum,\n" + " Set_WmsHQWithOutKanbanOutPutDetial \n" +
" temp.MaterialCode,\n" + " WHERE\n" +
" temp2.MaterialDesc,\n" + " IsBack = 1 \n" +
" temp.Qty,\n" + " AND VERSION = '{0}' \n" +
" 0 STATE,\n" + " AND Extend = '100113' \n" +
" EstimateTypeDesc MaterialGroup,\n" + " GROUP BY\n" +
" EstimateType,\n" + " BillNum,\n" +
" IsBack,\n" + " SapMaterialCode,\n" +
" Price \n" + " IsBack,\n" +
" FROM\n" + " Price UNION ALL\n" +
" (\n" + " SELECT\n" +
" SELECT\n" + " '红旗手工出库' AS Type,\n" +
" '大众准时化出库' AS Type,\n" + " '红旗' Client,\n" +
" '大众' Client,\n" + " 'Z34' CODE,\n" +
" BillNum,\n" + " '10' SaleCode,\n" +
" MaterialCode,\n" + " '100053' ClientCode,\n" +
" SUM( Qty ) Qty,\n" + " BillNum,\n" +
" 0 IsBack,\n" + " SapMaterialCode,\n" +
" Price,\n" + " SUM( Qty ) Qty,\n" +
" ChassisNumber CNumber \n" + " IsBack,\n" +
" FROM\n" + " Price \n" +
" Set_WmsJitOutPutDetial \n" + " FROM\n" +
" WHERE\n" + " Set_WmsHQWithOutKanbanOutPutDetial \n" +
" VERSION = '{0}' \n" + " WHERE\n" +
" AND State = 2 \n" + " IsBack = 0 \n" +
" GROUP BY\n" + " AND VERSION = '{0}' \n" +
" BillNum,\n" + " AND Extend = '100053' \n" +
" MaterialCode,\n" + " GROUP BY\n" +
" Price,\n" + " BillNum,\n" +
" ChassisNumber UNION ALL\n" + " SapMaterialCode,\n" +
" SELECT\n" + " IsBack,\n" +
" '大众看板出库' AS Type,\n" + " Price UNION ALL\n" +
" '大众' Client,\n" + " SELECT\n" +
" BillNum,\n" + " '红旗手工出库(备件)' AS Type,\n" +
" MaterialCode,\n" + " '红旗' Client,\n" +
" SUM( Qty ) Qty,\n" + " 'Z35' CODE,\n" +
" 0 IsBack,\n" + " '20' SaleCode,\n" +
" Price,\n" + " '100053' ClientCode,\n" +
" Kanban CNumber \n" + " BillNum,\n" +
" FROM\n" + " SapMaterialCode,\n" +
" Set_WmsKanbanOutPutDetial \n" + " SUM( Qty ) Qty,\n" +
" WHERE\n" + " IsBack,\n" +
" VERSION = '{0}' \n" + " Price \n" +
" AND State = 2 \n" + " FROM\n" +
" GROUP BY\n" + " Set_WmsHQWithOutKanbanOutPutDetial \n" +
" BillNum,\n" + " WHERE\n" +
" MaterialCode,\n" + " IsBack = 1 \n" +
" Price,\n" + " AND VERSION = '{0}' \n" +
" Kanban UNION ALL\n" + " AND Extend = '100053' \n" +
" SELECT\n" + " GROUP BY\n" +
" '大众无看板出库' AS Type,\n" + " BillNum,\n" +
" '大众' Client,\n" + " SapMaterialCode,\n" +
" BillNum,\n" + " IsBack,\n" +
" SapMaterialCode MaterialCode,\n" + " Price \n" +
" SUM( Qty ) Qty,\n" + " ) temp\n" +
" 0 IsBack,\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" +
" Price,\n" + " ) t1 UNION ALL\n" +
" '' CNumber \n" + " SELECT\n" +
" FROM\n" + " * \n" +
" Set_WmsWithOutKanbanOutPutDetial \n" + " FROM\n" +
" WHERE\n" + " (\n" +
" VERSION = '{0}' \n" + " SELECT\n" +
" AND State = 2 \n" + " temp.Client,\n" +
" GROUP BY\n" + " temp.CODE,\n" +
" BillNum,\n" + " temp.SaleCode,\n" +
" SapMaterialCode,\n" + " temp.ClientCode,\n" +
" Price UNION ALL\n" + " temp.Type,\n" +
" SELECT\n" + " temp.BillNum,\n" +
" '大众备件汇总出库' AS Type,\n" + " temp.MaterialCode,\n" +
" '大众' Client,\n" + " temp2.MaterialDesc,\n" +
" BillNum,\n" + " temp.Qty,\n" +
" MaterialCode,\n" + " 2 STATE,\n" +
" SUM( Qty ) Qty,\n" + " EstimateTypeDesc MaterialGroup,\n" +
" 1 IsBack,\n" + " EstimateType,\n" +
" Price,\n" + " IsBack,\n" +
" '' CNumber \n" + " Price \n" +
" FROM\n" + " FROM\n" +
" Set_WmsSharePartOutPutDetial \n" + " (\n" +
" WHERE\n" + " SELECT\n" +
" VERSION = '{0}' \n" + " '大众准时化出库' AS Type,\n" +
" AND State = 2 \n" + " '大众' Client,\n" +
" GROUP BY\n" + " 'Z11' CODE,\n" +
" BillNum,\n" + " '10' SaleCode,\n" +
" MaterialCode,\n" + " '10001' ClientCode,\n" +
" Price UNION ALL\n" + " BillNum,\n" +
" SELECT\n" + " MaterialCode,\n" +
" '大众备件条码出库' AS Type,\n" + " SUM( Qty ) Qty,\n" +
" '大众' Client,\n" + " 0 IsBack,\n" +
" BillNum,\n" + " Price \n" +
" MaterialCode,\n" + " FROM\n" +
" SUM( Qty ) Qty,\n" + " Set_WmsJitOutPutDetial \n" +
" 1 IsBack,\n" + " WHERE\n" +
" Price,\n" + " VERSION = '{0}' \n" +
" OrderBillNum CNumber \n" + " AND State = 2 \n" +
" FROM\n" + " GROUP BY\n" +
" Set_WmsSharePart90OutPutDetial \n" + " BillNum,\n" +
" WHERE\n" + " MaterialCode,\n" +
" VERSION = '{0}' \n" + " Price UNION ALL\n" +
" AND State = 2 \n" + " SELECT\n" +
" GROUP BY\n" + " '大众看板出库' AS Type,\n" +
" BillNum,\n" + " '大众' Client,\n" +
" MaterialCode,\n" + " 'Z12' CODE,\n" +
" Price,\n" + " '10' SaleCode,\n" +
" OrderBillNum UNION ALL\n" + " '10001' ClientCode,\n" +
" SELECT\n" + " BillNum,\n" +
" '红旗看板出库' AS Type,\n" + " MaterialCode,\n" +
" '红旗' Client,\n" + " SUM( Qty ) Qty,\n" +
" BillNum,\n" + " 0 IsBack,\n" +
" MaterialCode,\n" + " Price \n" +
" SUM( Qty ) Qty,\n" + " FROM\n" +
" 0 IsBack,\n" + " Set_WmsKanbanOutPutDetial \n" +
" Price,\n" + " WHERE\n" +
" Kanban CNumber \n" + " VERSION = '{0}' \n" +
" FROM\n" + " AND State = 2 \n" +
" Set_WmsHQHKanbanOutPutDetial \n" + " GROUP BY\n" +
" WHERE\n" + " BillNum,\n" +
" VERSION = '{0}' \n" + " MaterialCode,\n" +
" AND State = 2 \n" + " Price UNION ALL\n" +
" GROUP BY\n" + " SELECT\n" +
" BillNum,\n" + " '大众无看板出库' AS Type,\n" +
" MaterialCode,\n" + " '大众' Client,\n" +
" Price,\n" + " 'Z12' CODE,\n" +
" Kanban UNION ALL\n" + " '10' SaleCode,\n" +
" SELECT\n" + " '10001' ClientCode,\n" +
" '红旗一轿手工出库' AS Type,\n" + " BillNum,\n" +
" '红旗' Client,\n" + " SapMaterialCode MaterialCode,\n" +
" BillNum,\n" + " SUM( RealityNumber ) Qty,\n" +
" SapMaterialCode,\n" + " 0 IsBack,\n" +
" SUM( Qty ) Qty,\n" + " Price \n" +
" IsBack,\n" + " FROM\n" +
" Price,\n" + " Set_WmsWithOutKanbanOutPutDetial \n" +
" '' CNumber \n" + " WHERE\n" +
" FROM\n" + " VERSION = '{0}' \n" +
" Set_WmsHQWithOutKanbanOutPutDetial \n" + " AND State = 2 \n" +
" WHERE\n" + " GROUP BY\n" +
" IsBack = 0 \n" + " BillNum,\n" +
" AND VERSION = '{0}' \n" + " SapMaterialCode,\n" +
" AND State = 2 \n" + " Price UNION ALL\n" +
" GROUP BY\n" + " SELECT\n" +
" BillNum,\n" + " '大众备件汇总出库' AS Type,\n" +
" SapMaterialCode,\n" + " '大众' Client,\n" +
" IsBack,\n" + " 'Z13' CODE,\n" +
" Price UNION ALL\n" + " '20' SaleCode,\n" +
" SELECT\n" + " '10001' ClientCode,\n" +
" '红旗一轿手工出库(备件)' AS Type,\n" + " BillNum,\n" +
" '红旗' Client,\n" + " MaterialCode,\n" +
" BillNum,\n" + " SUM( RealityNumber ) Qty,\n" +
" SapMaterialCode,\n" + " 1 IsBack,\n" +
" SUM( Qty ) Qty,\n" + " Price \n" +
" IsBack,\n" + " FROM\n" +
" Price,\n" + " Set_WmsSharePartOutPutDetial \n" +
" '' CNumber \n" + " WHERE\n" +
" FROM\n" + " VERSION = '{0}' \n" +
" Set_WmsHQWithOutKanbanOutPutDetial \n" + " AND State = 2 \n" +
" WHERE\n" + " GROUP BY\n" +
" IsBack = 1 \n" + " BillNum,\n" +
" AND VERSION = '{0}' \n" + " MaterialCode,\n" +
" AND State = 2 \n" + " Price UNION ALL\n" +
" GROUP BY\n" + " SELECT\n" +
" BillNum,\n" + " '大众备件条码出库' AS Type,\n" +
" SapMaterialCode,\n" + " '大众' Client,\n" +
" IsBack,\n" + " 'Z13' CODE,\n" +
" Price \n" + " '20' SaleCode,\n" +
" ) temp\n" + " '10001' ClientCode,\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" + " BillNum,\n" +
" ) t2 \n" + " MaterialCode,\n" +
" ) TEMP PIVOT ( SUM( QTY ) FOR STATE IN ([0],[1],[2],[3]) ) A \n" + " SUM( Qty ) Qty,\n" +
"ORDER BY\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" +
" 客户,出库类型,结算单;";
_sql = string.Format(_sql, version); _sql = string.Format(_sql, version);
var _query = DbConnection.Query<WmsOutputSum>(_sql, null, null, true, 1200, null); var _query = DbConnection.Query<WmsOutputSum>(_sql, null, null, true, 1200, null);

Loading…
Cancel
Save