Administrator 3 years ago
parent
commit
5f345f91cf
  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. 454
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 65
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHUnSettledDetailDiffExportService.cs
  5. 3
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.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 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 = "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 = "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) =>
{
});

454
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;
@ -575,8 +564,366 @@ 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)
{
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 ";
}
//更改:按照财务要求,将有发货有结算中发货数量大于结算数据的数据整合到未结报表中20220324,sum求和不带交货单号,后算出来
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( 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" +
" '' 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, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, LastModificationTime ) AS a\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" +
" 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 UNION ALL\n" +
"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" +
" '' 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, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, 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 sql2 = "SELECT\n" +
" a.WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" a.Kanban ,\n" +
" A.LastModificationTime WmsDate \n" +
"FROM\n" +
" Set_HQ_H_Kanban A\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 " +
" left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode ";
var listCompare = DbConnection.Query<CompareExtend>(sql2);
//查询发运表中,看权号+物料号没有重复的数据
var sql3 = "SELECT\n" +
" a.WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" a.Kanban,\n" +
" A.LastModificationTime WmsDate \n" +
"FROM\n" +
" Set_HQ_H_Kanban A\n" +
" LEFT 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 \n" +
" left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode \n" +
"WHERE\n" +
" B.Kanban IS NULL";
var listCompare1 = DbConnection.Query<CompareExtend>(sql3);
//红旗结算数据中,看板号+物料号没有重复的数据
var sql10 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" +
" HQHKanBan,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_HQ_H_Platform a \n" +
" left join Set_material b2 on a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" ) t1\n" +
" LEFT JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_HQ_H_Platform a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"WHERE\n" +
" t2.HQHKanBan IS NULL";
var list_leftjoin_hplatform = DbConnection.Query<CompareExtend1>(string.Format(sql10, version));
//红旗结算数据中,看板号+物料号有重复的数据
var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" +
" HQHKanBan,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_HQ_H_Platform a \n" +
" left join Set_material b2 on a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" ) t1\n" +
" INNER JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_HQ_H_Platform a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"ORDER BY\n" +
" t1.HQHKanBan,\n" +
" t1.MaterialCode";
var list_innerjoin_hplatform = DbConnection.Query<CompareExtend1>(string.Format(sql11, version));
var sql12 = "SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" +
" HQHKanBan,\n" +
" b2.MaterialCode \n" +
"FROM\n" +
" Set_HQ_H_Platform a \n" +
" left join Set_material b2 on a.MaterialCode = b2.CustomerPartCode \n" +
"WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan = 'BJ'";
var list_hplaform_bj = DbConnection.Query<CompareExtend1>(string.Format(sql12, version));
//结算数据比较
List<CompareExtend1> _lscopy = new List<CompareExtend1>();
foreach (var itm in list_leftjoin_hplatform)
{
var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
first.KanbanNumber += "," + itm.KanbanNumber;
first.AcceptanceDate += "," + itm.AcceptanceDate;
first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber;
}
else
{
_lscopy.Add(itm);
}
}
foreach (var itm in list_innerjoin_hplatform)
{
_lscopy.Add(itm);
}
foreach (var itm in list_hplaform_bj)
{
_lscopy.Add(itm);
}
//发运数据比较
List<CompareExtend> _ls = new List<CompareExtend>();
foreach (var itm in listCompare.ToList())
{
var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
public virtual List<HQHUnSettledDetailDiff> GetReverseSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
first.WmsBillNum += "," + itm.WmsBillNum;
first.WmsDate += "," + itm.WmsDate;
}
else
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm);
}
}
foreach (var itm in listCompare1.ToList())
{
if (!string.IsNullOrEmpty(itm.WmsDate))
{
itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString();
}
_ls.Add(itm);
}
var _query = DbConnection.Query<HQHUnSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
//数据整合,相同看板号+物料号的交货单号合并成一行中以逗号分隔
foreach (var itm1 in _list)
{
var itm = _ls.FirstOrDefault(p => p.Kanban == itm1. && p.MaterialCode == itm1.Sap编码);
if (itm != null)
{
itm1. = itm.WmsBillNum;
itm1. = itm.WmsDate;
}
var itmcopy = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm1. && p.MaterialCode == itm1.Sap编码);
if (itmcopy != null)
{
itm1. = itmcopy.KanbanNumber;
itm1. = itmcopy.AcceptanceDate;
itm1. = itmcopy.ExternalKanbanNumber;
}
}
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> GetOriginalSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion)
{
List<HQHUnSettledDetailDiff> _list = new List<HQHUnSettledDetailDiff>();
@ -591,7 +938,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
}
//更改:按照财务要求,将有发货有结算中发货数量大于结算数据的数据整合到未结报表中20220324
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" +
@ -640,26 +997,70 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" Set_HQ_H_Kanban AS a\n" +
" LEFT OUTER JOIN Set_HQ_H_Platform AS b ON a.Kanban = b.HQHKanBan \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 {0}\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 UNION ALL\n" +
"SELECT\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.订货看板编号,\n" +
" temp1.订货零件号,\n" +
" temp1.Sap编码,\n" +
@ -667,7 +1068,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.物料组,\n" +
" temp1.零件中文名称,\n" +
" temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.外部验收单号,\n" +
" temp1.结算数量,\n" +
" temp1.结算单价,\n" +
@ -683,15 +1083,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" +
" a.WmsBillNum AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" '' AS 收货仓库,\n" +
" '' 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" +
" 0 AS 发货状态,\n" +
" '' AS 外部验收单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" +
" 0 AS 结算单价,\n" +
@ -699,28 +1096,27 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 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 GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \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 {0}\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, condition);
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)
{
List<HQHSettleQtyDiff> _list = new List<HQHSettleQtyDiff>();

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

@ -56,56 +56,19 @@ 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 iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").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();
// }
//}
//有发货无结算+有发货有结算中发货数量大于结算数量的数据-----组合
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(sapCode))
{
@ -120,9 +83,11 @@ namespace SettleAccount.Job.Services.Report
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_ls.ToList(), "有发货无结算对比")
//.SeparateBySheet()
//.Append(_lsnoSettle.ToList(), "有结算无发货对比")
var result = _exporter.Append(_ls.ToList(), "有发货对比(无结算加指定条件结算)")
.SeparateBySheet()
.Append(_ls_original.ToList(), "原始红旗未结数据")
.SeparateBySheet()
.Append(_ls_innerjoin.ToList(), "有发货有结算(发货数量大于结算)")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);

3
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -229,8 +229,9 @@ 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 iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
//有发货无结算,单独拿出去,财务要求
var _ls = _hqkanbanDapper.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
var _ls = _hqkanbanDapper.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion);
if (!string.IsNullOrEmpty(sapCode))
{
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();

Loading…
Cancel
Save