Browse Source

红旗备件提交

FoShanPG
44673626 3 years ago
parent
commit
eaf6707fbd
  1. 35
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 11
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  3. 324
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 23
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  5. 64
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  6. 6
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs
  7. 72
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs
  8. 135
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
  9. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs

35
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -653,7 +653,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
} }
/// <summary> /// <summary>
///红旗H平台核对明细 ///红旗工厂核对明细
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
@ -682,8 +682,39 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid; return _taskid;
} }
/// <summary>
///红旗工厂未结明细
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("HQHUnSettledDetailDiffExportService")]
[DisableRequestSizeLimit]
public async Task<string> HQHUnSettledDetailDiffExportServiceMake(
HQKanbanRequestDto input
)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
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;
}
/// <summary> /// <summary>
/// 红旗H平台备件结算出库 /// 红旗工厂备件明细
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>

11
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -4095,14 +4095,21 @@
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary> <summary>
红旗H平台核对明细 红旗工厂核对明细
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHUnSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
红旗工厂未结明细
</summary> </summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param> <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSharePartSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)"> <member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSharePartSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary> <summary>
红旗H平台备件结算出库 红旗工厂备件明细
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>

324
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs

@ -319,23 +319,32 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode); var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode);
if (first != null) if (first != null)
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{ {
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
first.WmsBillNum += "," + itm.WmsBillNum; first.WmsBillNum += "," + itm.WmsBillNum;
first.WmsDate += "," + itm.WmsDate; first.WmsDate += "," + itm.WmsDate;
} }
else else
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{ {
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm); _ls.Add(itm);
} }
} }
foreach (var itm in listCompare1.ToList()) foreach (var itm in listCompare1.ToList())
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{ {
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm); _ls.Add(itm);
} }
@ -445,7 +454,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND a.MaterialCode = b.MaterialCode\n" + " AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" + " WHERE\n" +
" a.Version= '{0}' \n" + " a.HQHKanBan <>'BJ' AND a.Version= '{0}' \n" +
" ) AS temp1\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 "; " 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 _sql = string.Format(str, version);
@ -455,6 +464,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list; return _list;
} }
/// <summary> /// <summary>
/// 反向对比,有发货无结算报表 /// 反向对比,有发货无结算报表
/// </summary> /// </summary>
@ -471,14 +481,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string condition = " "; string condition = " ";
//if (!string.IsNullOrEmpty(begin)) if (!string.IsNullOrEmpty(begin))
//{ {
// condition += string.Format(" and a.LastModificationTime>='{0}' ", begin); condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
//} }
//if (!string.IsNullOrEmpty(end)) if (!string.IsNullOrEmpty(end))
//{ {
// condition += string.Format(" and a.LastModificationTime<='{0}' ", end); condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
//} }
string str = "SELECT\n" + string str = "SELECT\n" +
" temp1.交货时间,\n" + " temp1.交货时间,\n" +
@ -525,15 +535,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组 \n" + " C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" + " FROM\n" +
" Set_HQ_H_Kanban AS a\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" + " AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" + " WHERE\n" +
" b.HQHKanBan IS NULL \n" + " b.HQHKanBan IS NULL \n" +
" AND b.MaterialCode IS NULL \n" + " AND b.MaterialCode IS NULL {0} \n" +
" ) AS temp1\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"; " 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<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null); var _query = DbConnection.Query<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList(); _list = _query.ToList();
@ -542,6 +552,128 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
///// <summary>
///// 反向对比,有发货无结算报表
///// </summary>
///// <param name="version"></param>
///// <param name="materialCode"></param>
///// <param name="begin"></param>
///// <param name="end"></param>
///// <param name="materialGroup"></param>
///// <returns></returns>
//public virtual List<HQHSettledDetailDiff> GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
//{
// List<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
// 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<HQHSettledDetailDiff>(_sql, null, null, true, 1200, null);
// return _list;
//}
public virtual List<HQHSettleQtyDiff> GetDiffQtyList(string version) public virtual List<HQHSettleQtyDiff> GetDiffQtyList(string version)
{ {
List<HQHSettleQtyDiff> _list = new List<HQHSettleQtyDiff>(); List<HQHSettleQtyDiff> _list = new List<HQHSettleQtyDiff>();
@ -576,25 +708,26 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
string condition = " "; string condition = " ";
if (!string.IsNullOrEmpty(begin)) //if (!string.IsNullOrEmpty(begin))
{ //{
condition += string.Format(" and a.LastModificationTime>='{0}' ", begin); // condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
} //}
if (!string.IsNullOrEmpty(end)) //if (!string.IsNullOrEmpty(end))
{ //{
condition += string.Format(" and a.LastModificationTime<='{0}' ", end); // condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
} //}
string str = string str = "SELECT\n" +
"SELECT\n" +
" temp1.*,\n" + " temp1.*,\n" +
" 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 ) ) 价格差异,\n" +
" ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额 \n" +
"FROM\n" + "FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" A.Price 结算单价,\n" + " ISNULL( A.Price, 0 ) 结算单价,\n" +
" A.Qty 结算数量,\n" + " ISNULL( A.Qty, 0 ) 结算数量,\n" +
" ISNULL( A.Price, 0 ) * ISNULL( A.Qty, 0 ) 结算金额,\n" +
" A.MaterialCode 结算物料号,\n" + " A.MaterialCode 结算物料号,\n" +
" A.StorageLocation 收货仓库,\n" + " A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" + " A.StorageLocationDesc 收货仓库描述,\n" +
@ -614,7 +747,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_HQ_H_Platform \n" + " Set_HQ_H_Platform \n" +
" WHERE\n" + " WHERE\n" +
" version = '{0}' \n" + " version = '{0}' \n" +
" AND HQHKanBan = 'BJ' {1}\n" + " AND HQHKanBan = 'BJ' \n" +
" GROUP BY\n" + " GROUP BY\n" +
" MaterialCode,\n" + " MaterialCode,\n" +
" StorageLocation,\n" + " StorageLocation,\n" +
@ -623,17 +756,99 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" ) A\n" + " ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\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<HQHSharePartSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
return _list;
}
/// <summary>
/// 求和汇总,厂内零件号+数量
/// </summary>
/// <param name="version"></param>
/// <param name="materialCode"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
public virtual List<HQHSharePartSettledDetailDiff> GetSharePartSumSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQHSharePartSettledDetailDiff> _list = new List<HQHSharePartSettledDetailDiff>();
//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" + " SELECT\n" +
" Price,\n" + " isnull( A.Qty, 0 ) 结算数量,\n" +
" MaterialCode \n" + " A.MaterialCode 结算物料号,\n" +
" A.StorageLocation 收货仓库,\n" +
" A.StorageLocationDesc 收货仓库描述,\n" +
" C.EstimateTypeDesc 物料组,\n" +
" C.MaterialCode Sap编码,\n" +
" C.MaterialDesc 物料描述,\n" +
" 0 寄销库数量 \n" +
" FROM\n" + " FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" (\n" + " (\n" +
" Version = ( SELECT MAX( Version ) AS Expr1 FROM Set_PriceList ))) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; " SELECT SUM\n" +
; " ( Qty ) Qty,\n" +
var _sql = string.Format(str, version, condition); " 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_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";
// var _sql = string.Format(str, version, condition);
var _sql = string.Format(str, version);
var _query = DbConnection.Query<HQHSharePartSettledDetailDiff>(_sql, null, null, true, 1200, null); var _query = DbConnection.Query<HQHSharePartSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList(); _list = _query.ToList();
@ -641,11 +856,35 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
} }
public class HQHSharePartSettledDetailDiff 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 = "收货仓库")] [ExporterHeader(DisplayName = "收货仓库")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")] [ExporterHeader(DisplayName = "收货仓库描述")]
@ -660,6 +899,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "结算单价")] [ExporterHeader(DisplayName = "结算单价")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "销售单价")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")] [ExporterHeader(DisplayName = "结算金额")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "Sap编码")] [ExporterHeader(DisplayName = "Sap编码")]
@ -667,6 +908,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "物料组(车型)")] [ExporterHeader(DisplayName = "物料组(车型)")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "差异总金额")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "价格差异")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "寄销库数量")] [ExporterHeader(DisplayName = "寄销库数量")]
public decimal { set; get; } public decimal { set; get; }
@ -707,6 +954,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算单价")] [ExporterHeader(DisplayName = "结算单价")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")] [ExporterHeader(DisplayName = "结算金额")]
public decimal { set; get; }
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "发货定价")] [ExporterHeader(DisplayName = "发货定价")]
public decimal { set; get; } public decimal { set; get; }

23
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs

@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算数量")] [ExporterHeader(DisplayName = "结算数量")]
public decimal SettleQty { set; get; } public decimal SettleQty { set; get; }
[ExporterHeader(DisplayName = "发货数量")] [ExporterHeader(DisplayName = "发货数量")]
public decimal Qty { set; get; } public decimal WMSDeliveryQty { set; get; }
[ExporterHeader(DisplayName = "量差")] [ExporterHeader(DisplayName = "量差")]
public decimal DiffQty { set; get; } public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "单价")] [ExporterHeader(DisplayName = "单价")]
@ -145,32 +145,37 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" a.WMSDeliveryNote WmsBillNum,\n" + " a.WMSDeliveryNote WmsBillNum,\n" +
" a.WMSActualGoodsDate BeginDate,\n" + " CONVERT ( VARCHAR ( 100 ), a.WMSActualGoodsDate, 23 ) BeginDate,\n" +
" a.Kanban,\n" + " a.Kanban,\n" +
" C.MaterialCode SapCode,\n" + " C.MaterialCode SapCode,\n" +
" C.MaterialDesc,\n" + " C.MaterialDesc,\n" +
" C.CustomerPartCode,\n" + " C.CustomerPartCode,\n" +
" C.EstimateTypeDesc MaterialGroup,\n" + " C.EstimateTypeDesc MaterialGroup,\n" +
" ISNULL( B.Qty, 0 ) SettleQty,\n" + " ISNULL( B.Qty, 0 ) SettleQty,\n" +
" a.WMSDeliveryQty,\n" + " ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
" (\n" + " ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS DiffQty \n" +
" a.WMSDeliveryQty - ISNULL( b.Qty, 0 )) AS DiffQty \n" +
" FROM\n" + " FROM\n" +
" Set_WMSKanBanSettle A\n" + " Set_WMSKanBanSettle A\n" +
" LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" + " LEFT JOIN ( SELECT * FROM Set_KanBanSettle ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode\n" + " AND A.MaterialCode = B.MaterialCode\n" +
" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode {0}\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" + " ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode"; " 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; string str = string.Empty;
str += " where 1=1 "; //str += " where 1=1 ";
if (!string.IsNullOrEmpty(begintime)) if (!string.IsNullOrEmpty(begintime))
{ {
str += string.Format(" and WMSActualGoodsDate >='{0}' ", begintime); str += string.Format(" and a.WMSActualGoodsDate >='{0}' ", begintime);
} }
if (string.IsNullOrEmpty(endtime)) if (string.IsNullOrEmpty(endtime))
{ {
str += string.Format(" and WMSActualGoodsDate<='{0}' ", endtime); str += string.Format(" and a.WMSActualGoodsDate<='{0}' ", endtime);
} }
sql = string.Format(sql, str); sql = string.Format(sql, str);
var _query = DbConnection.Query<KanbanUnSettled>(sql, null, null, true, 1200, null); var _query = DbConnection.Query<KanbanUnSettled>(sql, null, null, true, 1200, null);

64
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -31,47 +31,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode, public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode,
string customerPartCode,string estimateTypeDesc, string begintime, string endtime) 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" + string condition = " ";
//" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
//" b.MaterialDesc,--物料描述\n" + if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
//" b.CustomerPartCode,--客户物料\n" + {
//" b.EstimateTypeDesc,--物料组(车型)\n" + condition += string.Format(" and c.WMSActualGoodsDate>='{0}' ", begintime);
//" c.WMSDeliveryQty,--交货数量\n" + }
//" a.Qty AS SettleNumber,--结算数量\n" + if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue)
//" a.SettleDate,--结算日期\n" + {
//" a.Qty,--用于计算\n" + condition += string.Format(" and c.WMSActualGoodsDate<='{0}' ", endtime);
//" ( 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 sqlString = "SELECT\n" + string sqlString = "SELECT\n" +
" * ,\n" + " * ,\n" +
" ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" + " ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
@ -93,11 +64,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" b.CustomerPartCode,--客户物料\n" + " b.CustomerPartCode,--客户物料\n" +
" b.EstimateTypeDesc,--物料组(车型)\n" + " b.EstimateTypeDesc,--物料组(车型)\n" +
" c.WMSDeliveryQty,--交货数量\n" + " c.WMSDeliveryQty,--交货数量\n" +
" a.Qty AS SettleNumber,--结算数量\n" + " ISNULL( a.Qty, 0 ) AS SettleNumber,--结算数量\n" +
" a.SettleDate,--结算日期\n" + " a.SettleDate,--结算日期\n" +
" a.Qty,--用于计算\n" + " ISNULL( a.Qty, 0 ) AS Qty,--用于计算\n" +
" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" + " ( ISNULL( a.Qty, 0 ) - ISNULL( c.WMSDeliveryQty, 0 ) ) AS SettleWMSDiffQty,--结算与发货差异\n" +
" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" + " 0 AS SettleInvoiceDiffQty,--结算与开票差异\n" +
" ISNULL( a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" + " ISNULL( a.Qty, 0 ) AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
" ISNULL( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" + " ISNULL( d.InvoicePrice, 0 ) InvoicePrice --开票单价\n" +
" \n" + " \n" +
@ -108,7 +79,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND a.MaterialCode= c.MaterialCode\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" + " 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" + " WHERE\n" +
" a.VERSION= '{0}' \n" + " a.VERSION= '{0}' {1} \n" +
" ) TEMP1\n" + " ) TEMP1\n" +
" LEFT JOIN ( SELECT Price, --定价\n" + " LEFT JOIN ( SELECT Price, --定价\n" +
" MaterialCode --厂内物料号\n" + " MaterialCode --厂内物料号\n" +
@ -116,7 +87,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"WHERE\n" + "WHERE\n" +
" 1 =1"; " 1 =1";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version, condition);
//if (!string.IsNullOrEmpty(kanBan)) //if (!string.IsNullOrEmpty(kanBan))
//{ //{
// addwhere += string.Format(" AND Kanban LIKE '{0}%' ", kanBan); // addwhere += string.Format(" AND Kanban LIKE '{0}%' ", kanBan);

6
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 _lsnoSettle = _dapperRepository.GetNOInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//反向对比,有发货无结算 //反向对比,有发货无结算,单独拿出去,财务要求
var _reversels = _dapperRepository.GetReverseSettledDetailDiffReportList(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(), "红旗工厂核对明细") var result = _exporter.Append(_ls.ToList(), "红旗工厂核对明细")
.SeparateBySheet() .SeparateBySheet()
.Append(_lsnoSettle.ToList(), "有结算无发货对比") .Append(_lsnoSettle.ToList(), "有结算无发货对比")
.SeparateBySheet() //.SeparateBySheet()
.Append(_reversels.ToList(), "有发货无结算对比") //.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray(); .ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true); _fileContainer.SaveAsync(_filename, result.Result, true);

72
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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
@ -19,18 +23,26 @@ namespace SettleAccount.Job.Services.Report
private readonly OutputService _outputService; private readonly OutputService _outputService;
private readonly InputService _inputService; private readonly InputService _inputService;
private readonly WmsDapperRepository _wmsDapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public HQHSharePartSettledDetailDiffExportService( public HQHSharePartSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository, ErpPartDapperRepository erpdapperRepository,
HQHSettledDetailDapperRepository dapperRepository, HQHSettledDetailDapperRepository dapperRepository,
OutputService outputService, OutputService outputService,
WmsDapperRepository wmsDapper,
InputService inputService InputService inputService
, IBlobContainer<MyFileContainer> fileContainer
) )
{ {
_inputService = inputService; _inputService = inputService;
_outputService = outputService; _outputService = outputService;
_erpdapperRepository = erpdapperRepository; _erpdapperRepository = erpdapperRepository;
_wmsDapper = wmsDapper;
_fileContainer = fileContainer;
_dapperRepository = dapperRepository; _dapperRepository = dapperRepository;
} }
@ -46,7 +58,33 @@ namespace SettleAccount.Job.Services.Report
var acceptNo = p_list.Where(p => p.Name == "AcceptNo").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 sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value; var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
var _ls = _dapperRepository.GetSharePartSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup); 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 _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//var _lst=_dapperRepository.GetDiffQtyList(version); //var _lst=_dapperRepository.GetDiffQtyList(version);
@ -86,14 +124,14 @@ namespace SettleAccount.Job.Services.Report
// _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList(); // _ls = _ls.Where(p => _groupList.Contains(p.结算验收单号)).ToList();
// } // }
//} //}
if (!string.IsNullOrEmpty(materialGroup)) //if (!string.IsNullOrEmpty(materialGroup))
{ //{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); // var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0) // if (_groupList.Count() > 0)
{ // {
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList(); // _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
} // }
} //}
if (!string.IsNullOrEmpty(materialCode)) if (!string.IsNullOrEmpty(materialCode))
{ {
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); 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(); _ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList();
} }
} }
_outputService.Export<HQHSharePartSettledDetailDiff>(id, _filename, _ls); //_outputService.Export<HQHSharePartSettledDetailDiff>(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(); return id.ToString();
} }

135
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
{
/// <summary>
/// 红旗工厂未结明细
/// </summary>
public class HQHUnSettledDetailDiffExportService : ITransientDependency, IExportJob
{
private readonly HQHSettledDetailDapperRepository _dapperRepository;
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly OutputService _outputService;
private readonly InputService _inputService;
public HQHUnSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQHSettledDetailDapperRepository dapperRepository,
OutputService outputService,
InputService inputService
, IBlobContainer<MyFileContainer> fileContainer
)
{
_inputService = inputService;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
_fileContainer = fileContainer;
_dapperRepository = dapperRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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();
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs

@ -97,7 +97,7 @@ namespace SettleAccount.Job.Services.Report
} }
} }
ExcelExporter _exporter = new ExcelExporter();//导出Excel ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "有看板号未结差异对比") var result = _exporter.Append(_ls.ToList(), "有发货无结算差异对比")
.ExportAppendDataAsByteArray(); .ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();

Loading…
Cancel
Save