优化同步

This commit is contained in:
tongfei
2023-12-26 10:39:29 +08:00
parent bcfcd9b5d3
commit 44971d1507
6 changed files with 99 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
@@ -12,12 +13,12 @@ namespace WMS.Web.Domain.Entitys
/// </summary>
[Serializable]
[Table("t_wms_instock")]
public class InStock
public class InStock : EntityBase
{
/// <summary>
/// ID
/// </summary>
public int Id { get; set; }
public override int Id { get; set; }
/// <summary>
/// 单据编号
@@ -95,10 +96,8 @@ namespace WMS.Web.Domain.Entitys
this.CreateTime = DateTime.Now;
if (this.Type == InstockType.Purchase)
{
//只有采购订单入库才需要同步金蝶:单据头为同步中默认
this.SuccessSync = SyncStatus.SyncIng;
//erp明细为失败默认在处理同步时能找到该明细
this.ErpDetails.ForEach(f => f.SuccessSync = SyncStatus.Fail);
this.ErpDetails.ForEach(f => f.SuccessSync = SyncStatus.SyncIng);
}
else//非采购订单这里就没有记录erpdetails的数据了
this.SuccessSync = SyncStatus.Success;
@@ -180,5 +179,23 @@ namespace WMS.Web.Domain.Entitys
this.OperateId = operateId;
this.SyncTime = DateTime.Now;
}
/// <summary>
/// 重传
/// </summary>
public void RepeatSync()
{
//只有完全失败的情况下才能重传
if (this.SuccessSync != SyncStatus.Fail) return;
this.SuccessSync = SyncStatus.SyncIng;
var erpDetails = this.ErpDetails
.Where(w => w.SuccessSync == SyncStatus.Fail)
.ToList();
foreach (var e in erpDetails)
{
e.SuccessSync = SyncStatus.SyncIng;
}
this.Remark = "";
}
}
}