Browse Source

EF迁移结算表业务类型字段

master
mahao 1 year ago
parent
commit
d8458e0f10
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  3. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  4. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  5. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs
  6. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SA.cs
  7. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs
  8. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs
  9. 5425
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815023057_20230815-2.Designer.cs
  10. 67
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815023057_20230815-2.cs
  11. 13
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

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

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.LinqAsync; using System.LinqAsync;
using System.Security.Policy;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -288,6 +289,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
{ {
BillNum = bbacSaBillNum, BillNum = bbacSaBillNum,
State = "1", State = "1",
BusinessType = _businessType
}; };
//可结算单号 //可结算单号
var bbacCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); var bbacCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
@ -327,7 +329,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == bbacSaDetail.LU && bbacSaDetail.SettleDate > t.BeginTime && bbacSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == bbacSaDetail.LU && bbacSaDetail.SettleDate > t.BeginTime && bbacSaDetail.SettleDate < t.EndTime);
bbacSaDetail.Price = priceListEntity?.Price ?? default; bbacSaDetail.Price = priceListEntity?.Price ?? default;
bbacSaDetail.IsMaiDan = bbacSaDetail.PN.Contains("R0"); bbacSaDetail.BusinessType = bbacSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : _businessType;
}); });
//导入的零件号集合 //导入的零件号集合

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -386,7 +386,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoCanSaDetails.ForEach(hbpoCanSaDetail => hbpoCanSaDetails.ForEach(hbpoCanSaDetail =>
{ {
hbpoCanSaDetail.BillNum = hbpoCanSaDetail.InvGroupNum = hbpoCanSaBillNum; hbpoCanSaDetail.BillNum = hbpoCanSaDetail.InvGroupNum = hbpoCanSaBillNum;
hbpoCanSaDetail.BusinessType = _businessType;
}); });
await _hbpoCanSaRepository.InsertAsync(hbpoCanSa).ConfigureAwait(false); await _hbpoCanSaRepository.InsertAsync(hbpoCanSa).ConfigureAwait(false);
@ -394,11 +393,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
} }
if (hbpoNotSaDetails.Count > 0) if (hbpoNotSaDetails.Count > 0)
{ {
hbpoNotSaDetails.ForEach(hbpoNotSaDetail =>
{
hbpoNotSaDetail.BusinessType = _businessType;
});
await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails).ConfigureAwait(false); await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails).ConfigureAwait(false);
} }
if (materialRelationships.Count > 0) if (materialRelationships.Count > 0)

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

@ -88,6 +88,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords); var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords);
pubSeDetails.RemoveAll(t => !string.IsNullOrEmpty(t.LU) || !string.IsNullOrEmpty(t.PartCode));
if (pubSeDetails.Any()) if (pubSeDetails.Any())
{ {
//客户零件号和厂内零件号 //客户零件号和厂内零件号
@ -108,12 +109,12 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
t.BusinessType = businessType; t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
}); });
await _pubSeDetailRepository.InsertManyAsync(pubSeDetails); await _pubSeDetailRepository.InsertManyAsync(pubSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag); await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false);
} }
else else
{ {
@ -122,7 +123,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
TableName = syncTableName, TableName = syncTableName,
Position = wmsSeRecords.Last().UID.ToString() Position = wmsSeRecords.Last().UID.ToString()
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag); await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false);
} }
foreach (var pubSeDetail in pubSeDetails) foreach (var pubSeDetail in pubSeDetails)
@ -151,7 +152,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
RealCode = default, RealCode = default,
ReMark = pubSeDetail.Remark, ReMark = pubSeDetail.Remark,
}; };
await _vmiService.In(logType: Vmi.VmiLogType.Type100, changedNumber: pubSeDetail.DnBillNum, data: vmiBalance); await _vmiService.In(logType: Vmi.VmiLogType.Type100, changedNumber: pubSeDetail.DnBillNum, data: vmiBalance).ConfigureAwait(false);
} }
else if (pubSeDetail.TransType == EnumDelTransType.退) else if (pubSeDetail.TransType == EnumDelTransType.退)
{ {
@ -177,7 +178,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
RealCode = default, RealCode = default,
ReMark = pubSeDetail.Remark, ReMark = pubSeDetail.Remark,
}; };
await _vmiService.Out(VmiLogType.Type400, pubSeDetail.DnBillNum, vmiLog); await _vmiService.Out(VmiLogType.Type400, pubSeDetail.DnBillNum, vmiLog).ConfigureAwait(false);
} }
} }
} }

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

@ -378,6 +378,11 @@ namespace SettleAccount.Bases
/// 厂内物料号 /// 厂内物料号
/// </summary> /// </summary>
public virtual string PartCode { get; set; } public virtual string PartCode { get; set; }
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
} }
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE

13
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs

@ -2,6 +2,7 @@ using SettleAccount.Bases;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ; namespace SettleAccount.Domain.BQ;
@ -24,12 +25,16 @@ public class BBAC_SA : AuditedAggregateRoot<Guid>
/// </summary> /// </summary>
[Display(Name = "状态")] [Display(Name = "状态")]
public string State { get; set; } = null!; public string State { get; set; } = null!;
/// <summary> /// <summary>
/// 选择工厂导入 /// 选择工厂导入
/// </summary> /// </summary>
[Display(Name = "工厂地点")] [Display(Name = "工厂地点")]
public string Site { get; set; } = null!; public string Site { get; set; } = null!;
/// <summary>
/// 业务类型
/// </summary>
[Display(Name = "业务类型")]
public EnumBusinessType BusinessType { get; set; }
public BBAC_SA(Guid guid, int version, string billNum, string dNBillNum, string state):base(guid) public BBAC_SA(Guid guid, int version, string billNum, string dNBillNum, string state):base(guid)
{ {
@ -126,12 +131,6 @@ public class BBAC_SA_DETAIL:SA_BASE
//[Display(Name = "发票分组号")] //[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!; //public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 是否是买单件
/// </summary>
[Display(Name = "是否是买单件")]
public bool IsMaiDan { get; set; }
public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid) public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid)
{ {

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SA.cs

@ -35,8 +35,6 @@ public class HBPO_SA : AuditedAggregateRoot<Guid>
/// </summary> /// </summary>
[Display(Name = "工厂地点")] [Display(Name = "工厂地点")]
public string Site { get; set; } = null!; public string Site { get; set; } = null!;
/// <summary> /// <summary>
/// 业务类型 /// 业务类型
/// </summary> /// </summary>
@ -121,16 +119,9 @@ public class HBPO_SA_DETAIL : SA_BASE
///// </summary> ///// </summary>
//[Display(Name = "结算分组")] //[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!; //public string GroupNum { get; set; } = null!;
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "发票分组号")] [Display(Name = "发票分组号")]
public string InvGroupNum { get; set; } = null!; public string InvGroupNum { get; set; } = null!;
public HBPO_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType) public HBPO_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType)
{ {
this.Id= guid; this.Id= guid;

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs

@ -111,12 +111,6 @@ public class PUB_SA_DETAIL:SA_BASE
//[Display(Name = "结算分组")] //[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!; //public string GroupNum { get; set; } = null!;
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
public PUB_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string extend1, string extend2, string extend3, string groupNum) public PUB_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string extend1, string extend2, string extend3, string groupNum)
{ {
Id=guid; Id=guid;

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

@ -71,8 +71,8 @@ public class TM_BJBMPT_OTHER_RECORD
[DisplayName("目标Erp库位")] [DisplayName("目标Erp库位")]
public string ToErpLocCode { get; set; } public string ToErpLocCode { get; set; }
[DisplayName("状态")] //[DisplayName("状态")]
public EnumBillState State { get; set; } //public EnumBillState State { get; set; }
[DisplayName("数量")] [DisplayName("数量")]
public decimal? Qty { get; set; } public decimal? Qty { get; set; }
@ -99,5 +99,5 @@ public class TM_BJBMPT_OTHER_RECORD
public EnumDeliverSubBillType DeliverSubBillType { get; set; } public EnumDeliverSubBillType DeliverSubBillType { get; set; }
[DisplayName("创建时间")] [DisplayName("创建时间")]
public DateTime CreateTime { get; set; } public DateTime? CreateTime { get; set; }
} }

5425
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815023057_20230815-2.Designer.cs

File diff suppressed because it is too large

67
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815023057_20230815-2.cs

@ -0,0 +1,67 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308152 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"));
migrationBuilder.DropColumn(
name: "IsMaiDan",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_BBAC_SA_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_BBAC_SA",
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("75ce4934-06de-4cac-a1f0-536935975b38"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "8e865c8947ea4381b1b48c3ee4d572b4", 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("75ce4934-06de-4cac-a1f0-536935975b38"));
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_BBAC_SA");
migrationBuilder.AddColumn<bool>(
name: "IsMaiDan",
table: "Set_BBAC_SA_DETAIL",
type: "bit",
nullable: false,
defaultValue: false);
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 });
}
}
}

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

@ -470,6 +470,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasMaxLength(50) .HasMaxLength(50)
@ -525,6 +528,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("Category") b.Property<string>("Category")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -551,9 +557,6 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<bool>("IsMaiDan")
.HasColumnType("bit");
b.Property<string>("IsReturn") b.Property<string>("IsReturn")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -4411,10 +4414,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"), Id = new Guid("75ce4934-06de-4cac-a1f0-536935975b38"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "56d140554b1f4a679568b60866a9750a", ConcurrencyStamp = "8e865c8947ea4381b1b48c3ee4d572b4",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

Loading…
Cancel
Save