Browse Source

更新版本

master
zhaoxinyu 6 months ago
parent
commit
8f5d4d0ad2
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  2. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  3. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  4. 131
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs
  7. 7
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

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

@ -141,7 +141,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var jobItem = this.GetJobItem(job.Id);
Guid? jobLogId = null;
// 如果作业正在运行并且心跳超过20秒,则停止作业
if (jobItem.IsRunning && (DateTime.Now - jobItem.HeartBeat.Value).TotalSeconds > 20)
if (jobItem.IsRunning && (DateTime.Now - jobItem.HeartBeat.Value).TotalMinutes > 120)
{
JobItemStop(jobItem.Id);
}

20
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Coravel.Invocable;
using EFCore.BulkExtensions;
using Hangfire.Common;
using LinqToDB;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
@ -92,7 +94,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
while (seed < 6)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -103,7 +105,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(10_000).ToList();
.OrderBy(b => b.UID).Take(5_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{
@ -121,7 +123,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
/// </summary>
/// <remarks>
/// 同步TM_BJBMPT_JIS_RECORD表发运数据
/// 同步十次、每次同步100_000条发运数据
/// 同步十次、每次同步1_000条发运数据
/// </remarks>
private async Task SyncJisRecordAsync()
{
@ -134,7 +136,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
while (seed < 6)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -145,7 +147,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(10_000).ToList();
.OrderBy(b => b.UID).Take(5_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{
@ -199,9 +201,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
t.CreateTime = dateTimeNow;
t.CreationTime = dateTimeNow;
//如果MatchNumber为空,取MESConfigCode字段,MESConfigCode为老虚拟总成号
if (string.IsNullOrEmpty(t.MatchNumber))
{
t.MatchNumber = t.MESConfigCode;
}
});
var syncPosition = seDetails.Last().UID.ToString();
using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false);
try
{

15
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -93,7 +93,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
while (seed < 6)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -104,7 +104,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(10_000).ToList();
.OrderBy(b => b.UID).Take(5_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{
@ -135,7 +135,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
while (seed < 6)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -146,7 +146,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(10_000).ToList();
.OrderBy(b => b.UID).Take(5_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (jisSeDetails.Any())
{
@ -201,6 +201,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
t.CreateTime = dateTimeNow;
t.CreationTime = dateTimeNow;
//如果MatchNumber为空,取MESConfigCode字段,MESConfigCode为老虚拟总成号
if(string.IsNullOrEmpty(t.MatchNumber))
{
t.MatchNumber = t.MESConfigCode;
}
});
var syncPosition = seDetails.Last().UID.ToString();

131
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs

@ -788,34 +788,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
if (part_group_small.Count > 0)
{
var partlist = part_group_small.Select(p => p.LU).ToList();
var ls = hbpo_can_list.Where(p => partlist.Contains(p.LU)).ToList(); ;
decimal sum = 0;
List<HBPO_CAN_SA_DETAIL> details = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm1 in ls)
{
sum += (itm1.Qty * itm1.Price);
if (sum > 10000000)
{
var ls = hbpo_can_list.Where(p => partlist.Contains(p.LU)).ToList();
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa = new HBPO_CAN_SA();
bbac_sa.SetId(Guid.NewGuid());
bbac_sa.BillNum = billNum;
bbac_sa.InvGroupNum = billNum;
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "104T";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm2 in details)
var hbpo_sa = new HBPO_CAN_SA();
hbpo_sa.SetId(Guid.NewGuid());
hbpo_sa.BillNum = billNum;
hbpo_sa.InvGroupNum = billNum;
hbpo_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
hbpo_sa.State = SettleBillState.;
hbpo_sa.SettleBillNum = string.Empty;
hbpo_sa.Site = "104T";
hbpo_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(hbpo_sa);
foreach (var itm1 in ls)
{
itm2.SetBillNum(billNum);
itm2.SetGroupNum(billNum);
billDetails.Add(itm2);
}
details = new List<HBPO_CAN_SA_DETAIL>();
sum = itm1.Qty * itm1.Price;
}
var _detailEntity = new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode,
@ -828,34 +814,87 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
qty: itm1.Qty,
price: itm1.Price,
businessType: itm1.BusinessType,
settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum,
invGroupNum: string.Empty,
invbillnum: string.Empty,
partcode: itm1.PartCode
);
_detailEntity.RealPartCode = itm1.RealPartCode;
details.Add(_detailEntity);
}
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new HBPO_CAN_SA();
bbac_sa1.SetId(Guid.NewGuid());
bbac_sa1.BillNum = billNum1;
bbac_sa1.InvGroupNum = billNum1;
bbac_sa1.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa1.State = SettleBillState.;
bbac_sa1.SettleBillNum = string.Empty;
bbac_sa1.Site = "104T";
bbac_sa1.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa1);
foreach (var detail in details)
{
detail.SetBillNum(billNum1);
detail.SetGroupNum(billNum1);
billDetails.Add(detail);
billDetails.Add(_detailEntity);
}
//var partlist = part_group_small.Select(p => p.LU).ToList();
//var ls = hbpo_can_list.Where(p => partlist.Contains(p.LU)).ToList(); ;
//decimal sum = 0;
//List<HBPO_CAN_SA_DETAIL> details = new List<HBPO_CAN_SA_DETAIL>();
//foreach (var itm1 in ls)
//{
// sum += (itm1.Qty * itm1.Price);
// if (sum > 10000000)
// {
// var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
// var bbac_sa = new HBPO_CAN_SA();
// bbac_sa.SetId(Guid.NewGuid());
// bbac_sa.BillNum = billNum;
// bbac_sa.InvGroupNum = billNum;
// bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
// bbac_sa.State = SettleBillState.未结状态;
// bbac_sa.SettleBillNum = string.Empty;
// bbac_sa.Site = "104T";
// bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
// billList.Add(bbac_sa);
// foreach (var itm2 in details)
// {
// itm2.SetBillNum(billNum);
// itm2.SetGroupNum(billNum);
// billDetails.Add(itm2);
// }
// details = new List<HBPO_CAN_SA_DETAIL>();
// sum = itm1.Qty * itm1.Price;
// }
// var _detailEntity = new HBPO_CAN_SA_DETAIL(
// guid: GuidGenerator.Create(),
// keyCode: itm1.KeyCode,
// version: itm1.Version,
// billNum: string.Empty,
// settleBillNum: itm1.SettleBillNum,
// lU: itm1.LU,
// pN: itm1.PN,
// site: itm1.Site,
// qty: itm1.Qty,
// price: itm1.Price,
// businessType: itm1.BusinessType,
// settleDate: itm1.SettleDate,
// groupNum: itm1.GroupNum,
// invGroupNum: string.Empty,
// invbillnum: string.Empty,
// partcode: itm1.PartCode
// );
// _detailEntity.RealPartCode = itm1.RealPartCode;
// details.Add(_detailEntity);
//}
//var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
//var bbac_sa1 = new HBPO_CAN_SA();
//bbac_sa1.SetId(Guid.NewGuid());
//bbac_sa1.BillNum = billNum1;
//bbac_sa1.InvGroupNum = billNum1;
//bbac_sa1.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
//bbac_sa1.State = SettleBillState.未结状态;
//bbac_sa1.SettleBillNum = string.Empty;
//bbac_sa1.Site = "104T";
//bbac_sa1.BusinessType = EnumBusinessType.JisBBAC;
//billList.Add(bbac_sa1);
//foreach (var detail in details)
//{
// detail.SetBillNum(billNum1);
// detail.SetGroupNum(billNum1);
// billDetails.Add(detail);
//}
}
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs

@ -15,7 +15,7 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
public ExChangeCenterDbContext(DbContextOptions<ExChangeCenterDbContext> options) : base(options)
{
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs

@ -14,7 +14,7 @@ namespace Win.Sfs.SettleAccount
public SettleAccountDbContext(DbContextOptions<SettleAccountDbContext> options)
: base(options)
{
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(120));
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
}
protected override void OnModelCreating(ModelBuilder builder)

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

@ -11,12 +11,13 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
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()
{
}
//public WMSBJBMPTDbContext()
//{
//}
public WMSBJBMPTDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options)
{
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

Loading…
Cancel
Save