Browse Source

价格单导入

master
mahao 1 year ago
parent
commit
215e382f71
  1. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -90,17 +90,18 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
var query = from item1 in entityList var query = from item1 in entityList
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) where (item1.BeginTime >= item2.BeginTime && item1.EndTime <= item2.EndTime) || (item2.BeginTime >= item1.BeginTime && item2.EndTime <= item1.EndTime)
select item1; select item1.LU;
foreach (var item in query) var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间存在交集", string.Empty)); checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
} }
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -71,16 +71,17 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate)
select item1; select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in query) foreach (var item in query)
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间存在交集", string.Empty)); checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
} }
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);

Loading…
Cancel
Save