Browse Source

导出DTO调整

FoShanPG
44673626 3 years ago
parent
commit
5a555e314d
  1. 8
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs
  2. 517
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

8
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs

@ -235,7 +235,7 @@ namespace Win.Sfs.SettleAccount.Entities
[ExporterHeader(DisplayName = "开票金额")]
public decimal Amt { set; get; }
}
/// <summary>
/// 大众备件出库单
@ -631,9 +631,6 @@ namespace Win.Sfs.SettleAccount.Entities
}
/// <summary>
/// 学生状态 正常、流失、休学、勤工俭学、顶岗实习、毕业、参军
/// </summary>
public enum ExporterStatus
{
/// <summary>
@ -671,3 +668,6 @@ namespace Win.Sfs.SettleAccount.Entities
}

517
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -21,7 +21,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <summary>
/// 带采购订单号和无订单号一起统计报表 WHERE Extend != 'is90' 去掉 备件调整数据
/// 带采购订单号和无订单号一起统计报表 WHERE Extend != 'is90' 去掉 备件调整数据,开票单价财务说会有调整,做了一个开票单价平均数据
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="version"></param>
@ -34,133 +34,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string begintime, string endtime)
{
//string sqlString = "SELECT\n" +
//" union1.* \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.交货日期,\n" +
//" temp1.交货单号,\n" +
//" NULL 订单日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.采购订单文本,\n" +
//" temp1.收货数量,\n" +
//" temp1.开票数量,\n" +
//" ISNULL( temp1.收货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 收货与开票差异,\n" +
//" temp1.开票单价,\n" +
//" ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
//" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
//" ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额,\n" +
//" temp1.交货数量,\n" +
//" temp1.收货与交货差异,\n" +
//" ISNULL( temp1.交货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际交货数量,\n" +
//" ISNULL( temp3.Qty, 0 ) 退货数量 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.Version AS 期间,\n" +
//" a.PurchaseOrderNoText AS 采购订单文本,\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货日期,\n" +
//" a.PurchaseOrderNo AS 采购订单号,\n" +
//" b.MaterialCode AS SAP编码,\n" +
//" b.CustomerPartCode AS 物料代码,\n" +
//" b.MaterialDesc AS 物料描述,\n" +
//" b.EstimateTypeDesc AS 物料组,\n" +
//" ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票单价,\n" +
//" ISNULL( a.ReceiptQty, 0 ) AS 收货数量,\n" +
//" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
//" ISNULL( a.InvoicedQty, 0 ) * ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票金额,\n" +
//" ISNULL( C.WMSDeliveryQty, 0 ) AS 交货数量,\n" +
//" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( C.WMSDeliveryQty, 0 ) ) AS 收货与交货差异 \n" +
//" FROM\n" +
//" ( SELECT * FROM Set_SparePart WHERE Extend != 'is90' AND PurchaseOrderNo!='NoOrder' ) AS a\n" +
//" LEFT OUTER JOIN Set_material AS b ON a.MaterialCode = b.CustomerPartCode\n" +
//" LEFT JOIN (\n" +
//"   SELECT\n" +
//" ( ISNULL( temp1.Qty, 0 ) - ISNULL( temp2.Qty, 0 ) ) WMSDeliveryQty,\n" +
//" temp1.MaterialCode,\n" +
//" temp1.PurchaseOrderNo \n" +
//" FROM\n" +
//" (\n" +
//" ( SELECT SUM ( ReceiptQty ) Qty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) temp1\n" +
//" LEFT JOIN ( SELECT SUM ( ReceiptQty ) Qty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE VERSION < '{0}' AND Extend != 'is90' AND PurchaseOrderNo!='NoOrder' GROUP BY PurchaseOrderNo, MaterialCode ) temp2 ON temp1.PurchaseOrderNo = temp2.PurchaseOrderNo \n" +
//" AND temp1.MaterialCode = temp2.MaterialCode \n" +
//" ) \n" +
//" ) C ON A.PurchaseOrderNo = C.PurchaseOrderNo \n" +
//" AND A.MaterialCode = C.MaterialCode \n" +
//" WHERE\n" +
//" ( a.Version = '{0}' ) \n" +
//" ) AS temp1\n" +
//" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
//" AND temp1.SAP编码= temp3.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//" ) union1 UNION ALL\n" +
//"SELECT\n" +
//" union2.* \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.交货日期,\n" +
//" '' 交货单号,\n" +
//" '' 订单日期,\n" +
//" '' 采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" '' 采购订单文本,\n" +
//" temp1.收货数量,\n" +
//" temp1.开票数量,\n" +
//" ISNULL( temp1.收货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
//" temp1.开票单价,\n" +
//" ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
//" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
//" ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额,\n" +
//" 0 交货数量,\n" +
//" 0 收货与交货差异,\n" +
//" 0 实际交货数量,\n" +
//" 0 退货数量 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货日期,\n" +
//" c.MaterialCode AS SAP编码,\n" +
//" a.MaterialCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票单价,\n" +
//" ISNULL( a.ReceiptQty, 0 ) AS 收货数量,\n" +
//" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
//" ISNULL( a.ReceiptQty, 0 ) * ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票金额 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" SUM ( InvoicedQty ) InvoicedQty,\n" +
//" MaterialCode,\n" +
//" PurchasePriceNoTax \n" +
//" FROM\n" +
//" Set_SparePart \n" +
//" WHERE\n" +
//" Extend != 'is90' \n" +
//" AND Version = '{0}' \n" +
//" AND PurchaseOrderNo='NoOrder' \n" +
//" GROUP BY\n" +
//" MaterialCode,\n" +
//" PurchasePriceNoTax \n" +
//" ) AS a\n" +
//" LEFT JOIN ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, MaterialCode FROM Set_WMSSparePart GROUP BY MaterialCode ) AS b ON a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = ( SELECT MAX ( VERSION ) FROM Set_PriceList ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//" ) union2";
string sqlString = "SELECT\n" +
" union1.* \n" +
@ -178,11 +51,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.收货数量,\n" +
" temp1.开票数量,\n" +
" ISNULL( temp1.收货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 收货与开票差异,\n" +
" temp1.开票单价,\n" +
" ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
" ISNULL( TEMP4.PurchasePriceNoTax, 0 ) AS 开票单价,\n" +
" ISNULL( temp1.开票数量, 0 ) * ISNULL( TEMP4.PurchasePriceNoTax, 0 ) AS 开票金额,\n" +
" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额,\n" +
" ISNULL( TEMP4.PurchasePriceNoTax, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
" ( ISNULL( TEMP4.PurchasePriceNoTax, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额,\n" +
" temp1.交货数量,\n" +
" temp1.收货与交货差异,\n" +
" ISNULL( temp1.交货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际交货数量,\n" +
@ -190,7 +63,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.Version AS 期间,\n" +
" a.PurchaseOrderNoText AS 采购订单文本,\n" +
" '' AS 交货单号,\n" +
" NULL AS 交货日期,\n" +
@ -199,14 +71,29 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.CustomerPartCode AS 物料代码,\n" +
" b.MaterialDesc AS 物料描述,\n" +
" b.EstimateTypeDesc AS 物料组,\n" +
" ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票单价,\n" +
" ISNULL( a.ReceiptQty, 0 ) AS 收货数量,\n" +
" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
" ISNULL( a.InvoicedQty, 0 ) * ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票金额,\n" +
" ISNULL( C.WMSDeliveryQty, 0 ) AS 交货数量,\n" +
" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( C.WMSDeliveryQty, 0 ) ) AS 收货与交货差异 \n" +
" FROM\n" +
" ( SELECT * FROM Set_SparePart WHERE Extend != 'is90' AND PurchaseOrderNo!='NoOrder' ) AS a\n" +
" (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) ReceiptQty,\n" +
" SUM ( InvoicedQty ) InvoicedQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" PurchaseOrderNoText \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend != 'is90' \n" +
" AND PurchaseOrderNo != 'NoOrder' \n" +
" AND Version = '{0}' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" PurchaseOrderNoText \n" +
" ) AS a\n" +
" LEFT OUTER JOIN Set_material AS b ON a.MaterialCode = b.CustomerPartCode\n" +
" LEFT JOIN (\n" +
"   SELECT\n" +
@ -216,18 +103,46 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" FROM\n" +
" (\n" +
" ( SELECT SUM ( ReceiptQty ) Qty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) temp1\n" +
" LEFT JOIN ( SELECT SUM ( ReceiptQty ) Qty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE VERSION < '{0}' AND Extend != 'is90' AND PurchaseOrderNo!='NoOrder' GROUP BY PurchaseOrderNo, MaterialCode ) temp2 ON temp1.PurchaseOrderNo = temp2.PurchaseOrderNo \n" +
" LEFT JOIN (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) Qty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" VERSION < '{0}' \n" +
" AND Extend != 'is90' \n" +
" AND PurchaseOrderNo != 'NoOrder' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" ) temp2 ON temp1.PurchaseOrderNo = temp2.PurchaseOrderNo \n" +
" AND temp1.MaterialCode = temp2.MaterialCode \n" +
" ) \n" +
" ) C ON A.PurchaseOrderNo = C.PurchaseOrderNo \n" +
" AND A.MaterialCode = C.MaterialCode \n" +
" WHERE\n" +
" ( a.Version = '{0}' ) \n" +
" ) AS temp1\n" +
" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
" AND temp1.SAP编码= temp3.MaterialCode\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) union1 \n" ;
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" ROUND( SUM ( AmountNoTax ) / SUM ( ReceiptQty ), 4 ) PurchasePriceNoTax,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend != 'is90' \n" +
" AND PurchaseOrderNo != 'NoOrder' \n" +
" AND Version = '{0}' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" ) AS TEMP4 ON temp1.[物料代码] = TEMP4.MaterialCode \n" +
" AND temp1.采购订单号 = TEMP4.PurchaseOrderNo \n" +
" ) union1";
@ -350,177 +265,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
/// <summary>
/// 带采购订单号和无订单号一起统计报表 WHERE Extend != 'is90'
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="version"></param>
/// <param name="sapCode"></param>
/// <param name="matialCode"></param>
/// <param name="begintime"></param>
/// <param name="endtime"></param>
/// <returns></returns>
//public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
// string begintime, string endtime)
//{
// string sqlString = "SELECT\n" +
// " union1.* \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " temp1.交货日期,\n" +
// " temp1.交货单号,\n" +
// " '' 订单日期,\n" +
// " temp1.采购订单号,\n" +
// " temp1.SAP编码,\n" +
// " temp1.物料代码,\n" +
// " temp1.物料描述,\n" +
// " temp1.采购订单文本,\n" +
// " temp1.发货数量,\n" +
// " temp1.开票数量,\n" +
// " ISNULL( temp1.发货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
// " temp1.开票单价,\n" +
// " ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
// " ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
// " temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
// " ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " a.Version AS 期间,\n" +
// " a.PurchaseOrderNoText AS 采购订单文本,\n" +
// " b.WMSDeliveryNote AS 交货单号,\n" +
// " b.SpareDate AS 交货日期,\n" +
// " a.PurchaseOrderNo AS 采购订单号,\n" +
// " c.MaterialCode AS SAP编码,\n" +
// " b.MaterialCode AS 物料代码,\n" +
// " c.MaterialDesc AS 物料描述,\n" +
// " c.EstimateTypeDesc AS 物料组,\n" +
// " a.PurchasePriceNoTax AS 开票单价,\n" +
// " 0 AS 数量差异,\n" +
// " ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
// " ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
// " ISNULL( a.AmountNoTax, 0 ) AS 开票金额 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT SUM\n" +
// " ( ReceiptQty ) AS ReceiptQty,\n" +
// " PurchaseOrderNo,\n" +
// " MaterialCode,\n" +
// " Version,\n" +
// " PurchasePriceNoTax,\n" +
// " InvoicedQty,\n" +
// " PurchaseOrderNoText,\n" +
// " AmountNoTax \n" +
// " FROM\n" +
// " Set_SparePart WHERE Extend != 'is90' \n" +
// " GROUP BY\n" +
// " PurchaseOrderNo,\n" +
// " MaterialCode,\n" +
// " Version,\n" +
// " PurchasePriceNoTax,\n" +
// " InvoicedQty,\n" +
// " PurchaseOrderNoText,\n" +
// " AmountNoTax \n" +
// " ) AS a\n" +
// " INNER JOIN (\n" +
// " SELECT SUM\n" +
// " ( ReceiptQty ) AS ReceiptQty,\n" +
// " PurchaseOrderNo,\n" +
// " SapCode,\n" +
// " MaterialCode,\n" +
// " WMSDeliveryNote,\n" +
// " SpareDate \n" +
// " FROM\n" +
// " Set_WMSSparePart \n" +
// " GROUP BY\n" +
// " PurchaseOrderNo,\n" +
// " SapCode,\n" +
// " MaterialCode,\n" +
// " WMSDeliveryNote,\n" +
// " SpareDate \n" +
// " ) AS b ON a.PurchaseOrderNo = b.PurchaseOrderNo \n" +
// " AND a.MaterialCode = b.MaterialCode\n" +
// " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
// " WHERE\n" +
// " ( a.Version = '{0}' ) \n" +
// " ) AS temp1\n" +
// " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
// " ) union1 UNION ALL\n" +
// "SELECT\n" +
// " union2.* \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " temp1.交货日期,\n" +
// " '' 交货单号,\n" +
// " '' 订单日期,\n" +
// " '' 采购订单号,\n" +
// " temp1.SAP编码,\n" +
// " temp1.物料代码,\n" +
// " temp1.物料描述,\n" +
// " temp1.采购订单文本,\n" +
// " temp1.发货数量,\n" +
// " temp1.开票数量,\n" +
// " ISNULL( temp1.发货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
// " temp1.开票单价,\n" +
// " ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
// " ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
// " temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
// " ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额 \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " a.Version AS 期间,\n" +
// " '' AS 采购订单文本,\n" +
// " NULL AS 交货日期,\n" +
// " c.MaterialCode AS SAP编码,\n" +
// " a.MaterialCode AS 物料代码,\n" +
// " c.MaterialDesc AS 物料描述,\n" +
// " c.EstimateTypeDesc AS 物料组,\n" +
// " a.PurchasePriceNoTax AS 开票单价,\n" +
// " 0 AS 数量差异,\n" +
// " ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
// " ISNULL( a.ReceiptQty, 0 ) AS 开票数量 ,\n" +
// " ISNULL( a.ReceiptQty, 0 ) * ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票金额 \n" +
// " FROM\n" +
// " ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, MaterialCode, Version, PurchasePriceNoTax FROM Set_SparePart WHERE Extend != 'is90' and PurchaseOrderNo is null GROUP BY MaterialCode, Version, PurchasePriceNoTax ) AS a\n" +
// " LEFT JOIN ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, SapCode, MaterialCode FROM Set_WMSSparePart GROUP BY SapCode, MaterialCode ) AS b ON a.MaterialCode = b.MaterialCode\n" +
// " LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
// " WHERE\n" +
// " ( a.Version = '{0}' ) \n" +
// " ) AS temp1\n" +
// " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
// " ) union2";
// //" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp.Sap编码 = TEMP2.MaterialCode\n" +
// string addwhere = string.Empty;
// string addSqlStr = string.Format(sqlString, version);
// //if (!string.IsNullOrEmpty(purchaseOrderNo))
// //{
// // addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo);
// //}
// //else if (!string.IsNullOrEmpty(sapCode))
// //{
// // addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode);
// //}
// //else if (!string.IsNullOrEmpty(matialCode))
// //{
// // addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode);
// //}
// //else if (!string.IsNullOrEmpty(begintime)&& !string.IsNullOrEmpty(endtime))
// //{
// // addwhere += string.Format(" AND OrderDate BETWEEN '{0}' AND '{1}' ", begintime, endtime);
// //}
// string _sql = string.Format(addSqlStr, addwhere);
// //string _sql = string.Format(sqlString, version);
// var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
// return _query.ToList();
//}
/// <summary>
/// 大众备件有单号,统计有结算无发货
@ -761,69 +505,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
/// <summary>
/// 有发货无结算的报表统计,不用了
/// </summary>
/// <param name="purchaseOrderNo"></param>
/// <param name="version"></param>
/// <param name="sapCode"></param>
/// <param name="matialCode"></param>
/// <param name="begintime"></param>
/// <param name="endtime"></param>
/// <returns></returns>
//public virtual List<SettleSparePartExport> GetReverseSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
// string begintime, string endtime)
//{
// string sqlString = "SELECT\n" +
// " temp1.交货日期,\n" +
// " '' 交货单号,\n" +
// " '' 订单日期,\n" +
// " '' 采购订单号,\n" +
// " temp1.SAP编码,\n" +
// " temp1.物料代码,\n" +
// " temp1.物料描述,\n" +
// " temp1.采购订单文本,\n" +
// " temp1.发货数量,\n" +
// " temp1.开票数量,\n" +
// " ISNULL( temp1.发货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
// " temp1.开票单价,\n" +
// " ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
// " ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
// " temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
// " ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额 \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " b.Version AS 期间,\n" +
// " '' AS 采购订单文本,\n" +
// " NULL AS 交货日期,\n" +
// " c.MaterialCode AS SAP编码,\n" +
// " a.MaterialCode AS 物料代码,\n" +
// " c.MaterialDesc AS 物料描述,\n" +
// " c.EstimateTypeDesc AS 物料组,\n" +
// " b.PurchasePriceNoTax AS 开票单价,\n" +
// " 0 AS 数量差异,\n" +
// " ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" +
// " ISNULL( b.ReceiptQty, 0 ) AS 开票数量 ,\n" +
// " ISNULL( b.ReceiptQty, 0 ) * ISNULL( b.PurchasePriceNoTax, 0 ) AS 开票金额 \n" +
// " FROM\n" +
// " ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, MaterialCode FROM Set_WMSSparePart GROUP BY MaterialCode ) AS a\n" +
// " LEFT JOIN ( SELECT * FROM Set_SparePart WHERE Extend != 'is90' AND Version = '{0}' ) AS b ON a.MaterialCode = b.MaterialCode\n" +
// " LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
// " WHERE\n" +
// " ( b.MaterialCode IS NULL ) \n" +
// " ) AS temp1\n" +
// " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode";
// string addwhere = string.Empty;
// string addSqlStr = string.Format(sqlString, version);
// string _sql = string.Format(addSqlStr, addwhere);
// //string _sql = string.Format(sqlString, version);
// var _query = DbConnection.Query<SettleSparePartExport>(_sql, null, null, true, 1200, null);
// return _query.ToList();
//}
/// <summary>
@ -938,91 +619,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
" ) unint2";
//string sqlString = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.交货单号,\n" +
//" temp1.交货日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.交货数量,\n" +
//" temp1.收货数量,\n" +
//" temp1.收货与交货差异,\n" +
//" ISNULL( temp3.Qty, 0 ) 退货数量,\n" +
//" ISNULL( temp1.交货数量, 0 ) - ISNULL( temp1.收货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际交货数量,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货日期,\n" +
//" a.PurchaseOrderNo AS 采购订单号,\n" +
//" c.MaterialCode AS SAP编码,\n" +
//" c.CustomerPartCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" ISNULL( a.ReceiptQty, 0 ) AS 交货数量,\n" +
//" ISNULL( b.ReceiptQty, 0 ) AS 收货数量,\n" +
//" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( b.ReceiptQty, 0 ) ) AS 收货与交货差异 \n" +
//" FROM\n" +
//" ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) AS a\n" +
//" LEFT JOIN ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Extend != 'is90' AND Version = '{0}' GROUP BY PurchaseOrderNo, MaterialCode ) AS b ON a.PurchaseOrderNo= b.PurchaseOrderNo \n" +
//" AND a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" WHERE\n" +
//" b.PurchaseOrderNo IS NULL \n" +
//" AND b.MaterialCode IS NULL \n" +
//" ) AS temp1\n" +
//" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
//" AND temp1.SAP编码= temp3.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//" ) unint1 UNION ALL\n" +
//"SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.交货单号,\n" +
//" temp1.交货日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.交货数量,\n" +
//" temp1.收货数量,\n" +
//" temp1.收货与交货差异,\n" +
//" ISNULL( temp3.Qty, 0 ) 退货数量,\n" +
//" ISNULL( temp1.交货数量, 0 ) - ISNULL( temp1.收货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 实际交货数量,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' AS 交货单号,\n" +
//" NULL AS 交货日期,\n" +
//" a.PurchaseOrderNo AS 采购订单号,\n" +
//" c.MaterialCode AS SAP编码,\n" +
//" c.CustomerPartCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" ISNULL( a.ReceiptQty, 0 ) AS 交货数量,\n" +
//" ISNULL( b.ReceiptQty, 0 ) AS 收货数量,\n" +
//" ( ISNULL( b.ReceiptQty, 0 ) - ISNULL( a.ReceiptQty, 0 ) ) AS 收货与交货差异 \n" +
//" FROM\n" +
//" ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) a\n" +
//" INNER JOIN ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Extend != 'is90' AND Version < '{0}' GROUP BY PurchaseOrderNo, MaterialCode ) AS b ON a.PurchaseOrderNo= b.PurchaseOrderNo \n" +
//" AND a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" +
//" WHERE\n" +
//" a.ReceiptQty> b.ReceiptQty \n" +
//" ) AS temp1\n" +
//" LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" +
//" AND temp1.SAP编码= temp3.MaterialCode\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//" ) unint2";
string _sql = string.Format(sqlString, version);

Loading…
Cancel
Save