优化同步金蝶

This commit is contained in:
tongfei
2024-04-24 14:06:14 +08:00
parent 4a33a37bc4
commit 6ce2e55507
2 changed files with 22 additions and 8 deletions

View File

@@ -877,7 +877,7 @@ namespace WMS.Web.Domain.Services
var currentDet = details.Where(x => x.Qty == det.Qty).FirstOrDefault();
if (currentDet != null)
{
var res = await this.QueryFirst(currentDet, erpDto.FormId, entity.BillNo, det, sc_erpService);
var res = await this.QueryFirst(currentDet, erpDto.TargetFormId, entity.BillNo, det, sc_erpService);
if (res.result.IsSuccess)
entity.SyncSuccess(det.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
else
@@ -894,12 +894,6 @@ namespace WMS.Web.Domain.Services
}
}
//else
//{
// erpDetails_tags.ForEach(x => { x.SuccessSync = SyncStatus.Fail; });
// entity.SyncFailAll("同步金蝶失败,该采购单已存在采购入库单", loginInfo?.UserInfo?.StaffId ?? 0);
//}
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
var isSuccess = await sc_InStockRepositories.Update(entity, true);
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
@@ -1072,6 +1066,26 @@ namespace WMS.Web.Domain.Services
_logger.LogInformation($"入库单->审核失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
return (resSubmit, SyncStatus.CheckFail, o_dto.Numbers.First());
}
}
else if (currentDet.DocumentStatus == ErpOrderStatus.D.ToString())
{
//提交
_logger.LogInformation($"入库单->查询到已有重新审核的入库单 开始提交 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
var resSubmit = await sc_erpService.Submit(o_dto, formId);
if (!resSubmit.IsSuccess)
{
_logger.LogInformation($"入库单->提交失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
return (resSubmit, SyncStatus.SubmitFail, o_dto.Numbers.First());
}
//审核
_logger.LogInformation($"入库单->提交成功 开始审核 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId}");
resSubmit = await sc_erpService.Audit(o_dto, formId);
if (!resSubmit.IsSuccess)
{
_logger.LogInformation($"入库单->审核失败 单号:{billNo} erp明细Id:{erpDetail.ErpDetailId} 错误:{resSubmit.Message}");
return (resSubmit, SyncStatus.CheckFail, o_dto.Numbers.First());
}
}
else if (currentDet.DocumentStatus == ErpOrderStatus.C.ToString())
{