调整结构
This commit is contained in:
@@ -1064,11 +1064,6 @@
|
|||||||
同步成功或者失败 默认是失败状态
|
同步成功或者失败 默认是失败状态
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SuccessSyncFail">
|
|
||||||
<summary>
|
|
||||||
同步失败的源订单号(默认就包含所有来源单号)
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SyncTime">
|
<member name="P:WMS.Web.Domain.Entitys.OutStock.SyncTime">
|
||||||
<summary>
|
<summary>
|
||||||
同步时间
|
同步时间
|
||||||
@@ -1090,7 +1085,7 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<param name="creatorId"></param>
|
<param name="creatorId"></param>
|
||||||
</member>
|
</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>
|
||||||
同步金蝶(成功)
|
同步金蝶(成功)
|
||||||
</summary>
|
</summary>
|
||||||
@@ -1217,6 +1212,11 @@
|
|||||||
出库数量
|
出库数量
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.OutStockErpDetails.SuccessSync">
|
||||||
|
<summary>
|
||||||
|
同步成功或者失败 默认是失败状态
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Entitys.OutStockTask">
|
<member name="T:WMS.Web.Domain.Entitys.OutStockTask">
|
||||||
<summary>
|
<summary>
|
||||||
erp出库任务单
|
erp出库任务单
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("SuccessSync")]
|
[Column("SuccessSync")]
|
||||||
public bool SuccessSync { get; set; } = false;
|
public bool SuccessSync { get; set; } = false;
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 同步失败的源订单号(默认就包含所有来源单号)
|
///// 同步失败的源订单号(默认就包含所有来源单号)
|
||||||
/// </summary>
|
///// </summary>
|
||||||
[Column("SuccessSyncFail")]
|
//[Column("SuccessSyncFail")]
|
||||||
public List<int> SuccessSyncFail { get; set; } = new List<int>();
|
//public List<int> SuccessSyncFail { get; set; } = new List<int>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步时间
|
/// 同步时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -119,24 +119,32 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
{
|
{
|
||||||
//只有销售出库才需要同步金蝶
|
//只有销售出库才需要同步金蝶
|
||||||
this.SuccessSync = false;
|
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
|
else
|
||||||
{
|
{
|
||||||
this.SuccessSync = true;
|
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>
|
||||||
/// 同步金蝶(成功)
|
/// 同步金蝶(成功)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="operateId"></param>
|
/// <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);
|
||||||
|
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())
|
||||||
{
|
{
|
||||||
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;
|
||||||
this.SyncTime = DateTime.Now;
|
this.SyncTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,5 +44,10 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
///</summary>
|
///</summary>
|
||||||
[Column("Qty")]
|
[Column("Qty")]
|
||||||
public decimal Qty { get; set; }
|
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;
|
if (entity.SuccessSync) continue;
|
||||||
List<string> failList =entity.Details.SelectMany(s=>s.ErpDetails)
|
List<string> failList =entity.Details.SelectMany(s=>s.ErpDetails)
|
||||||
.Where(w=> entity.SuccessSyncFail.Contains(w.Erp_DetailId))
|
.Where(w=> w.SuccessSync==false).GroupBy(g=>g.SourceBillNo)
|
||||||
.Select(s=>s.SourceBillNo).ToList();//同步失败的来源单号
|
.Select(s=>s.Key).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)
|
||||||
@@ -197,11 +197,11 @@ 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(erp_details, loginInfo.UserInfo.StaffId);
|
entity.SyncSuccess(s, loginInfo.UserInfo.StaffId);
|
||||||
else
|
else
|
||||||
entity.SyncFail(res.Message, loginInfo.UserInfo.StaffId);
|
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);
|
var isSuccess = await _outStockRepositories.Edit(entity, true);
|
||||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|||||||
@@ -83,10 +83,6 @@ namespace WMS.Web.Repositories.Configuration
|
|||||||
ent.ToTable("t_wms_outstock");
|
ent.ToTable("t_wms_outstock");
|
||||||
ent.HasKey(x => x.Id);
|
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)
|
ent.HasMany(p => p.Details)
|
||||||
.WithOne()
|
.WithOne()
|
||||||
.HasForeignKey(p => p.Fid)
|
.HasForeignKey(p => p.Fid)
|
||||||
|
|||||||
Reference in New Issue
Block a user