Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
2818c26274
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs
  3. 93
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -463,6 +463,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string LU1 { get; set; }
[Display(Name = "不可结算零件号")]
public string InvBillNum { get; set; }
//[Display(Name = "不可结算零件号")]
//public string LU1 { get; set; }

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@ -42,6 +43,9 @@ public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid>
[Display(Name = "键值")]
public string KeyCode { get; set; }
[Display(Name = "价格")]
public string Price { get; set; }
}

93
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Volo.Abp;
@ -22,10 +25,12 @@ using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Win.Sfs.SettleAccount.Bases;
/// <summary>
@ -42,6 +47,8 @@ public class ADJ_SERVICE : BASE_SERVICE
protected readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _bbacRepository;
protected readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _pubRepository;
protected readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _hbpoRepository;
protected readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
protected readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
public ADJ_SERVICE(
@ -54,7 +61,9 @@ public class ADJ_SERVICE : BASE_SERVICE
INormalEfCoreRepository<MaterialRelationship, Guid> relRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> bbacRepository,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> pubRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> hbpoRepository
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> hbpoRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository
)
: base(excelImportService, snowflakeIdGenerator, commonManager)
@ -65,7 +74,9 @@ public class ADJ_SERVICE : BASE_SERVICE
_baseDomainService = baseDomainService;
_bbacRepository = bbacRepository;
_pubRepository = pubRepository;
_hbpoRepository= hbpoRepository;
_hbpoRepository = hbpoRepository;
_priceRepository = priceRepository;
_pricebjRepository = pricebjRepository;
}
/// <summary>
///查询明细
@ -73,7 +84,7 @@ public class ADJ_SERVICE : BASE_SERVICE
/// <param name="input">明细查询条件</param>
/// <returns></returns>
[HttpPost]
public virtual async Task<PagedResultDto<PUB_ADJ_DETAIL_DTO>> DetailQueryAsync(PUB_ADJ_DETAIL_REQ_DTO input)
{
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
@ -193,11 +204,11 @@ public class ADJ_SERVICE : BASE_SERVICE
{
itm.KeyCode = itm.PN + itm.LU.Replace(" ", "").Trim();
}
var pnlist=p_list.Select(p => p.PN).Distinct();
var pnlist = p_list.Select(p => p.PN).Distinct();
int flag = 0;
var keylist = p_list.Select(p => p.KeyCode).Distinct();
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
var first=p_list.FirstOrDefault();
var first = p_list.FirstOrDefault();
if (first != null)
{
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
@ -228,6 +239,7 @@ public class ADJ_SERVICE : BASE_SERVICE
}
break;
case EnumBusinessType.BeiJian:
flag = 1;
var errors3 = _pubRepository.Where(p => pnlist.Contains(p.PN));
foreach (var p in errors3)
{
@ -238,18 +250,18 @@ public class ADJ_SERVICE : BASE_SERVICE
var errors4 = _bbacRepository.Where(p => keylist.Contains(p.KeyCode));
foreach (var p in errors4)
{
errorList.Add(new ERR_EXP_DTO() {Message=$"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" });
errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" });
}
break;
case EnumBusinessType.JisHBPO:
var errors5=_hbpoRepository.Where(p => keylist.Contains(p.KeyCode));
var errors5 = _hbpoRepository.Where(p => keylist.Contains(p.KeyCode));
foreach (var p in errors5)
{
errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" });
}
break;
case EnumBusinessType.YinDuJian:
var errors6=_pubRepository.Where(p => pnlist.Contains(p.PN));
var errors6 = _pubRepository.Where(p => pnlist.Contains(p.PN));
foreach (var p in errors6)
{
errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在发货单{p.PN}数据,不能导入调整表" });
@ -259,7 +271,7 @@ public class ADJ_SERVICE : BASE_SERVICE
}
}
var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
var codelist = entityList.Select(p => p.LU).ToList();
var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true });
@ -279,10 +291,65 @@ public class ADJ_SERVICE : BASE_SERVICE
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
}
List<PUB_ADJ_DETAIL_DTO> ls = new List<PUB_ADJ_DETAIL_DTO>();
if (flag == 1)
{
var pricebjlist = _pricebjRepository.ToList();
var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU
where
d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate
select
new PUB_ADJ_DETAIL_DTO()
{
InvBillNum = d.InvBillNum,
SettleDate = d.SettleDate,
LU = d.LU,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
KeyCode = d.KeyCode,
Price = d.Price,
};
ls = inner.ToList();
}
else
{
var pricelist = _priceRepository.ToList();
var inner = from d in p_list
join p in pricelist on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new PUB_ADJ_DETAIL_DTO()
{
InvBillNum = d.InvBillNum,
SettleDate = d.SettleDate,
LU = d.LU,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
KeyCode = d.KeyCode,
Price = d.Price,
};
ls = inner.ToList();
}
return new JsonResult(new { Code = 200, Message = "校验成功" }); ;
return new JsonResult(new { Code = 200, Message =ls }); ;
}
}

Loading…
Cancel
Save