Browse Source

一汽轿车报表

FoShanPG
44673626 3 years ago
parent
commit
9e398c8bf6
  1. 56
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  3. 520
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
  4. 646
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  5. 82
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
  6. 1
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSharePartSettledDetailDiffExportService.cs

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

@ -683,35 +683,35 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
/// <summary>
///红旗工厂未结明细
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("HQHUnSettledDetailDiffExportService")]
[DisableRequestSizeLimit]
public async Task<string> HQHUnSettledDetailDiffExportServiceMake(
HQKanbanRequestDto input
)
{
///// <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;
}
// 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>
/// 红旗工厂备件明细

7
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -4100,13 +4100,6 @@
<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>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Reports.ReportServices.ReportService.HQHSharePartSettledDetailDiffExportServiceMake(Win.Sfs.SettleAccount.Reports.ReportRequestDto.HQKanbanRequestDto)">
<summary>
红旗工厂备件明细

520
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs

@ -47,7 +47,15 @@ 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<HQCarSettledDetailDiff> 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<HQCarSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
@ -185,92 +114,307 @@ 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<HQCarSettledDetailDiff> GetHQCarSettledDetailDiffSumReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQCarSettledDetailDiff> _list = new List<HQCarSettledDetailDiff>();
string condition = " ";
//public virtual List<HQCarSettledDetailDiff> GetHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
//{
// List<HQCarSettledDetailDiff> _list = new List<HQCarSettledDetailDiff>();
// 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<HQCarSettledDetailDiff>(_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<HQCarSettledDetailDiff>(_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<HQCarSettledDetailDiff> GetBJHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQCarSettledDetailDiff> _list = new List<HQCarSettledDetailDiff>();
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<HQCarSettledDetailDiff>(_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<HQCarSettledDetailDiff> GetBJHQCarSettledDetailDiffSumReportList(string version, string materialCode, string begin, string end, string materialGroup)
{
List<HQCarSettledDetailDiff> _list = new List<HQCarSettledDetailDiff>();
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<HQCarSettledDetailDiff>(_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 = "寄销库数量")]

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

@ -57,10 +57,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
//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<HQHSettledDetailDiff> _list = new List<HQHSettledDetailDiff>();
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<HQHSettledDetailDiff>(_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 = "发货总金额")]

82
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<MyFileContainer> _fileContainer;
public HQCarSettledDetailDiffExportService(
ErpPartDapperRepository erpdapperRepository,
HQCarSettledDetailDapperRepository dapperRepository,
WmsDapperRepository wmsDapper,
OutputService outputService,
InputService inputService
, IBlobContainer<MyFileContainer> 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<HQCarSettledDetailDiff>(id, _filename, _ls);
// _outputService.Export<HQCarSettledDetailDiff>(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();
}

1
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);
//求和汇总

Loading…
Cancel
Save