调整同步接口

This commit is contained in:
18942506660
2023-11-09 11:14:40 +08:00
parent 3687bbb7d1
commit bb77363dad
5 changed files with 130 additions and 26 deletions

View File

@@ -158,7 +158,7 @@ namespace WMS.Web.Domain.Services
/// </summary>
/// <param name="isTransaction"></param>
/// <returns></returns>
public async Task<Result> SsynDeliveryNoticeOutStock(bool isTransaction, List<string> sourceBillNos = null)
public async Task<Result> BillQueryForDeliveryNoticeOutStock(bool isTransaction, List<string> sourceBillNos = null)
{
//1.获取金蝶数据:采购订单数据
var erp_result = await _erpService.BillQueryForDeliveryNoticeOutStock(sourceBillNos);
@@ -204,7 +204,7 @@ namespace WMS.Web.Domain.Services
public async Task<Result> BillQueryForAssembledAppOutStock(bool isTransaction, List<string> sourceBillNos = null)
{
List<ErpDeliveryNoticeOutStockResultDto> list = new List<ErpDeliveryNoticeOutStockResultDto>();
var erp_result = await _erpService.BillQueryForAssembledAppOutStock_Dassembly(sourceBillNos);
if (!erp_result.IsSuccess)
return Result.ReFailure(erp_result.Message, erp_result.Status);
@@ -231,5 +231,99 @@ namespace WMS.Web.Domain.Services
return await this.SsynDate(erp_result.Data.ToList(), isTransaction);
}
/// <summary>
/// 同步金蝶数据 不传源订单号则更新所有
/// </summary>
/// <param name="sourceBillNos"></param>
/// <returns></returns>
public async Task<Result> Ssyn(List<string> sourceBillNos = null)
{
//1.事务
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
bool isRollback = false;
bool isSuccess = true;
Result result;
//定时任务更新
if (sourceBillNos == null)
{
//更新时间范围内所有
result= await BillQueryForDeliveryNoticeOutStock(false, null);
if (!result.IsSuccess) isRollback = true;
result = await BillQueryForTransferDirectOutStock(false, null);
if (!result.IsSuccess) isRollback = true;
result = await BillQueryForTransferOutOutStock(false, null);
if (!result.IsSuccess) isRollback = true;
result = await BillQueryForAssembledAppOutStock(false, null);
if (!result.IsSuccess) isRollback = true;
result = await BillQueryForMisDeliveryOutStock(false, null);
if (!result.IsSuccess) isRollback = true;
//同步成功后 更新定时开始时间
if (!isRollback)
{
}
//4.提交事务
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
//根据指定单号更新
List<string> DeliveryNotice_Nos = new List<string>();
List<string> TransferDirect_Nos = new List<string>();
List<string> TransferOut_Nos = new List<string>();
List<string> AssembledApp_Nos = new List<string>();
List<string> MisDeliveryOut_Nos = new List<string>();
var taskList = await _outStockTaskRepositories.GetListBySourceBillNo(sourceBillNos);
foreach (var entity in taskList)
{
if (entity.Type == OutStockType.Sal)
DeliveryNotice_Nos.Add(entity.SourceBillNo);
else if (entity.Type == OutStockType.Stkdirecttransfers)
TransferDirect_Nos.Add(entity.SourceBillNo);
else if (entity.Type == OutStockType.StktransferInst)
TransferOut_Nos.Add(entity.SourceBillNo);
else if (entity.Type == OutStockType.Assembled)
AssembledApp_Nos.Add(entity.SourceBillNo);
else if (entity.Type == OutStockType.Miscellaneous)
MisDeliveryOut_Nos.Add(entity.SourceBillNo);
}
if (DeliveryNotice_Nos.Count() > 0)
{
result= await BillQueryForDeliveryNoticeOutStock(false, DeliveryNotice_Nos);
if (!result.IsSuccess) isRollback = true;
}
if (TransferDirect_Nos.Count() > 0)
{
result = await BillQueryForDeliveryNoticeOutStock(false, TransferDirect_Nos);
if (!result.IsSuccess) isRollback = true;
}
if (TransferOut_Nos.Count() > 0)
{
result = await BillQueryForDeliveryNoticeOutStock(false, TransferOut_Nos);
if (!result.IsSuccess) isRollback = true;
}
if (AssembledApp_Nos.Count() > 0)
{
result = await BillQueryForDeliveryNoticeOutStock(false, AssembledApp_Nos);
if (!result.IsSuccess) isRollback = true;
}
if (MisDeliveryOut_Nos.Count() > 0)
{
result = await BillQueryForDeliveryNoticeOutStock(false, MisDeliveryOut_Nos);
if (!result.IsSuccess) isRollback = true;
}
//4.提交事务
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
}
}