修复bug
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Inventory;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.OutStock;
|
||||
@@ -235,11 +236,11 @@ namespace WMS.Web.Domain.Services
|
||||
DetailsId = string.Join(",", erp_details)
|
||||
};
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto);
|
||||
if (res.IsSuccess)
|
||||
entity.SyncSuccess(s, loginInfo?.UserInfo?.StaffId ?? 0);
|
||||
var res = await this.Push(erpDto, entity);
|
||||
if (res.result.IsSuccess)
|
||||
entity.SyncSuccess(s, loginInfo?.UserInfo?.StaffId ?? 0,res.erpId);
|
||||
else
|
||||
entity.SyncFail(res.Message, loginInfo?.UserInfo?.StaffId ?? 0, SyncStatus.Fail);
|
||||
entity.SyncFail(res.result.Message, loginInfo?.UserInfo?.StaffId ?? 0, res.syncStatus);
|
||||
}
|
||||
//entity.SuccessSync = entity.SuccessSyncFail.Count() > 0 ? false : true;
|
||||
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
|
||||
@@ -253,12 +254,47 @@ namespace WMS.Web.Domain.Services
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> Push(ErpPushDto dto)
|
||||
private async Task<(Result result, SyncStatus syncStatus, string erpId)> Push(ErpPushDto dto, OutStock entity)
|
||||
{
|
||||
var res = await _erpService.Push(dto);
|
||||
var id = res.Data;
|
||||
if (!res.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"出库单->下推失败 单号:{entity.BillNo} 错误:{res.Message}");
|
||||
return (Result.ReFailure(res.Message, res.Status), SyncStatus.Fail, "");
|
||||
}
|
||||
string id = res.Data;
|
||||
var resSalOutStock= await _erpService.BillQueryForSalOutStock(id);
|
||||
var salOutStock = resSalOutStock.Data;
|
||||
salOutStock.Details[0].Qty = entity.Details[0].Qty;
|
||||
//{"Id":12709885,"Number":"XSCKD10629570","DIndex":0}
|
||||
return Result.ReSuccess();
|
||||
|
||||
string formId = dto.TargetFormId.ToString();
|
||||
_logger.LogInformation($"出库单->开始同步金蝶 单号:{entity.BillNo} 数据: {JsonConvert.SerializeObject(dto)}");
|
||||
var res_s = await _erpService.Save<ErpSalOutStockSaveDto>(salOutStock, formId);
|
||||
if (!res_s.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"出库单->修改数量失败 单号:{entity.BillNo} 错误:{res_s.Message}");
|
||||
return (Result.ReFailure(res_s.Message, res_s.Status), SyncStatus.SubmitFail, id);
|
||||
}
|
||||
//提交
|
||||
_logger.LogInformation($"出库单->保存成功 开始提交 单号:{entity.BillNo}");
|
||||
ErpOperateDto o_dto = new ErpOperateDto(formId, res_s.Data);//res_s.Data
|
||||
var resSubmit = await _erpService.Submit(o_dto, formId);
|
||||
if (!resSubmit.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"出库单->提交失败 单号:{entity.BillNo} 错误:{resSubmit.Message}");
|
||||
return (resSubmit, SyncStatus.SubmitFail, o_dto.Ids);
|
||||
}
|
||||
//审核
|
||||
_logger.LogInformation($"出库单->提交成功 开始审核 单号:{entity.BillNo}");
|
||||
resSubmit = await _erpService.Audit(o_dto, formId);
|
||||
if (!resSubmit.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"出库单->审核失败 单号:{entity.BillNo} 错误:{resSubmit.Message}");
|
||||
return (resSubmit, SyncStatus.CheckFail, o_dto.Ids);
|
||||
}
|
||||
_logger.LogInformation($"同步金蝶成功");
|
||||
return (Result.ReSuccess(), SyncStatus.Success, o_dto.Ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user