Browse Source

红旗未结相关调整未完成

FoShanPG
44673626 3 years ago
parent
commit
5c5c18f640
  1. 4
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Reports/ReportRequestDto/ReportRequestDto.cs
  2. 1
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  3. 267
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 56
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs

4
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Reports/ReportRequestDto/ReportRequestDto.cs

@ -31,6 +31,10 @@ namespace Win.Sfs.SettleAccount.Reports.ReportRequestDto
public string State { set; get; } public string State { set; get; }
public string IsContainVersion { set; get; }

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

@ -755,6 +755,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); 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 = "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 }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion });
var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) =>
{ {
}); });

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

@ -382,17 +382,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
//var _ls_1 = from itm1 in _list
// join itm2 in _ls on new { Kanban = itm1.订货看板编号, MaterialCode=itm1.Sap编码 }
// equals new { itm2.Kanban, itm2.MaterialCode } into g
// from t in g.DefaultIfEmpty()
// select new HQHSettledDetailDiff
// {
// } ;
return _list; return _list;
@ -575,7 +564,16 @@ 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>
/// <param name="iscontionversion"></param>
/// <returns></returns>
public virtual List<HQHUnSettledDetailDiff> GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion) public virtual List<HQHUnSettledDetailDiff> GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion)
{ {
@ -610,8 +608,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" temp1.交货时间,\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.Sap编码,\n" +
@ -619,7 +615,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.物料组,\n" + " temp1.物料组,\n" +
" temp1.零件中文名称,\n" + " temp1.零件中文名称,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.外部验收单号,\n" + " temp1.外部验收单号,\n" +
" temp1.结算数量,\n" + " temp1.结算数量,\n" +
" temp1.结算单价,\n" + " temp1.结算单价,\n" +
@ -635,23 +630,20 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" + " a.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" + " CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" b.StorageLocation AS 收货仓库,\n" +
" b.StorageLocationDesc AS 收货仓库描述,\n" +
" a.Kanban AS 订货看板编号,\n" + " a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" + " b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" + " c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" + " c.CustomerPartCode 客户物料号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" + " c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" +
" isnull( a.State, 0 ) AS 发货状态,\n" + " '' AS 外部验收单号,\n" +
" b.ExternalKanbanNumber AS 外部验收单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" + " isnull( b.Qty, 0 ) AS 结算数量,\n" +
" isnull( b.Price, 0 ) AS 结算单价,\n" + " 0 AS 结算单价,\n" +
" isnull( b.Amt, 0 ) AS 结算金额 ,\n" + " 0 AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" + " C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" + " FROM\n" +
" Set_HQ_H_Kanban AS a\n" + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode, WmsBillNum, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, WmsBillNum, LastModificationTime ) AS a\n" +
" LEFT OUTER JOIN (select * from Set_HQ_H_Platform {0}) AS b ON a.Kanban = b.HQHKanBan \n" + " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode ) 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" +
@ -669,8 +661,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" temp1.交货时间,\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.Sap编码,\n" +
@ -678,7 +668,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.物料组,\n" + " temp1.物料组,\n" +
" temp1.零件中文名称,\n" + " temp1.零件中文名称,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.外部验收单号,\n" + " temp1.外部验收单号,\n" +
" temp1.结算数量,\n" + " temp1.结算数量,\n" +
" temp1.结算单价,\n" + " temp1.结算单价,\n" +
@ -694,15 +683,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" + " a.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" + " CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" '' AS 收货仓库,\n" +
" '' AS 收货仓库描述,\n" +
" a.Kanban AS 订货看板编号,\n" + " a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" + " b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" + " c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" + " c.CustomerPartCode 客户物料号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" + " c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" +
" 0 AS 发货状态,\n" +
" '' AS 外部验收单号,\n" + " '' AS 外部验收单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" + " isnull( b.Qty, 0 ) AS 结算数量,\n" +
" 0 AS 结算单价,\n" + " 0 AS 结算单价,\n" +
@ -720,11 +706,13 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" + " AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION2"; " ) UNION2";
var _sql = string.Format(str,version, condition);
var _sql = string.Format(str, contion, condition);
//发运数据中,查出看板号+物料号相同的重复数据
var sql2 = "SELECT\n" + var sql2 = "SELECT\n" +
" a.WmsBillNum,\n" + " a.WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" + " t1.MaterialCode MaterialCode,\n" +
@ -735,19 +723,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" + " INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" +
" AND A.MaterialCode = B.MaterialCode " + " AND A.MaterialCode = B.MaterialCode " +
" left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode "; " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode ";
var listCompare = DbConnection.Query<CompareExtend>(sql2); var listCompare = DbConnection.Query<CompareExtend>(sql2);
//查询发运表中,看权号+物料号没有重复的数据
var sql3 = "SELECT\n" + var sql3 = "SELECT\n" +
" a.WmsBillNum,\n" + " a.WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" + " t1.MaterialCode MaterialCode,\n" +
@ -762,14 +743,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"WHERE\n" + "WHERE\n" +
" B.Kanban IS NULL"; " B.Kanban IS NULL";
var listCompare1 = DbConnection.Query<CompareExtend>(sql3); var listCompare1 = DbConnection.Query<CompareExtend>(sql3);
//红旗结算数据中,看板号+物料号没有重复的
var sql10 = "SELECT DISTINCT\n" + var sql10 = "SELECT DISTINCT\n" +
" t1.* \n" + " t1.* \n" +
"FROM\n" + "FROM\n" +
@ -800,7 +779,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//红旗结算数据中,看板号+物料号有重复的数据
var sql11 = "SELECT DISTINCT\n" + var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" + " t1.* \n" +
"FROM\n" + "FROM\n" +
@ -825,8 +804,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"ORDER BY\n" + "ORDER BY\n" +
" t1.HQHKanBan,\n" + " t1.HQHKanBan,\n" +
" t1.MaterialCode"; " t1.MaterialCode";
var list12 = DbConnection.Query<CompareExtend1>(string.Format(sql11, version)); var list12 = DbConnection.Query<CompareExtend1>(string.Format(sql11, version));
@ -847,6 +824,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var list13 = DbConnection.Query<CompareExtend1>(string.Format(sql12, version)); var list13 = DbConnection.Query<CompareExtend1>(string.Format(sql12, version));
//结算数据比较
List<CompareExtend1> _lscopy = new List<CompareExtend1>(); List<CompareExtend1> _lscopy = new List<CompareExtend1>();
foreach (var itm in list11) foreach (var itm in list11)
@ -873,6 +851,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
//发运数据比较
List<CompareExtend> _ls = new List<CompareExtend>(); List<CompareExtend> _ls = new List<CompareExtend>();
foreach (var itm in listCompare.ToList()) foreach (var itm in listCompare.ToList())
{ {
@ -933,8 +912,208 @@ 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>
/// <param name="iscontionversion"></param>
/// <returns></returns>
public virtual List<HQHUnSettledDetailDiff> GetOriginalSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion)
{
List<HQHUnSettledDetailDiff> _list = new List<HQHUnSettledDetailDiff>();
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 contion = string.Empty;
//选中,是否过滤掉当期结算数据
if (iscontionversion == "0")
{
contion += string.Format(" WHERE Version <'{0}' ", version);
}
else
{
contion += " WHERE 1=1 ";
}
string str = "SELECT\n" +
" * \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.交货时间,\n" +
" isnull( 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" +
" isnull( tt.Qty, 0 ) 退货数量,\n" +
" isnull( temp1.发货数量, 0 ) - isnull( tt.Qty, 0 ) AS 数量差异,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * ( isnull( temp1.发货数量, 0 ) - isnull( tt.Qty, 0 ) ) AS 差异总金额 \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" b.StorageLocation AS 收货仓库,\n" +
" b.StorageLocationDesc AS 收货仓库描述,\n" +
" a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" +
" isnull( a.State, 0 ) AS 发货状态,\n" +
" b.ExternalKanbanNumber AS 外部验收单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" +
" isnull( b.Price, 0 ) AS 结算单价,\n" +
" isnull( b.Amt, 0 ) AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" Set_HQ_H_Kanban AS a\n" +
" LEFT OUTER JOIN (select * from Set_HQ_H_Platform {0}) 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 {1}\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 set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION1 " ;
var _sql = string.Format(str, contion, condition);
var _query = DbConnection.Query<HQHUnSettledDetailDiff>(_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>
/// <param name="iscontionversion"></param>
/// <returns></returns>
public virtual List<HQHUnSettledDetailDiff> GetInnerJoinSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion)
{
List<HQHUnSettledDetailDiff> _list = new List<HQHUnSettledDetailDiff>();
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 contion = string.Empty;
//选中,是否过滤掉当期结算数据
if (iscontionversion == "0")
{
contion += string.Format(" WHERE Version <'{0}' ", version);
}
else
{
contion += " WHERE 1=1 ";
}
string str = "SELECT\n" +
" * \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.交货时间,\n" +
" isnull( 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" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
" isnull( tt.Qty, 0 ) 退货数量,\n" +
" isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) AS 数量差异,\n" +
" temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" +
" ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * ( isnull( temp1.发货数量, 0 ) - isnull( tt.Qty, 0 ) ) AS 差异总金额 \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" +
" '' AS 外部验收单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" +
" 0 AS 结算单价,\n" +
" 0 AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode, WmsBillNum, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, WmsBillNum, LastModificationTime ) AS a\n" +
" INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode ) 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" +
" a.Qty> b.Qty {1}\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 set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION2";
var _sql = string.Format(str, contion, condition);
var _query = DbConnection.Query<HQHUnSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
return _list;
}
public virtual List<HQHSettleQtyDiff> GetDiffQtyList(string version) public virtual List<HQHSettleQtyDiff> GetDiffQtyList(string version)

56
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs

@ -60,53 +60,15 @@ namespace SettleAccount.Job.Services.Report
//有发货无结算,单独拿出去,财务要求 //有发货无结算+有发货有结算中发货数量大于结算数量的数据-----组合
var _ls = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion); var _ls = _dapperRepository.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion);
//原始正常的红旗未结数据(不包含有发货有结算中发货大于结算的数据,数量也未求和)
var _ls_original = _dapperRepository.GetOriginalSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion);
//有发货有结算,发货数量大于结算数量
var _ls_innerjoin = _dapperRepository.GetInnerJoinSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion);
//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)) if (!string.IsNullOrEmpty(sapCode))
{ {
@ -121,9 +83,11 @@ 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(), "有发货对比(无结算加指定条件结算)")
//.SeparateBySheet() .SeparateBySheet()
//.Append(_lsnoSettle.ToList(), "有结算无发货对比") .Append(_ls_original.ToList(), "原始红旗未结数据")
.SeparateBySheet()
.Append(_ls_innerjoin.ToList(), "有发货有结算(发货数量大于结算)")
.ExportAppendDataAsByteArray(); .ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true); _fileContainer.SaveAsync(_filename, result.Result, true);

Loading…
Cancel
Save