修复bug

This commit is contained in:
18942506660
2023-11-15 14:46:36 +08:00
parent 79f57894fa
commit bff2ce4b3e
4 changed files with 35 additions and 7 deletions

View File

@@ -47,8 +47,8 @@ namespace WMS.Web.Domain.IService.Public
/// <summary> /// <summary>
/// 同步金蝶数据 不传源订单号则更新所有 /// 同步金蝶数据 不传源订单号则更新所有
/// </summary> /// </summary>
/// <param name="sourceBillNos"></param> /// <param name="billNos"></param>
/// <returns></returns> /// <returns></returns>
Task<Result> Sync(List<string> sourceBillNos = null); Task<Result> Sync(List<string> billNos = null);
} }
} }

View File

@@ -28,6 +28,12 @@ namespace WMS.Web.Domain.Infrastructure
/// <param name="sourceBillNos"></param> /// <param name="sourceBillNos"></param>
/// <returns></returns> /// <returns></returns>
Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourceBillNos); Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourceBillNos);
/// <summary>
/// 列表-根据订单号
/// </summary>
/// <param name="billNos"></param>
/// <returns></returns>
Task<List<OutStockTask>> GetListByBillNo(List<string> billNos);
/// 修改实体集合 /// 修改实体集合
Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true); Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true);
//编辑 //编辑

View File

@@ -236,7 +236,7 @@ namespace WMS.Web.Domain.Services
/// </summary> /// </summary>
/// <param name="sourceBillNos"></param> /// <param name="sourceBillNos"></param>
/// <returns></returns> /// <returns></returns>
public async Task<Result> Sync(List<string> sourceBillNos = null) public async Task<Result> Sync(List<string> billNos = null)
{ {
//1.事务 //1.事务
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
@@ -244,7 +244,7 @@ namespace WMS.Web.Domain.Services
bool isSuccess = true; bool isSuccess = true;
Result result; Result result;
//定时任务更新 //定时任务更新
if (sourceBillNos == null) if (billNos == null)
{ {
DateTime begin = await _erpOpsSyncDateRepositories.Get(ErpOpsSyncType.OutStock); DateTime begin = await _erpOpsSyncDateRepositories.Get(ErpOpsSyncType.OutStock);
//更新时间范围内所有 //更新时间范围内所有
@@ -277,7 +277,7 @@ namespace WMS.Web.Domain.Services
List<string> TransferOut_Nos = new List<string>(); List<string> TransferOut_Nos = new List<string>();
List<string> AssembledApp_Nos = new List<string>(); List<string> AssembledApp_Nos = new List<string>();
List<string> MisDeliveryOut_Nos = new List<string>(); List<string> MisDeliveryOut_Nos = new List<string>();
var taskList = await _outStockTaskRepositories.GetListBySourceBillNo(sourceBillNos); var taskList = await _outStockTaskRepositories.GetListByBillNo(billNos);
foreach (var entity in taskList) foreach (var entity in taskList)
{ {
if (entity.Type == OutStockType.Sal) if (entity.Type == OutStockType.Sal)

View File

@@ -376,11 +376,22 @@ namespace WMS.Web.Repositories
/// </summary> /// </summary>
/// <param name="sourceBillNos"></param> /// <param name="sourceBillNos"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> billNos) public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourcebillNos)
{ {
List<int> ids = new List<int>();
string str=$"SELECT Fid FROM t_erp_outstock_task_details WHERE ";
for (int i=0;i<sourcebillNos.Count();i++)
{
if (i == 0)
str += $" SourceBillNo like '%{sourcebillNos[i]}%'";
else
str += $" or SourceBillNo like '%{sourcebillNos[i]}%'";
}
ids = await _context.OutStockTaskDetails.FromSqlRaw(str).Select(s => s.Id).ToListAsync();
var entitys = await _context.OutStockTask var entitys = await _context.OutStockTask
.Include(s => s.Details) .Include(s => s.Details)
.Where(w => billNos.Contains(w.BillNo)) .Where(w => ids.Contains(w.Id))
.OrderByDescending(o => o.Id) .OrderByDescending(o => o.Id)
.ToListAsync(); .ToListAsync();
@@ -447,5 +458,16 @@ namespace WMS.Web.Repositories
{ {
return await GetListAsync(dto); return await GetListAsync(dto);
} }
public async Task<List<OutStockTask>> GetListByBillNo(List<string> billNos)
{
var entitys = await _context.OutStockTask
.Include(s => s.Details)
.Where(w => billNos.Contains(w.BillNo))
.OrderByDescending(o => o.Id)
.ToListAsync();
return entitys.Clone();
}
} }
} }