金蝶同步 发货通知单变更为销售出库

This commit is contained in:
18942506660
2024-03-05 14:01:51 +08:00
parent 9a19089a9c
commit c46a0f2635
7 changed files with 157 additions and 30 deletions

View File

@@ -266,6 +266,21 @@ namespace WMS.Web.Domain.Services
return await this.SsynDate(erp_result.Data.ToList(), isTransaction);
}
/// <summary>
/// 销售出库单
/// </summary>
/// <param name="isTransaction"></param>
/// <param name="sourceBillNos"></param>
/// <param name="beginTime"></param>
/// <returns></returns>
public async Task<Result> BillQueryForSalOutStock(bool isTransaction, List<string> sourceBillNos = null, DateTime? beginTime = null)
{
var erp_result = await _erpService.BillQueryForSalOutStock(sourceBillNos, beginTime);
if (!erp_result.IsSuccess)
return Result.ReFailure(erp_result.Message, erp_result.Status);
return await this.SsynDate(erp_result.Data.ToList(), isTransaction);
}
/// <summary>
/// 同步金蝶数据 不传源订单号则更新所有
/// </summary>
/// <param name="sourceBillNos"></param>
@@ -285,7 +300,7 @@ namespace WMS.Web.Domain.Services
if (DateTime.Now > Convert.ToDateTime("2024-03-04 00:00:00"))
begin = DateTime.Now.AddDays(-3);//默认拉去三天以内的数据
//更新时间范围内所有
result = await BillQueryForDeliveryNoticeOutStock(false, null, begin);
result = await BillQueryForSalOutStock(false, null, begin);
if (!result.IsSuccess) isRollback = true;
result = await BillQueryForTransferDirectOutStock(false, null, begin);
if (!result.IsSuccess) isRollback = true;
@@ -309,7 +324,7 @@ namespace WMS.Web.Domain.Services
}
//根据指定单号更新
List<string> DeliveryNotice_Nos = new List<string>();
List<string> SalOutStock_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>();
@@ -318,7 +333,7 @@ namespace WMS.Web.Domain.Services
foreach (var entity in taskList)
{
if (entity.Type == OutStockType.Sal)
DeliveryNotice_Nos.AddRange(entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo));
SalOutStock_Nos.AddRange(entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo));
else if (entity.Type == OutStockType.Stkdirecttransfers)
TransferDirect_Nos.AddRange(entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo));
else if (entity.Type == OutStockType.StktransferInst)
@@ -329,9 +344,9 @@ namespace WMS.Web.Domain.Services
MisDeliveryOut_Nos.AddRange(entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo));
}
if (DeliveryNotice_Nos.Count() > 0)
if (SalOutStock_Nos.Count() > 0)
{
result = await BillQueryForDeliveryNoticeOutStock(false, DeliveryNotice_Nos);
result = await BillQueryForSalOutStock(false, SalOutStock_Nos);
if (!result.IsSuccess) isRollback = true;
}
if (TransferDirect_Nos.Count() > 0)
@@ -361,5 +376,6 @@ namespace WMS.Web.Domain.Services
return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
}
}