Browse Source

EnumBusinessType添加类型

master
mahao 1 year ago
parent
commit
e9b32f58e3
  1. 9
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  5. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  6. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  7. 143
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs
  8. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs
  9. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncConfig.cs
  10. 122
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs
  11. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  12. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  13. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  14. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs
  15. 58
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs
  16. 91
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs
  17. 58
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs
  18. 1
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

9
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -13,7 +13,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NUglify.Helpers;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount;
@ -28,6 +28,9 @@ public class Startup
.ForEach(o => services.AddTransient(o));
services.AddScheduler();
services.AddTransient<HBPOSeSyncAppService>();
services.AddTransient<BBACSeSyncAppService>();
services.AddTransient<ZhiGongBBACSeSyncAppService>();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
@ -50,7 +53,9 @@ public class Startup
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler =>
{
scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
//scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongBBACSeSyncAppService>().EveryMinute();
using var scope = app.ApplicationServices.CreateScope();
var jobs = scope.ServiceProvider.GetService<SettleAccountDbContext>().Set<JobItem>().ToList();
jobs?.ForEach(job =>

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -252,7 +252,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.BBAC,
bussiessType: EnumBusinessType.JisBBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContactDocID,
@ -294,7 +294,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.BBAC,
businessType: EnumBusinessType.JisBBAC,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
@ -400,7 +400,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.BBAC,
bussiessType: EnumBusinessType.JisBBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContractDocID,
@ -447,7 +447,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.BBAC,
businessType: EnumBusinessType.JisBBAC,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -234,7 +234,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.HBPO,
bussiessType: EnumBusinessType.JisHBPO,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
@ -275,7 +275,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
businessType: EnumBusinessType.JisHBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
@ -371,7 +371,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.BBAC,
bussiessType: EnumBusinessType.JisBBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
@ -416,7 +416,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
businessType: EnumBusinessType.JisHBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.

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

@ -108,7 +108,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
public async Task<string> ImportAsync([FromForm] IFormFileCollection files)
{
//业务类型
var businessType = EnumBusinessType.HBPO;
var businessType = EnumBusinessType.JisHBPO;
//数据校验
var checkList = new List<ErrorExportDto>();
//结算单号

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -142,16 +142,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
case EnumBusinessType.BeiJian:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.ZhiGongJian:
case EnumBusinessType.ZhiGongJianBBAC:
case EnumBusinessType.ZhiGongJianHBPO:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.YingDuJian:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.BBAC:
case EnumBusinessType.JisBBAC:
await _bbacMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.HBPO:
case EnumBusinessType.JisHBPO:
await _hbpoMng.SetNewState(input.InvGroupNum);
break;
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -230,7 +230,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.HBPO,
bussiessType: EnumBusinessType.JisHBPO,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
@ -271,7 +271,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
businessType: EnumBusinessType.JisHBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.
@ -368,7 +368,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: main.InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: EnumBusinessType.BBAC,
bussiessType: EnumBusinessType.JisBBAC,
amt: detail.Amt,
pRICE: detail.Price,
extend1: string.Empty,
@ -413,7 +413,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: EnumBusinessType.HBPO,
businessType: EnumBusinessType.JisHBPO,
invGroupNum: main.InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.

143
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs

@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// HBPO发运数据同步服务
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class BBACSeSyncAppService : ApplicationService, IInvocable
{
/// <summary>
/// WMS数据上下文
/// </summary>
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext;
/// <summary>
/// 同步位置标记
/// </summary>
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository;
/// <summary>
/// HBPO发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> _bbacSeDetailRepository;
/// <summary>
/// 构造
/// </summary>
public BBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> bbacSeDetailRepository)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_bbacSeDetailRepository = bbacSeDetailRepository;
}
[HttpPost]
public async Task Invoke()
{
await SyncJitRecord();
//await SyncJisRecord();
}
/// <summary>
/// 同步JitRecord
/// </summary>
/// <returns></returns>
private async Task SyncJitRecord()
{
//同步表名称
var syncTableName = "TM_BJBMPT_JIT_RECORD";
//BBAC类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.BBAC,
EnumDeliverSubBillType.JIT直供件BBAC
};
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
if (syncPositionFlag != null)
{
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> expression = (t) => t.UID > int.Parse(syncPositionFlag.Position);
var body = expression.Body;
predicate = Expression.Lambda<Func<TM_BJBMPT_JIT_RECORD, bool>>(Expression.And(predicate.Body, body), predicate.Parameters);
}
var jitRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(jitRecords);
if (bbacSeDetails.Any())
{
await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails);
if (syncPositionFlag != null)
{
syncPositionFlag.Position = jitRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag);
}
else
{
syncPositionFlag = new SyncPositionFlag()
{
TableName = syncTableName,
Position = jitRecords.Last().UID.ToString()
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag);
}
}
}
private async Task SyncJisRecord()
{
//同步表名称
var syncTableName = "TM_BJBMPT_JIS_RECORD";
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => true;
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
if (syncPositionFlag != null)
{
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position);
}
var jisRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(jisRecords);
if (bbacSeDetails.Any())
{
await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails);
if (syncPositionFlag != null)
{
syncPositionFlag.Position = jisRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag);
}
else
{
syncPositionFlag = new SyncPositionFlag()
{
TableName = syncTableName,
Position = jisRecords.Last().UID.ToString()
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag);
}
}
}
}

39
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPOSeSyncAppService.cs → code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs

@ -6,16 +6,12 @@ using System.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// HBPO发运数据同步服务
@ -62,7 +58,7 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
[HttpPost]
public async Task Invoke()
{
//await SyncJitRecord();
await SyncJitRecord();
//await SyncJisRecord();
//if (!dbContext.GetService<IRelationalDatabaseCreator>().Exists() && dbContext.Database.EnsureCreated())
//{
@ -107,7 +103,7 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
// Console.WriteLine($"{blog.UID}");
// }
//}
Console.WriteLine($"{this.GetType().FullName}执行了");
Console.WriteLine($"{GetType().FullName}执行了");
}
/// <summary>
@ -118,13 +114,38 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
{
//同步表名称
var syncTableName = "TM_BJBMPT_JIT_RECORD";
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => true;
//HBPO类型集合
var EnumDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.HBPO,
EnumDeliverSubBillType.JIT直供件HBPO
};
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
if (syncPositionFlag != null)
{
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position);
//var inv = Expression.Invoke(t=>t.UID > int.Parse(syncPositionFlag.Position), predicate.Parameters);
//return Expression.Lambda<Func<T, bool>>(Expression.And(exp.Body, inv), exp.Parameters);
//predicate.And(t => t.UID > int.Parse(syncPositionFlag.Position));
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> expression = (t) => t.UID > int.Parse(syncPositionFlag.Position);
var body = expression.Body;
//var inv = Expression.Invoke(condition, exp.Parameters);
predicate = Expression.Lambda<Func<TM_BJBMPT_JIT_RECORD, bool>>(Expression.And(predicate.Body, body), predicate.Parameters);
//Expression.Lambda<Func<T, bool>>(Expression.Equal(member, constant), parameter);
//var expression = predicate.And(t => t.UID > int.Parse(syncPositionFlag.Position));
}
Console.WriteLine($"表达式:{predicate}");
var jitRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD
.Where(predicate)
.OrderBy(b => b.UID)

31
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncConfig.cs

@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.ComponentModel;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// 发运同步配置
/// </summary>
public class SeSyncConfig
{
/// <summary>
/// 同步表名称
/// </summary>
public string SyncTableName { get; set; }
/// <summary>
/// 同步发运主类型
/// </summary>
public EnumDeliverBjBmpBillType SyncDeliverBillType { get; set; }
/// <summary>
/// 同步发运子类型
/// </summary>
public List<EnumDeliverSubBillType> SyncDeliverSubBillTypes { get; set; }
/// <summary>
///
/// </summary>
public EnumBusinessType BusinessType { get; set; }
}

122
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs

@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// 直供件BBAC发运同步
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService
{
/// <summary>
/// 构造
/// </summary>
public ZhiGongBBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
SyncTableName = "ZhiGongBBACSeSync",
SyncDeliverBillType = EnumDeliverBjBmpBillType.JIT直供件,
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.JIT直供件BBAC
}
};
}
}
/// <summary>
/// Jit发运数据同步
/// </summary>
public class JitSeSyncAppService : ApplicationService, IInvocable
{
/// <summary>
/// WMS数据上下文
/// </summary>
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext;
/// <summary>
/// 同步位置标记
/// </summary>
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository;
/// <summary>
/// Jit发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
/// <summary>
/// 构造
/// </summary>
public JitSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_pubSeDetailRepository = pubSeDetailRepository;
}
public SeSyncConfig SeSyncConfigInfo { get; set; }
[HttpPost]
public async Task Invoke()
{
//同步表名称
var syncTableName = SeSyncConfigInfo.SyncTableName;
//同步发运主类型
var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType;
//同步发运子类型
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
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);
if (syncPositionFlag != null)
{
Expression<Func<TM_BJBMPT_OTHER_RECORD, bool>> expression = (t) => t.UID > int.Parse(syncPositionFlag.Position);
var body = expression.Body;
predicate = Expression.Lambda<Func<TM_BJBMPT_OTHER_RECORD, bool>>(Expression.And(predicate.Body, body), predicate.Parameters);
}
var jitRecords = _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>>(jitRecords);
if (pubSeDetails.Any())
{
await _pubSeDetailRepository.InsertManyAsync(pubSeDetails);
if (syncPositionFlag != null)
{
syncPositionFlag.Position = jitRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag);
}
else
{
syncPositionFlag = new SyncPositionFlag()
{
TableName = syncTableName,
Position = jitRecords.Last().UID.ToString()
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag);
}
}
await Task.CompletedTask;
}
}

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

@ -1049,6 +1049,14 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.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.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.PN, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -49,7 +49,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.Version = DateTime.Now.Year + DateTime.Now.Month;
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
_entity.BusinessType = EnumBusinessType.BBAC;
_entity.BusinessType = EnumBusinessType.JisBBAC;
var _entityList = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm in p_list)
{

14
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -71,8 +71,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
if (p_entiy.BusinessType == EnumBusinessType.BeiJian ||
p_entiy.BusinessType == EnumBusinessType.YingDuJian ||
p_entiy.BusinessType == EnumBusinessType.MaiDanJian ||
p_entiy.BusinessType == EnumBusinessType.ZhiGongJian
p_entiy.BusinessType == EnumBusinessType.MaiDanJianBBAC ||
p_entiy.BusinessType == EnumBusinessType.MaiDanJianHBPO ||
p_entiy.BusinessType == EnumBusinessType.ZhiGongJianBBAC ||
p_entiy.BusinessType == EnumBusinessType.ZhiGongJianHBPO
)
{
bool isSucc = false;
@ -86,7 +88,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
return isSucc;
}
else if (p_entiy.BusinessType == EnumBusinessType.BBAC)
else if (p_entiy.BusinessType == EnumBusinessType.JisBBAC)
{
bool isSucc = false;
if (IsForward == true)
@ -100,7 +102,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return isSucc;
}
else if (p_entiy.BusinessType == EnumBusinessType.HBPO)
else if (p_entiy.BusinessType == EnumBusinessType.JisHBPO)
{
bool isSucc = false;
@ -250,7 +252,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<bool> ReceivedAsync(string p_groupbillnum)
{
var inv = _repository.Where(p => p.InvGroupNum == p_groupbillnum).FirstOrDefault();
if (inv.BusinessType == EnumBusinessType.BBAC)
if (inv.BusinessType == EnumBusinessType.JisBBAC)
{
var entity = await _bbacMng.GetMainAsync(inv.InvGroupNum);
if (entity == null)
@ -303,7 +305,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
}
}
else if (inv.BusinessType == EnumBusinessType.HBPO)
else if (inv.BusinessType == EnumBusinessType.JisHBPO)
{
var entity = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (entity != null)

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

@ -68,11 +68,14 @@ public class TM_BJBMPT_JIS_RECORD
[DisplayName("单据性质")]
public string BillCharacter { get; set; }
public int? TransType { get; set; }
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
public int? DeliverBillType { get; set; }
[DisplayName("发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
public int? DeliverSubBillType { get; set; }
[DisplayName("发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
[DisplayName("发货关联单号")]
public string RefBillNum { get; set; }

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

@ -5,6 +5,9 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// Jis小件
/// </summary>
public class TM_BJBMPT_JIT_RECORD
{
[Key]
@ -64,11 +67,14 @@ public class TM_BJBMPT_JIT_RECORD
//[DisplayName("子单据类型")]
//public EnumSubBillType SubBillType { get; set; }
public int? TransType { get; set; }
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
public int? DeliverBillType { get; set; }
[DisplayName("发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
public int? DeliverSubBillType { get; set; }
[DisplayName("发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
[DisplayName("单据性质")]
public string BillCharacter { get; set; }
@ -118,9 +124,55 @@ public enum EnumProTpe
Jit买单件退货 = 18,
Jit匹配件退货 = 19,
Jit补发订单退货 = 20,
4S发货 = 21,
HBPO发货 = 22,
= 23,
= 24,
4S退货 = 25,
HBPO退货 = 26,
退 = 27,
退 = 28,
}
public enum EnumBillType { }
public enum EnumSubBillType { }
/// <summary>
/// 事务类型
/// </summary>
public enum EnumDelTransType
{
= 1,
退 = -1,
}
/// <summary>
/// 发运主类型
/// </summary>
public enum EnumDeliverBjBmpBillType
{
= 0,
JIS件 = 1,
JIT直供件 = 2,
= 3,
4S备件 = 4,
}
/// <summary>
/// 发运子类型
/// </summary>
public enum EnumDeliverSubBillType
{
= 0,
BBAC = 1,
HBPO = 2,
BBAC = 3,
HBPO = 4,
BBAC = 5,
HBPO = 6,
BBAC = 7,
HBPO = 8,
JIT直供件BBAC = 9,
JIT直供件HBPO = 10,
}

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

@ -0,0 +1,91 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// Jit(非Jis
/// </summary>
public class TM_BJBMPT_OTHER_RECORD
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[DisplayName("发货单号")]
public string BillNum { get; set; }
[DisplayName("发货时间")]
public DateTime? BillTime { get; set; }
[DisplayName("零件号")]
public string PartCode { get; set; }
[DisplayName("批次")]
public string Batch { get; set; }
[DisplayName("发货人")]
public string Oper { get; set; }
[DisplayName("DN单据号")]
public string DnBillNum { get; set; }
[DisplayName("DN单据时间")]
public DateTime? DnBillTime { get; set; }
[DisplayName("DN单添加人")]
public string DnOper { get; set; }
[DisplayName("交付索引")]
public string DeliveryIndex { get; set; }
[DisplayName("客户")]
public string CustId { get; set; }
[DisplayName("发货仓库")]
public string DeliveryHose { get; set; }
[DisplayName("来源库位")]
public string FromLocCode { get; set; }
[DisplayName("来源仓库")]
public string FromHose { get; set; }
[DisplayName("来源ERP库存")]
public string FromErpLocCode { get; set; }
[DisplayName("目标库位")]
public string ToLocCode { get; set; }
[DisplayName("目标仓库")]
public string ToHose { get; set; }
[DisplayName("目标Erp库位")]
public string ToErpLocCode { get; set; }
[DisplayName("数量")]
public decimal? Qty { get; set; }
//[DisplayName("单据类型")]
//public EnumBillType BillType { get; set; }
//[DisplayName("子单据类型")]
//public EnumSubBillType SubBillType { get; set; }
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
[DisplayName("发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
[DisplayName("发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
//[DisplayName("业务类型")]
//public EnumProTpe ProType { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
}

58
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs

@ -14,39 +14,63 @@ namespace Win.Sfs.SettleAccount
None = 0,
/// <summary>
/// 直供件
/// JisBBAC
/// </summary>
[Display(Name = "直供件")]
ZhiGongJian = 1,
[Display(Name = "JisBBAC")]
JisBBAC = 1,
/// <summary>
/// 买单件
/// JisHBPO
/// </summary>
[Display(Name = "买单件")]
MaiDanJian = 2,
[Display(Name = "JisHBPO")]
JisHBPO = 2,
/// <summary>
/// 备件
/// 直供件BBAC
/// </summary>
[Display(Name = "备件")]
BeiJian = 3,
[Display(Name = "直供件BBAC")]
ZhiGongJianBBAC = 3,
/// <summary>
/// 印度件
/// 直供件HBPO
/// </summary>
[Display(Name = "印度件")]
YingDuJian = 4,
[Display(Name = "直供件HBPO")]
ZhiGongJianHBPO = 4,
/// <summary>
///
/// 买单件BBAC
/// </summary>
[Display(Name = "HBPO-JIS")]
HBPO = 5,
[Display(Name = "买单件BBAC")]
MaiDanJianBBAC = 5,
/// <summary>
/// 买单件HBPO
/// </summary>
[Display(Name = "买单件HBPO")]
MaiDanJianHBPO = 6,
/// <summary>
/// 备件
/// </summary>
[Display(Name = "备件")]
BeiJian = 7,
/// <summary>
/// 印度件
/// </summary>
[Display(Name = "BBAC-JIS")]
BBAC = 6
[Display(Name = "印度件")]
YingDuJian = 8,
///// <summary>
/////
///// </summary>
//[Display(Name = "HBPO-JIS")]
//HBPO = 5,
///// <summary>
///// 印度件
///// </summary>
//[Display(Name = "BBAC-JIS")]
//BBAC = 6
}
}

1
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

@ -9,6 +9,7 @@ public class WMSBJBMPTDbContext : DbContext
{
public DbSet<TM_BJBMPT_JIT_RECORD> TM_BJBMPT_JIT_RECORD { get; set; }
public DbSet<TM_BJBMPT_JIS_RECORD> TM_BJBMPT_JIS_RECORD { get; set; }
public DbSet<TM_BJBMPT_OTHER_RECORD> TM_BJBMPT_OTHER_RECORD { get; set; }
public WMSBJBMPTDbContext()
{

Loading…
Cancel
Save