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. 85
      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; } public string LU1 { get; set; }
[Display(Name = "不可结算零件号")]
public string InvBillNum { get; set; }
//[Display(Name = "不可结算零件号")] //[Display(Name = "不可结算零件号")]
//public string LU1 { get; set; } //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;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
@ -42,6 +43,9 @@ public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid>
[Display(Name = "键值")] [Display(Name = "键值")]
public string KeyCode { get; set; } public string KeyCode { get; set; }
[Display(Name = "价格")]
public string Price { get; set; }
} }

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

@ -1,15 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Office2010.Excel; using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp; 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.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Win.Sfs.SettleAccount.Bases; namespace Win.Sfs.SettleAccount.Bases;
/// <summary> /// <summary>
@ -42,6 +47,8 @@ public class ADJ_SERVICE : BASE_SERVICE
protected readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _bbacRepository; protected readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _bbacRepository;
protected readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _pubRepository; protected readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _pubRepository;
protected readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _hbpoRepository; protected readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _hbpoRepository;
protected readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
protected readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
public ADJ_SERVICE( public ADJ_SERVICE(
@ -54,7 +61,9 @@ public class ADJ_SERVICE : BASE_SERVICE
INormalEfCoreRepository<MaterialRelationship, Guid> relRepository, INormalEfCoreRepository<MaterialRelationship, Guid> relRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> bbacRepository, INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> bbacRepository,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> pubRepository, 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) : base(excelImportService, snowflakeIdGenerator, commonManager)
@ -65,7 +74,9 @@ public class ADJ_SERVICE : BASE_SERVICE
_baseDomainService = baseDomainService; _baseDomainService = baseDomainService;
_bbacRepository = bbacRepository; _bbacRepository = bbacRepository;
_pubRepository = pubRepository; _pubRepository = pubRepository;
_hbpoRepository= hbpoRepository; _hbpoRepository = hbpoRepository;
_priceRepository = priceRepository;
_pricebjRepository = pricebjRepository;
} }
/// <summary> /// <summary>
///查询明细 ///查询明细
@ -193,11 +204,11 @@ public class ADJ_SERVICE : BASE_SERVICE
{ {
itm.KeyCode = itm.PN + itm.LU.Replace(" ", "").Trim(); 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(); var keylist = p_list.Select(p => p.KeyCode).Distinct();
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>(); List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
var first=p_list.FirstOrDefault(); var first = p_list.FirstOrDefault();
if (first != null) if (first != null)
{ {
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault(); var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
@ -228,6 +239,7 @@ public class ADJ_SERVICE : BASE_SERVICE
} }
break; break;
case EnumBusinessType.BeiJian: case EnumBusinessType.BeiJian:
flag = 1;
var errors3 = _pubRepository.Where(p => pnlist.Contains(p.PN)); var errors3 = _pubRepository.Where(p => pnlist.Contains(p.PN));
foreach (var p in errors3) foreach (var p in errors3)
{ {
@ -238,18 +250,18 @@ public class ADJ_SERVICE : BASE_SERVICE
var errors4 = _bbacRepository.Where(p => keylist.Contains(p.KeyCode)); var errors4 = _bbacRepository.Where(p => keylist.Contains(p.KeyCode));
foreach (var p in errors4) 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; break;
case EnumBusinessType.JisHBPO: 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) foreach (var p in errors5)
{ {
errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" }); errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" });
} }
break; break;
case EnumBusinessType.YinDuJian: 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) foreach (var p in errors6)
{ {
errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在发货单{p.PN}数据,不能导入调整表" }); errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在发货单{p.PN}数据,不能导入调整表" });
@ -281,8 +293,63 @@ public class ADJ_SERVICE : BASE_SERVICE
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) }); 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