Browse Source

EF迁移非Jis发运数据表

master
mahao 1 year ago
parent
commit
495e1de50c
  1. 47
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs
  2. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs
  3. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  4. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  5. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  6. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  7. 87
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SE_DETAIL.cs
  8. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs
  9. 57
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs
  10. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs
  11. 147
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs
  12. 5422
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815013824_20230815-1.Designer.cs
  13. 87
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815013824_20230815-1.cs
  14. 19
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  15. 7
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs
  16. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/BBACEdiSeCompareExportService.cs
  17. 294
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs
  18. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs
  19. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

47
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs

@ -0,0 +1,47 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
/// <summary>
/// Jis结算与发运对比请求Dto
/// </summary>
public class JisEdiSeCompareRequestDto
{
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
[Required(ErrorMessage = "{0}不能为空")]
public string Version { get; set; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 通用码
/// </summary>
[Display(Name = "通用码")]
public string PN { get; set; }
/// <summary>
/// 发运开始时间
/// </summary>
[Display(Name = "发运开始时间")]
public DateTime? SeStartDateTime { get; set; }
/// <summary>
/// 发运结束时间
/// </summary>
[Display(Name = "发运结束时间")]
public DateTime? SeEndDateTime { get; set; }
/// <summary>
/// 下线开始时间
/// </summary>
[Display(Name = "下线开始时间")]
public DateTime? DownLineStartDateTime { get; set; }
/// <summary>
/// 下线结束时间
/// </summary>
[Display(Name = "下线结束时间")]
public DateTime? DownLineEndDateTime { get; set; }
}

46
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs

@ -34,26 +34,21 @@ public class EdiSeCompareService : ApplicationService
/// BBACEdi与发运比对
/// </summary>
[HttpPost]
public async Task<string> BBACEdiSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
public async Task<string> BBACEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
{
var businessTypeDisplayName = pubSaSeCompareRequestDto.BusinessType.ToString();
DisplayAttribute attributeOfType = pubSaSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
var projectName = $"JisBBACEDI与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)pubSaSeCompareRequestDto.BusinessType).ToString() });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(BBACEdiSeCompareExportService), customConditionList, (rs) =>
var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisBBACEdiSeCompareExportService), customConditionList, (rs) =>
{
});
}).ConfigureAwait(false);
return _taskid;
}
@ -61,26 +56,21 @@ public class EdiSeCompareService : ApplicationService
/// HBPOEdi与发运比对
/// </summary>
[HttpPost]
public async Task<string> HBPOEdiSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
public async Task<string> HBPOEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
{
var businessTypeDisplayName = pubSaSeCompareRequestDto.BusinessType.ToString();
DisplayAttribute attributeOfType = pubSaSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
var projectName = $"JisHBPOEDI与发运数据对比结算与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)pubSaSeCompareRequestDto.BusinessType).ToString() });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(HBPOEdiSeCompareExportService), customConditionList, (rs) =>
var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisHBPOEdiSeCompareExportService), customConditionList, (rs) =>
{
});
}).ConfigureAwait(false);
return _taskid;
}
#endregion

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -33,9 +33,9 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
await HandDelEdiDataAsync().ConfigureAwait(false);
var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU });
var seDetails = db.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
seDetails.ForEach(t => t.IsHaveEdiData = true);

18
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs

@ -56,31 +56,29 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
where se.IsHaveEdiData == false
group se by new { se.PN, se.LU }
into a
select new { a.Key.PN, a.Key.LU, Qty = a.Sum(t => t.Qty) };
select new { a.Key.PN, a.Key.LU };
var ediDetailGroup = from edi in db.Set<HBPO_SE_EDI>()
where edi.IsHaveSeData == false
where edi.IsDeleted == false && edi.IsHaveSeData == false
group edi by new { edi.PN, edi.LU }
into a
select new { a.Key.PN, a.Key.LU, Qty = a.Sum(t => t.Qty) };
select new { a.Key.PN, a.Key.LU };
var keyCodes = from se in seDetailGroup
join edi in ediDetailGroup on new
{
se.PN,
se.LU,
se.Qty
se.LU
} equals new
{
edi.PN,
edi.LU,
edi.Qty
edi.LU
}
select new { se.PN, se.LU };
//var seDetailGroup2 = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var ediDetailGroup2 = db.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var keyCodes2 = seDetailGroup2.Join(ediDetailGroup2, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
//var seDetailGroup2 = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
//var ediDetailGroup2 = db.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
//var keyCodes2 = seDetailGroup2.Join(ediDetailGroup2, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU });
var seDetails = db.Set<HBPO_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<HBPO_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
seDetails.ForEach(t => t.IsHaveEdiData = true);

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -79,7 +79,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var businessType = SeSyncConfigInfo.BusinessType;
Expression<Func<TM_BJBMPT_OTHER_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && (!deliverSubBillTypes.Any() || deliverSubBillTypes.Contains(t.DeliverSubBillType));
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (syncPositionFlag != null)
{
predicate = (t) => t.DeliverBillType == deliverBillType && t.UID > int.Parse(syncPositionFlag.Position) && (!deliverSubBillTypes.Any() || deliverSubBillTypes.Contains(t.DeliverSubBillType));
@ -138,10 +138,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
BillType = pubSeDetail.DeliverBillType,
Qty = pubSeDetail.Qty,
BillTime = pubSeDetail.BillTime,
DeliverTime = pubSeDetail.DnBillTime,
DeliverTime = pubSeDetail.AssembleData,
ErpToLoc = pubSeDetail.ToErpLocCode,
Seq = default,
OrderNum = pubSeDetail.DnBillNum,
OrderNum = pubSeDetail.DeliveryIndex,
UniqueCode = default,
MatchNumber = default,
PjsNum = default,

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -1185,10 +1185,10 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_OTHER_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.DnBillTime))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
}

87
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SE_DETAIL.cs

@ -9,21 +9,6 @@ namespace SettleAccount.Domain.BQ;
[Display(Name = "PUB发运数据")]
public class PUB_SE_DETAIL :SE_BASE
{
//[Display(Name = "LU+生产码")]
//public string KeyCode { get; set; } = null!;
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "零件号")]
//public string LU { get; set; } = null!;
//[Display(Name = "ASN单号")]
//public string PN { get; set; } = null!;
//[Display(Name = "发货数量")]
//public decimal Qty { get; set; }
[Display(Name = "扩展1")]
public string Extend1 { get; set; } = null!;
@ -42,150 +27,146 @@ public class PUB_SE_DETAIL :SE_BASE
[Display(Name = "订单时间")]
public DateTime BeginDate { get; set; }
//[Display(Name = "发货时间")]
//public DateTime ShippingDate { get; set; }
//[Display(Name = "Wms发货单号")]
//public string WmsBillNum { get; set; } = null!;
/// <summary>
/// 发货单号
/// </summary>
[Display(Name = "发货单号")]
public string BillNum { get; set; }
/// <summary>
/// 发货时间
/// </summary>
[Display(Name = "发货时间")]
public DateTime BillTime { get; set; }
/// <summary>
/// 订单时间
/// </summary>
[Display(Name = "订单时间")]
public DateTime AssembleData { get; set; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
public string PartCode { get; set; }
/// <summary>
/// 批次
/// </summary>
[Display(Name = "批次")]
public string Batch { get; set; }
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "客户零件号")]
public string CustPartCode { get; set; }
/// <summary>
/// 发货人
/// </summary>
[Display(Name = "发货人")]
public string Oper { get; set; }
/// <summary>
/// DN单据号
/// </summary>
[Display(Name = "DN单据号")]
public string DnBillNum { get; set; }
/// <summary>
/// DN单据时间
/// </summary>
[Display(Name = "DN单据时间")]
public DateTime DnBillTime { get; set; }
/// <summary>
/// DN单添加人
/// </summary>
[Display(Name = "DN单添加人")]
public string DnOper { get; set; }
/// <summary>
/// 交付索引
/// </summary>
[Display(Name = "交付索引")]
public string DeliveryIndex { get; set; }
/// <summary>
/// 客户
/// </summary>
[Display(Name = "客户")]
public string CustId { get; set; }
/// <summary>
/// 发货仓库
/// </summary>
[Display(Name = "发货仓库")]
public string DeliveryHose { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
public string FromLocCode { get; set; }
/// <summary>
/// 来源仓库
/// </summary>
[Display(Name = "来源仓库")]
public string FromHose { get; set; }
/// <summary>
/// 来源ERP库存
/// </summary>
[Display(Name = "来源ERP库存")]
public string FromErpLocCode { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
public string ToLocCode { get; set; }
/// <summary>
/// 目标仓库
/// </summary>
[Display(Name = "目标仓库")]
public string ToHose { get; set; }
/// <summary>
/// 目标Erp库位
/// </summary>
[Display(Name = "目标Erp库位")]
public string ToErpLocCode { get; set; }
/// <summary>
/// 目标仓库
/// 状态
/// </summary>
[Display(Name = "目标仓库")]
public string ToHose { get; set; }
[Display(Name = "状态")]
public EnumBillState State { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
/// <summary>
/// 单据类型
/// </summary>
[DisplayName("单据类型")]
[Display(Name = "单据类型")]
public EnumBillType BillType { get; set; }
/// <summary>
/// 子单据类型
/// </summary>
[DisplayName("子单据类型")]
[Display(Name = "子单据类型")]
public EnumSubBillType SubBillType { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[DisplayName("业务类型")]
[Display(Name = "业务类型")]
public EnumProTpe ProType { get; set; }
/// <summary>
/// 事务类型
/// </summary>
[DisplayName("事务类型")]
[Display(Name = "事务类型")]
public EnumDelTransType TransType { get; set; }
/// <summary>
/// 发运主类型
/// </summary>
[DisplayName("发运主类型")]
[Display(Name = "发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
/// <summary>
/// 发运子类型
/// </summary>
[DisplayName("发运子类型")]
[Display(Name = "发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Display(Name = "创建时间")]
public DateTime CreateTime { get; set; }
public PUB_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, decimal qty, string extend1, string extend2, string extend3, EnumBusinessType businessType, DateTime beginDate, DateTime shippingDate, string wmsBillNum)
{

39
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs

@ -35,35 +35,47 @@ public class TM_BJBMPT_JIS_RECORD
[DisplayName("JIS生产码类型")]
public string CodeType { get; set; }
[DisplayName("状态")]
public EnumBillState State { get; set; }
[DisplayName("订单零件号")]
public string RealPartCode { get; set; }
[DisplayName("父级零件号")]
public string PartCode { get; set; }
[DisplayName("批次")]
public string Batch { get; set; }
[DisplayName("客户零件号")]
public string CustPartCode { get; set; }
[DisplayName("数量")]
public decimal? Qty { get; set; }
public decimal Qty { get; set; }
[DisplayName("发货单号")]
public string BillNum { get; set; }
[DisplayName("MES配置码")]
public string MESConfigCode { get; set; }
[DisplayName("订单时间")]
public DateTime AssembleData { get; set; }
[DisplayName("来源库位")]
public string FromLoc { get; set; }
[DisplayName("目标库位")]
public string ToLoc { get; set; }
public string RealPartCode { get; set; }
public string Batch { get; set; }
[DisplayName("参照订单生产码")]
public string RefVinCode { get; set; }
//[DisplayName("单据类型")]
//public EnumBillType BillType { get; set; }
[DisplayName("单据类型")]
public EnumBillType BillType { get; set; }
//[DisplayName("子单据类型")]
//public EnumSubBillType SubBillType { get; set; }
[DisplayName("子单据类型")]
public EnumSubBillType SubBillType { get; set; }
[DisplayName("单据性质")]
public string BillCharacter { get; set; }
@ -98,10 +110,15 @@ public class TM_BJBMPT_JIS_RECORD
[DisplayName("虚拟小总成")]
public string MatchNumber { get; set; }
//[DisplayName("业务类型")]
//public EnumProTpe ProType { get; set; }
[DisplayName("业务类型")]
public EnumProTpe ProType { get; set; }
[DisplayName("发货条码")]
public string DeliverCode { get; set; }
[DisplayName("客户位置")]
public string Position { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
}

57
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs

@ -29,9 +29,18 @@ public class TM_BJBMPT_JIT_RECORD
[DisplayName("订单零件号")]
public string RealPartCode { get; set; }
[DisplayName("批次")]
public string Batch { get; set; }
[DisplayName("客户零件号")]
public string CustPartCode { get; set; }
[DisplayName("订单序号")]
public string Seq { get; set; }
[DisplayName("订单时间")]
public DateTime AssembleData { get; set; }
[DisplayName("发货条码")]
public string DeliverCode { get; set; }
@ -50,22 +59,20 @@ public class TM_BJBMPT_JIT_RECORD
[DisplayName("客户位置")]
public string Position { get; set; }
public string MESConfigCode { get; set; }
[DisplayName("工厂")]
public string Factory { get; set; }
[DisplayName("生产线")]
public string Line { get; set; }
[DisplayName("MES配置码")]
public string MESConfigCode { get; set; }
[DisplayName("目标库位")]
public string ToLoc { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
[DisplayName("单据类型")]
public EnumBillType BillType { get; set; }
//[DisplayName("单据类型")]
//public EnumBillType BillType { get; set; }
//[DisplayName("子单据类型")]
//public EnumSubBillType SubBillType { get; set; }
[DisplayName("子单据类型")]
public EnumSubBillType SubBillType { get; set; }
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
@ -79,26 +86,50 @@ public class TM_BJBMPT_JIT_RECORD
[DisplayName("单据性质")]
public string BillCharacter { get; set; }
//[DisplayName("业务类型")]
//public EnumProTpe ProType { get; set; }
[DisplayName("原生产码")]
public string OrigiCode { get; set; }
[DisplayName("描述")]
public string PartDesc { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
[DisplayName("业务类型")]
public EnumProTpe ProType { get; set; }
[DisplayName("JIS排序单号")]
public string OrderNum { get; set; }
[DisplayName("JIS实际生产码")]
public string RealCode { get; set; }
[DisplayName("来源库位")]
public string FromLoc { get; set; }
[DisplayName("参照订单生产码")]
public string RefVinCode { get; set; }
[DisplayName("发货关联单号")]
public string RefBillNum { get; set; }
[DisplayName("Erp目标库位")]
public string ErpToLoc { get; set; }
[DisplayName("塑件唯一码")]
public string UniqueCode { get; set; }
[DisplayName("PJS顺序号")]
public string PjsNum { get; set; }
[DisplayName("虚拟小总成")]
public string MatchNumber { get; set; }
public string RefVinCode { get; set; }
[DisplayName("状态")]
public EnumBillState State { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
}
public enum EnumProTpe

30
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs

@ -20,12 +20,18 @@ public class TM_BJBMPT_OTHER_RECORD
[DisplayName("发货时间")]
public DateTime? BillTime { get; set; }
[DisplayName("订单时间")]
public DateTime? AssembleData { get; set; }
[DisplayName("零件号")]
public string PartCode { get; set; }
[DisplayName("批次")]
public string Batch { get; set; }
[DisplayName("客户零件号")]
public string CustPartCode { get; set; }
[DisplayName("发货人")]
public string Oper { get; set; }
@ -65,14 +71,23 @@ public class TM_BJBMPT_OTHER_RECORD
[DisplayName("目标Erp库位")]
public string ToErpLocCode { get; set; }
[DisplayName("状态")]
public EnumBillState State { get; set; }
[DisplayName("数量")]
public decimal? Qty { get; set; }
//[DisplayName("单据类型")]
//public EnumBillType BillType { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
[DisplayName("单据类型")]
public EnumBillType BillType { get; set; }
[DisplayName("子单据类型")]
public EnumSubBillType SubBillType { get; set; }
//[DisplayName("子单据类型")]
//public EnumSubBillType SubBillType { get; set; }
[DisplayName("业务类型")]
public EnumProTpe ProType { get; set; }
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
@ -83,9 +98,6 @@ public class TM_BJBMPT_OTHER_RECORD
[DisplayName("发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
//[DisplayName("业务类型")]
//public EnumProTpe ProType { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
}

147
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs

@ -0,0 +1,147 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisBBAC Edi与发运对比
/// </summary>
public class JisBBACEidSeCompareReport
{
}
/// <summary>
/// JisBBAC Edi与发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class JisBBACEidSeCompareExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
public string Category { get; set; }
/// <summary>
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// CarModeCode
/// </summary>
[Display(Name = "CarModeCode")]
[ExporterHeader(DisplayName = "CarModeCode")]
public string CarModeCode { get; set; }
/// <summary>
/// LineStationcode
/// </summary>
[Display(Name = "LineStationcode")]
[ExporterHeader(DisplayName = "LineStationcode")]
public string LineStationcode { get; set; }
/// <summary>
/// SequenceNumber
/// </summary>
[Display(Name = "SequenceNumber")]
[ExporterHeader(DisplayName = "SequenceNumber")]
public string SequenceNumber { get; set; }
/// <summary>
/// ParType
/// </summary>
[Display(Name = "ParType")]
[ExporterHeader(DisplayName = "ParType")]
public string ParType { get; set; }
/// <summary>
/// 配置码
/// </summary>
[Display(Name = "配置码")]
[ExporterHeader(DisplayName = "配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")]
[ExporterHeader(DisplayName = "生产码")]
public string PN { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Display(Name = "序列号")]
[ExporterHeader(DisplayName = "序列号")]
public string { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PJIS日顺序号 { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
[ExporterHeader(DisplayName = "物料号")]
public string MaterialNumber { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDes { get; set; }
/// <summary>
/// WMS发货数量
/// </summary>
[Display(Name = "WMS发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// EDI数量
/// </summary>
[Display(Name = "EDI数量")]
[ExporterHeader(DisplayName = "EDI数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// WMS发货与EDI数量差
/// </summary>
[Display(Name = "WMS发货与EDI数量差")]
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal DiffQty { set; get; }
/// <summary>
/// 客户下线时间
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime AssemblyDate { get; set; }
/// <summary>
/// 小总成号
/// </summary>
[Display(Name = "小总成号")]
[ExporterHeader(DisplayName = "小总成号")]
public DateTime MatchNumber { get; set; }
/// <summary>
/// 注塑码
/// </summary>
[Display(Name = "注塑码")]
[ExporterHeader(DisplayName = "注塑码")]
public string InjectionCode { get; set; }
/// <summary>
/// 是否完全匹配
/// </summary>
[Display(Name = "是否完全匹配")]
[ExporterHeader(DisplayName = "是否完全匹配")]
public string MateType { get; set; }
/// <summary>
/// 差异说明
/// </summary>
[Display(Name = "差异说明")]
[ExporterHeader(DisplayName = "差异说明")]
public string DiffDesc { get; set; }
}

5422
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815013824_20230815-1.Designer.cs

File diff suppressed because it is too large

87
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815013824_20230815-1.cs

@ -0,0 +1,87 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308151 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("27b08950-27f6-42ae-aeff-c7d19315b467"));
migrationBuilder.AddColumn<DateTime>(
name: "AssembleData",
table: "Set_PUB_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "BillNum",
table: "Set_PUB_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreateTime",
table: "Set_PUB_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "CustPartCode",
table: "Set_PUB_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "State",
table: "Set_PUB_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "56d140554b1f4a679568b60866a9750a", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"));
migrationBuilder.DropColumn(
name: "AssembleData",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.DropColumn(
name: "BillNum",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CreateTime",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustPartCode",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.DropColumn(
name: "State",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("27b08950-27f6-42ae-aeff-c7d19315b467"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "86c4ebf001bf4993a0cca2af4216ba92", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
}
}

19
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -3399,12 +3399,18 @@ namespace Win.Sfs.SettleAccount.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("AssembleData")
.HasColumnType("datetime2");
b.Property<string>("Batch")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("BeginDate")
.HasColumnType("datetime2");
b.Property<string>("BillNum")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("BillTime")
.HasColumnType("datetime2");
@ -3421,6 +3427,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -3432,6 +3441,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("CustId")
.HasColumnType("nvarchar(max)");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -3530,6 +3542,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("ShippingDate")
.HasColumnType("datetime2");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("SubBillType")
.HasColumnType("int");
@ -4396,10 +4411,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData(
new
{
Id = new Guid("27b08950-27f6-42ae-aeff-c7d19315b467"),
Id = new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1,
ConcurrencyStamp = "86c4ebf001bf4993a0cca2af4216ba92",
ConcurrencyStamp = "56d140554b1f4a679568b60866a9750a",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum",

7
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs

@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.Shared.Filter;
@ -42,7 +43,6 @@ namespace Win.Sfs.SettleAccount.Repository
public virtual async Task<long> GetCountByFilterAsync(List<FilterCondition> filters, CancellationToken cancellationToken = default)
{
return await this.GetQueryable()
.WhereIf(filters?.Count != 0, filters.ToLambda<TEntity>())
.LongCountAsync(GetCancellationToken(cancellationToken));
@ -54,6 +54,11 @@ namespace Win.Sfs.SettleAccount.Repository
{
var query = includeDetails ? this.WithDetails() : this.GetQueryable();
if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)))
{
query = (IQueryable<TEntity>)query.WhereIf(DataFilter.IsEnabled<ISoftDelete>(), e => ((ISoftDelete)e).IsDeleted == false);
}
var entities = query.WhereIf(filters?.Count != 0, filters.ToLambda<TEntity>());
entities = GetSortingQueryable(entities, sorting);

46
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/BBACEdiSeCompareExportService.cs

@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// BBACEdi与发运对比导出服务
/// </summary>
public class BBACEdiSeCompareExportService : ITransientDependency, IExportJob
{
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// 构造
/// </summary>
public BBACEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
return "";
}
}
}

294
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs

@ -0,0 +1,294 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// BBACEdi与发运对比导出服务
/// </summary>
public class JisBBACEdiSeCompareExportService : ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// AutoMapper
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public JisBBACEdiSeCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext)
{
_hubContext = hubContext;
_fileContainer = fileContainer;
_objectMapper = objectMapper;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value;
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value;
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
//有EDI的发运数据
var haveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true);
//有发运的EDI数据
//var haveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true && haveEidSes.Select(t => new { t.PN, t.LU }).Contains(new { t.PN, t.LU }));
var haveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).Join(haveEidSes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (edi, se) => edi);
//无EDI的发运数据
var notHaveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false);
//无发运的EDI数据
var notHaveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false);
//有EDI有发运
var haveEdiHaveSes = haveEidSes.ToList();
var dsdddd = haveSeEids.ToList();
//有EDI无发运
var haveEdiNotHaveSes = notHaveEidSes.ToList();
//无EDI有发运
var notHaveEdiHaveSes = notHaveSeEids.ToList();
var ids = id.ToString();
//var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var ediDetailGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
//var seDetails = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
//var ediDetails = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
////有EDI有发运
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
////有EDI无发运
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////无EDI有发运
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
//seDetails.ForEach(t => t.IsHaveEdiData = true);
//ediDetails.ForEach(t => t.IsHaveSeData = true);
//db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
//db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
//await db.SaveChangesAsync().ConfigureAwait(false);
//EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
//var businessTypeDisplayName = businessType.ToString();
//DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
//if (attributeOfType != null)
//{
// businessTypeDisplayName = attributeOfType.Name;
//}
//var filename = exportName.FirstOrDefault();
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
//pubSaSeCompareDiffs.ForEach(p =>
//{
// p.Category = (string.IsNullOrEmpty(p.SaLU), string.IsNullOrEmpty(p.SeLU)) switch
// {
// (false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe,
// (false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe,
// (true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe,
// _ => EnumPubSaSeCompareCategory.None,
// };
//});
////有结算有发运
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
////有结算无发运
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////无结算有发运
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
////二次匹配上的记录
//var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
//haveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
//haveSaNotHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
//notHaveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SeLU);
//#region 二次对比
////二次对比(替换零件号)
//var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList();
//var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && t.BusinessType == businessType).Result;
//tbRePartsRelationships.ForEach(tbRePartsRelationship =>
//{
// notHaveSaHaveSes.FindAll(t => t.SeLU == tbRePartsRelationship.RepLU).ForEach(t =>
// {
// t.ReplaceLU = tbRePartsRelationship.LU;
// });
//});
//var haveSaNotHaveSeLUPNs = haveSaNotHaveSes.Select(t => new { t.ReplaceLU, t.PN });
//var notHaveSaHaveSeLUPNs = notHaveSaHaveSes.Select(t => new { t.ReplaceLU, t.PN });
////二次匹配 匹配上的零件号
//var secondMatchLUPNs = haveSaNotHaveSeLUPNs.Intersect(notHaveSaHaveSeLUPNs);
//if (secondMatchLUPNs.Any() == true)
//{
// pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchLUPNs.Contains(new { t.ReplaceLU, t.PN }));
// foreach (var secondMatchLUPN in secondMatchLUPNs)
// {
// var haveSaNotHaveSe = haveSaNotHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
// var notHaveSaHaveSe = notHaveSaHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
// secondMatchHaveSaHaveSes.Add(new PubSaSeCompareDiff()
// {
// WmsBillNum = notHaveSaHaveSe.WmsBillNum,
// ShippingDate = notHaveSaHaveSe.ShippingDate,
// SeqNumber = notHaveSaHaveSe.SeqNumber,
// PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
// MaterialNumber = haveSaNotHaveSe.MaterialNumber,
// MaterialDes = haveSaNotHaveSe.MaterialDes,
// CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
// SAQty = haveSaNotHaveSe.SAQty,
// SEQty = notHaveSaHaveSe.SEQty,
// MateType = haveSaNotHaveSe.MateType,
// FixPrice = haveSaNotHaveSe.FixPrice,
// PrimitiveLU = haveSaNotHaveSe.PrimitiveLU,
// ReplaceLU = haveSaNotHaveSe.ReplaceLU,
// SeLU = notHaveSaHaveSe.SeLU,
// SaLU = haveSaNotHaveSe.SaLU,
// PN = haveSaNotHaveSe.PN,
// Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
// IsRemove = false
// });
// }
//}
////二次对比比对上的数据入库
//if (secondMatchHaveSaHaveSes.Count > 0)
//{
// pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
// var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
// _pubSeCDetailRepository.InsertManyAsync(pubSeCDetailEntitys);
//}
//#endregion
//if (string.IsNullOrEmpty(lu) == false)
//{
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.SaLU == lu || p.SeLU == lu);
//}
//if (string.IsNullOrEmpty(pn) == false)
//{
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
//}
//var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs);
////结算核对汇总
//var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
////有结算有发运
//var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
////有结算有发运汇总
//var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
////有结算无发运
//var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////有结算无发运
//var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
////无结算有发运
//var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
////无结算有发运
//var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
//ExcelExporter excelExporter = new ExcelExporter();
//excelExporter
// .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
// .SeparateBySheet()
// .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
// .SeparateBySheet()
// .Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
// .SeparateBySheet()
// .Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
// .SeparateBySheet()
// .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
// .SeparateBySheet()
// .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出")
// .SeparateBySheet();
//var result = excelExporter.ExportAppendDataAsByteArray();
//result.ShouldNotBeNull();
//_fileContainer.SaveAsync(filename, result.Result, true);
//Notify();
return id.ToString();
}
#region 私有方法
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
#endregion
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HBPOEdiSeCompareExportService.cs → code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs

@ -12,7 +12,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// HBPOEdi与发运对比导出服务
/// </summary>
public class HBPOEdiSeCompareExportService : ITransientDependency, IExportJob
public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob
{
/// <summary>
/// 文件容器
@ -27,7 +27,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 构造
/// </summary>
public HBPOEdiSeCompareExportService(
public JisHBPOEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper)
{

12
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -40,8 +40,8 @@ namespace Win.Sfs.SettleAccount
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0});
context.Services.AddTransient<PubSaSeCompareExportService>();
context.Services.AddTransient<BBACEdiSeCompareExportService>();
context.Services.AddTransient<HBPOEdiSeCompareExportService>();
context.Services.AddTransient<JisBBACEdiSeCompareExportService>();
context.Services.AddTransient<JisHBPOEdiSeCompareExportService>();
context.Services.AddTransient<SettleAccountImportService>();
@ -89,13 +89,13 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<PubSaSeCompareExportService>();
}
if (key.Equals(typeof(BBACEdiSeCompareExportService).FullName))
if (key.Equals(typeof(JisBBACEdiSeCompareExportService).FullName))
{
return implementationFactory.GetService<BBACEdiSeCompareExportService>();
return implementationFactory.GetService<JisBBACEdiSeCompareExportService>();
}
if (key.Equals(typeof(HBPOEdiSeCompareExportService).FullName))
if (key.Equals(typeof(JisHBPOEdiSeCompareExportService).FullName))
{
return implementationFactory.GetService<HBPOEdiSeCompareExportService>();
return implementationFactory.GetService<JisHBPOEdiSeCompareExportService>();
}
if (key.Equals(typeof(PD_SERVICE).FullName))
{

Loading…
Cancel
Save