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