From 86afc70a14f868e4ae1c196ecf673976b6619590 Mon Sep 17 00:00:00 2001
From: 44673626 <44673626@qq.com>
Date: Sun, 3 Apr 2022 19:20:43 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E4=BC=97=E6=9C=89=E5=8D=95=E5=8F=B7?=
=?UTF-8?q?=E5=A4=87=E4=BB=B6=E5=92=8C=E6=97=A0=E5=8D=95=E5=8F=B7=E5=A4=87?=
=?UTF-8?q?=E4=BB=B6=E6=9B=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../HQFactorySettledDetailDapperRepository.cs | 2 +-
.../SettleSparePartDapperReportRepository.cs | 387 +++++++++++++++++-
...SharePartSettledDetailDiffExportService.cs | 1 +
.../Report/SettleSparePartExportService.cs | 28 +-
4 files changed, 400 insertions(+), 18 deletions(-)
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
index 297dcede..48ba2225 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
@@ -492,7 +492,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
///
- /// 红旗系统未对比对红旗主机厂未结
+ /// 红旗系统未对比对红旗主机厂未结,其中红旗系统未结数据中还包括有发货有结算中发货数量大于结算的也要整合到未结当中
///
///
///
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
index 72b2e19c..9da565c1 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
@@ -452,8 +452,172 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//}
+
+ ///
+ /// 大众备件有单号,统计有结算无发货
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetWithCodeSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
+ string begintime, string endtime)
+ {
+ string sqlString = "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 Version = '{0}' ) 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' 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" +
+ " C.PurchaseOrderNo is null and C.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";
+
+ 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(_sql, null, null, true, 1200, null);
+ return _query.ToList();
+
+ }
+
+
+
+ ///
+ /// 大众备件无单号,求和汇总显示
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetNoCodeSettleSparePartReportList(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" +
+ " '' 采购订单文本,\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" +
+ " '' 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 IS NULL \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " PurchasePriceNoTax \n" +
+ " ) AS a\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";
+
+ 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(_sql, null, null, true, 1200, null);
+ return _query.ToList();
+
+ }
+
+
+
///
- /// 有结算无发货的报表统计
+ /// 不管备件有无单号,财务要求都做一个汇总,然后和寄售库进行比对
///
///
///
@@ -506,11 +670,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ) 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);
+
+ string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
return _query.ToList();
@@ -582,6 +743,218 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
+ ///
+ /// 大众备件未结(带单号),包含有发货有结算(条件:发货数量大于结算数据)也整合到大众备件未结中
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetReverseWithCodeSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
+ string begintime, string endtime)
+ {
+ List _list = new List();
+
+ string condition = "";
+
+ if (!string.IsNullOrEmpty(begintime))
+ {
+ condition += string.Format(" and a.SpareDate>='{0}' ", begintime);
+ }
+ if (!string.IsNullOrEmpty(endtime))
+ {
+ condition += string.Format(" and a.SpareDate<='{0}' ", endtime);
+ }
+
+ 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);
+
+
+
+ //发运数据中,查出看板号+物料号相同的重复数据
+ var sql2 = "SELECT\n" +
+ " a.WMSDeliveryNote WmsBillNum,\n" +
+ " t1.MaterialCode MaterialCode,\n" +
+ " a.PurchaseOrderNo Kanban ,\n" +
+ " A.SpareDate WmsDate \n" +
+ "FROM\n" +
+ " Set_WMSSparePart A\n" +
+ " INNER JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \n" +
+ " AND A.MaterialCode = B.MaterialCode\n" +
+ " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" +
+ "WHERE\n" +
+ " 1 = 1 {0} ";
+ var _sql2 = string.Format(sql2, condition);
+ var listCompare = DbConnection.Query(_sql2);
+
+
+
+
+ //查询发运表中,看板号+物料号没有重复的数据
+ var sql3 = "SELECT\n" +
+ " a.WMSDeliveryNote WmsBillNum,\n" +
+ " t1.MaterialCode MaterialCode,\n" +
+ " a.PurchaseOrderNo Kanban,\n" +
+ " A.SpareDate WmsDate \n" +
+ "FROM\n" +
+ " Set_WMSSparePart A\n" +
+ " LEFT JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \n" +
+ " AND A.MaterialCode = B.MaterialCode\n" +
+ " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" +
+ "WHERE\n" +
+ " B.PurchaseOrderNo IS NULL {0}";
+ var _sql3 = string.Format(sql3, condition);
+ var listCompare1 = DbConnection.Query(_sql3);
+
+
+
+
+
+ //发运数据比较
+ List _ls = new List();
+ foreach (var itm in listCompare.ToList())
+ {
+ var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode);
+ if (first != null)
+ {
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
+
+ first.WmsBillNum += "," + itm.WmsBillNum;
+ first.WmsDate += "," + itm.WmsDate;
+ }
+ else
+ {
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
+ _ls.Add(itm);
+ }
+
+ }
+
+ foreach (var itm in listCompare1.ToList())
+ {
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
+ _ls.Add(itm);
+ }
+
+
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+
+ foreach (var itm1 in _list)
+ {
+ var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.采购订单号 && p.MaterialCode == itm1.SAP编码);
+ if (itm != null)
+ {
+ itm1.交货单号 = itm.WmsBillNum;
+ itm1.交货日期 = itm.WmsDate;
+ }
+ }
+
+
+ return _list;
+
+ }
+
+
}
@@ -596,7 +969,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
-public class SparePartSumQtyDiff
+ public class SparePartSumQtyDiff
{
public decimal 数量差异 { set; get; }
public string 订单号 { set; get; }
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
index 30bdb6dc..7cc4697a 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
@@ -59,6 +59,7 @@ namespace SettleAccount.Job.Services.Report
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
+ //备件明细数据
var _ls = _dapperRepository.GetSharePartSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//求和汇总
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs
index 1b25aa14..874c34d2 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs
@@ -45,15 +45,21 @@ namespace SettleAccount.Job.Services.Report
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
- //汇总
+ //大众备件明细输出
var _ls = _dapper.GetSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
- //正向对比,有结算无发货
- var _forwardls = _dapper.GetForwardSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
+ //正向对比,即有结算无发货,针对有单号备件,订单号+物料号明细
+ var _forwardls_withcode = _dapper.GetWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
+
+ //反向对比,即大众备件未结(有单号),包含有发货有结算并且发货数量大于结算数量的数据也整合到未结中
+ var _reversels_withcode = _dapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
+
+ //针对无单号备件,求和汇总显示
+ var _forwardls_nocode = _dapper.GetNoCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
- //反向对比,有发货无结算
- var _reversels = _dapper.GetReverseSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
+ //不管有单号备件还是无单号备件,财务要求全部按照零件汇总求和显示,并和寄售库存比对
+ var _forwardls = _dapper.GetForwardSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
//按照零件号汇总数量,有一列显示寄售库数量
var stockList = _wmsDapper.GetSalesStock();
var queryStockList = from itm in _forwardls
@@ -65,7 +71,7 @@ namespace SettleAccount.Job.Services.Report
itm.物料描述,
itm.开票数量,
tm1 == null ? 0 : tm1.Qty
- );
+ );
@@ -126,11 +132,13 @@ namespace SettleAccount.Job.Services.Report
ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls.ToList(), "大众备件数据输出")
- .SeparateBySheet()
- .Append(_forwardls.ToList(), "有结算无发货对比")
+ var result = _exporter.Append(_ls.ToList(), "大众备件明细数据")
.SeparateBySheet()
- .Append(_reversels.ToList(), "有发货无结算对比")
+ .Append(_forwardls_withcode.ToList(), "有结算无发货对比")
+ .SeparateBySheet()
+ .Append(_reversels_withcode.ToList(), "大众备件未结(包含发货数量大于结算数据)")
+ .SeparateBySheet()
+ .Append(_forwardls_nocode.ToList(), "大众备件无单号汇总")
.SeparateBySheet()
.Append(queryStockList.ToList(), "零件汇总比对寄售库存")
.ExportAppendDataAsByteArray();