修复bug
This commit is contained in:
@@ -85,7 +85,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 同步失败的源订单号(默认就包含所有来源单号)
|
||||
/// </summary>
|
||||
[Column("SuccessSyncFail")]
|
||||
public List<string> SuccessSyncFail { get; set; }=new List<string>();
|
||||
public List<int> SuccessSyncFail { get; set; } = new List<int>();
|
||||
/// <summary>
|
||||
/// 同步时间
|
||||
/// </summary>
|
||||
@@ -104,7 +104,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 创建(需要在明细都生成后最后调用)
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId, OutStockTask task,int method)
|
||||
public void Create(int creatorId, OutStockTask task, int method)
|
||||
{
|
||||
this.TaskId = task.Id;
|
||||
this.Type = task.Type;
|
||||
@@ -119,20 +119,22 @@ namespace WMS.Web.Domain.Entitys
|
||||
{
|
||||
//只有销售出库才需要同步金蝶
|
||||
this.SuccessSync = false;
|
||||
this.SuccessSyncFail = this.Details.SelectMany(s => s.ErpDetails).GroupBy(g => g.SourceBillNo).Select(s => s.Key).ToList();
|
||||
}else
|
||||
this.SuccessSyncFail = this.Details.SelectMany(s => s.ErpDetails).GroupBy(g => g.Erp_DetailId).Select(s => s.Key).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SuccessSync = true;
|
||||
this.SuccessSyncFail = new List<string>();
|
||||
this.SuccessSyncFail = new List<int>();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步金蝶(成功)
|
||||
/// </summary>
|
||||
/// <param name="operateId"></param>
|
||||
public void SyncSuccess(string sourcNos, int operateId)
|
||||
public void SyncSuccess(List<int> erpDetailIds, int operateId)
|
||||
{
|
||||
this.SuccessSyncFail.Remove(sourcNos);
|
||||
foreach (var e in erpDetailIds)
|
||||
this.SuccessSyncFail.Remove(e);
|
||||
this.SuccessSync = true;
|
||||
this.Remark = "";
|
||||
this.OperateId = operateId;
|
||||
@@ -142,7 +144,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 同步金蝶(失败)
|
||||
/// </summary>
|
||||
/// <param name="operateId"></param>
|
||||
public void SyncFail(string remark,int operateId)
|
||||
public void SyncFail(string remark, int operateId)
|
||||
{
|
||||
this.SuccessSync = false;
|
||||
this.Remark = remark;
|
||||
|
||||
@@ -179,7 +179,9 @@ namespace WMS.Web.Domain.Services
|
||||
foreach (var entity in list)
|
||||
{
|
||||
if (entity.SuccessSync) continue;
|
||||
List<string> failList = entity.SuccessSyncFail.Clone();//同步失败的来源单号
|
||||
List<string> failList =entity.Details.SelectMany(s=>s.ErpDetails)
|
||||
.Where(w=> entity.SuccessSyncFail.Contains(w.Erp_DetailId))
|
||||
.Select(s=>s.SourceBillNo).ToList();//同步失败的来源单号
|
||||
//找到单据里需要同步的单据
|
||||
var sourcNos = entity.Details.SelectMany(s => s.ErpDetails).GroupBy(s => s.SourceBillNo).Select(s => s.Key);
|
||||
foreach (var s in failList)
|
||||
@@ -195,7 +197,7 @@ namespace WMS.Web.Domain.Services
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto);
|
||||
if (res.IsSuccess)
|
||||
entity.SyncSuccess(s, loginInfo.UserInfo.StaffId);
|
||||
entity.SyncSuccess(erp_details, loginInfo.UserInfo.StaffId);
|
||||
else
|
||||
entity.SyncFail(res.Message, loginInfo.UserInfo.StaffId);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
|
||||
ent.Property(f => f.SuccessSyncFail).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
v => JsonConvert.DeserializeObject<List<int>>(v));
|
||||
|
||||
ent.HasMany(p => p.Details)
|
||||
.WithOne()
|
||||
|
||||
Reference in New Issue
Block a user