diff --git a/DOAN.Admin.WebApi/DOAN.WebApi.csproj b/DOAN.Admin.WebApi/DOAN.WebApi.csproj index 7ab56f3..f36ed45 100644 --- a/DOAN.Admin.WebApi/DOAN.WebApi.csproj +++ b/DOAN.Admin.WebApi/DOAN.WebApi.csproj @@ -47,7 +47,7 @@ - + diff --git a/MES_Model/Assets/ImportTemplate/MaterialMODEL.xlsx b/MDM/Assets/ImportTemplate/MaterialMODEL.xlsx similarity index 100% rename from MES_Model/Assets/ImportTemplate/MaterialMODEL.xlsx rename to MDM/Assets/ImportTemplate/MaterialMODEL.xlsx diff --git a/MES_Model/Controllers/Material/MaterialBomController.cs b/MDM/Controllers/Material/MaterialBomController.cs similarity index 66% rename from MES_Model/Controllers/Material/MaterialBomController.cs rename to MDM/Controllers/Material/MaterialBomController.cs index 1816448..a9f4292 100644 --- a/MES_Model/Controllers/Material/MaterialBomController.cs +++ b/MDM/Controllers/Material/MaterialBomController.cs @@ -14,6 +14,10 @@ using MDM.Model.Material.Dto; using MDM.Model.Material; using MDM.Repository; using DOAN.Model.MES.base_.Dto; +using MDM.Services.Material; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; //创建时间:2025-11-15 namespace MDM.Controllers.Material @@ -130,6 +134,54 @@ namespace MDM.Controllers.Material return SUCCESS(response); } + //TODO 导出模板 + [HttpGet("importTemplate")] + [Log(Title = "物料类型模板", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)] + [AllowAnonymous] + public IActionResult ImportTemplateExcel() + { + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string fullPath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); + + (string, string) result = ("MaterialMODEL.xlsx", fullPath); + return ExportExcel(result.Item2, result.Item1); + } + + + //TODO 导入excel + [HttpPost("importData")] + [Log(Title = "物料类型导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)] + [AllowAnonymous] + public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile) + { + + if (formFile == null) + { + return SUCCESS(null); + } + int response = _MaterialBomService.ImportData(formFile, HttpContext.GetName()); + + return SUCCESS(response); + } + + //TODO 导出excel + [HttpGet("exportData")] + [Log(Title = "物料类型导出", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)] + [AllowAnonymous] + public IActionResult ExportData() + { + + var excelBytes = _MaterialBomService.ExportData(); + string fileName = $"PlanAchievementRate_{DateTime.Now.Date:yyyyMMdd}.xlsx"; + return File( + excelBytes, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + fileName + ); + + } + } } \ No newline at end of file diff --git a/MES_Model/Controllers/Material/MaterialListController.cs b/MDM/Controllers/Material/MaterialListController.cs similarity index 91% rename from MES_Model/Controllers/Material/MaterialListController.cs rename to MDM/Controllers/Material/MaterialListController.cs index bd8f898..4e108aa 100644 --- a/MES_Model/Controllers/Material/MaterialListController.cs +++ b/MDM/Controllers/Material/MaterialListController.cs @@ -15,6 +15,7 @@ using MDM.Model.Material; using MDM.Services.Material; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Hosting; //创建时间:2025-11-15 namespace MDM.Controllers.Material @@ -120,10 +121,11 @@ namespace MDM.Controllers.Material [AllowAnonymous] public IActionResult ImportTemplateExcel() { - string path = "./Assets/ImportTemplate"; - string sFileName = $"MaterialMODEL.xlsx"; - string fullPath = Path.Combine(path, sFileName); - (string, string) result = (sFileName, fullPath); + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string fullPath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); + + (string, string) result = ("MaterialMODEL.xlsx", fullPath); return ExportExcel(result.Item2, result.Item1); } diff --git a/MES_Model/Controllers/Material/MaterialTypeController.cs b/MDM/Controllers/Material/MaterialTypeController.cs similarity index 95% rename from MES_Model/Controllers/Material/MaterialTypeController.cs rename to MDM/Controllers/Material/MaterialTypeController.cs index 1d4dc12..70e0d25 100644 --- a/MES_Model/Controllers/Material/MaterialTypeController.cs +++ b/MDM/Controllers/Material/MaterialTypeController.cs @@ -123,10 +123,10 @@ namespace MDM.Controllers.Material public IActionResult ImportTemplateExcel() { IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); - string path= "Assets/ImportTemplate"; - string sFileName = $"MaterialMODEL.xlsx"; - string fullPath = Path.Combine(webHostEnvironment.ContentRootPath,path, sFileName); - (string, string) result = (sFileName,fullPath); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string fullPath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); + + (string, string) result = ("MaterialMODEL.xlsx", fullPath); return ExportExcel(result.Item2, result.Item1); } diff --git a/MES_Model/Controllers/Plant/PlantFactorySiteController.cs b/MDM/Controllers/Plant/PlantFactorySiteController.cs similarity index 100% rename from MES_Model/Controllers/Plant/PlantFactorySiteController.cs rename to MDM/Controllers/Plant/PlantFactorySiteController.cs diff --git a/MES_Model/Controllers/Plant/PlantProductlinebodyController.cs b/MDM/Controllers/Plant/PlantProductlinebodyController.cs similarity index 100% rename from MES_Model/Controllers/Plant/PlantProductlinebodyController.cs rename to MDM/Controllers/Plant/PlantProductlinebodyController.cs diff --git a/MES_Model/Controllers/Plant/PlantWorkshopController.cs b/MDM/Controllers/Plant/PlantWorkshopController.cs similarity index 100% rename from MES_Model/Controllers/Plant/PlantWorkshopController.cs rename to MDM/Controllers/Plant/PlantWorkshopController.cs diff --git a/MES_Model/Controllers/Plant/PlantWorkstationController.cs b/MDM/Controllers/Plant/PlantWorkstationController.cs similarity index 100% rename from MES_Model/Controllers/Plant/PlantWorkstationController.cs rename to MDM/Controllers/Plant/PlantWorkstationController.cs diff --git a/MES_Model/Controllers/Process/ProcessControlStrategyDictController.cs b/MDM/Controllers/Process/ProcessControlStrategyDictController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessControlStrategyDictController.cs rename to MDM/Controllers/Process/ProcessControlStrategyDictController.cs diff --git a/MES_Model/Controllers/Process/ProcessOperationController.cs b/MDM/Controllers/Process/ProcessOperationController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessOperationController.cs rename to MDM/Controllers/Process/ProcessOperationController.cs diff --git a/MES_Model/Controllers/Process/ProcessOperationReworkRuleController.cs b/MDM/Controllers/Process/ProcessOperationReworkRuleController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessOperationReworkRuleController.cs rename to MDM/Controllers/Process/ProcessOperationReworkRuleController.cs diff --git a/MES_Model/Controllers/Process/ProcessOperationTransitionController.cs b/MDM/Controllers/Process/ProcessOperationTransitionController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessOperationTransitionController.cs rename to MDM/Controllers/Process/ProcessOperationTransitionController.cs diff --git a/MES_Model/Controllers/Process/ProcessOprerationTransitionDictController.cs b/MDM/Controllers/Process/ProcessOprerationTransitionDictController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessOprerationTransitionDictController.cs rename to MDM/Controllers/Process/ProcessOprerationTransitionDictController.cs diff --git a/MES_Model/Controllers/Process/ProcessRoutingController.cs b/MDM/Controllers/Process/ProcessRoutingController.cs similarity index 100% rename from MES_Model/Controllers/Process/ProcessRoutingController.cs rename to MDM/Controllers/Process/ProcessRoutingController.cs diff --git a/MES_Model/MDM.csproj b/MDM/MDM.csproj similarity index 86% rename from MES_Model/MDM.csproj rename to MDM/MDM.csproj index eef89ab..b35bb7a 100644 --- a/MES_Model/MDM.csproj +++ b/MDM/MDM.csproj @@ -11,11 +11,12 @@ - + + true PreserveNewest Always - + diff --git a/MES_Model/Models/GlobalUsing.cs b/MDM/Models/GlobalUsing.cs similarity index 100% rename from MES_Model/Models/GlobalUsing.cs rename to MDM/Models/GlobalUsing.cs diff --git a/MES_Model/Models/Material/Dto/MaterialBomDto.cs b/MDM/Models/Material/Dto/MaterialBomDto.cs similarity index 100% rename from MES_Model/Models/Material/Dto/MaterialBomDto.cs rename to MDM/Models/Material/Dto/MaterialBomDto.cs diff --git a/MES_Model/Models/Material/Dto/MaterialListDto.cs b/MDM/Models/Material/Dto/MaterialListDto.cs similarity index 100% rename from MES_Model/Models/Material/Dto/MaterialListDto.cs rename to MDM/Models/Material/Dto/MaterialListDto.cs diff --git a/MES_Model/Models/Material/Dto/MaterialTypeDto.cs b/MDM/Models/Material/Dto/MaterialTypeDto.cs similarity index 100% rename from MES_Model/Models/Material/Dto/MaterialTypeDto.cs rename to MDM/Models/Material/Dto/MaterialTypeDto.cs diff --git a/MES_Model/Models/Material/MaterialBom.cs b/MDM/Models/Material/MaterialBom.cs similarity index 100% rename from MES_Model/Models/Material/MaterialBom.cs rename to MDM/Models/Material/MaterialBom.cs diff --git a/MES_Model/Models/Material/MaterialList.cs b/MDM/Models/Material/MaterialList.cs similarity index 100% rename from MES_Model/Models/Material/MaterialList.cs rename to MDM/Models/Material/MaterialList.cs diff --git a/MES_Model/Models/Material/MaterialType.cs b/MDM/Models/Material/MaterialType.cs similarity index 100% rename from MES_Model/Models/Material/MaterialType.cs rename to MDM/Models/Material/MaterialType.cs diff --git a/MES_Model/Models/PagedInfo.cs b/MDM/Models/PagedInfo.cs similarity index 100% rename from MES_Model/Models/PagedInfo.cs rename to MDM/Models/PagedInfo.cs diff --git a/MES_Model/Models/PagerInfo.cs b/MDM/Models/PagerInfo.cs similarity index 100% rename from MES_Model/Models/PagerInfo.cs rename to MDM/Models/PagerInfo.cs diff --git a/MES_Model/Models/Plant/Dto/PlantFactorySiteDto.cs b/MDM/Models/Plant/Dto/PlantFactorySiteDto.cs similarity index 100% rename from MES_Model/Models/Plant/Dto/PlantFactorySiteDto.cs rename to MDM/Models/Plant/Dto/PlantFactorySiteDto.cs diff --git a/MES_Model/Models/Plant/Dto/PlantProductlinebodyDto.cs b/MDM/Models/Plant/Dto/PlantProductlinebodyDto.cs similarity index 100% rename from MES_Model/Models/Plant/Dto/PlantProductlinebodyDto.cs rename to MDM/Models/Plant/Dto/PlantProductlinebodyDto.cs diff --git a/MES_Model/Models/Plant/Dto/PlantWorkshopDto.cs b/MDM/Models/Plant/Dto/PlantWorkshopDto.cs similarity index 100% rename from MES_Model/Models/Plant/Dto/PlantWorkshopDto.cs rename to MDM/Models/Plant/Dto/PlantWorkshopDto.cs diff --git a/MES_Model/Models/Plant/Dto/PlantWorkstationDto.cs b/MDM/Models/Plant/Dto/PlantWorkstationDto.cs similarity index 100% rename from MES_Model/Models/Plant/Dto/PlantWorkstationDto.cs rename to MDM/Models/Plant/Dto/PlantWorkstationDto.cs diff --git a/MES_Model/Models/Plant/PlantFactorySite.cs b/MDM/Models/Plant/PlantFactorySite.cs similarity index 100% rename from MES_Model/Models/Plant/PlantFactorySite.cs rename to MDM/Models/Plant/PlantFactorySite.cs diff --git a/MES_Model/Models/Plant/PlantProductlinebody.cs b/MDM/Models/Plant/PlantProductlinebody.cs similarity index 100% rename from MES_Model/Models/Plant/PlantProductlinebody.cs rename to MDM/Models/Plant/PlantProductlinebody.cs diff --git a/MES_Model/Models/Plant/PlantWorkshop.cs b/MDM/Models/Plant/PlantWorkshop.cs similarity index 100% rename from MES_Model/Models/Plant/PlantWorkshop.cs rename to MDM/Models/Plant/PlantWorkshop.cs diff --git a/MES_Model/Models/Plant/PlantWorkstation.cs b/MDM/Models/Plant/PlantWorkstation.cs similarity index 100% rename from MES_Model/Models/Plant/PlantWorkstation.cs rename to MDM/Models/Plant/PlantWorkstation.cs diff --git a/MES_Model/Models/Process/Dto/ProcessControlStrategyDictDto.cs b/MDM/Models/Process/Dto/ProcessControlStrategyDictDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessControlStrategyDictDto.cs rename to MDM/Models/Process/Dto/ProcessControlStrategyDictDto.cs diff --git a/MES_Model/Models/Process/Dto/ProcessOperationDto.cs b/MDM/Models/Process/Dto/ProcessOperationDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessOperationDto.cs rename to MDM/Models/Process/Dto/ProcessOperationDto.cs diff --git a/MES_Model/Models/Process/Dto/ProcessOperationReworkRuleDto.cs b/MDM/Models/Process/Dto/ProcessOperationReworkRuleDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessOperationReworkRuleDto.cs rename to MDM/Models/Process/Dto/ProcessOperationReworkRuleDto.cs diff --git a/MES_Model/Models/Process/Dto/ProcessOperationTransitionDto.cs b/MDM/Models/Process/Dto/ProcessOperationTransitionDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessOperationTransitionDto.cs rename to MDM/Models/Process/Dto/ProcessOperationTransitionDto.cs diff --git a/MES_Model/Models/Process/Dto/ProcessOprerationTransitionDictDto.cs b/MDM/Models/Process/Dto/ProcessOprerationTransitionDictDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessOprerationTransitionDictDto.cs rename to MDM/Models/Process/Dto/ProcessOprerationTransitionDictDto.cs diff --git a/MES_Model/Models/Process/Dto/ProcessRoutingDto.cs b/MDM/Models/Process/Dto/ProcessRoutingDto.cs similarity index 100% rename from MES_Model/Models/Process/Dto/ProcessRoutingDto.cs rename to MDM/Models/Process/Dto/ProcessRoutingDto.cs diff --git a/MES_Model/Models/Process/ProcessControlStrategyDict.cs b/MDM/Models/Process/ProcessControlStrategyDict.cs similarity index 100% rename from MES_Model/Models/Process/ProcessControlStrategyDict.cs rename to MDM/Models/Process/ProcessControlStrategyDict.cs diff --git a/MES_Model/Models/Process/ProcessOperation.cs b/MDM/Models/Process/ProcessOperation.cs similarity index 100% rename from MES_Model/Models/Process/ProcessOperation.cs rename to MDM/Models/Process/ProcessOperation.cs diff --git a/MES_Model/Models/Process/ProcessOperationReworkRule.cs b/MDM/Models/Process/ProcessOperationReworkRule.cs similarity index 100% rename from MES_Model/Models/Process/ProcessOperationReworkRule.cs rename to MDM/Models/Process/ProcessOperationReworkRule.cs diff --git a/MES_Model/Models/Process/ProcessOperationTransition.cs b/MDM/Models/Process/ProcessOperationTransition.cs similarity index 100% rename from MES_Model/Models/Process/ProcessOperationTransition.cs rename to MDM/Models/Process/ProcessOperationTransition.cs diff --git a/MES_Model/Models/Process/ProcessOprerationTransitionDict.cs b/MDM/Models/Process/ProcessOprerationTransitionDict.cs similarity index 100% rename from MES_Model/Models/Process/ProcessOprerationTransitionDict.cs rename to MDM/Models/Process/ProcessOprerationTransitionDict.cs diff --git a/MES_Model/Models/Process/ProcessRouting.cs b/MDM/Models/Process/ProcessRouting.cs similarity index 100% rename from MES_Model/Models/Process/ProcessRouting.cs rename to MDM/Models/Process/ProcessRouting.cs diff --git a/MES_Model/Models/TreeDto.cs b/MDM/Models/TreeDto.cs similarity index 100% rename from MES_Model/Models/TreeDto.cs rename to MDM/Models/TreeDto.cs diff --git a/MES_Model/Repository/BaseRepository.cs b/MDM/Repository/BaseRepository.cs similarity index 100% rename from MES_Model/Repository/BaseRepository.cs rename to MDM/Repository/BaseRepository.cs diff --git a/MES_Model/Repository/IBaseRepository.cs b/MDM/Repository/IBaseRepository.cs similarity index 100% rename from MES_Model/Repository/IBaseRepository.cs rename to MDM/Repository/IBaseRepository.cs diff --git a/MES_Model/Services/BaseService.cs b/MDM/Services/BaseService.cs similarity index 100% rename from MES_Model/Services/BaseService.cs rename to MDM/Services/BaseService.cs diff --git a/MES_Model/Services/GlobalUsing.cs b/MDM/Services/GlobalUsing.cs similarity index 100% rename from MES_Model/Services/GlobalUsing.cs rename to MDM/Services/GlobalUsing.cs diff --git a/MES_Model/Services/IBaseService.cs b/MDM/Services/IBaseService.cs similarity index 100% rename from MES_Model/Services/IBaseService.cs rename to MDM/Services/IBaseService.cs diff --git a/MES_Model/Services/Material/IService/IMaterialBomService.cs b/MDM/Services/Material/IService/IMaterialBomService.cs similarity index 100% rename from MES_Model/Services/Material/IService/IMaterialBomService.cs rename to MDM/Services/Material/IService/IMaterialBomService.cs diff --git a/MES_Model/Services/Material/IService/IMaterialListService.cs b/MDM/Services/Material/IService/IMaterialListService.cs similarity index 100% rename from MES_Model/Services/Material/IService/IMaterialListService.cs rename to MDM/Services/Material/IService/IMaterialListService.cs diff --git a/MES_Model/Services/Material/IService/IMaterialTypeService.cs b/MDM/Services/Material/IService/IMaterialTypeService.cs similarity index 100% rename from MES_Model/Services/Material/IService/IMaterialTypeService.cs rename to MDM/Services/Material/IService/IMaterialTypeService.cs diff --git a/MES_Model/Services/Material/MaterialBomService.cs b/MDM/Services/Material/MaterialBomService.cs similarity index 95% rename from MES_Model/Services/Material/MaterialBomService.cs rename to MDM/Services/Material/MaterialBomService.cs index 8160659..ce495ee 100644 --- a/MES_Model/Services/Material/MaterialBomService.cs +++ b/MDM/Services/Material/MaterialBomService.cs @@ -9,6 +9,7 @@ using MDM.Model.Material.Dto; using MDM.Repository; using MDM.Service; using MDM.Services.IMaterialService; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; @@ -216,12 +217,10 @@ namespace MDM.Services.Material public byte[] ExportData() { - string templatePath = Path.Combine( - Directory.GetCurrentDirectory(), - "wwwroot", - "ImportTemplate", - "MaterialMODEL.xlsx" - ); + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string templatePath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); + if (!global::System.IO.File.Exists(templatePath)) { diff --git a/MES_Model/Services/Material/MaterialListService.cs b/MDM/Services/Material/MaterialListService.cs similarity index 95% rename from MES_Model/Services/Material/MaterialListService.cs rename to MDM/Services/Material/MaterialListService.cs index b9f1355..dfc617a 100644 --- a/MES_Model/Services/Material/MaterialListService.cs +++ b/MDM/Services/Material/MaterialListService.cs @@ -6,6 +6,7 @@ using MDM.Model.Material.Dto; using MDM.Repository; using MDM.Service; using MDM.Services.IMaterialService; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; @@ -103,7 +104,7 @@ namespace MDM.Services.Material try { IWorkbook workbook = new XSSFWorkbook(stream); - ISheet sheet = workbook.GetSheet("物料列表"); + ISheet sheet = workbook.GetSheet("物料类型"); List materialLists = new List(); // 遍历每一行 for (int row = 1; row <= sheet.LastRowNum; row++) @@ -225,12 +226,10 @@ namespace MDM.Services.Material public byte[] ExportData() { - string templatePath = Path.Combine( - Directory.GetCurrentDirectory(), - "Assets", - "ImportTemplate", - "MaterialMODEL.xlsx" - ); + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string templatePath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); + if (!global::System.IO.File.Exists(templatePath)) { diff --git a/MES_Model/Services/Material/MaterialTypeService.cs b/MDM/Services/Material/MaterialTypeService.cs similarity index 95% rename from MES_Model/Services/Material/MaterialTypeService.cs rename to MDM/Services/Material/MaterialTypeService.cs index adde963..70a9ef7 100644 --- a/MES_Model/Services/Material/MaterialTypeService.cs +++ b/MDM/Services/Material/MaterialTypeService.cs @@ -11,6 +11,7 @@ using Infrastructure; using Microsoft.AspNetCore.Http; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; +using Microsoft.AspNetCore.Hosting; namespace MDM.Services.Material { /// @@ -169,12 +170,11 @@ namespace MDM.Services.Material public byte[] ExportData() { - string templatePath = Path.Combine( - Directory.GetCurrentDirectory(), - "wwwroot", - "ImportTemplate", - "MaterialMODEL.xlsx" - ); + + + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + // 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符 + string templatePath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx"); if (!global::System.IO.File.Exists(templatePath)) { diff --git a/MES_Model/Services/Plant/IService/IPlantFactorySiteService.cs b/MDM/Services/Plant/IService/IPlantFactorySiteService.cs similarity index 100% rename from MES_Model/Services/Plant/IService/IPlantFactorySiteService.cs rename to MDM/Services/Plant/IService/IPlantFactorySiteService.cs diff --git a/MES_Model/Services/Plant/IService/IPlantProductlinebodyService.cs b/MDM/Services/Plant/IService/IPlantProductlinebodyService.cs similarity index 100% rename from MES_Model/Services/Plant/IService/IPlantProductlinebodyService.cs rename to MDM/Services/Plant/IService/IPlantProductlinebodyService.cs diff --git a/MES_Model/Services/Plant/IService/IPlantWorkshopService.cs b/MDM/Services/Plant/IService/IPlantWorkshopService.cs similarity index 100% rename from MES_Model/Services/Plant/IService/IPlantWorkshopService.cs rename to MDM/Services/Plant/IService/IPlantWorkshopService.cs diff --git a/MES_Model/Services/Plant/IService/IPlantWorkstationService.cs b/MDM/Services/Plant/IService/IPlantWorkstationService.cs similarity index 100% rename from MES_Model/Services/Plant/IService/IPlantWorkstationService.cs rename to MDM/Services/Plant/IService/IPlantWorkstationService.cs diff --git a/MES_Model/Services/Plant/PlantFactorySiteService.cs b/MDM/Services/Plant/PlantFactorySiteService.cs similarity index 100% rename from MES_Model/Services/Plant/PlantFactorySiteService.cs rename to MDM/Services/Plant/PlantFactorySiteService.cs diff --git a/MES_Model/Services/Plant/PlantProductlinebodyService.cs b/MDM/Services/Plant/PlantProductlinebodyService.cs similarity index 100% rename from MES_Model/Services/Plant/PlantProductlinebodyService.cs rename to MDM/Services/Plant/PlantProductlinebodyService.cs diff --git a/MES_Model/Services/Plant/PlantWorkshopService.cs b/MDM/Services/Plant/PlantWorkshopService.cs similarity index 100% rename from MES_Model/Services/Plant/PlantWorkshopService.cs rename to MDM/Services/Plant/PlantWorkshopService.cs diff --git a/MES_Model/Services/Plant/PlantWorkstationService.cs b/MDM/Services/Plant/PlantWorkstationService.cs similarity index 100% rename from MES_Model/Services/Plant/PlantWorkstationService.cs rename to MDM/Services/Plant/PlantWorkstationService.cs diff --git a/MES_Model/Services/Process/IService/IProcessControlStrategyDictService.cs b/MDM/Services/Process/IService/IProcessControlStrategyDictService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessControlStrategyDictService.cs rename to MDM/Services/Process/IService/IProcessControlStrategyDictService.cs diff --git a/MES_Model/Services/Process/IService/IProcessOperationReworkRuleService.cs b/MDM/Services/Process/IService/IProcessOperationReworkRuleService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessOperationReworkRuleService.cs rename to MDM/Services/Process/IService/IProcessOperationReworkRuleService.cs diff --git a/MES_Model/Services/Process/IService/IProcessOperationService.cs b/MDM/Services/Process/IService/IProcessOperationService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessOperationService.cs rename to MDM/Services/Process/IService/IProcessOperationService.cs diff --git a/MES_Model/Services/Process/IService/IProcessOperationTransitionService.cs b/MDM/Services/Process/IService/IProcessOperationTransitionService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessOperationTransitionService.cs rename to MDM/Services/Process/IService/IProcessOperationTransitionService.cs diff --git a/MES_Model/Services/Process/IService/IProcessOprerationTransitionDictService.cs b/MDM/Services/Process/IService/IProcessOprerationTransitionDictService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessOprerationTransitionDictService.cs rename to MDM/Services/Process/IService/IProcessOprerationTransitionDictService.cs diff --git a/MES_Model/Services/Process/IService/IProcessRoutingService.cs b/MDM/Services/Process/IService/IProcessRoutingService.cs similarity index 100% rename from MES_Model/Services/Process/IService/IProcessRoutingService.cs rename to MDM/Services/Process/IService/IProcessRoutingService.cs diff --git a/MES_Model/Services/Process/ProcessControlStrategyDictService.cs b/MDM/Services/Process/ProcessControlStrategyDictService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessControlStrategyDictService.cs rename to MDM/Services/Process/ProcessControlStrategyDictService.cs diff --git a/MES_Model/Services/Process/ProcessOperationReworkRuleService.cs b/MDM/Services/Process/ProcessOperationReworkRuleService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessOperationReworkRuleService.cs rename to MDM/Services/Process/ProcessOperationReworkRuleService.cs diff --git a/MES_Model/Services/Process/ProcessOperationService.cs b/MDM/Services/Process/ProcessOperationService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessOperationService.cs rename to MDM/Services/Process/ProcessOperationService.cs diff --git a/MES_Model/Services/Process/ProcessOperationTransitionService.cs b/MDM/Services/Process/ProcessOperationTransitionService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessOperationTransitionService.cs rename to MDM/Services/Process/ProcessOperationTransitionService.cs diff --git a/MES_Model/Services/Process/ProcessOprerationTransitionDictService.cs b/MDM/Services/Process/ProcessOprerationTransitionDictService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessOprerationTransitionDictService.cs rename to MDM/Services/Process/ProcessOprerationTransitionDictService.cs diff --git a/MES_Model/Services/Process/ProcessRoutingService.cs b/MDM/Services/Process/ProcessRoutingService.cs similarity index 100% rename from MES_Model/Services/Process/ProcessRoutingService.cs rename to MDM/Services/Process/ProcessRoutingService.cs diff --git a/上海干巷总装车间MES.sln b/上海干巷总装车间MES.sln index 343161d..76c5b08 100644 --- a/上海干巷总装车间MES.sln +++ b/上海干巷总装车间MES.sln @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DOAN.CodeGenerator", "DOAN. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DOAN.ServiceCore", "DOAN.ServiceCore\DOAN.ServiceCore.csproj", "{4E2CC4E4-F109-4876-8498-912E13905765}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MDM", "MES_Model\MDM.csproj", "{95026B00-9C87-4175-AAC4-6B46DE5AD2A5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MDM", "MDM\MDM.csproj", "{95026B00-9C87-4175-AAC4-6B46DE5AD2A5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution