Browse Source

已结出库单查询SQL更改

FoShanPG
44673626 3 years ago
parent
commit
54e3bd6100
  1. 3
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WmsDetailReport.cs
  2. 159
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsOutputSumDapperRepository.cs

3
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待出库金额")]

159
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);

Loading…
Cancel
Save