采购入库同步金蝶-一直同步中的问题解决

This commit is contained in:
tongfei
2024-04-10 14:28:12 +08:00
parent a03fff91a9
commit e24ce0a3ef
3 changed files with 53 additions and 25 deletions

View File

@@ -788,6 +788,13 @@
<param name="operateId"></param>
<param name="syncStatus"></param>
</member>
<member name="M:WMS.Web.Domain.Entitys.InStock.SyncFailAll(System.String,System.Int32)">
<summary>
全部失败
</summary>
<param name="remark"></param>
<param name="operateId"></param>
</member>
<member name="M:WMS.Web.Domain.Entitys.InStock.RepeatSync">
<summary>
重传

View File

@@ -190,6 +190,19 @@ namespace WMS.Web.Domain.Entitys
this.SyncTime = DateTime.Now;
}
/// <summary>
/// 全部失败
/// </summary>
/// <param name="remark"></param>
/// <param name="operateId"></param>
public void SyncFailAll(string remark, int operateId)
{
this.SuccessSync = SyncStatus.Fail;
this.Remark = remark;
this.OperateId = operateId;
this.SyncTime = DateTime.Now;
}
/// <summary>
/// 重传
/// </summary>

View File

@@ -200,7 +200,7 @@ namespace WMS.Web.Domain.Services
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.Box_No_Task_Data);
//1.先判断:箱号已经绑定了入库任务单中;备注:其它单据收的提示
var tast_box = await _inStockTaskBoxRepositories.GetBy(dto.BoxBillNo,dto.TaskId);
var tast_box = await _inStockTaskBoxRepositories.GetBy(dto.BoxBillNo, dto.TaskId);
if (tast_box == null)
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
@@ -316,17 +316,17 @@ namespace WMS.Web.Domain.Services
//1.获取最新的erp明细信息
var billNo_new = await _inStockRepositories.GetLastBillNo();
//erp明细生成批号
int new_firstBillNo = billNo_new == null ? 0 : (billNo_new.FirstBillNo.HasValue? billNo_new.FirstBillNo.Value:0);
int new_lastBillNo = billNo_new == null ? 0 : (billNo_new.LastBillNo.HasValue? billNo_new.LastBillNo.Value:0);
int new_firstBillNo = billNo_new == null ? 0 : (billNo_new.FirstBillNo.HasValue ? billNo_new.FirstBillNo.Value : 0);
int new_lastBillNo = billNo_new == null ? 0 : (billNo_new.LastBillNo.HasValue ? billNo_new.LastBillNo.Value : 0);
entity.ErpDetails.ForEach(x =>
{
//物料必须是启动了批号管理才生成批号
var mat= materials.Where(m => m.MaterialNumber == x.MaterialNumber && m.OrgCode == entity.OrgCode && m.IsBatchManage==true).FirstOrDefault();
var mat = materials.Where(m => m.MaterialNumber == x.MaterialNumber && m.OrgCode == entity.OrgCode && m.IsBatchManage == true).FirstOrDefault();
if (mat != null)
{
x.GenerateBatchBillNo(new_firstBillNo, new_lastBillNo, mat.IsBatchManage);
new_firstBillNo = x.FirstBillNo??0;
new_lastBillNo = x.LastBillNo??0;
new_firstBillNo = x.FirstBillNo ?? 0;
new_lastBillNo = x.LastBillNo ?? 0;
}
});
@@ -748,6 +748,8 @@ namespace WMS.Web.Domain.Services
erpDetails.Add(item);
}
if (erpDetails.Count != 0)
{
foreach (var s in erpDetails)
{
var erp_details = entity.ErpDetails
@@ -767,6 +769,12 @@ namespace WMS.Web.Domain.Services
else
entity.SyncFail(res.result.Message, s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
}
}
else
{
erpDetails_tags.ForEach(x => { x.SuccessSync = SyncStatus.Fail; });
entity.SyncFailAll("同步金蝶失败,金蝶存在已审核的采购入库单", loginInfo?.UserInfo?.StaffId ?? 0);
}
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
var isSuccess = await sc_InStockRepositories.Update(entity, true);
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);