调整结构
This commit is contained in:
@@ -1064,11 +1064,6 @@
|
||||
同步成功或者失败 默认是失败状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SuccessSyncFail">
|
||||
<summary>
|
||||
同步失败的源订单号(默认就包含所有来源单号)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SyncTime">
|
||||
<summary>
|
||||
同步时间
|
||||
@@ -1090,7 +1085,7 @@
|
||||
</summary>
|
||||
<param name="creatorId"></param>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.SyncSuccess(System.Collections.Generic.List{System.Int32},System.Int32)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.SyncSuccess(System.String,System.Int32)">
|
||||
<summary>
|
||||
同步金蝶(成功)
|
||||
</summary>
|
||||
@@ -1217,6 +1212,11 @@
|
||||
出库数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockErpDetails.SuccessSync">
|
||||
<summary>
|
||||
同步成功或者失败 默认是失败状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.OutStockTask">
|
||||
<summary>
|
||||
erp出库任务单
|
||||
|
||||
@@ -81,11 +81,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Column("SuccessSync")]
|
||||
public bool SuccessSync { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 同步失败的源订单号(默认就包含所有来源单号)
|
||||
/// </summary>
|
||||
[Column("SuccessSyncFail")]
|
||||
public List<int> SuccessSyncFail { get; set; } = new List<int>();
|
||||
///// <summary>
|
||||
///// 同步失败的源订单号(默认就包含所有来源单号)
|
||||
///// </summary>
|
||||
//[Column("SuccessSyncFail")]
|
||||
//public List<int> SuccessSyncFail { get; set; } = new List<int>();
|
||||
/// <summary>
|
||||
/// 同步时间
|
||||
/// </summary>
|
||||
@@ -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<int>();
|
||||
var erpd = this.Details.SelectMany(s => s.ErpDetails).ToList();
|
||||
erpd.ForEach(f => f.SuccessSync = true);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步金蝶(成功)
|
||||
/// </summary>
|
||||
/// <param name="operateId"></param>
|
||||
public void SyncSuccess(List<int> 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;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,10 @@ namespace WMS.Web.Domain.Entitys
|
||||
///</summary>
|
||||
[Column("Qty")]
|
||||
public decimal Qty { get; set; }
|
||||
/// <summary>
|
||||
/// 同步成功或者失败 默认是失败状态
|
||||
/// </summary>
|
||||
[Column("SuccessSync")]
|
||||
public bool SuccessSync { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
if (entity.SuccessSync) continue;
|
||||
List<string> 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);
|
||||
|
||||
@@ -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<List<int>>(v));
|
||||
|
||||
ent.HasMany(p => p.Details)
|
||||
.WithOne()
|
||||
.HasForeignKey(p => p.Fid)
|
||||
|
||||
Reference in New Issue
Block a user