From 54e3bd61008bc5d8d778079f0e79def170e13a25 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Wed, 23 Mar 2022 19:26:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E7=BB=93=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2SQL=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/WmsDetailReport.cs | 3 +- .../Report/WmsOutputSumDapperRepository.cs | 159 +++++++++++++++++- 2 files changed, 156 insertions(+), 6 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs index c4ace711..c984f6f2 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs @@ -247,8 +247,7 @@ namespace Win.Sfs.SettleAccount.Entities public decimal DiffQty { set; get; } [Display(Name = "开票单价")] public decimal Price { set; get; } - //[Display(Name = "结算金额")] - //public decimal Amt { set; get; } + //[Display(Name = "已出库金额")] //public decimal OutPutAmt { set; get; } //[Display(Name = "WMS待出库金额")] 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 9a4f3aad..759d92ea 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 @@ -1043,7 +1043,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsJitOutPutDetial \n" + " WHERE\n" + " VERSION = '{0}' \n" + - " AND State = 2 UNION ALL\n" + + " AND State =2 UNION ALL\n" + " SELECT\n" + " '大众看板出库' AS Type,\n" + " '大众' Client,\n" + @@ -1059,7 +1059,39 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsKanbanOutPutDetial \n" + " WHERE\n" + " VERSION = '{0}' \n" + - " AND State = 2 UNION ALL\n" + + " AND State =2 UNION ALL\n" + + " SELECT\n" + + " '大众无看板出库' AS Type,\n" + + " '大众' Client,\n" + + " BillNum,\n" + + " SapMaterialCode MaterialCode,\n" + + " Qty Qty,\n" + + " RealityNumber OutputQty,\n" + + " 0 IsBack,\n" + + " Price,\n" + + " '' CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsWithOutKanbanOutPutDetial \n" + + " WHERE\n" + + " VERSION = '{0}' \n" + + " AND State =2 UNION ALL\n" + + " SELECT\n" + + " '大众备件汇总出库' AS Type,\n" + + " '大众' Client,\n" + + " BillNum,\n" + + " MaterialCode,\n" + + " Qty Qty,\n" + + " RealityNumber OutputQty,\n" + + " 1 IsBack,\n" + + " Price,\n" + + " '' CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsSharePartOutPutDetial \n" + + " WHERE\n" + + " VERSION = '{0}' \n" + + " AND State =2 UNION ALL\n" + " SELECT\n" + " '大众备件条码出库' AS Type,\n" + " '大众' Client,\n" + @@ -1075,7 +1107,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsSharePart90OutPutDetial \n" + " WHERE\n" + " VERSION = '{0}' \n" + - " AND State = 2 UNION ALL\n" + + " AND State =2 UNION ALL\n" + " SELECT\n" + " '红旗看板出库' AS Type,\n" + " '红旗' Client,\n" + @@ -1091,9 +1123,128 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " Set_WmsHQHKanbanOutPutDetial \n" + " WHERE\n" + " VERSION = '{0}' \n" + - " AND State = 2 \n" + + " AND State =2 UNION ALL\n" + + " SELECT\n" + + " '红旗一轿手工出库' AS Type,\n" + + " '红旗' Client,\n" + + " BillNum,\n" + + " SapMaterialCode MaterialCode,\n" + + " Qty,\n" + + " RealityNumber OutputQty,\n" + + " IsBack,\n" + + " Price,\n" + + " '' CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsHQWithOutKanbanOutPutDetial \n" + + " WHERE\n" + + " IsBack = 0 \n" + + " AND VERSION = '{0}' \n" + + " AND State =2 UNION ALL\n" + + " SELECT\n" + + " '红旗一轿手工出库(备件)' AS Type,\n" + + " '红旗' Client,\n" + + " BillNum,\n" + + " SapMaterialCode,\n" + + " Qty Qty,\n" + + " RealityNumber OutputQty,\n" + + " IsBack,\n" + + " Price,\n" + + " '' CNumber,\n" + + " Remark \n" + + " FROM\n" + + " Set_WmsHQWithOutKanbanOutPutDetial \n" + + " WHERE\n" + + " IsBack = 1 \n" + + " AND 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" + + // " temp1.Client 客户,\n" + + // " temp1.Type 出库类型,\n" + + // " temp1.BillNum 结算单,\n" + + // " temp1.MaterialCode 物料号,\n" + + // " temp1.CNumber 通用代码号,\n" + + // " Isnull( temp1.Qty, 0 ) 结算数量,\n" + + // " Isnull( temp1.OutputQty, 0 ) 实际出库数量,\n" + + // " Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) 差异数量,\n" + + // " temp1.Price 开票单价,\n" + + // " Round( Isnull( temp1.Qty, 0 ) * temp1.Price, 2 ) 结算金额,\n" + + // " Round( ( Isnull( temp1.Qty, 0 ) - Isnull( temp1.OutputQty, 0 ) ) * temp1.Price, 2 ) WMS待出库金额,\n" + + // " temp2.EstimateType 物料组编码,\n" + + // " temp2.EstimateTypeDesc 物料组车型,\n" + + // " temp2.MaterialDesc 物料描述,\n" + + // " temp1.remark 备注 \n" + + // "FROM\n" + + // " (\n" + + // " SELECT\n" + + // " '大众准时化出库' AS Type,\n" + + // " '大众' Client,\n" + + // " BillNum,\n" + + // " MaterialCode,\n" + + // " Qty,\n" + + // " 0 OutputQty,\n" + + // " 0 IsBack,\n" + + // " Price,\n" + + // " ChassisNumber CNumber,\n" + + // " Remark \n" + + // " FROM\n" + + // " Set_WmsJitOutPutDetial \n" + + // " WHERE\n" + + // " VERSION = '{0}' \n" + + // " AND State = 2 UNION ALL\n" + + // " SELECT\n" + + // " '大众看板出库' AS Type,\n" + + // " '大众' Client,\n" + + // " BillNum,\n" + + // " MaterialCode,\n" + + // " Qty Qty,\n" + + // " 0 OutputQty,\n" + + // " 0 IsBack,\n" + + // " Price,\n" + + // " Kanban CNumber,\n" + + // " Remark \n" + + // " FROM\n" + + // " Set_WmsKanbanOutPutDetial \n" + + // " WHERE\n" + + // " VERSION = '{0}' \n" + + // " AND State = 2 UNION ALL\n" + + // " SELECT\n" + + // " '大众备件条码出库' AS Type,\n" + + // " '大众' Client,\n" + + // " BillNum,\n" + + // " MaterialCode,\n" + + // " Qty Qty,\n" + + // " 0 OutPutQty,\n" + + // " 1 IsBack,\n" + + // " Price,\n" + + // " OrderBillNum CNumber,\n" + + // " Remark \n" + + // " FROM\n" + + // " Set_WmsSharePart90OutPutDetial \n" + + // " WHERE\n" + + // " VERSION = '{0}' \n" + + // " AND State = 2 UNION ALL\n" + + // " SELECT\n" + + // " '红旗看板出库' AS Type,\n" + + // " '红旗' Client,\n" + + // " BillNum,\n" + + // " MaterialCode,\n" + + // " Qty Qty,\n" + + // " 0 OutPutQty,\n" + + // " 0 IsBack,\n" + + // " Price,\n" + + // " Kanban CNumber,\n" + + // " Remark \n" + + // " FROM\n" + + // " Set_WmsHQHKanbanOutPutDetial \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"; _sql = string.Format(_sql, version, state);