|
@ -38,13 +38,18 @@ namespace SettleAccount.Job.Services.Report |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取结算、发运比对数据
|
|
|
/// 获取结算、发运比对数据
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 获取全量有结算无发运的数据
|
|
|
|
|
|
/// 获取全量无结算有发运的数据
|
|
|
|
|
|
/// 获取当期有结算有发运的数据
|
|
|
|
|
|
/// </remarks>
|
|
|
public List<SaSeCompareDiff> GetSaSeCompareDataJis<TSaDetail, TSeDetail>(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) |
|
|
public List<SaSeCompareDiff> GetSaSeCompareDataJis<TSaDetail, TSeDetail>(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime) |
|
|
where TSaDetail : SA_BASE |
|
|
where TSaDetail : SA_BASE |
|
|
where TSeDetail : JisSeBase |
|
|
where TSeDetail : JisSeBase |
|
|
{ |
|
|
{ |
|
|
//结算
|
|
|
//结算
|
|
|
var saGroup = from sa in _settleAccountDbContext.Set<TSaDetail>() |
|
|
var saGroup = from sa in _settleAccountDbContext.Set<TSaDetail>() |
|
|
where sa.BusinessType == businessType && sa.MappingType == EnumMappingType.None |
|
|
where sa.BusinessType == businessType |
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
|
select new |
|
|
select new |
|
|
{ |
|
|
{ |
|
@ -56,6 +61,19 @@ namespace SettleAccount.Job.Services.Report |
|
|
SettleDate = groupItem.Max(t => t.SettleDate), |
|
|
SettleDate = groupItem.Max(t => t.SettleDate), |
|
|
PartCode = groupItem.Max(t => t.PartCode) |
|
|
PartCode = groupItem.Max(t => t.PartCode) |
|
|
}; |
|
|
}; |
|
|
|
|
|
var saGroupByMappingType = from sa in _settleAccountDbContext.Set<TSaDetail>() |
|
|
|
|
|
where sa.BusinessType == businessType && sa.MappingType == EnumMappingType.None |
|
|
|
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
|
|
|
|
select new |
|
|
|
|
|
{ |
|
|
|
|
|
groupItem.Key.PN, |
|
|
|
|
|
groupItem.Key.CustomerPartCodeNoSpace, |
|
|
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
|
|
Version = groupItem.Max(t => t.Version), |
|
|
|
|
|
LU = groupItem.Max(t => t.LU), |
|
|
|
|
|
SettleDate = groupItem.Max(t => t.SettleDate), |
|
|
|
|
|
PartCode = groupItem.Max(t => t.PartCode) |
|
|
|
|
|
}; |
|
|
var saGroupByVersion = from sa in _settleAccountDbContext.Set<TSaDetail>() |
|
|
var saGroupByVersion = from sa in _settleAccountDbContext.Set<TSaDetail>() |
|
|
where sa.BusinessType == businessType && sa.Version == version |
|
|
where sa.BusinessType == businessType && sa.Version == version |
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
@ -87,7 +105,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
//有结算无发运
|
|
|
//有结算无发运
|
|
|
var haveSaNotHaveSeList = (from sa in saGroup |
|
|
var haveSaNotHaveSeList = (from sa in saGroupByMappingType |
|
|
join se in seGroup |
|
|
join se in seGroup |
|
|
on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } |
|
|
on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } |
|
|
into temp |
|
|
into temp |
|
@ -147,6 +165,12 @@ namespace SettleAccount.Job.Services.Report |
|
|
return haveSaHaveSeList.Union(haveSaNotHaveSeList).Union(notHaveSaHaveSeList).ToList(); |
|
|
return haveSaHaveSeList.Union(haveSaNotHaveSeList).Union(notHaveSaHaveSeList).ToList(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 区分比对类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 根据 是否有结算、是否有发运数据区分类型<see cref="EnumPubSaSeCompareCategory"/>
|
|
|
|
|
|
/// </remarks>
|
|
|
public virtual void HandlePubSaSeCompareDiffList(List<SaSeCompareDiff> saSeCompareDiffs) |
|
|
public virtual void HandlePubSaSeCompareDiffList(List<SaSeCompareDiff> saSeCompareDiffs) |
|
|
{ |
|
|
{ |
|
|
saSeCompareDiffs.ForEach(p => |
|
|
saSeCompareDiffs.ForEach(p => |
|
@ -189,6 +213,12 @@ namespace SettleAccount.Job.Services.Report |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 二次比对
|
|
|
/// 二次比对
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 检索出有 有结算无发运 和 无结算有发运的数据
|
|
|
|
|
|
/// 根据厂内零件号替换关系替换发运数据的厂内零件号
|
|
|
|
|
|
/// 再次对比
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
/// <returns>二次对比上的数据</returns>
|
|
|
public virtual List<SaSeCompareDiff> HandleSecondCompare(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType) |
|
|
public virtual List<SaSeCompareDiff> HandleSecondCompare(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType) |
|
|
{ |
|
|
{ |
|
|
//二次匹配上的记录
|
|
|
//二次匹配上的记录
|
|
@ -275,8 +305,10 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 结算数据处理
|
|
|
/// 结算数据处理
|
|
|
/// 结算详情表写入库位、替换零件号
|
|
|
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 对比上发运的结算数据写入库位、替换零件号(开票使用)
|
|
|
|
|
|
/// </remarks>
|
|
|
public virtual void HandleSaDetails<TCanSa, TNotSa>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) |
|
|
public virtual void HandleSaDetails<TCanSa, TNotSa>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) |
|
|
where TCanSa : SA_CAN_BASE |
|
|
where TCanSa : SA_CAN_BASE |
|
|
where TNotSa : SA_NOT_BASE |
|
|
where TNotSa : SA_NOT_BASE |
|
@ -319,8 +351,10 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 处理结算数据
|
|
|
/// 处理结算数据
|
|
|
/// 结算、发运对比上的数据修改结算详情表匹配类型
|
|
|
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 对比上发运的结算数据修改匹配类型
|
|
|
|
|
|
/// </remarks>
|
|
|
public virtual void HandleSaDetailsMain<T>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE |
|
|
public virtual void HandleSaDetailsMain<T>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE |
|
|
{ |
|
|
{ |
|
|
var haveSaHaveSes = saSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); |
|
|
var haveSaHaveSes = saSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); |
|
@ -353,6 +387,9 @@ namespace SettleAccount.Job.Services.Report |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 创建导出文件结构
|
|
|
/// 创建导出文件结构
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 根据导出Excel配置的最大行数分Sheel
|
|
|
|
|
|
/// </remarks>
|
|
|
public ExcelExporter BindExcelExporter<T>(List<T> saSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeCompareDetailReport, new() |
|
|
public ExcelExporter BindExcelExporter<T>(List<T> saSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeCompareDetailReport, new() |
|
|
{ |
|
|
{ |
|
|
//详情Sheet行数
|
|
|
//详情Sheet行数
|
|
@ -467,6 +504,5 @@ namespace SettleAccount.Job.Services.Report |
|
|
{ |
|
|
{ |
|
|
_hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); |
|
|
_hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|