From eaf6707fbd7f86fd39ba638ca9377336488a62f3 Mon Sep 17 00:00:00 2001
From: 44673626 <44673626@qq.com>
Date: Thu, 24 Feb 2022 20:54:25 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E6=97=97=E5=A4=87=E4=BB=B6=E6=8F=90?=
=?UTF-8?q?=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ReportServices/ReportMakeService.cs | 35 +-
.../SettleAccount.Application.xml | 11 +-
.../HQHSettledDetailDapperRepository.cs | 336 +++++++++++++++---
.../Report/KanbanUnSettledDapperRepository.cs | 63 ++--
.../SettleKBWithCodeDapperReportRepository.cs | 140 +++-----
.../HQHSettledDetailDiffExportService.cs | 6 +-
...SharePartSettledDetailDiffExportService.cs | 72 +++-
.../HQHUnSettledDetailDiffExportService.cs | 135 +++++++
.../Services/Report/KanBanUnSettledExport.cs | 2 +-
9 files changed, 626 insertions(+), 174 deletions(-)
create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
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 8ac1f19c..41c644c1 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
@@ -653,7 +653,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
///
- ///红旗H平台核对明细
+ ///红旗工厂核对明细
///
/// 上传的文件(前端已经限制只能上传一个附件)
///
@@ -682,8 +682,39 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
+
+ ///
+ ///红旗工厂未结明细
+ ///
+ /// 上传的文件(前端已经限制只能上传一个附件)
+ ///
+ [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;
+ }
+
///
- /// 红旗H平台备件结算出库
+ /// 红旗工厂备件明细
///
///
///
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
index c80d095d..43f8408d 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
@@ -4095,14 +4095,21 @@
- 红旗H平台核对明细
+ 红旗工厂核对明细
+
+ 上传的文件(前端已经限制只能上传一个附件)
+
+
+
+
+ 红旗工厂未结明细
上传的文件(前端已经限制只能上传一个附件)
- 红旗H平台备件结算出库
+ 红旗工厂备件明细
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 48be6421..9ad33307 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
@@ -320,14 +320,20 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
- itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
first.WmsBillNum += "," + itm.WmsBillNum;
first.WmsDate += "," + itm.WmsDate;
}
else
{
- itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
_ls.Add(itm);
}
@@ -335,7 +341,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
foreach (var itm in listCompare1.ToList())
{
- itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ if (!string.IsNullOrEmpty(itm.WmsDate))
+ {
+ itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
+ }
_ls.Add(itm);
}
@@ -445,7 +454,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 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" +
+ " 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);
@@ -455,6 +464,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list;
}
+
///
/// 反向对比,有发货无结算报表
///
@@ -470,16 +480,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
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);
- //}
-
+
+ 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( temp1.手工或自动, '' ) 手工或自动,\n" +
@@ -525,15 +535,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" Set_HQ_H_Kanban AS a\n" +
- " LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' AND Version = '{0}' ) AS b ON a.Kanban = b.HQHKanBan \n" +
+ " LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) AS b ON a.Kanban = b.HQHKanBan \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" b.HQHKanBan IS NULL \n" +
- " AND b.MaterialCode IS NULL \n" +
+ " AND b.MaterialCode IS NULL {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";
- var _sql = string.Format(str, version, condition);
+ var _sql = string.Format(str, condition);
var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
_list = _query.ToList();
@@ -542,6 +552,128 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
+ /////
+ ///// 反向对比,有发货无结算报表
+ /////
+ /////
+ /////
+ /////
+ /////
+ /////
+ /////
+ //public virtual List GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ //{
+
+ // List _list = new List();
+
+ // string condition = " ";
+
+ // 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" +
+ // " b.StorageLocation AS 收货仓库,\n" +
+ // " b.StorageLocationDesc AS 收货仓库描述,\n" +
+ // " a.Kanban AS 订货看板编号,\n" +
+ // " a.MaterialCode AS 订货零件号,\n" +
+ // " c.MaterialCode Sap编码,\n" +
+ // " a.MaterialCode 结算物料代码,\n" +
+ // " c.MaterialDesc AS 零件中文名称,\n" +
+ // " isnull( a.Qty, 0 ) AS 发货数量,\n" +
+ // " 0 AS 发货状态,\n" +
+ // " '' AS 结算验收单号,\n" +
+ // " isnull( b.Qty, 0 ) AS 结算数量,\n" +
+ // " C.EstimateTypeDesc AS 物料组,\n" +
+ // " b.Factory AS 工厂,\n" +
+ // " '' AS 看板编号,\n" +
+ // " '' AS 验收单日期 \n" +
+ // " FROM\n" +
+ // " (\n" +
+ // " SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode\n" +
+ // " ) AS a\n" +
+ // " LEFT JOIN \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 WHERE HQHKanBan <> 'BJ'\n" +
+ // " GROUP BY\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version,\n" +
+ // " StorageLocation,\n" +
+ // " StorageLocationDesc,\n" +
+ // " Factory\n" +
+ // " \n" +
+ // " ) AS b \n" +
+ // " ON a.Kanban = b.HQHKanBan \n" +
+ // " AND a.MaterialCode = b.MaterialCode\n" +
+ // " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ // " WHERE\n" +
+ // " b.HQHKanBan 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" +
+ // " 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" +
+ // " GROUP BY\n" +
+ // " HQHKanBan,\n" +
+ // " MaterialCode,\n" +
+ // " Version \n" +
+ // " ) AS TEMP3 ON temp1.[结算物料代码] = TEMP3.MaterialCode \n" +
+ // " AND temp1.订货看板编号 = TEMP3.HQHKanBan";
+ // var _sql = string.Format(str, version, condition);
+
+ // var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+
+
+
+ // return _list;
+
+ //}
+
+
public virtual List GetDiffQtyList(string version)
{
List _list = new List();
@@ -576,25 +708,26 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
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);
- }
+ //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" +
+ string str = "SELECT\n" +
" temp1.*,\n" +
- " isnull( temp2.Price, 0 ) 销售单价,(\n" +
- " isnull( temp1.结算单价, 0 )- isnull( temp2.Price, 0 )) 价格差异 \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" +
- " A.Price 结算单价,\n" +
- " A.Qty 结算数量,\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" +
@@ -606,7 +739,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" Price,\n" +
- " SUM( Qty ) Qty,\n" +
+ " SUM ( Qty ) Qty,\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
" StorageLocationDesc \n" +
@@ -614,7 +747,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_HQ_H_Platform \n" +
" WHERE\n" +
" version = '{0}' \n" +
- " AND HQHKanBan = 'BJ' {1}\n" +
+ " AND HQHKanBan = 'BJ' \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
@@ -623,17 +756,99 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\n" +
- " LEFT OUTER JOIN (\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 _sql = string.Format(str, version);
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+ return _list;
+
+ }
+
+ ///
+ /// 求和汇总,厂内零件号+数量
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual List GetSharePartSumSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ {
+
+ List _list = new List();
+
+ //string condition = " where 1=1 ";
+
+ 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" +
- " Price,\n" +
- " MaterialCode \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" +
+ " FROM\n" +
+ " Set_HQ_H_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " AND HQHKanBan = 'BJ' \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc \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" +
+ " HQHKanBan,\n" +
+ " MaterialCode,\n" +
+ " Version \n" +
" FROM\n" +
- " Set_PriceList \n" +
+ " Set_HQ_H_Platform \n" +
" WHERE\n" +
- " (\n" +
- " Version = ( SELECT MAX( Version ) AS Expr1 FROM Set_PriceList ))) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
- ;
- var _sql = string.Format(str, version, condition);
+ " HQHKanBan = 'BJ' \n" +
+ " AND Version = '{0}' \n" +
+ " GROUP BY\n" +
+ " HQHKanBan,\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();
@@ -641,11 +856,35 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
-
}
public class HQHSharePartSettledDetailDiff
{
+
+ public HQHSharePartSettledDetailDiff()
+ {
+ }
+
+
+
+ public HQHSharePartSettledDetailDiff(string sapMaterialCode, string materialCode, string materialDesc,decimal price,
+ string storageLocation,string storageLocationDesc,decimal selprice,decimal diffprice,decimal sumprice,decimal settleprice, decimal qty,
+ decimal sockQty)
+ {
+ Sap编码 = sapMaterialCode;
+ 物料描述 = materialDesc;
+ 结算物料号 = materialCode;
+ 寄销库数量 = sockQty;
+ 结算单价 = price;
+ 收货仓库 = storageLocation;
+ 收货仓库描述 = storageLocationDesc;
+ 销售单价 = selprice;
+ 价格差异 = diffprice;
+ 差异总金额 = sumprice;
+ 结算数量 = qty;
+ 结算金额 = settleprice;
+ }
+
[ExporterHeader(DisplayName = "收货仓库")]
public string 收货仓库 { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")]
@@ -660,6 +899,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 = "Sap编码")]
@@ -667,6 +908,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "物料组(车型)")]
public string 物料组 { set; get; }
+ [ExporterHeader(DisplayName = "差异总金额")]
+ public decimal 差异总金额 { set; get; }
+
+ [ExporterHeader(DisplayName = "价格差异")]
+ public decimal 价格差异 { set; get; }
+
[ExporterHeader(DisplayName = "寄销库数量")]
public decimal 寄销库数量 { set; get; }
@@ -707,6 +954,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算单价")]
public decimal 结算单价 { set; get; }
[ExporterHeader(DisplayName = "结算金额")]
+
+
+ public decimal 销售单价 { set; get; }
+
+
public decimal 结算金额 { set; get; }
[ExporterHeader(DisplayName = "发货定价")]
public decimal 发货定价 { set; get; }
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
index 3ff20a5b..8786dcb6 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
@@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettleQty { set; get; }
[ExporterHeader(DisplayName = "发货数量")]
- public decimal Qty { set; get; }
+ public decimal WMSDeliveryQty { set; get; }
[ExporterHeader(DisplayName = "量差")]
public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "单价")]
@@ -137,40 +137,45 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List GetKanbanReportList(string version, string begintime, string endtime)
{
- string sql = " SELECT\n" +
- " TEMP1.*,\n" +
- " TEMP2.Price,\n" +
- " ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
- "FROM\n" +
- " (\n" +
- " SELECT\n" +
- " a.WMSDeliveryNote WmsBillNum,\n" +
- " a.WMSActualGoodsDate BeginDate,\n" +
- " a.Kanban,\n" +
- " C.MaterialCode SapCode,\n" +
- " C.MaterialDesc,\n" +
- " C.CustomerPartCode,\n" +
- " C.EstimateTypeDesc MaterialGroup,\n" +
- " ISNULL( B.Qty, 0 ) SettleQty,\n" +
- " a.WMSDeliveryQty,\n" +
- " (\n" +
- " a.WMSDeliveryQty - ISNULL( b.Qty, 0 )) AS DiffQty \n" +
- " FROM\n" +
- " Set_WMSKanBanSettle A \n" +
- " LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" +
- " AND A.MaterialCode = B.MaterialCode\n" +
- " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode {0}\n" +
- " ) TEMP1\n" +
- " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode";
+ string sql = "SELECT\n" +
+ " TEMP1.*,\n" +
+ " TEMP2.Price,\n" +
+ " ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " a.WMSDeliveryNote WmsBillNum,\n" +
+ " CONVERT ( VARCHAR ( 100 ), a.WMSActualGoodsDate, 23 ) BeginDate,\n" +
+ " a.Kanban,\n" +
+ " C.MaterialCode SapCode,\n" +
+ " C.MaterialDesc,\n" +
+ " C.CustomerPartCode,\n" +
+ " C.EstimateTypeDesc MaterialGroup,\n" +
+ " ISNULL( B.Qty, 0 ) SettleQty,\n" +
+ " ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
+ " ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS DiffQty \n" +
+ " FROM\n" +
+ " Set_WMSKanBanSettle A\n" +
+ " LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" +
+ " AND A.MaterialCode = B.MaterialCode\n" +
+ " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode \n" +
+ " WHERE\n" +
+ " B.Kanban IS NULL \n" +
+ " AND B.MaterialCode IS NULL {0}\n" +
+ " ) TEMP1\n" +
+ " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode";
+
+
+
string str = string.Empty;
- str += " where 1=1 ";
+ //str += " where 1=1 ";
if (!string.IsNullOrEmpty(begintime))
{
- str += string.Format(" and WMSActualGoodsDate >='{0}' ", begintime);
+ str += string.Format(" and a.WMSActualGoodsDate >='{0}' ", begintime);
}
if (string.IsNullOrEmpty(endtime))
{
- str += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime);
+ str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime);
}
sql = string.Format(sql, str);
var _query = DbConnection.Query(sql, null, null, true, 1200, null);
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
index c97e682a..dec9e90b 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
@@ -31,92 +31,64 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode,
string customerPartCode,string estimateTypeDesc, string begintime, string endtime)
{
- //string sqlString = "SELECT\n" +
- //" * ,\n" +
- //" ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
- //" ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
- //" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
- //" ISNULL( Price * Qty - InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" +
- //" \n" +
- //"FROM\n" +
- //" (\n" +
- //" SELECT\n" +
- //" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
- //" c.WMSDeliveryNote,--交货单号\n" +
- //" CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
-
- //" a.Kanban,--条码号\n" +
- //" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
- //" b.MaterialDesc,--物料描述\n" +
- //" b.CustomerPartCode,--客户物料\n" +
- //" b.EstimateTypeDesc,--物料组(车型)\n" +
- //" c.WMSDeliveryQty,--交货数量\n" +
- //" a.Qty AS SettleNumber,--结算数量\n" +
- //" a.SettleDate,--结算日期\n" +
- //" a.Qty,--用于计算\n" +
- //" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
- //" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
- //" a.Qty AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
- //" d.InvoicePrice,--开票单价\n" +
- //" 0 AS InvoiceMoney,--开票金额\n" +
- //" '' DeliveryOrderNo --出库单号\n" +
- //" \n" +
- //" FROM\n" +
- //" Set_KanBanSettle AS a\n" +
- //" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
- //" LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
- //" AND a.MaterialCode= c.MaterialCode\n" +
- //" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" +
- //" ) TEMP1\n" +
- //" LEFT JOIN ( SELECT Price, --定价\n" +
- //" MaterialCode --厂内物料号\n" +
- //" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
- //"WHERE 1=1 ";
+
+ string condition = " ";
+
+ if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
+ {
+ condition += string.Format(" and c.WMSActualGoodsDate>='{0}' ", begintime);
+ }
+ if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
+ {
+ condition += string.Format(" and c.WMSActualGoodsDate<='{0}' ", endtime);
+ }
+
string sqlString = "SELECT\n" +
- " * ,\n" +
- " ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
- " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
- " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
- " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
- " ISNULL( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" +
- " '' DeliveryOrderNo --出库单号\n" +
- " \n" +
- "FROM\n" +
- " (\n" +
- " SELECT\n" +
- " row_number ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" +
- " c.WMSDeliveryNote,--交货单号\n" +
- " CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
- " a.Kanban,--条码号\n" +
- " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
- " b.MaterialDesc,--物料描述\n" +
- " b.CustomerPartCode,--客户物料\n" +
- " b.EstimateTypeDesc,--物料组(车型)\n" +
- " c.WMSDeliveryQty,--交货数量\n" +
- " a.Qty AS SettleNumber,--结算数量\n" +
- " a.SettleDate,--结算日期\n" +
- " a.Qty,--用于计算\n" +
- " ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
- " 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
- " ISNULL(a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
- " ISNULL(d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" +
- " \n" +
- " FROM\n" +
- " Set_KanBanSettle AS a\n" +
- " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
- " LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
- " AND a.MaterialCode= c.MaterialCode\n" +
- " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" +
- " WHERE\n" +
- " a.VERSION= '{0}' \n" +
- " ) TEMP1\n" +
- " LEFT JOIN ( SELECT Price, --定价\n" +
- " MaterialCode --厂内物料号\n" +
- " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
- "WHERE\n" +
- " 1 = 1";
+ " * ,\n" +
+ " ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
+ " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
+ " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
+ " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
+ " ISNULL( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" +
+ " '' DeliveryOrderNo --出库单号\n" +
+ " \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " row_number ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" +
+ " c.WMSDeliveryNote,--交货单号\n" +
+ " CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
+ " a.Kanban,--条码号\n" +
+ " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
+ " b.MaterialDesc,--物料描述\n" +
+ " b.CustomerPartCode,--客户物料\n" +
+ " b.EstimateTypeDesc,--物料组(车型)\n" +
+ " c.WMSDeliveryQty,--交货数量\n" +
+ " ISNULL( a.Qty, 0 ) AS SettleNumber,--结算数量\n" +
+ " a.SettleDate,--结算日期\n" +
+ " ISNULL( a.Qty, 0 ) AS Qty,--用于计算\n" +
+ " ( ISNULL( a.Qty, 0 ) - ISNULL( c.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" +
+ " 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" +
+ " ISNULL( a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
+ " ISNULL( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" +
+ " \n" +
+ " FROM\n" +
+ " Set_KanBanSettle AS a\n" +
+ " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
+ " LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
+ " AND a.MaterialCode= c.MaterialCode\n" +
+ " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" +
+ " WHERE\n" +
+ " a.VERSION= '{0}' {1} \n" +
+ " ) TEMP1\n" +
+ " LEFT JOIN ( SELECT Price, --定价\n" +
+ " MaterialCode --厂内物料号\n" +
+ " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
+ "WHERE\n" +
+ " 1 =1";
string addwhere = string.Empty;
- string addSqlStr = string.Format(sqlString, version);
+ string addSqlStr = string.Format(sqlString, version, condition);
+
//if (!string.IsNullOrEmpty(kanBan))
//{
// addwhere += string.Format(" AND Kanban LIKE '{0}%' ", kanBan);
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
index e09f9db8..83c85c1e 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
@@ -62,7 +62,7 @@ namespace SettleAccount.Job.Services.Report
//有结算无发货报表
var _lsnoSettle = _dapperRepository.GetNOInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
- //反向对比,有发货无结算
+ //反向对比,有发货无结算,单独拿出去,财务要求
var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
@@ -134,8 +134,8 @@ namespace SettleAccount.Job.Services.Report
var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细")
.SeparateBySheet()
.Append(_lsnoSettle.ToList(), "有结算无发货对比")
- .SeparateBySheet()
- .Append(_reversels.ToList(), "有发货无结算对比")
+ //.SeparateBySheet()
+ //.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
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 6663eb46..e4cfe5e1 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.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
@@ -19,18 +23,26 @@ namespace SettleAccount.Job.Services.Report
private readonly OutputService _outputService;
private readonly InputService _inputService;
+ private readonly WmsDapperRepository _wmsDapper;
+
+ private readonly IBlobContainer _fileContainer;
+
public HQHSharePartSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQHSettledDetailDapperRepository dapperRepository,
OutputService outputService,
+ WmsDapperRepository wmsDapper,
+
InputService inputService
+ , IBlobContainer fileContainer
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
-
+ _wmsDapper = wmsDapper;
+ _fileContainer = fileContainer;
_dapperRepository = dapperRepository;
}
@@ -46,7 +58,33 @@ 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.GetSharePartSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
+
+ //求和汇总
+ var _ls_sum = _dapperRepository.GetSharePartSumSettledDetailDiffReportList(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 HQHSharePartSettledDetailDiff(
+ itm.Sap编码,
+ itm.结算物料号,
+ itm.物料描述,
+ itm.结算单价,
+ itm.收货仓库,
+ itm.收货仓库描述,
+ itm.销售单价,
+ itm.价格差异,
+ itm.差异总金额,
+ itm.结算金额,
+ itm.结算数量,
+ tm1 == null ? 0 : tm1.Qty
+ );
+
//var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//var _lst=_dapperRepository.GetDiffQtyList(version);
@@ -86,14 +124,14 @@ namespace SettleAccount.Job.Services.Report
// _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList();
// }
//}
- if (!string.IsNullOrEmpty(materialGroup))
- {
- var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
- if (_groupList.Count() > 0)
- {
- _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
- }
- }
+ //if (!string.IsNullOrEmpty(materialGroup))
+ //{
+ // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
+ // if (_groupList.Count() > 0)
+ // {
+ // _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
+ // }
+ //}
if (!string.IsNullOrEmpty(materialCode))
{
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
@@ -110,7 +148,19 @@ 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(), "备件汇总比对寄售库存")
+ .ExportAppendDataAsByteArray();
+ result.ShouldNotBeNull();
+ _fileContainer.SaveAsync(_filename, result.Result, true);
+
+
+
return id.ToString();
}
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
new file mode 100644
index 00000000..c1614a66
--- /dev/null
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
@@ -0,0 +1,135 @@
+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
+{
+ ///
+ /// 红旗工厂未结明细
+ ///
+ public class HQHUnSettledDetailDiffExportService : ITransientDependency, IExportJob
+ {
+
+ private readonly HQHSettledDetailDapperRepository _dapperRepository;
+ private readonly ErpPartDapperRepository _erpdapperRepository;
+ private readonly IBlobContainer _fileContainer;
+
+ private readonly OutputService _outputService;
+ private readonly InputService _inputService;
+
+ public HQHUnSettledDetailDiffExportService(
+
+ ErpPartDapperRepository erpdapperRepository,
+ HQHSettledDetailDapperRepository dapperRepository,
+
+ OutputService outputService,
+ InputService inputService
+ , IBlobContainer fileContainer
+ )
+ {
+ _inputService = inputService;
+ _outputService = outputService;
+ _erpdapperRepository = erpdapperRepository;
+ _fileContainer = fileContainer;
+ _dapperRepository = dapperRepository;
+ }
+
+ public string ExportFile(Guid id, List exportName, List p_list)
+ {
+ var _filename = exportName.FirstOrDefault();
+ var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
+ var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
+ var kanban = p_list.Where(p => p.Name == "Kanban").FirstOrDefault().Value;
+ var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
+ var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
+ var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
+ 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.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
+
+
+
+ if (!string.IsNullOrEmpty(kanban))
+ {
+ var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.订货看板编号)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(warehouseDesc))
+ {
+ var _groupList = warehouseDesc.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.收货仓库描述)).ToList();
+ }
+ }
+
+ if (!string.IsNullOrEmpty(acceptNo))
+ {
+ var _groupList = acceptNo.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(materialGroup))
+ {
+ var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(materialCode))
+ {
+ var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.发货零件号)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(sapCode))
+ {
+ var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList();
+ }
+ }
+
+
+
+
+ ExcelExporter _exporter = new ExcelExporter();//导出Excel
+ var result = _exporter.Append(_ls.ToList(), "有发货无结算对比")
+ //.SeparateBySheet()
+ //.Append(_lsnoSettle.ToList(), "有结算无发货对比")
+ .ExportAppendDataAsByteArray();
+ result.ShouldNotBeNull();
+ _fileContainer.SaveAsync(_filename, result.Result, true);
+
+
+
+
+ return id.ToString();
+ }
+
+ }
+}
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs
index 3578b6ff..bdeada19 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs
@@ -97,7 +97,7 @@ namespace SettleAccount.Job.Services.Report
}
}
ExcelExporter _exporter = new ExcelExporter();//导出Excel
- var result = _exporter.Append(_ls.ToList(), "有看板号未结差异对比")
+ var result = _exporter.Append(_ls.ToList(), "有发货无结算差异对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();