wanggang 1 year ago
parent
commit
49b9a77202
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs
  2. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  3. 82
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  4. 5866
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230825071603_20230825-1.Designer.cs
  5. 310
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230825071603_20230825-1.cs
  6. 58
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  7. 56
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  8. 56
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  9. 74
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  10. 74
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  11. 194
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  12. 67
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs

@ -23,14 +23,14 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ;
/// <summary>
/// 客户替换件关系
/// 厂内物料替换件关系
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase<TB_RePartsRelationship>
{
/// <summary>
/// 客户替换件关系仓储
/// 厂内物料替换件关系仓储
/// </summary>
private readonly INormalEfCoreRepository<TB_RePartsRelationship, Guid> _repository;

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

@ -1139,7 +1139,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
@ -1150,16 +1150,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.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.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
@ -1170,7 +1162,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
@ -1181,16 +1173,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.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.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.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.AssembleData))

82
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -94,7 +94,7 @@ namespace SettleAccount.Bases
[Display(Name = "关联结算单号")]
public virtual string SettleBillNum { get; set; } = null!;
/// <summary>
/// 可结算单状态
/// </summary>
@ -170,7 +170,7 @@ namespace SettleAccount.Bases
/// 结算日期
/// </summary>
public DateTime SettleDate { set; get; }
public string InvGroupNum { set; get; }
/// <summary>
/// 结算分组号
@ -195,7 +195,7 @@ namespace SettleAccount.Bases
/// <summary>
/// 结算日期
/// </summary>
public DateTime SettleDate { set; get;}
public DateTime SettleDate { set; get; }
/// <summary>
/// 结算分组号
/// </summary>
@ -220,7 +220,7 @@ namespace SettleAccount.Bases
}
public class RE_BASE :FullAuditedAggregateRoot<Guid>, IRE_BASE
public class RE_BASE : FullAuditedAggregateRoot<Guid>, IRE_BASE
{
public RE_BASE()
{
@ -240,18 +240,18 @@ namespace SettleAccount.Bases
/// <summary>
/// 零件號
/// </summary>
public string LU { get; set ; }
public string LU { get; set; }
/// <summary>
/// 發貨單號、
/// </summary>
public string PN { get; set ; }
public string PN { get; set; }
/// <summary>
///
/// </summary>
public string KeyCode { get; set ; }
public string KeyCode { get; set; }
}
@ -260,18 +260,18 @@ namespace SettleAccount.Bases
public interface ISE_BASE : ISBASE
{
/// <summary>
/// 期间
/// </summary>
public int Version { set; get; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime ShippingDate { set; get; }
/// <summary>
/// 发运单号
/// </summary>
public string WmsBillNum { set; get; }
/// <summary>
/// 期间
/// </summary>
public int Version { set; get; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime ShippingDate { set; get; }
/// <summary>
/// 发运单号
/// </summary>
public string WmsBillNum { set; get; }
}
public interface IPD_BASE : ISBASE
@ -300,7 +300,7 @@ namespace SettleAccount.Bases
/// 結算分組號
/// </summary>
public string GroupNum { set; get; }
}
/// <summary>
/// 基类检查设置
@ -318,9 +318,9 @@ namespace SettleAccount.Bases
/// <summary>
/// 是否检查BOM
/// </summary>
public bool IsBom { set; get; }
public bool IsBom { set; get; }
public bool IsPriceList { set; get; }
public bool IsPriceList { set; get; }
public BASE_CONF(bool isRelationShip, bool isMaterial, bool isBom)
@ -335,12 +335,12 @@ namespace SettleAccount.Bases
}
}
public class SA_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
{
public SA_BASE() { }
public SA_BASE(Guid id) : base(id) { }
@ -364,29 +364,34 @@ namespace SettleAccount.Bases
/// <summary>
/// 客户物料号
/// </summary>
public virtual string LU { get ; set ; }
public virtual string LU { get; set; }
/// <summary>
/// 客户零件号(无空格)
/// </summary>
[MaxLength(100)]
public string CustomerPartCodeNoSpace { get; set; }
/// <summary>
/// 生產號
/// </summary>
public virtual string PN { get; set ; }
public virtual string PN { get; set; }
/// <summary>
/// 組合鍵值(LU+PN)
/// </summary>
public virtual string KeyCode { get ; set ; }
public virtual string KeyCode { get; set; }
/// <summary>
/// 數量
/// </summary>
public virtual decimal Qty { get ; set ; }
public virtual decimal Qty { get; set; }
/// <summary>
/// 結算分組號
/// </summary>
public virtual string GroupNum { get ; set ; }
public virtual string GroupNum { get; set; }
/// <summary>
/// 厂内物料号
/// </summary>
public virtual string PartCode { get; set; }
@ -403,7 +408,7 @@ namespace SettleAccount.Bases
public SA_CAN_BASE(Guid id) : base(id) { Id = id; }
/// <summary>
@ -453,7 +458,7 @@ namespace SettleAccount.Bases
public string InvbillNum { get; set; }
public string ErpLoc { get; set; }=string.Empty;
public string ErpLoc { get; set; } = string.Empty;
public string PartCode { get; set; }
public string RealPartCode { get; set; }
@ -569,6 +574,11 @@ namespace SettleAccount.Bases
/// </summary>
public string LU { get; set; }
/// <summary>
/// 客户零件号(无空格)
/// </summary>
[MaxLength(100)]
public string CustomerPartCodeNoSpace { get; set; }
/// <summary>
/// 厂内零件号
/// </summary>
public string FactoryPartCode { get; set; }
@ -622,11 +632,11 @@ namespace SettleAccount.Bases
/// <summary>
/// LU(零件号)
/// </summary>
public string LU { get ; set; }
public string LU { get; set; }
/// <summary>
/// 生产号、发货单号、交付单号等
/// </summary>
public string PN { get ; set; }
public string PN { get; set; }
/// <summary>
/// 替换LU
/// </summary>

5866
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230825071603_20230825-1.Designer.cs

File diff suppressed because it is too large

310
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230825071603_20230825-1.cs

@ -0,0 +1,310 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308251 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("f12dd04d-4189-4f24-9501-038a2846b84a"));
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_PUB_SE_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_PUB_SA_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_HBPO_SE_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_HBPO_SA_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_BBAC_SE_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomerPartCodeNoSpace",
table: "Set_BBAC_SA_DETAIL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "d6ba8aa579b04d55a23bd4bf24e6ed9f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "72a5ae8256104547b6d5a41323c3ad84");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "03f4d0ab46de4dfa88a918fe2b3c48fa");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "143f0e0bf5b6446aafe7964aab5fcb1a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "76e8e365e9ff48e1953f3b14e7e01fe7");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8e1cb5a9-8bcf-17fd-97e3-4c10532a5794"),
column: "ConcurrencyStamp",
value: "5bdbe6b8c451462983e460c4adcab0f1");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "955009a9778e4cd1b2dfde2aabebabfd");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "8f8d688a37e54d84aeca023750200e2f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "041fcaa8b49347edb5b46fde3ab1032d");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "9ed27ee117aa41a681a8cdbfb30b2f25");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c3fe2b66-28cc-c612-eca6-a362769ae90c"),
column: "ConcurrencyStamp",
value: "b612ac27de904ec5b5fb5371cf427566");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "f8789477c42b476485bd7499b5facce4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "1b569f48046046b2b908b1a3b327f104");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "AssembleData", "BillTime", "CodeType", "ConcurrencyStamp", "Configcode", "CustPartCode", "DeliverBillType", "DeliverSubBillType", "ErpToLoc", "IsReplenished", "MatchNumber", "OrderNum", "PjsNum", "Qty", "ReMark", "RealCode", "RealPartCode", "Seq", "SettlementPartCode", "SettlementVinCode", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("73ceebb1-5b80-48b1-ac38-80334d1f345f"), null, null, null, "bfe48a54e65e4856bd2e768456026105", null, null, 1, null, "ErpToLoc", null, null, "OrderNum", null, 0m, null, null, "PartCode", null, null, null, null, "VinCode", null });
migrationBuilder.UpdateData(
table: "Set_VmiSyncTask",
keyColumn: "Id",
keyValue: new Guid("08de7a37-5ede-f524-cb3d-3c80888fd7d8"),
column: "ConcurrencyStamp",
value: "25685f349c47487f874b9ac5dc039190");
migrationBuilder.UpdateData(
table: "Set_VmiSyncTask",
keyColumn: "Id",
keyValue: new Guid("b8ba69e3-f5a3-c95e-8f82-c9c2fec960b4"),
column: "ConcurrencyStamp",
value: "2debe020ac9d4f37b62a52ff564577c2");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("73ceebb1-5b80-48b1-ac38-80334d1f345f"));
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_PUB_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_PUB_SA_DETAIL");
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_HBPO_SA_DETAIL");
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustomerPartCodeNoSpace",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "cda3828abfa24e43a7ff9dced0aceaeb");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "ebb669926c1d4ab988edfe14269e4b20");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "03159d6b06554bf99cfbbb15d476e386");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "73e9bf92fae34390a12c393f6ed8d163");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "b22b285ec9aa48c8b7ed2aa1f9dd7af6");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8e1cb5a9-8bcf-17fd-97e3-4c10532a5794"),
column: "ConcurrencyStamp",
value: "12581a5c89da4c8587f2696f8b02ce62");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "456fe904f19a46349489730351148e28");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "15d1504855924d95abde0dc835de555d");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "f5d16790a44b4367aeeec82ab1a35fd4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "11cf3dd1955c4da29aa430ed0b9bafdb");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c3fe2b66-28cc-c612-eca6-a362769ae90c"),
column: "ConcurrencyStamp",
value: "cedf8a69b6474171b18c5fe227b78d26");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "87fd77d7f0e04c4da372a75168619afc");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "6cdaca1650424494980e906bb44eab0f");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "AssembleData", "BillTime", "CodeType", "ConcurrencyStamp", "Configcode", "CustPartCode", "DeliverBillType", "DeliverSubBillType", "ErpToLoc", "IsReplenished", "MatchNumber", "OrderNum", "PjsNum", "Qty", "ReMark", "RealCode", "RealPartCode", "Seq", "SettlementPartCode", "SettlementVinCode", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("f12dd04d-4189-4f24-9501-038a2846b84a"), null, null, null, "1200fe51a7b84cfda12141b184958098", null, null, 1, null, "ErpToLoc", null, null, "OrderNum", null, 0m, null, null, "PartCode", null, null, null, null, "VinCode", null });
migrationBuilder.UpdateData(
table: "Set_VmiSyncTask",
keyColumn: "Id",
keyValue: new Guid("08de7a37-5ede-f524-cb3d-3c80888fd7d8"),
column: "ConcurrencyStamp",
value: "b301dcf7075a41768ced27af9a124f2f");
migrationBuilder.UpdateData(
table: "Set_VmiSyncTask",
keyColumn: "Id",
keyValue: new Guid("b8ba69e3-f5a3-c95e-8f82-c9c2fec960b4"),
column: "ConcurrencyStamp",
value: "1606b33f2487461fb72fb38851576947");
}
}
}

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

@ -564,6 +564,10 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -677,6 +681,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -1777,6 +1785,10 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -1890,6 +1902,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -3495,6 +3511,10 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Extend1")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -3610,6 +3630,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("CustomerPartCodeNoSpace")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -4415,7 +4439,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "87fd77d7f0e04c4da372a75168619afc",
ConcurrencyStamp = "f8789477c42b476485bd7499b5facce4",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4425,7 +4449,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "cda3828abfa24e43a7ff9dced0aceaeb",
ConcurrencyStamp = "d6ba8aa579b04d55a23bd4bf24e6ed9f",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4435,7 +4459,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "ebb669926c1d4ab988edfe14269e4b20",
ConcurrencyStamp = "72a5ae8256104547b6d5a41323c3ad84",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4445,7 +4469,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8e1cb5a9-8bcf-17fd-97e3-4c10532a5794"),
ConcurrencyStamp = "12581a5c89da4c8587f2696f8b02ce62",
ConcurrencyStamp = "5bdbe6b8c451462983e460c4adcab0f1",
Cron = "0 0/5 * * * ? *",
IsDisabled = false,
IsRunning = false,
@ -4455,7 +4479,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c3fe2b66-28cc-c612-eca6-a362769ae90c"),
ConcurrencyStamp = "cedf8a69b6474171b18c5fe227b78d26",
ConcurrencyStamp = "b612ac27de904ec5b5fb5371cf427566",
Cron = "0 0/5 * * * ? *",
IsDisabled = false,
IsRunning = false,
@ -4465,7 +4489,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "15d1504855924d95abde0dc835de555d",
ConcurrencyStamp = "8f8d688a37e54d84aeca023750200e2f",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4475,7 +4499,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "03159d6b06554bf99cfbbb15d476e386",
ConcurrencyStamp = "03f4d0ab46de4dfa88a918fe2b3c48fa",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4485,7 +4509,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "b22b285ec9aa48c8b7ed2aa1f9dd7af6",
ConcurrencyStamp = "76e8e365e9ff48e1953f3b14e7e01fe7",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4495,7 +4519,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "73e9bf92fae34390a12c393f6ed8d163",
ConcurrencyStamp = "143f0e0bf5b6446aafe7964aab5fcb1a",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4505,7 +4529,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "6cdaca1650424494980e906bb44eab0f",
ConcurrencyStamp = "1b569f48046046b2b908b1a3b327f104",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4515,7 +4539,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "456fe904f19a46349489730351148e28",
ConcurrencyStamp = "955009a9778e4cd1b2dfde2aabebabfd",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4525,7 +4549,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "11cf3dd1955c4da29aa430ed0b9bafdb",
ConcurrencyStamp = "9ed27ee117aa41a681a8cdbfb30b2f25",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4535,7 +4559,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "f5d16790a44b4367aeeec82ab1a35fd4",
ConcurrencyStamp = "041fcaa8b49347edb5b46fde3ab1032d",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4671,8 +4695,8 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData(
new
{
Id = new Guid("f12dd04d-4189-4f24-9501-038a2846b84a"),
ConcurrencyStamp = "1200fe51a7b84cfda12141b184958098",
Id = new Guid("73ceebb1-5b80-48b1-ac38-80334d1f345f"),
ConcurrencyStamp = "bfe48a54e65e4856bd2e768456026105",
CreatedTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
DeliverBillType = 1,
ErpToLoc = "ErpToLoc",
@ -4975,7 +4999,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("08de7a37-5ede-f524-cb3d-3c80888fd7d8"),
ConcurrencyStamp = "b301dcf7075a41768ced27af9a124f2f",
ConcurrencyStamp = "25685f349c47487f874b9ac5dc039190",
LastUpdate = new DateTime(2023, 8, 20, 0, 0, 0, 0, DateTimeKind.Local),
Name = "库存事务备份",
Number = "Set_VmiLog"
@ -4983,7 +5007,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b8ba69e3-f5a3-c95e-8f82-c9c2fec960b4"),
ConcurrencyStamp = "1606b33f2487461fb72fb38851576947",
ConcurrencyStamp = "2debe020ac9d4f37b62a52ff564577c2",
LastUpdate = new DateTime(2023, 8, 20, 0, 0, 0, 0, DateTimeKind.Local),
Name = "库存余额备份",
Number = "Set_VmiBalance"

56
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs

@ -130,17 +130,38 @@ namespace SettleAccount.Job.Services.Report
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from se in temp.DefaultIfEmpty()
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
@ -150,29 +171,8 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion

56
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

@ -129,17 +129,38 @@ namespace SettleAccount.Job.Services.Report
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from se in temp.DefaultIfEmpty()
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
@ -149,29 +170,8 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion

74
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs

@ -15,6 +15,7 @@ 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.Reports;
namespace SettleAccount.Job.Services.Report
@ -48,7 +49,7 @@ namespace SettleAccount.Job.Services.Report
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
SettleAccountDbContext settleAccountDbContext) : base(hubContext, settleAccountDbContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
@ -75,6 +76,21 @@ namespace SettleAccount.Job.Services.Report
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
#region 二次对比
//二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(pubSaSeCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any())
{
//二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库
var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<PUB_SEC_DETAIL>().AddRange(pubSeCDetailEntitys);
}
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
@ -130,17 +146,38 @@ namespace SettleAccount.Job.Services.Report
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from se in temp.DefaultIfEmpty()
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
@ -150,29 +187,8 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion

74
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs

@ -15,6 +15,7 @@ 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.Reports;
namespace SettleAccount.Job.Services.Report
@ -48,7 +49,7 @@ namespace SettleAccount.Job.Services.Report
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
SettleAccountDbContext settleAccountDbContext) : base(hubContext, settleAccountDbContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
@ -75,6 +76,21 @@ namespace SettleAccount.Job.Services.Report
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
#region 二次对比
//二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(pubSaSeCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any())
{
//二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库
var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<PUB_SEC_DETAIL>().AddRange(pubSeCDetailEntitys);
}
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
@ -130,17 +146,38 @@ namespace SettleAccount.Job.Services.Report
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from se in temp.DefaultIfEmpty()
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
@ -150,29 +187,8 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion

194
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -24,14 +24,10 @@ using Win.Sfs.Shared.RepositoryBase;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// Pub结算发运对比导出服务
/// 结算发运对比导出服务
/// </summary>
public class PubSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// DbContext
/// </summary>
@ -40,22 +36,18 @@ namespace SettleAccount.Job.Services.Report
/// 替换件关系仓储
/// </summary>
private readonly INormalEfCoreRepository<TB_RePartsRelationship, Guid> _tbRePartsRelationshipRepository;
/// <summary>
/// PUB二次比对仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> _pubSeCDetailRepository;
/// <summary>
/// Pub结算发运对比Dapper
/// </summary>
private readonly PubSaSeCompareDapperRepository _pubSaSeCompareDapperRepository;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
@ -71,9 +63,8 @@ namespace SettleAccount.Job.Services.Report
INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSeCDetailRepository,
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper) : base(hubContext)
IObjectMapper objectMapper) : base(hubContext, settleAccountDbContext)
{
_hubContext = hubContext;
_settleAccountDbContext = settleAccountDbContext;
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
_pubSeCDetailRepository = pubSeCDetailRepository;
@ -114,59 +105,9 @@ namespace SettleAccount.Job.Services.Report
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
//有结算有发运
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>();
#region 二次对比
//二次对比(替换无结算有发运数据的厂内零件号)
var repFactoryPartCodes = notHaveSaHaveSes.Select(t => t.FactoryPartCode).Distinct().ToList();
var tbRePartsRelationships = _settleAccountDbContext.Set<TB_RePartsRelationship>().Where(t => repFactoryPartCodes.Contains(t.LU) && t.BusinessType == businessType).ToList();
//var tbRePartsRelationshipsOld = _tbRePartsRelationshipRepository.GetListAsync(t => repFactoryPartCodes.Contains(t.LU) && t.BusinessType == businessType).Result;
tbRePartsRelationships.ForEach(tbRePartsRelationship =>
{
notHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t =>
{
t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU;
t.IsReplace = true;
});
});
//获取二次比对上的数据
secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes
join haveSaNotHaveSe in haveSaNotHaveSes
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
where notHaveSaHaveSe.IsReplace == true
select new PubSaSeCompareDiff()
{
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
SAQty = haveSaNotHaveSe.SAQty,
SEQty = notHaveSaHaveSe.SEQty,
FixPrice = haveSaNotHaveSe.FixPrice,
PN = haveSaNotHaveSe.PN,
ToLocCode = notHaveSaHaveSe.ToLocCode,
ToErpLocCode = notHaveSaHaveSe.ToErpLocCode,
Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
SeCustomerPartCode = notHaveSaHaveSe.SeCustomerPartCode,
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode,
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode,
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode,
CustomerPartCode = notHaveSaHaveSe.CustomerPartCode,
PartCodeDesc = notHaveSaHaveSe.PartCodeDesc,
FactoryPartCode = notHaveSaHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = notHaveSaHaveSe.ReplaceFactoryPartCode
}).ToList();
//二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(pubSaSeCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any())
{
//二次匹配 匹配上的厂内零件号、PN
@ -273,10 +214,15 @@ namespace SettleAccount.Job.Services.Report
#region 私有方法
/// <summary>
/// 获取结算与发运比对数据
/// 获取比对数据
/// </summary>
public List<PubSaSeCompareDiff> GetSaSeCompareData(EnumBusinessType businessType, int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//印度件LU对比
if (businessType == EnumBusinessType.YinDuJian)
{
return GetSaSeCompareDataYinDu(version, seStartDateTime, seEndDateTime);
}
//结算
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version
@ -305,17 +251,38 @@ namespace SettleAccount.Job.Services.Report
ToLocCode = groupItem.Max(t => t.ToLocCode),
ToErpLocCode = groupItem.Max(t => t.ToErpLocCode)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from se in temp.DefaultIfEmpty()
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.LU,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
@ -325,49 +292,33 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.LU,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
//印度件LU对比
if (businessType == EnumBusinessType.YinDuJian && (1 + 1) == 3)
{
saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
/// <summary>
/// 获取比对数据
/// </summary>
public List<PubSaSeCompareDiff> GetSaSeCompareDataYinDu(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version
group sa by new { sa.LU } into groupItem
select new
{
PN = "",
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode),
};
seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
where se.BusinessType == EnumBusinessType.YinDuJian && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.LU } into groupItem
select new
{
PN = "",
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
WmsBillNum = groupItem.Max(t => t.WmsBillNum),
@ -376,9 +327,48 @@ namespace SettleAccount.Job.Services.Report
ToLocCode = groupItem.Max(t => t.ToLocCode),
ToErpLocCode = groupItem.Max(t => t.ToErpLocCode)
};
}
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
var saSeCompareLeft = from sa in saGroup
join se in seGroup
on sa.LU equals se.LU
into temp
from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareRight = from se in seGroup
join sa in saGroup
on se.LU equals sa.LU
into temp
from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion

67
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

@ -2,7 +2,9 @@ using System.Collections.Generic;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -17,10 +19,15 @@ namespace SettleAccount.Job.Services.Report
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
public SaSeCompareExportBaseService(IHubContext<PageHub> hubContext)
public SaSeCompareExportBaseService(IHubContext<PageHub> hubContext, SettleAccountDbContext settleAccountDbContext)
{
_hubContext = hubContext;
_settleAccountDbContext = settleAccountDbContext;
}
public virtual void HandlePubSaSeCompareDiffList(List<PubSaSeCompareDiff> pubSaSeCompareDiffs)
@ -65,6 +72,64 @@ namespace SettleAccount.Job.Services.Report
});
}
/// <summary>
/// 二次比对
/// </summary>
public virtual List<PubSaSeCompareDiff> HandleSecondCompare(List<PubSaSeCompareDiff> pubSaSeCompareDiffs, EnumBusinessType businessType)
{
//二次匹配上的记录
var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
//有结算有发运
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 repFactoryPartCodes = notHaveSaHaveSes.Select(t => t.FactoryPartCode).Distinct().ToList();
var tbRePartsRelationships = _settleAccountDbContext.Set<TB_RePartsRelationship>().Where(t => repFactoryPartCodes.Contains(t.LU) && t.BusinessType == businessType).ToList();
tbRePartsRelationships.ForEach(tbRePartsRelationship =>
{
notHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t =>
{
t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU;
t.IsReplace = true;
});
});
//获取二次比对上的数据
secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes
join haveSaNotHaveSe in haveSaNotHaveSes
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
where notHaveSaHaveSe.IsReplace == true
select new PubSaSeCompareDiff()
{
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
SAQty = haveSaNotHaveSe.SAQty,
SEQty = notHaveSaHaveSe.SEQty,
FixPrice = haveSaNotHaveSe.FixPrice,
PN = haveSaNotHaveSe.PN,
ToLocCode = notHaveSaHaveSe.ToLocCode,
ToErpLocCode = notHaveSaHaveSe.ToErpLocCode,
Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
SeCustomerPartCode = notHaveSaHaveSe.SeCustomerPartCode,
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode,
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode,
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode,
CustomerPartCode = notHaveSaHaveSe.CustomerPartCode,
PartCodeDesc = notHaveSaHaveSe.PartCodeDesc,
FactoryPartCode = notHaveSaHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = notHaveSaHaveSe.ReplaceFactoryPartCode
}).ToList();
return secondMatchHaveSaHaveSes;
}
/// <summary>
/// 创建导出文件结构
/// </summary>

Loading…
Cancel
Save