优化
This commit is contained in:
@@ -718,30 +718,39 @@ namespace WMS.Web.Domain.Services
|
||||
erpDetails.Add(item);
|
||||
}
|
||||
|
||||
|
||||
foreach (var s in erpDetails)
|
||||
try
|
||||
{
|
||||
var erp_details = entity.ErpDetails
|
||||
.Where(w => w.SourceBillNo.Equals(s)).Select(s => s.ErpDetailId).ToList();
|
||||
var erpDto = new ErpPushDto()
|
||||
foreach (var s in erpDetails)
|
||||
{
|
||||
RuleId = "PUR_PurchaseOrder-STK_InStock",//转换规则内码 采购订单下推采购入库单
|
||||
FormId = FormIdParam.PUR_PurchaseOrder.ToString(),
|
||||
TargetFormId = FormIdParam.STK_InStock.ToString(),
|
||||
DetailsId = s.ErpDetailId.ToString(),
|
||||
IsDraftWhenSaveFail=true
|
||||
};
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto, s, entity.BillNo, sc_erpService);
|
||||
if (res.result.IsSuccess)
|
||||
entity.SyncSuccess(s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
||||
else
|
||||
entity.SyncFail(res.result.Message, s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
|
||||
var erp_details = entity.ErpDetails
|
||||
.Where(w => w.SourceBillNo.Equals(s)).Select(s => s.ErpDetailId).ToList();
|
||||
var erpDto = new ErpPushDto()
|
||||
{
|
||||
RuleId = "PUR_PurchaseOrder-STK_InStock",//转换规则内码 采购订单下推采购入库单
|
||||
FormId = FormIdParam.PUR_PurchaseOrder.ToString(),
|
||||
TargetFormId = FormIdParam.STK_InStock.ToString(),
|
||||
DetailsId = s.ErpDetailId.ToString(),
|
||||
IsDraftWhenSaveFail = true
|
||||
};
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto, s, entity.BillNo, sc_erpService);
|
||||
if (res.result.IsSuccess)
|
||||
entity.SyncSuccess(s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.erpBillNo);
|
||||
else
|
||||
entity.SyncFail(res.result.Message, s.ErpDetailId, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
|
||||
}
|
||||
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
|
||||
var isSuccess = await sc_InStockRepositories.Update(entity, true);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
|
||||
var isSuccess = await sc_InStockRepositories.Update(entity, true);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReSuccess();
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogInformation($"采购下推-同步:错误:{JsonConvert.SerializeObject(entity)} 操作人:{loginInfo.UserInfo.StaffId}");
|
||||
return Result.ReFailure(ResultCodes.ErpSynsError);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user