diff --git a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 index 9604cf19..e1f4a529 100644 Binary files a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 and b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 differ diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index b149caa5..ef9135d6 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -1064,11 +1064,6 @@ 同步成功或者失败 默认是失败状态 - - - 同步失败的源订单号(默认就包含所有来源单号) - - 同步时间 @@ -1090,7 +1085,7 @@ - + 同步金蝶(成功) @@ -1217,6 +1212,11 @@ 出库数量 + + + 同步成功或者失败 默认是失败状态 + + erp出库任务单 diff --git a/src/WMS.Web.Domain/Entitys/OutStock.cs b/src/WMS.Web.Domain/Entitys/OutStock.cs index 0e0c7c18..c2d2d348 100644 --- a/src/WMS.Web.Domain/Entitys/OutStock.cs +++ b/src/WMS.Web.Domain/Entitys/OutStock.cs @@ -81,11 +81,11 @@ namespace WMS.Web.Domain.Entitys /// [Column("SuccessSync")] public bool SuccessSync { get; set; } = false; - /// - /// 同步失败的源订单号(默认就包含所有来源单号) - /// - [Column("SuccessSyncFail")] - public List SuccessSyncFail { get; set; } = new List(); + ///// + ///// 同步失败的源订单号(默认就包含所有来源单号) + ///// + //[Column("SuccessSyncFail")] + //public List SuccessSyncFail { get; set; } = new List(); /// /// 同步时间 /// @@ -119,24 +119,32 @@ namespace WMS.Web.Domain.Entitys { //只有销售出库才需要同步金蝶 this.SuccessSync = false; - this.SuccessSyncFail = this.Details.SelectMany(s => s.ErpDetails).GroupBy(g => g.Erp_DetailId).Select(s => s.Key).ToList(); + var erpd = this.Details.SelectMany(s => s.ErpDetails).ToList(); + erpd.ForEach(f => f.SuccessSync = false); } else { this.SuccessSync = true; - this.SuccessSyncFail = new List(); + var erpd = this.Details.SelectMany(s => s.ErpDetails).ToList(); + erpd.ForEach(f => f.SuccessSync = true); } } /// /// 同步金蝶(成功) /// /// - public void SyncSuccess(List erpDetailIds, int operateId) + public void SyncSuccess(string sourcBillNo, int operateId) { - foreach (var e in erpDetailIds) - this.SuccessSyncFail.Remove(e); - this.SuccessSync = true; - this.Remark = ""; + //foreach (var e in erpDetailIds) + // this.SuccessSyncFail.Remove(e); + var erpd = this.Details.SelectMany(s => s.ErpDetails).Where(w => w.SourceBillNo.Equals(sourcBillNo)).ToList(); + erpd.ForEach(f => f.SuccessSync = true); + //所有erp明细同步成功才是整个单据成功 + if (this.Details.SelectMany(s => s.ErpDetails).Where(w => w.SuccessSync != false).Any()) + { + this.SuccessSync = true; + this.Remark = ""; + } this.OperateId = operateId; this.SyncTime = DateTime.Now; } diff --git a/src/WMS.Web.Domain/Entitys/OutStockErpDetails.cs b/src/WMS.Web.Domain/Entitys/OutStockErpDetails.cs index 7f393e94..ead3bbb2 100644 --- a/src/WMS.Web.Domain/Entitys/OutStockErpDetails.cs +++ b/src/WMS.Web.Domain/Entitys/OutStockErpDetails.cs @@ -44,5 +44,10 @@ namespace WMS.Web.Domain.Entitys /// [Column("Qty")] public decimal Qty { get; set; } + /// + /// 同步成功或者失败 默认是失败状态 + /// + [Column("SuccessSync")] + public bool SuccessSync { get; set; } = false; } } diff --git a/src/WMS.Web.Domain/Services/OutStockService.cs b/src/WMS.Web.Domain/Services/OutStockService.cs index 66d926ef..55fd3b6f 100644 --- a/src/WMS.Web.Domain/Services/OutStockService.cs +++ b/src/WMS.Web.Domain/Services/OutStockService.cs @@ -180,8 +180,8 @@ namespace WMS.Web.Domain.Services { if (entity.SuccessSync) continue; List failList =entity.Details.SelectMany(s=>s.ErpDetails) - .Where(w=> entity.SuccessSyncFail.Contains(w.Erp_DetailId)) - .Select(s=>s.SourceBillNo).ToList();//同步失败的来源单号 + .Where(w=> w.SuccessSync==false).GroupBy(g=>g.SourceBillNo) + .Select(s=>s.Key).ToList();//同步失败的来源单号 //找到单据里需要同步的单据 var sourcNos = entity.Details.SelectMany(s => s.ErpDetails).GroupBy(s => s.SourceBillNo).Select(s => s.Key); foreach (var s in failList) @@ -197,11 +197,11 @@ namespace WMS.Web.Domain.Services //下推金蝶 var res = await this.Push(erpDto); if (res.IsSuccess) - entity.SyncSuccess(erp_details, loginInfo.UserInfo.StaffId); + entity.SyncSuccess(s, loginInfo.UserInfo.StaffId); else entity.SyncFail(res.Message, loginInfo.UserInfo.StaffId); } - entity.SuccessSync = entity.SuccessSyncFail.Count() > 0 ? false : true; + //entity.SuccessSync = entity.SuccessSyncFail.Count() > 0 ? false : true; //最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱 var isSuccess = await _outStockRepositories.Edit(entity, true); if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError); diff --git a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs index 998c9ef7..50221302 100644 --- a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs +++ b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs @@ -83,10 +83,6 @@ namespace WMS.Web.Repositories.Configuration ent.ToTable("t_wms_outstock"); ent.HasKey(x => x.Id); - ent.Property(f => f.SuccessSyncFail).HasConversion( - v => JsonConvert.SerializeObject(v), - v => JsonConvert.DeserializeObject>(v)); - ent.HasMany(p => p.Details) .WithOne() .HasForeignKey(p => p.Fid)