From 9e398c8bf61e5c1d23a7589173403aaa4d91d947 Mon Sep 17 00:00:00 2001
From: 44673626 <44673626@qq.com>
Date: Fri, 25 Feb 2022 20:39:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E6=B1=BD=E8=BD=BF=E8=BD=A6=E6=8A=A5?=
=?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ReportServices/ReportMakeService.cs | 56 +-
.../SettleAccount.Application.xml | 7 -
.../HQCarSettledDetailDapperRepository.cs | 520 +++++++++-----
.../HQHSettledDetailDapperRepository.cs | 646 ++++++++++++++----
.../HQCarSettledDetailDiffExportService.cs | 82 ++-
...SharePartSettledDetailDiffExportService.cs | 1 -
6 files changed, 934 insertions(+), 378 deletions(-)
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
index 41c644c1..dce65dea 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
@@ -683,35 +683,35 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
- ///
- ///红旗工厂未结明细
- ///
- /// 上传的文件(前端已经限制只能上传一个附件)
- ///
- [HttpPost]
- [Route("HQHUnSettledDetailDiffExportService")]
- [DisableRequestSizeLimit]
- public async Task HQHUnSettledDetailDiffExportServiceMake(
- HQKanbanRequestDto input
- )
- {
+ /////
+ /////红旗工厂未结明细
+ /////
+ ///// 上传的文件(前端已经限制只能上传一个附件)
+ /////
+ //[HttpPost]
+ //[Route("HQHUnSettledDetailDiffExportService")]
+ //[DisableRequestSizeLimit]
+ //public async Task HQHUnSettledDetailDiffExportServiceMake(
+ // HQKanbanRequestDto input
+ // )
+ //{
- List customConditionList = new List();
- customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
- customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
- customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
- customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
- customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
- customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
- customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
- customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
- customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
- customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
- var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) =>
- {
- });
- return _taskid;
- }
+ // List customConditionList = new List();
+ // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
+ // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
+ // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
+ // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
+ // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
+ // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
+ // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
+ // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
+ // var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) =>
+ // {
+ // });
+ // return _taskid;
+ //}
///
/// 红旗工厂备件明细
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
index 43f8408d..87cc32f5 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
@@ -4100,13 +4100,6 @@
上传的文件(前端已经限制只能上传一个附件)
-
-
- 红旗工厂未结明细
-
- 上传的文件(前端已经限制只能上传一个附件)
-
-
红旗工厂备件明细
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
index 766f9da4..bb6cda36 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
@@ -47,7 +47,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
-
+ ///
+ /// 轿车中不包含备品数据
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public virtual List GetHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
@@ -57,127 +65,48 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
- if (!string.IsNullOrEmpty(begin))
- {
- condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
- }
- if (!string.IsNullOrEmpty(end))
- {
- condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
- }
+ //if (!string.IsNullOrEmpty(begin))
+ //{
+ // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
+ //}
+ //if (!string.IsNullOrEmpty(end))
+ //{
+ // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
+ //}
string str = "SELECT\n" +
- " temp1.交货日期,\n" +
- " temp1.手工或自动,\n" +
- " '' 订单日期,\n" +
- " temp1.[收货仓库],\n" +
- " temp1.[收货仓库描述],\n" +
- " temp1.[订货看板号],\n" +
- " temp1.[订货零件号],\n" +
- " temp1.[SAP编码],\n" +
- " temp1.[发货零件号],\n" +
- " temp1.[物料组],\n" +
- " temp1.[物料描述],\n" +
- " temp1.[发货数量],\n" +
- " ISNULL( TEMP2.Price, 0 ) AS 发货定价,\n" +
- " temp1.[发货总金额],\n" +
- " temp1.[发货状态],\n" +
- " temp1.[结算验收单],\n" +
- " temp1.[结算零件号],\n" +
- " temp1.[结算数量],\n" +
- " temp1.[结算单价],\n" +
- " temp1.[结算金额],\n" +
- " temp1.[发货数量] - temp1.[结算数量] AS 数量差异,\n" +
- " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
- " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
- "FROM\n" +
- " (\n" +
- " SELECT NULL AS\n" +
- " 交货日期,\n" +
- " '' AS 手工或自动,\n" +
- " '' 交货单号,\n" +
- " '' 收货仓库,\n" +
- " '' 收货仓库描述,\n" +
- " '' 订货看板号,\n" +
- " '' 订货零件号,\n" +
- " C.MaterialCode AS SAP编码,\n" +
- " '' 发货零件号,\n" +
- " C.EstimateTypeDesc 物料组,\n" +
- " C.MaterialDesc 物料描述,\n" +
- " 0 AS 发货数量,\n" +
- " 0 发货总金额,\n" +
- " '' 发货状态,\n" +
- " '' 结算验收单,\n" +
- " '' 结算零件号,\n" +
- " isnull( A.Qty, 0 ) AS 结算数量,\n" +
- " isnull( A.Price, 0 ) AS 结算单价,\n" +
- " isnull( A.Price, 0 ) * isnull( A.Qty, 0 ) AS 结算金额,\n" +
- " 0 寄销库数量 \n" +
- " FROM\n" +
- " ( SELECT Price, SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform GROUP BY MaterialCode, price, Version ) A\n" +
- " INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
- " WHERE\n" +
- " A.Version= '{0}' \n" +
- " ) temp1\n" +
- " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.SAP编码 = temp2.MaterialCode";
-
- //string str = "SELECT\n" +
- // " temp1.*,\n" +
- // " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
- // " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 -- isnull( temp2.Price, 0 ) 销售单价,\n" +
- // "-- ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异\n" +
- // " \n" +
- // "FROM\n" +
- // " (\n" +
- // " SELECT NULL AS\n" +
- // " 交货日期,\n" +
- // " '手工看板' AS 手工或自动,\n" +
- // " '' 交货单号,\n" +
- // " A.StorageLocation 收货仓库,\n" +
- // " A.StorageLocationDesc 收货仓库描述,\n" +
- // " A.AcceptanceNo 订货看板号,\n" +
- // " '' 订货零件号,\n" +
- // " C.MaterialCode AS SAP编码,\n" +
- // " '' 发货零件号,\n" +
- // " C.EstimateTypeDesc 物料组,\n" +
- // " C.MaterialDesc 物料描述,\n" +
- // " 0 AS 发货数量,\n" +
- // " 0 发货总金额,\n" +
- // " '' 发货状态,\n" +
- // " '' 结算验收单,\n" +
- // " '' 结算零件号,\n" +
- // " isnull(A.Qty,0) AS 结算数量,\n" +
- // " isnull(A.Price,0) AS 结算单价,\n" +
- // " isnull(A.Amt,0) AS 结算金额,\n" +
- // "--A.MaterialCode 物料号,\n" +
- // " 0 寄销库数量 \n" +
- // " FROM\n" +
- // " (\n" +
- // " SELECT\n" +
- // " Price,\n" +
- // " SUM ( Qty ) Qty,\n" +
- // " MaterialCode,\n" +
- // " StorageLocation,\n" +
- // " StorageLocationDesc,\n" +
- // " AcceptanceNo,\n" +
- // " Amt \n" +
- // " FROM\n" +
- // " Set_BT_Car_Platform \n" +
- // " WHERE\n" +
- // " version = '{0}' \n" +
- // " GROUP BY\n" +
- // " MaterialCode,\n" +
- // " StorageLocation,\n" +
- // " StorageLocationDesc,\n" +
- // " price,\n" +
- // " AcceptanceNo,\n" +
- // " Amt \n" +
- // " ) A\n" +
- // " INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
- // " ) temp1\n" +
- // " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.SAP编码 = temp2.MaterialCode";
-
- var _sql = string.Format(str, version, condition);
+ " temp1.*,\n" +
+ " isnull( temp2.Price, 0 ) 定价,\n" +
+ " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
+ " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " ISNULL( A.Price, 0 ) 结算单价,\n" +
+ " ISNULL( A.Qty, 0 ) 结算数量,\n" +
+ " ISNULL( A.Price, 0 ) * ISNULL( A.Qty, 0 ) 结算金额,\n" +
+ " a.MaterialCode 结算物料号,\n" +
+ " A.StorageLocation 收货仓库,\n" +
+ " A.StorageLocationDesc 收货仓库描述,\n" +
+ " C.EstimateTypeDesc 物料组,\n" +
+ " C.MaterialCode Sap编码,\n" +
+ " C.MaterialDesc 物料描述,\n" +
+ " 0 寄销库数量 \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform A\n" +
+ " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " \n" +
+ " WHERE\n" +
+ " a.Version= '{0}' \n" +
+ " AND a.StorageLocationDesc NOT LIKE '%备品%'\n" +
+ " ) temp1\n" +
+ " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" +
+ " ";
+
+
+
+ //var _sql = string.Format(str, version, condition);
+ var _sql = string.Format(str, version);
var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
_list = _query.ToList();
@@ -185,92 +114,307 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
+ ///
+ /// 轿车中不包含备品--求和出库
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetHQCarSettledDetailDiffSumReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ {
+
+ List _list = new List();
+
+ string condition = " ";
+
- //public virtual List GetHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
- //{
-
- // List _list = new List();
-
- // string condition = " ";
-
-
-
- // if (!string.IsNullOrEmpty(begin))
- // {
- // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
- // }
- // if (!string.IsNullOrEmpty(end))
- // {
- // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
- // }
-
- // string str =
- // "SELECT\n" +
- // " temp1.*,\n" +
- // " isnull( temp2.Price, 0 ) 销售单价,\n" +
- // " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异 \n" +
- // "FROM\n" +
- // " (\n" +
- // " SELECT\n" +
- // " A.Price 结算单价,\n" +
- // " A.Qty 结算数量,\n" +
- // " A.MaterialCode 结算物料号,\n" +
- // " A.StorageLocation 收货仓库,\n" +
- // " A.StorageLocationDesc 收货仓库描述,\n" +
- // " C.EstimateTypeDesc 物料组,\n" +
- // " C.MaterialCode Sap编码,\n" +
- // " C.MaterialDesc 物料描述,\n" +
- // " 0 寄销库数量 \n" +
- // " FROM\n" +
- // " (\n" +
- // " SELECT\n" +
- // " Price,\n" +
- // " SUM ( Qty ) Qty,\n" +
- // " MaterialCode,\n" +
- // " StorageLocation,\n" +
- // " StorageLocationDesc \n" +
- // " FROM\n" +
- // " Set_BT_Car_Platform \n" +
- // " WHERE\n" +
- // " version = '{0}' \n" +
- // " {1} \n" +
- // " GROUP BY\n" +
- // " MaterialCode,\n" +
- // " StorageLocation,\n" +
- // " StorageLocationDesc,\n" +
- // " price \n" +
- // " ) A\n" +
- // " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
- // " ) temp1\n" +
- // " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
- // var _sql = string.Format(str, version, condition);
-
- // var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
- // _list = _query.ToList();
- // return _list;
-
- //}
+ //if (!string.IsNullOrEmpty(begin))
+ //{
+ // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
+ //}
+ //if (!string.IsNullOrEmpty(end))
+ //{
+ // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
+ //}
+ string str = "SELECT\n" +
+ " temp1.*,\n" +
+ " isnull( temp2.Price, 0 ) 定价,\n" +
+ " ISNULL( temp3.Price, 0 ) 结算单价,\n" +
+ " ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
+ " ( temp3.Price * temp1.结算数量 ) 结算金额,\n" +
+ " ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " ISNULL( A.Qty, 0 ) 结算数量,\n" +
+ " A.MaterialCode 结算物料号,\n" +
+ " A.StorageLocation 收货仓库,\n" +
+ " A.StorageLocationDesc 收货仓库描述,\n" +
+ " C.EstimateTypeDesc 物料组,\n" +
+ " C.MaterialCode Sap编码,\n" +
+ " C.MaterialDesc 物料描述,\n" +
+ " 0 寄销库数量 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT SUM\n" +
+ " ( Qty ) Qty,\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " AND StorageLocationDesc NOT LIKE '%备品%' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Version \n" +
+ " ) A\n" +
+ " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " ) temp1\n" +
+ " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" +
+ " LEFT JOIN (\n" +
+ " SELECT SUM\n" +
+ " ( Amt ) / SUM ( Qty ) AS Price,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " AND StorageLocationDesc NOT LIKE '%备品%' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
+
+
+
+ //var _sql = string.Format(str, version, condition);
+ var _sql = string.Format(str, version);
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+ return _list;
+
+ }
+ ///
+ /// 只包含备品
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetBJHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ {
+
+ List _list = new List();
+
+ string condition = " ";
+
+
+
+ //if (!string.IsNullOrEmpty(begin))
+ //{
+ // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
+ //}
+ //if (!string.IsNullOrEmpty(end))
+ //{
+ // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
+ //}
+
+ string str = "SELECT\n" +
+ " temp1.*,\n" +
+ " isnull( temp2.Price, 0 ) 定价,\n" +
+ " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
+ " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " ISNULL( A.Price, 0 ) 结算单价,\n" +
+ " ISNULL( A.Qty, 0 ) 结算数量,\n" +
+ " ISNULL( A.Price, 0 ) * ISNULL( A.Qty, 0 ) 结算金额,\n" +
+ " a.MaterialCode 结算物料号,\n" +
+ " A.StorageLocation 收货仓库,\n" +
+ " A.StorageLocationDesc 收货仓库描述,\n" +
+ " C.EstimateTypeDesc 物料组,\n" +
+ " C.MaterialCode Sap编码,\n" +
+ " C.MaterialDesc 物料描述,\n" +
+ " 0 寄销库数量 \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform A\n" +
+ " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " \n" +
+ " WHERE\n" +
+ " a.Version= '{0}' \n" +
+ " AND a.StorageLocationDesc LIKE '%备品%'\n" +
+ " ) temp1\n" +
+ " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" +
+ " ";
+
+
+
+ //var _sql = string.Format(str, version, condition);
+ var _sql = string.Format(str, version);
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+ return _list;
+
+ }
+
+ ///
+ /// 只包含备件--求和出库
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetBJHQCarSettledDetailDiffSumReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ {
+
+ List _list = new List();
+
+ string condition = " ";
+
+
+
+ //if (!string.IsNullOrEmpty(begin))
+ //{
+ // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
+ //}
+ //if (!string.IsNullOrEmpty(end))
+ //{
+ // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
+ //}
+
+ string str = "SELECT\n" +
+ " temp1.*,\n" +
+ " isnull( temp2.Price, 0 ) 定价,\n" +
+ " ISNULL( temp3.Price, 0 ) 结算单价,\n" +
+ " ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异,\n" +
+ " ( temp3.Price * temp1.结算数量 ) 结算金额,\n" +
+ " ( isnull( temp3.Price, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " ISNULL( A.Qty, 0 ) 结算数量,\n" +
+ " A.MaterialCode 结算物料号,\n" +
+ " A.StorageLocation 收货仓库,\n" +
+ " A.StorageLocationDesc 收货仓库描述,\n" +
+ " C.EstimateTypeDesc 物料组,\n" +
+ " C.MaterialCode Sap编码,\n" +
+ " C.MaterialDesc 物料描述,\n" +
+ " 0 寄销库数量 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT SUM\n" +
+ " ( Qty ) Qty,\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " AND StorageLocationDesc LIKE '%备品%' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Version \n" +
+ " ) A\n" +
+ " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " ) temp1\n" +
+ " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" +
+ " LEFT JOIN (\n" +
+ " SELECT SUM\n" +
+ " ( Amt ) / SUM ( Qty ) AS Price,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " AND StorageLocationDesc LIKE '%备品%' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
+
+
+
+ //var _sql = string.Format(str, version, condition);
+ var _sql = string.Format(str, version);
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+ return _list;
+
+ }
}
public class HQCarSettledDetailDiff
{
+ public HQCarSettledDetailDiff()
+ {
+ }
+
+
+
+ public HQCarSettledDetailDiff(string sapMaterialCode, string materialCode, string materialDesc, decimal price,
+ string storageLocation, string storageLocationDesc, decimal selprice, decimal diffprice, decimal sumprice, decimal settleprice, decimal qty,
+ decimal sockQty,string metarialGroup)
+ {
+ SAP编码 = sapMaterialCode;
+ 物料描述 = materialDesc;
+ 结算物料号 = materialCode;
+ 寄销库数量 = sockQty;
+ 结算单价 = price;
+ 收货仓库 = storageLocation;
+ 收货仓库描述 = storageLocationDesc;
+ 定价 = selprice;
+ 价格差异 = diffprice;
+ 差异总金额 = sumprice;
+ 结算数量 = qty;
+ 结算金额 = settleprice;
+ 物料组 = metarialGroup;
+ }
+
+
+
[ExporterHeader(DisplayName = "交货日期")]
public string 交货日期 { set; get; }
[ExporterHeader(DisplayName = "手工或自动")]
public string 手工或自动 { set; get; }
[ExporterHeader(DisplayName = "交货单号")]
+
public string 交货单号 { set; get; }
[ExporterHeader(DisplayName = "收货仓库")]
public string 收货仓库 { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")]
public string 收货仓库描述 { set; get; }
[ExporterHeader(DisplayName = "订货看板号")]
+
public string 订货看板号 { set; get; }
+ [ExporterHeader(DisplayName = "结算物料号")]
+ public string 结算物料号 { set; get; }
[ExporterHeader(DisplayName = "订货零件号")]
public string 订货零件号 { set; get; }
[ExporterHeader(DisplayName = "SAP编码")]
@@ -281,8 +425,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string 物料描述 { set; get; }
[ExporterHeader(DisplayName = "发货数量")]
public decimal 发货数量 { set; get; }
- [ExporterHeader(DisplayName = "发货定价")]
- public decimal 发货定价 { set; get; }
+ [ExporterHeader(DisplayName = "定价")]
+ public decimal 定价 { set; get; }
[ExporterHeader(DisplayName = "发货总金额")]
public decimal 发货总金额 { set; get; }
[ExporterHeader(DisplayName = "发货状态")]
@@ -299,8 +443,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal 结算金额 { set; get; }
[ExporterHeader(DisplayName = "数量差异")]
public decimal 数量差异 { set; get; }
- [ExporterHeader(DisplayName = "单价差异")]
- public decimal 单价差异 { set; get; }
+ [ExporterHeader(DisplayName = "价格差异")]
+ public decimal 价格差异 { set; get; }
[ExporterHeader(DisplayName = "差异总金额")]
public decimal 差异总金额 { set; get; }
[ExporterHeader(DisplayName = "寄销库数量")]
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
index 9ad33307..5eb62f1b 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
@@ -57,10 +57,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List _list = new List();
-
+
//string condition = " ";
-
+
//if (!string.IsNullOrEmpty(begin))
//{
// condition += string.Format(" and b.LastModificationTime>='{0}' ", begin);
@@ -69,98 +69,287 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//{
// condition += string.Format(" and b.LastModificationTime<='{0}' ", end);
//}
-
+
string str = "SELECT\n" +
- " isnull( temp1.交货单号, '' ) 交货单号,\n" +
- " temp1.交货时间,\n" +
- " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
- " temp1.[工厂],\n" +
- " temp1.收货仓库,\n" +
- " temp1.收货仓库描述,\n" +
- " temp1.订货看板编号,\n" +
- " temp1.订货零件号,\n" +
- " temp1.验收单日期,\n" +
- " temp1.Sap编码,\n" +
- " temp1.看板编号,\n" +
- " temp1.物料组,\n" +
- " temp1.零件中文名称,\n" +
- " temp1.发货数量,\n" +
- " temp1.发货状态,\n" +
- " temp1.结算验收单号,\n" +
- " temp1.结算数量,\n" +
- " temp3.Price AS 结算单价,\n" +
- " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
- " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
- " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
- " (isnull( temp1.发货数量, 0 )-isnull(temp1.[结算数量],0)) AS 数量差异,\n" +
- " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
- " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
- "FROM\n" +
- " (\n" +
- " SELECT\n" +
- " '' AS 交货单号,\n" +
- " NULL AS 交货时间,\n" +
- " '' AS 手工或自动,\n" +
- " a.StorageLocation AS 收货仓库,\n" +
- " a.StorageLocationDesc AS 收货仓库描述,\n" +
- " a.HQHKanBan AS 订货看板编号,\n" +
- " a.MaterialCode AS 订货零件号,\n" +
- " c.MaterialCode Sap编码,\n" +
- " a.MaterialCode 结算物料代码,\n" +
- " c.MaterialDesc AS 零件中文名称,\n" +
- " isnull( b.Qty, 0 ) AS 发货数量,\n" +
- " 2 AS 发货状态,\n" +
- " '' AS 结算验收单号,\n" +
- " isnull( a.Qty, 0 ) AS 结算数量,\n" +
- " C.EstimateTypeDesc AS 物料组,\n" +
- " a.Factory AS 工厂,\n" +
- " '' AS 看板编号,\n" +
- " '' AS 验收单日期 \n" +
- " FROM\n" +
- " (\n" +
- " SELECT SUM\n" +
- " ( Qty ) AS Qty,\n" +
- " HQHKanBan,\n" +
- " MaterialCode,\n" +
- " Version,\n" +
- " StorageLocation,\n" +
- " StorageLocationDesc,\n" +
- " Factory \n" +
- " FROM\n" +
- " Set_HQ_H_Platform \n" +
- " GROUP BY\n" +
- " HQHKanBan,\n" +
- " MaterialCode,\n" +
- " Version,\n" +
- " StorageLocation,\n" +
- " StorageLocationDesc,\n" +
- " Factory \n" +
- " ) AS a\n" +
- " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
- " AND a.MaterialCode = b.MaterialCode\n" +
- " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
- " WHERE\n" +
- " ( a.HQHKanBan <> 'BJ' ) \n" +
- " AND a.Version= '{0}' \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" +
- " LEFT JOIN (\n" +
- " SELECT SUM\n" +
- " ( Amt ) / SUM ( Qty ) AS Price,\n" +
- " HQHKanBan,\n" +
- " MaterialCode,\n" +
- " Version \n" +
- " FROM\n" +
- " Set_HQ_H_Platform \n" +
- " WHERE\n" +
- " HQHKanBan <> 'BJ' \n" +
- " AND Version = '{0}' \n" +
- " GROUP BY\n" +
- " HQHKanBan,\n" +
- " MaterialCode,\n" +
- " Version \n" +
- " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
- " AND temp1.订货看板编号 = TEMP3.HQHKanBan";
+ " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ " temp1.交货时间,\n" +
+ " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ " temp1.[工厂],\n" +
+ " temp1.收货仓库,\n" +
+ " temp1.收货仓库描述,\n" +
+ " temp1.订货看板编号,\n" +
+ " temp1.订货零件号,\n" +
+ " temp1.验收单日期,\n" +
+ " temp1.Sap编码,\n" +
+ " temp1.看板编号,\n" +
+ " temp1.物料组,\n" +
+ " temp1.零件中文名称,\n" +
+ " temp1.发货数量,\n" +
+ " temp1.发货状态,\n" +
+ " temp1.结算验收单号,\n" +
+ " temp1.结算数量,\n" +
+ " temp3.Price AS 结算单价,\n" +
+ " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
+ " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" +
+ " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " '' AS 交货单号,\n" +
+ " NULL AS 交货时间,\n" +
+ " '' AS 手工或自动,\n" +
+ " a.StorageLocation AS 收货仓库,\n" +
+ " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ " a.HQHKanBan AS 订货看板编号,\n" +
+ " a.MaterialCode AS 订货零件号,\n" +
+ " c.MaterialCode Sap编码,\n" +
+ " a.MaterialCode 结算物料代码,\n" +
+ " c.MaterialDesc AS 零件中文名称,\n" +
+ " isnull( b.Qty, 0 ) AS 发货数量,\n" +
+ " 2 AS 发货状态,\n" +
+ " a.[AcceptanceNo] AS 结算验收单号,\n" +
+ " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ " C.EstimateTypeDesc AS 物料组,\n" +
+ " a.Factory AS 工厂,\n" +
+ " '' AS 看板编号,\n" +
+ " '' AS 验收单日期 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT SUM\n" +
+ " ( Qty ) AS Qty,\n" +
+ " HQHKanBan,\n" +
+ " MaterialCode,\n" +
+ " Version,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Factory,AcceptanceNo \n" +
+ " FROM\n" +
+ " Set_HQ_H_Platform \n" +
+ " GROUP BY\n" +
+ " HQHKanBan,\n" +
+ " MaterialCode,\n" +
+ " Version,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Factory,AcceptanceNo \n" +
+ " ) AS a\n" +
+ " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
+ " AND a.MaterialCode = b.MaterialCode\n" +
+ " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " WHERE\n" +
+ " ( a.HQHKanBan <> 'BJ' AND a.HQHKanBan IS NOT NULL ) \n" +
+ " AND a.Version= '{0}' \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" +
+ " LEFT JOIN (\n" +
+ " SELECT\n" +
+ " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" +
+ " HQHKanBan,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_HQ_H_Platform \n" +
+ " WHERE\n" +
+ " HQHKanBan <> 'BJ' \n" +
+ " AND Version = '{0}' \n" +
+ " GROUP BY\n" +
+ " HQHKanBan,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
+ " AND temp1.订货看板编号 = TEMP3.HQHKanBan";
+
+
+ //string str = "SELECT\n" +
+ // " aaaa.* \n" +
+ // "FROM\n" +
+ // " (\n" +
+ // " SELECT\n" +
+ // " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ // " temp1.交货时间,\n" +
+ // " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ // " temp1.[工厂],\n" +
+ // " temp1.收货仓库,\n" +
+ // " temp1.收货仓库描述,\n" +
+ // " temp1.订货看板编号,\n" +
+ // " temp1.订货零件号,\n" +
+ // " temp1.验收单日期,\n" +
+ // " temp1.Sap编码,\n" +
+ // " temp1.看板编号,\n" +
+ // " temp1.物料组,\n" +
+ // " temp1.零件中文名称,\n" +
+ // " temp1.发货数量,\n" +
+ // " temp1.发货状态,\n" +
+ // " temp1.结算验收单号,\n" +
+ // " temp1.结算数量,\n" +
+ // " temp3.Price AS 结算单价,\n" +
+ // " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
+ // " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ // " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ // " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" +
+ // " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ // " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ // " FROM\n" +
+ // " (\n" +
+ // " SELECT\n" +
+ // " '' AS 交货单号,\n" +
+ // " NULL AS 交货时间,\n" +
+ // " '' AS 手工或自动,\n" +
+ // " a.StorageLocation AS 收货仓库,\n" +
+ // " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ // " a.HQHKanBan AS 订货看板编号,\n" +
+ // " a.MaterialCode AS 订货零件号,\n" +
+ // " c.MaterialCode Sap编码,\n" +
+ // " a.MaterialCode 结算物料代码,\n" +
+ // " c.MaterialDesc AS 零件中文名称,\n" +
+ // " isnull( b.Qty, 0 ) AS 发货数量,\n" +
+ // " 2 AS 发货状态,\n" +
+ // " '' AS 结算验收单号,\n" +
+ // " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ // " C.EstimateTypeDesc AS 物料组,\n" +
+ // " a.Factory AS 工厂,\n" +
+ // " '' AS 看板编号,\n" +
+ // " '' AS 验收单日期 \n" +
+ // " FROM\n" +
+ // " (\n" +
+ // " SELECT SUM\n" +
+ // " ( Qty ) AS Qty,\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version,\n" +
+ // " StorageLocation,\n" +
+ // " StorageLocationDesc,\n" +
+ // " Factory \n" +
+ // " FROM\n" +
+ // " Set_HQ_H_Platform \n" +
+ // " GROUP BY\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version,\n" +
+ // " StorageLocation,\n" +
+ // " StorageLocationDesc,\n" +
+ // " Factory \n" +
+ // " ) AS a\n" +
+ // " INNER JOIN ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode ) AS b ON a.HQHKanBan = b.Kanban \n" +
+ // " AND a.MaterialCode = b.MaterialCode\n" +
+ // " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ // " WHERE\n" +
+ // " ( a.HQHKanBan <> 'BJ' AND a.HQHKanBan IS NOT NULL ) \n" +
+ // " AND a.Version= '{0}' \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" +
+ // " LEFT JOIN (\n" +
+ // " SELECT\n" +
+ // " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version \n" +
+ // " FROM\n" +
+ // " Set_HQ_H_Platform \n" +
+ // " WHERE\n" +
+ // " HQHKanBan <> 'BJ' \n" +
+ // " AND Version = '{0}' \n" +
+ // " GROUP BY\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version \n" +
+ // " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
+ // " AND temp1.订货看板编号 = TEMP3.HQHKanBan \n" +
+ // " ) aaaa UNION ALL\n" +
+ // "SELECT\n" +
+ // " ccc.* \n" +
+ // "FROM\n" +
+ // " (\n" +
+ // " SELECT\n" +
+ // " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ // " temp1.交货时间,\n" +
+ // " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ // " temp1.[工厂],\n" +
+ // " temp1.收货仓库,\n" +
+ // " temp1.收货仓库描述,\n" +
+ // " temp1.订货看板编号,\n" +
+ // " temp1.订货零件号,\n" +
+ // " temp1.验收单日期,\n" +
+ // " temp1.Sap编码,\n" +
+ // " temp1.看板编号,\n" +
+ // " temp1.物料组,\n" +
+ // " temp1.零件中文名称,\n" +
+ // " temp1.发货数量,\n" +
+ // " temp1.发货状态,\n" +
+ // " temp1.结算验收单号,\n" +
+ // " temp1.结算数量,\n" +
+ // " temp3.Price AS 结算单价,\n" +
+ // " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
+ // " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ // " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ // " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" +
+ // " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ // " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ // " FROM\n" +
+ // " (\n" +
+ // " SELECT\n" +
+ // " '' AS 交货单号,\n" +
+ // " NULL AS 交货时间,\n" +
+ // " '' AS 手工或自动,\n" +
+ // " a.StorageLocation AS 收货仓库,\n" +
+ // " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ // " '' AS 订货看板编号,\n" +
+ // " a.MaterialCode AS 订货零件号,\n" +
+ // " c.MaterialCode Sap编码,\n" +
+ // " a.MaterialCode 结算物料代码,\n" +
+ // " c.MaterialDesc AS 零件中文名称,\n" +
+ // " 0 AS 发货数量,\n" +
+ // " 2 AS 发货状态,\n" +
+ // " '' AS 结算验收单号,\n" +
+ // " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ // " C.EstimateTypeDesc AS 物料组,\n" +
+ // " a.Factory AS 工厂,\n" +
+ // " '' AS 看板编号,\n" +
+ // " '' AS 验收单日期 \n" +
+ // " FROM\n" +
+ // " (\n" +
+ // " SELECT SUM\n" +
+ // " ( Qty ) AS Qty,\n" +
+ // " MaterialCode,\n" +
+ // " Version,\n" +
+ // " StorageLocation,\n" +
+ // " StorageLocationDesc,\n" +
+ // " Factory \n" +
+ // " FROM\n" +
+ // " Set_HQ_H_Platform \n" +
+ // " WHERE\n" +
+ // " HQHKanBan IS NULL \n" +
+ // " GROUP BY\n" +
+ // " MaterialCode,\n" +
+ // " Version,\n" +
+ // " StorageLocation,\n" +
+ // " StorageLocationDesc,\n" +
+ // " Factory \n" +
+ // " ) AS a\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 = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
+ // " LEFT JOIN (\n" +
+ // " SELECT\n" +
+ // " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" +
+ // " MaterialCode,\n" +
+ // " Version \n" +
+ // " FROM\n" +
+ // " Set_HQ_H_Platform \n" +
+ // " WHERE\n" +
+ // " HQHKanBan IS NULL \n" +
+ // " AND Version = '{0}' \n" +
+ // " GROUP BY\n" +
+ // " MaterialCode,\n" +
+ // " Version \n" +
+ // " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
+ // " ) ccc";
+
//var _sql = string.Format(str, version, condition);
var _sql = string.Format(str, version);
@@ -400,63 +589,216 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
List _list = new List();
-
+
string str = "SELECT\n" +
- " temp1.交货时间,\n" +
- " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
- " isnull( temp1.交货单号, '' ) 交货单号,\n" +
- " temp1.[工厂],\n" +
- " temp1.收货仓库,\n" +
- " temp1.收货仓库描述,\n" +
- " temp1.订货看板编号,\n" +
- " temp1.订货零件号,\n" +
- " temp1.验收单日期,\n" +
- " temp1.Sap编码,\n" +
- " temp1.看板编号,\n" +
- " temp1.物料组,\n" +
- " temp1.零件中文名称,\n" +
- " temp1.发货数量,\n" +
- " temp1.发货状态,\n" +
- " temp1.结算验收单号,\n" +
- " temp1.结算数量,\n" +
- " temp1.结算单价,\n" +
- " temp1.结算金额,\n" +
- " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
- " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
- " 0 AS 数量差异,\n" +
- " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
- " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
- "FROM\n" +
- " (\n" +
- " SELECT\n" +
- " b.WmsBillNum AS 交货单号,\n" +
- " CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" +
- " b.IsAuto AS 手工或自动,\n" +
- " a.StorageLocation AS 收货仓库,\n" +
- " a.StorageLocationDesc AS 收货仓库描述,\n" +
- " a.HQHKanBan AS 订货看板编号,\n" +
- " a.MaterialCode AS 订货零件号,\n" +
- " c.MaterialCode Sap编码,\n" +
- " c.MaterialDesc AS 零件中文名称,\n" +
- " isnull( b.Qty, 0 ) AS 发货数量,\n" +
- " isnull( b.State, 0 ) AS 发货状态,\n" +
- " a.AcceptanceNo AS 结算验收单号,\n" +
- " isnull( a.Qty, 0 ) AS 结算数量,\n" +
- " isnull( a.Price, 0 ) AS 结算单价,\n" +
- " isnull( a.Amt, 0 ) AS 结算金额 ,\n" +
- " C.EstimateTypeDesc AS 物料组,\n" +
- " a.Factory AS 工厂,\n" +
- " a.KanbanNumber AS 看板编号,\n" +
- " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
- " FROM\n" +
- " Set_HQ_H_Platform AS a\n" +
- " LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" +
- " AND a.MaterialCode = b.MaterialCode\n" +
- " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
- " WHERE\n" +
- " a.HQHKanBan <>'BJ' AND a.Version= '{0}' \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 WHERE temp1.[交货单号] is null ";
+ " aaaa.* \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " temp1.交货时间,\n" +
+ " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ " temp1.[工厂],\n" +
+ " temp1.收货仓库,\n" +
+ " temp1.收货仓库描述,\n" +
+ " temp1.订货看板编号,\n" +
+ " temp1.订货零件号,\n" +
+ " temp1.验收单日期,\n" +
+ " temp1.Sap编码,\n" +
+ " temp1.看板编号,\n" +
+ " temp1.物料组,\n" +
+ " temp1.零件中文名称,\n" +
+ " temp1.发货数量,\n" +
+ " temp1.发货状态,\n" +
+ " temp1.结算验收单号,\n" +
+ " temp1.结算数量,\n" +
+ " temp1.结算单价,\n" +
+ " temp1.结算金额,\n" +
+ " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ " 0 AS 数量差异,\n" +
+ " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " b.WmsBillNum AS 交货单号,\n" +
+ " CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" +
+ " b.IsAuto AS 手工或自动,\n" +
+ " a.StorageLocation AS 收货仓库,\n" +
+ " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ " a.HQHKanBan AS 订货看板编号,\n" +
+ " a.MaterialCode AS 订货零件号,\n" +
+ " c.MaterialCode Sap编码,\n" +
+ " c.MaterialDesc AS 零件中文名称,\n" +
+ " isnull( b.Qty, 0 ) AS 发货数量,\n" +
+ " isnull( b.State, 0 ) AS 发货状态,\n" +
+ " a.AcceptanceNo AS 结算验收单号,\n" +
+ " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ " isnull( a.Price, 0 ) AS 结算单价,\n" +
+ " isnull( a.Amt, 0 ) AS 结算金额 ,\n" +
+ " C.EstimateTypeDesc AS 物料组,\n" +
+ " a.Factory AS 工厂,\n" +
+ " a.KanbanNumber AS 看板编号,\n" +
+ " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
+ " FROM\n" +
+ " ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' AND Version = '{0}' ) AS a\n" +
+ " LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" +
+ " AND a.MaterialCode = b.MaterialCode\n" +
+ " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " WHERE\n" +
+ " b.Kanban IS NULL \n" +
+ " AND b.MaterialCode IS NULL \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" +
+ " ) aaaa UNION ALL\n" +
+ "SELECT\n" +
+ " ccc.* \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ " temp1.交货时间,\n" +
+ " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ " temp1.[工厂],\n" +
+ " temp1.收货仓库,\n" +
+ " temp1.收货仓库描述,\n" +
+ " temp1.订货看板编号,\n" +
+ " temp1.订货零件号,\n" +
+ " temp1.验收单日期,\n" +
+ " temp1.Sap编码,\n" +
+ " temp1.看板编号,\n" +
+ " temp1.物料组,\n" +
+ " temp1.零件中文名称,\n" +
+ " temp1.发货数量,\n" +
+ " temp1.发货状态,\n" +
+ " temp1.结算验收单号,\n" +
+ " temp1.结算数量,\n" +
+ " temp3.Price AS 结算单价,\n" +
+ " ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
+ " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ " ( isnull( temp1.发货数量, 0 ) - isnull( temp1.[结算数量], 0 ) ) AS 数量差异,\n" +
+ " ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ " ( ISNULL( temp3.Price, 0 ) - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " '' AS 交货单号,\n" +
+ " NULL AS 交货时间,\n" +
+ " '' AS 手工或自动,\n" +
+ " a.StorageLocation AS 收货仓库,\n" +
+ " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ " '' AS 订货看板编号,\n" +
+ " a.MaterialCode AS 订货零件号,\n" +
+ " c.MaterialCode Sap编码,\n" +
+ " a.MaterialCode 结算物料代码,\n" +
+ " c.MaterialDesc AS 零件中文名称,\n" +
+ " 0 AS 发货数量,\n" +
+ " 0 AS 发货状态,\n" +
+ " a.AcceptanceNo AS 结算验收单号,\n" +
+ " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ " C.EstimateTypeDesc AS 物料组,\n" +
+ " a.Factory AS 工厂,\n" +
+ " '' AS 看板编号,\n" +
+ " '' AS 验收单日期 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT SUM\n" +
+ " ( Qty ) AS Qty,\n" +
+ " MaterialCode,\n" +
+ " Version,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Factory,AcceptanceNo \n" +
+ " FROM\n" +
+ " Set_HQ_H_Platform \n" +
+ " WHERE\n" +
+ " HQHKanBan IS NULL \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " Version,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " Factory,AcceptanceNo \n" +
+ " ) AS a\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 = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
+ " LEFT JOIN (\n" +
+ " SELECT\n" +
+ " ROUND( SUM ( Amt ) / SUM ( Qty ), 4 ) price,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " FROM\n" +
+ " Set_HQ_H_Platform \n" +
+ " WHERE\n" +
+ " HQHKanBan IS NULL \n" +
+ " AND Version = '{0}' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
+ " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
+ " ) ccc";
+
+ //string str = "SELECT\n" +
+ // " temp1.交货时间,\n" +
+ // " isnull( temp1.手工或自动, '' ) 手工或自动,\n" +
+ // " isnull( temp1.交货单号, '' ) 交货单号,\n" +
+ // " temp1.[工厂],\n" +
+ // " temp1.收货仓库,\n" +
+ // " temp1.收货仓库描述,\n" +
+ // " temp1.订货看板编号,\n" +
+ // " temp1.订货零件号,\n" +
+ // " temp1.验收单日期,\n" +
+ // " temp1.Sap编码,\n" +
+ // " temp1.看板编号,\n" +
+ // " temp1.物料组,\n" +
+ // " temp1.零件中文名称,\n" +
+ // " temp1.发货数量,\n" +
+ // " temp1.发货状态,\n" +
+ // " temp1.结算验收单号,\n" +
+ // " temp1.结算数量,\n" +
+ // " temp1.结算单价,\n" +
+ // " temp1.结算金额,\n" +
+ // " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
+ // " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
+ // " 0 AS 数量差异,\n" +
+ // " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
+ // " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
+ // "FROM\n" +
+ // " (\n" +
+ // " SELECT\n" +
+ // " b.WmsBillNum AS 交货单号,\n" +
+ // " CONVERT ( VARCHAR ( 100 ), b.LastModificationTime, 23 ) AS 交货时间,\n" +
+ // " b.IsAuto AS 手工或自动,\n" +
+ // " a.StorageLocation AS 收货仓库,\n" +
+ // " a.StorageLocationDesc AS 收货仓库描述,\n" +
+ // " a.HQHKanBan AS 订货看板编号,\n" +
+ // " a.MaterialCode AS 订货零件号,\n" +
+ // " c.MaterialCode Sap编码,\n" +
+ // " c.MaterialDesc AS 零件中文名称,\n" +
+ // " isnull( b.Qty, 0 ) AS 发货数量,\n" +
+ // " isnull( b.State, 0 ) AS 发货状态,\n" +
+ // " a.AcceptanceNo AS 结算验收单号,\n" +
+ // " isnull( a.Qty, 0 ) AS 结算数量,\n" +
+ // " isnull( a.Price, 0 ) AS 结算单价,\n" +
+ // " isnull( a.Amt, 0 ) AS 结算金额 ,\n" +
+ // " C.EstimateTypeDesc AS 物料组,\n" +
+ // " a.Factory AS 工厂,\n" +
+ // " a.KanbanNumber AS 看板编号,\n" +
+ // " CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS 验收单日期 \n" +
+ // " FROM\n" +
+ // " Set_HQ_H_Platform AS a\n" +
+ // " LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" +
+ // " AND a.MaterialCode = b.MaterialCode\n" +
+ // " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ // " WHERE\n" +
+ // " a.HQHKanBan <>'BJ' AND a.Version= '{0}' \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 WHERE temp1.[交货单号] is null ";
var _sql = string.Format(str, version);
var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
@@ -953,13 +1295,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal 结算数量 { set; get; }
[ExporterHeader(DisplayName = "结算单价")]
public decimal 结算单价 { set; get; }
- [ExporterHeader(DisplayName = "结算金额")]
+ [ExporterHeader(DisplayName = "结算金额")]
+ public decimal 结算金额 { set; get; }
+ [ExporterHeader(DisplayName = "销售单价")]
public decimal 销售单价 { set; get; }
- public decimal 结算金额 { set; get; }
+
[ExporterHeader(DisplayName = "发货定价")]
public decimal 发货定价 { set; get; }
[ExporterHeader(DisplayName = "发货总金额")]
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
index ebd36441..ebc05d7c 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
@@ -1,11 +1,15 @@
-using System;
+using Magicodes.ExporterAndImporter.Excel;
+using Shouldly;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
+using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
+using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
@@ -22,18 +26,24 @@ namespace SettleAccount.Job.Services.Report
private readonly OutputService _outputService;
private readonly InputService _inputService;
+ private readonly WmsDapperRepository _wmsDapper;
+ private readonly IBlobContainer _fileContainer;
+
public HQCarSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQCarSettledDetailDapperRepository dapperRepository,
+ WmsDapperRepository wmsDapper,
OutputService outputService,
InputService inputService
+ , IBlobContainer fileContainer
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
-
+ _wmsDapper = wmsDapper;
+ _fileContainer = fileContainer;
_dapperRepository = dapperRepository;
}
@@ -49,8 +59,58 @@ namespace SettleAccount.Job.Services.Report
var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
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.GetHQCarSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
+ //不包含备品--求和出库
+ var _ls_sum = _dapperRepository.GetHQCarSettledDetailDiffSumReportList(version, materialCode, begin, end, materialGroup);
+ //按照零件号汇总数量,有一列显示寄售库数量
+ var stockList = _wmsDapper.GetSalesStock();
+ var queryStockList = from itm in _ls_sum
+ join itm1 in stockList on itm.SAP编码 equals itm1.SapCode into temp1
+ from tm1 in temp1.DefaultIfEmpty()
+ select new HQCarSettledDetailDiff(
+ itm.SAP编码,
+ itm.结算物料号,
+ itm.物料描述,
+ itm.结算单价,
+ itm.收货仓库,
+ itm.收货仓库描述,
+ itm.定价,
+ itm.价格差异,
+ itm.差异总金额,
+ itm.结算金额,
+ itm.结算数量,
+ tm1 == null ? 0 : tm1.Qty,
+ itm.物料组
+ );
+
+
+ //包含备品
+ var _ls_bj = _dapperRepository.GetBJHQCarSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
+
+ //包含备品--求和出库
+ var _ls_bj_sum = _dapperRepository.GetBJHQCarSettledDetailDiffSumReportList(version, materialCode, begin, end, materialGroup);
+ var queryBJStockList = from itm in _ls_bj_sum
+ join itm1 in stockList on itm.SAP编码 equals itm1.SapCode into temp1
+ from tm1 in temp1.DefaultIfEmpty()
+ select new HQCarSettledDetailDiff(
+ itm.SAP编码,
+ itm.结算物料号,
+ itm.物料描述,
+ itm.结算单价,
+ itm.收货仓库,
+ itm.收货仓库描述,
+ itm.定价,
+ itm.价格差异,
+ itm.差异总金额,
+ itm.结算金额,
+ itm.结算数量,
+ tm1 == null ? 0 : tm1.Qty,
+ itm.物料组
+ );
+
//if (!string.IsNullOrEmpty(kanban))
//{
// var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
@@ -94,7 +154,23 @@ namespace SettleAccount.Job.Services.Report
_ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
}
}
- _outputService.Export(id, _filename, _ls);
+
+ // _outputService.Export(id, _filename, _ls);
+ ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ var result = _exporter.Append(_ls.ToList(), "轿车批量明细(不含备品)")
+ .SeparateBySheet()
+ .Append(queryStockList.ToList(), "轿车汇总(不含备品)比对寄售库存")
+ .SeparateBySheet()
+ .Append(_ls_bj.ToList(), "轿车备品输出表")
+ .SeparateBySheet()
+ .Append(queryBJStockList.ToList(), "轿车备品比对寄售库存")
+ .ExportAppendDataAsByteArray();
+ result.ShouldNotBeNull();
+ _fileContainer.SaveAsync(_filename, result.Result, true);
+
+
+
+
return id.ToString();
}
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 e4cfe5e1..9509408e 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
@@ -59,7 +59,6 @@ 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);
//求和汇总