diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js index 7a2abe49..485eb189 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js @@ -1,73 +1,73 @@ -const schema = { - title: "通用代码", - type: "object", - disableSelection: true, - properties: { - settleBillNum: { - title: "关联结算单号", - type: "string", - }, - billNum: { - title: "发票分组号", - type: "string", - }, - settleDate: { - title: "下线日期", - type: "string", - input: "datetime", - }, - invBillNum: { - title: "发票号", - type: "string", - }, - lu: { - title: "客户零件号", - type: "string", - }, - partCode: { - title: "厂内零件号", - type: "string", - }, - materialDesc: { - title: "零件描述", - type: "decimal", - }, - pn: { - title: "标识号", - type: "string", - }, - qty: { - title: "结算数量", - type: "number", - }, - price: { - title: "单价", - type: "number", - }, - groupNum: { - title: "结算分组号", - type: "decimal", - }, - site: { - title: "工厂地点", - type: "string", - }, - isReturn: { - title: "是否退货", - type: "boolean", - }, - isMaidan: { - title: "是否买单", - type: "boolean", - }, - contractDocID: { - title: "合同号", - type: "string", +export default function (businessType, type) { + const schema = { + title: "通用代码", + type: "object", + disableSelection: true, + properties: { + settleBillNum: { + title: "关联结算单号", + type: "string", + }, + billNum: { + title: "发票分组号", + type: "string", + }, + settleDate: { + title: "下线日期", + type: "string", + input: "datetime", + }, + invBillNum: { + title: "发票号", + type: "string", + }, + lu: { + title: "客户零件号", + type: "string", + }, + partCode: { + title: "厂内零件号", + type: "string", + }, + materialDesc: { + title: "零件描述", + type: "decimal", + }, + pn: { + title: "标识号", + type: "string", + }, + qty: { + title: "结算数量", + type: "number", + }, + price: { + title: "单价", + type: "number", + }, + groupNum: { + title: "结算分组号", + type: "decimal", + }, + site: { + title: "工厂地点", + type: "string", + }, + isReturn: { + title: "是否退货", + type: "boolean", + }, + isMaidan: { + title: "是否买单", + type: "boolean", + }, + contractDocID: { + title: "合同号", + type: "string", + }, }, - }, -}; + }; -export default function (businessType, type) { let service; if (type === "unable") { if (businessType === "JisBBAC") { @@ -86,6 +86,7 @@ export default function (businessType, type) { service = "pub_can_sa_service"; } } + if (businessType === "JisBBAC" || businessType === "JisHBPO" || businessType === "MaiDanJianBBAC" || businessType === "MaiDanJianHBPO") { schema.properties.pn.title = "生产码"; } else if (businessType === "ZhiGongJianBBAC" || businessType === "ZhiGongJianHBPO" || businessType === "YinDuJian") { @@ -207,5 +208,3 @@ export default function (businessType, type) { }, }; } - -export { schema }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable-bk.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable-bk.js deleted file mode 100644 index ee817361..00000000 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable-bk.js +++ /dev/null @@ -1,113 +0,0 @@ -//不可结算明细 -import { version, state } from "../_options.js"; - -const schema = { - title: "可结算单", - type: "object", - properties: { - version, - state, - billNum: { - title: "结算单据", - type: "string", - oneToMany: "/settle/detail", - config: "/models/settle/detail.js", - }, - settleBillNum: { - title: "关联结算单号", - type: "string", - }, - invGroupNum: { - title: "发票分组号", - type: "string", - }, - }, -}; - -export default function (businessType) { - let service; - if (businessType === "JisBBAC") { - service = "bbac_can_sa_service"; - } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") { - service = "hbpo_can_sa_service"; - } else { - service = "pub_can_sa_service"; - } - const queryUrl = `settleaccount/${service}/main-query`; - const exportUrl = `settleaccount/${service}/export`; - const addUrl = `settleaccount/${service}/generate-invoice`; - - const queryMethod = "POST"; - const exportMethod = "POST"; - const addMethod = "POST"; - - return { - query: { - url: queryUrl, - method: queryMethod, - hasFilter: true, - schema: { - title: "发票分组号", - type: "object", - properties: { - filters: { - title: "项目", - type: "array", - hidden: true, - items: { - type: "object", - properties: { - logic: { - type: "int", - }, - column: { - type: "string", - }, - action: { - type: "int", - }, - value: { - type: "string", - }, - }, - }, - default: [ - { - logic: "and", - column: "version", - action: "equal", - value: null, - readOnly: true, - }, - ], - }, - skipCount: { - hidden: true, - default: 0, - }, - maxResultCount: { - hidden: true, - default: 10, - }, - sorting: { - hidden: true, - }, - businessType: { - hidden: true, - default: 0, - }, - }, - }, - }, - table: { - schema: schema, - }, - edit: { - exportUrl, - addUrl, - exportMethod, - addMethod, - schema: schema, - }, - }; -} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js index 1b3608e6..dbfef566 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js @@ -14,6 +14,8 @@ export default { const route = useRoute(); const businessType = route.meta.businessType; const config = useConfig(businessType, "unable"); + delete config.table.schema.properties["invBillNum"]; + delete config.table.schema.properties["billNum"]; const onCommand = async (item) => { const url = config.edit.addUrl; if (item.path === "add") { diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js index b91785ba..3f3a3f29 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js @@ -3,7 +3,7 @@ import html from "html"; import { ref } from "vue"; import { useRoute } from "vue-router"; import useConfig from "../../models/settle/usable.js"; -import request from "../../request/index.js"; +import request, { getUrl } from "../../request/index.js"; export default { components: { AppList }, @@ -17,7 +17,19 @@ export default { const url = config.edit.addUrl; if (item.path === "add") { const invbillNum = rows[0].billNum; - await appListRef.value.onClick(async () => await request(url, invbillNum, { method: "POST" }, true), `确认为${invbillNum}创建发票?`, true); + await appListRef.value.onClick( + async () => { + const result = await request(url, invbillNum, { method: "POST" }, true); + if (result.errors) { + if (result.data.code === 400 && result.data.fileName) { + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + console.log(result); + } + }, + `确认为${invbillNum}创建发票?`, + true + ); } }; return { appListRef, config, onCommand }; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index dcaa113b..173fe31a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Linq.Dynamic.Core; +using System.Security.Policy; using System.Text.RegularExpressions; using System.Threading.Tasks; using EFCore.BulkExtensions; @@ -153,7 +154,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase [HttpPost] public async Task> GetListAsync(PUB_SARequestDto input) { - input.Filters.RemoveAll(t => t.Column.ToLower() == "site"); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entities); @@ -451,6 +451,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase EnumBusinessType.YinDuJian => "1040", _ => throw new UserFriendlyException($"业务编码错误", "400") }; + site = clientCode; if (businessType == EnumBusinessType.BeiJian) { @@ -526,7 +527,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase BillNum = pubSaBillNum, State = "0", BusinessType = pubSaFirstDetail.BusinessType, - Version = pubSaFirstDetail.Version + Version = pubSaFirstDetail.Version, + Site = site }; //可结算单号 var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); @@ -538,13 +540,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase SettleBillNum = pubSaBillNum, State = SettleBillState.未结状态, BusinessType = pubSa.BusinessType, - Version = pubSa.Version + Version = pubSa.Version, + Site = site }; #region 入库数据赋值 pubSaDetails.ForEach(pubSaDetail => { pubSaDetail.BillNum = pubSaBillNum; + pubSaDetail.Site = site; }); //不可结算 结算分组号码(根据价格区分结算、不可结算) var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 4403ccc7..447d7d27 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -80,25 +80,25 @@ public class PriceListAppService : SettleAccountApplicationBase result = result.FindAll(p => filter.Contains(p.Plant)).ToList(); result.FindAll(t => !string.IsNullOrEmpty(t.ES1) || !string.IsNullOrEmpty(t.ES2)).ForEach(t => t.PartNo = t.PartNo + new string(' ', 6) + t.ES1 + t.ES2); var newPrice = ObjectMapper.Map, List>(result); - newPrice = newPrice.GroupBy(p => new { p.LU, p.ClientCode, p.BeginTime, p.EndTime }).Select(p => p.FirstOrDefault()).ToList(); + newPrice = newPrice.GroupBy(p => new { p.Date, p.ClientCode, p.LU, p.BeginTime, p.EndTime }).Select(p => p.FirstOrDefault()).ToList(); #region 校验 if (newPrice.Any()) { var query = from item1 in newPrice join item2 in newPrice - on new { item1.LU, item1.ClientCode } equals new { item2.LU, item2.ClientCode } + on new { item1.Date, item1.ClientCode, item1.LU } equals new { item2.Date, item2.ClientCode, item2.LU } where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) || (item1.BeginTime == item2.BeginTime && item1.EndTime != item2.EndTime) || (item1.BeginTime != item2.BeginTime && item1.EndTime == item2.EndTime) - select item1.LU; + select item1; 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},时间区间存在交集", string.Empty)); + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},合同签订时间:{item.Date},时间区间存在交集", string.Empty)); } foreach (var item in CheckPriceListContinuity(newPrice)) { - checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间【{item.BeginTime}至{item.EndTime}】不连续", string.Empty)); + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},合同签订时间:{item.Date},时间区间【{item.BeginTime}至{item.EndTime}】不连续", string.Empty)); } } if (checkList.Count > 0) @@ -108,22 +108,30 @@ public class PriceListAppService : SettleAccountApplicationBase } #endregion + newPrice.ForEach(t => t.IsCancel = true); + newPrice.GroupBy(t => new { t.ClientCode, t.LU }) + .SelectMany(t => + { + var data = t.OrderByDescending(t => t.Date).First().Date; + return t.Where(t => t.Date == data); + }) + .ForEach(t => t.IsCancel = false); + var importLus = newPrice.Select(t => t.LU).Distinct().ToList(); var oldPrices = _settleAccountDbContext.Set() .Where(t => t.IsCancel == false) .Where(t => importLus.Contains(t.LU)) .ToList(); //系统中合同日期比导入文件中的合同日期晚 - var oldPriceNewDate = from oldprice in oldPrices - from newprice in newPrice - where oldprice.LU == newprice.LU && oldprice.Date > newprice.Date - select oldprice; + var oldPriceNewDate = from oldPriceItem in oldPrices + from newPriceItem in newPrice.FindAll(t => t.IsCancel == false) + where oldPriceItem.ClientCode == newPriceItem.ClientCode && oldPriceItem.LU == newPriceItem.LU && oldPriceItem.Date > newPriceItem.Date + select new { oldPriceItem, newPriceItem }; oldPrices.ForEach(t => t.IsCancel = true); if (oldPriceNewDate.Any()) { - oldPrices.FindAll(t => oldPriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); - var importCancelLus = oldPrices.Select(t => t.LU).Distinct(); - newPrice.FindAll(t => importCancelLus.Contains(t.LU)).ForEach(t => t.IsCancel = true); + oldPrices.FindAll(t => t.IsCancel == true && oldPriceNewDate.Select(t => t.oldPriceItem).Contains(t)).ForEach(t => t.IsCancel = false); + newPrice.FindAll(t => t.IsCancel == false && oldPriceNewDate.Select(t => t.newPriceItem).Contains(t)).ForEach(t => t.IsCancel = true); } foreach (var item in newPrice) { @@ -155,22 +163,27 @@ public class PriceListAppService : SettleAccountApplicationBase return priceList; // 只有一个或零个价格条目 } - var clientCodeGroup = priceList.GroupBy(t => t.ClientCode); - foreach (var item in clientCodeGroup) + var dateGroups = priceList.GroupBy(t => t.Date); + foreach (var dateGroup in dateGroups) { - if (item.ToList().Count <= 1) - { - continue; - } - var sortedList = item.OrderBy(t => t.LU).ThenBy(t => t.BeginTime).ToList(); - for (var i = 1; i < sortedList.Count; i++) + var clientCodeGroups = dateGroup.GroupBy(t => t.ClientCode); + foreach (var clientCodeGroup in clientCodeGroups) { - if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginTime != sortedList[i - 1].EndTime.AddDays(1)) + if (clientCodeGroup.ToList().Count <= 1) { - result.Add(sortedList[i]); + continue; + } + var sortedList = clientCodeGroup.OrderBy(t => t.LU).ThenBy(t => t.BeginTime).ToList(); + for (var i = 1; i < sortedList.Count; i++) + { + if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginTime != sortedList[i - 1].EndTime.AddDays(1)) + { + result.Add(sortedList[i]); + } } } } + return result; // 所有价格时间都连续 } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index f78edce6..aed28b00 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -63,25 +63,25 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase result = result.Where(p => filter.Contains(p.Plant)).ToList(); result.FindAll(t => !string.IsNullOrEmpty(t.ES1) || !string.IsNullOrEmpty(t.ES2)).ForEach(t => t.PartNo = t.PartNo + new string(' ', 6) + t.ES1 + t.ES2); var newPrice = ObjectMapper.Map, List>(result); - newPrice = newPrice.GroupBy(p => new { p.LU, p.BeginDate, p.EndDate }).Select(p => p.FirstOrDefault()).ToList(); + newPrice = newPrice.GroupBy(p => new { p.Date, p.ClientCode, p.LU, p.BeginDate, p.EndDate }).Select(p => p.FirstOrDefault()).ToList(); #region 校验 if (newPrice.Any()) { var query = from item1 in newPrice join item2 in newPrice - on item1.LU equals item2.LU + on new { item1.Date, item1.ClientCode, item1.LU } equals new { item2.Date, item2.ClientCode, item2.LU } where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) || (item1.BeginDate == item2.BeginDate && item1.EndDate != item2.EndDate) || (item1.BeginDate != item2.BeginDate && item1.EndDate == item2.EndDate) - select item1.LU; + select item1; 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},时间区间存在交集", string.Empty)); + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},合同签订时间:{item.Date},时间区间存在交集", string.Empty)); } foreach (var item in CheckPriceListContinuity(newPrice)) { - checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间【{item.BeginDate}至{item.EndDate}】不连续", string.Empty)); + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},合同签订时间:{item.Date},时间区间【{item.BeginDate}至{item.EndDate}】不连续", string.Empty)); } } if (checkList.Count > 0) @@ -91,22 +91,30 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase } #endregion + newPrice.ForEach(t => t.IsCancel = true); + newPrice.GroupBy(t => new { t.ClientCode, t.LU }) + .SelectMany(t => + { + var data = t.OrderByDescending(t => t.Date).First().Date; + return t.Where(t => t.Date == data); + }) + .ForEach(t => t.IsCancel = false); + var importLus = newPrice.Select(t => t.LU).Distinct().ToList(); var oldPrices = _settleAccountDbContext.Set() .Where(t => t.IsCancel == false) .Where(t => importLus.Contains(t.LU)) .ToList(); //系统中合同日期比导入文件中的合同日期晚 - var oldPriceNewDate = from oldprice in oldPrices - from newprice in newPrice - where oldprice.LU == newprice.LU && oldprice.Date > newprice.Date - select oldprice; + var oldPriceNewDate = from oldPriceItem in oldPrices + from newPriceItem in newPrice.FindAll(t => t.IsCancel == false) + where oldPriceItem.ClientCode == newPriceItem.ClientCode && oldPriceItem.LU == newPriceItem.LU && oldPriceItem.Date > newPriceItem.Date + select new { oldPriceItem, newPriceItem }; oldPrices.ForEach(t => t.IsCancel = true); if (oldPriceNewDate.Any()) { - oldPrices.FindAll(t => oldPriceNewDate.Contains(t)).ForEach(t => t.IsCancel = false); - var importCancelLus = oldPrices.Select(t => t.LU).Distinct(); - newPrice.FindAll(t => importCancelLus.Contains(t.LU)).ForEach(t => t.IsCancel = true); + oldPrices.FindAll(t => t.IsCancel == true && oldPriceNewDate.Select(t => t.oldPriceItem).Contains(t)).ForEach(t => t.IsCancel = false); + newPrice.FindAll(t => t.IsCancel == false && oldPriceNewDate.Select(t => t.newPriceItem).Contains(t)).ForEach(t => t.IsCancel = true); } foreach (var item in newPrice) { @@ -139,24 +147,28 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase return priceList; // 只有一个或零个价格条目 } - var clientCodeGroup = priceList.GroupBy(t => t.ClientCode); - foreach (var item in clientCodeGroup) + var dateGroups = priceList.GroupBy(t => t.Date); + foreach (var dateGroup in dateGroups) { - if (item.ToList().Count <= 1) - { - continue; - } - var sortedList = item.OrderBy(t => t.LU).ThenBy(t => t.BeginDate).ToList(); - for (var i = 1; i < sortedList.Count; i++) + var clientCodeGroups = dateGroup.GroupBy(t => t.ClientCode); + foreach (var clientCodeGroup in clientCodeGroups) { - if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginDate != sortedList[i - 1].EndDate.AddDays(1)) + if (clientCodeGroup.ToList().Count <= 1) + { + continue; + } + var sortedList = clientCodeGroup.OrderBy(t => t.LU).ThenBy(t => t.BeginDate).ToList(); + for (var i = 1; i < sortedList.Count; i++) { - result.Add(sortedList[i]); + if (sortedList[i].LU == sortedList[i - 1].LU && sortedList[i].BeginDate != sortedList[i - 1].EndDate.AddDays(1)) + { + result.Add(sortedList[i]); + } } } } - return result; + return result; // 所有价格时间都连续 } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs index 7dd05aa9..2218e76d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs @@ -52,6 +52,10 @@ namespace Win.Sfs.SettleAccount.ExcelImporter public virtual async Task> UploadExcelImport([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService) where T : class, new() { + if (files.Count > 1) + { + throw new UserFriendlyException("只能上传一个附件!", "400"); + } using var fs = ServiceProvider.CreateScope(); var fc = fs.ServiceProvider.GetRequiredService>(); Type type = typeof(T).GetType();