From 6ea2d596f4ee2d022887aabffd176acc93f5f0bd Mon Sep 17 00:00:00 2001 From: quowingwang Date: Thu, 15 Jan 2026 14:51:20 +0800 Subject: [PATCH] =?UTF-8?q?Bom=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Material/MaterialBomController.cs | 2 +- MDM/Models/Plant/Dto/PlantWorkstationDto.cs | 2 +- MDM/Services/Material/MaterialBomService.cs | 23 ++++++++++--------- MDM/Services/Material/MaterialTypeService.cs | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/MDM/Controllers/Material/MaterialBomController.cs b/MDM/Controllers/Material/MaterialBomController.cs index d6aaf57..19d4d0b 100644 --- a/MDM/Controllers/Material/MaterialBomController.cs +++ b/MDM/Controllers/Material/MaterialBomController.cs @@ -151,7 +151,7 @@ namespace MDM.Controllers.Material //TODO 导入excel [HttpPost("importData")] - [Log(Title = "物料类型导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)] + [Log(Title = "BOM导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)] [AllowAnonymous] public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile) { diff --git a/MDM/Models/Plant/Dto/PlantWorkstationDto.cs b/MDM/Models/Plant/Dto/PlantWorkstationDto.cs index 42c67b5..d4d4452 100644 --- a/MDM/Models/Plant/Dto/PlantWorkstationDto.cs +++ b/MDM/Models/Plant/Dto/PlantWorkstationDto.cs @@ -53,7 +53,7 @@ namespace MDM.Model.Plant.Dto public string? FunctionGroupName { get; set; } - public int IsReplaceable { get; set; } + public int? IsReplaceable { get; set; } public string? CreatedBy { get; set; } diff --git a/MDM/Services/Material/MaterialBomService.cs b/MDM/Services/Material/MaterialBomService.cs index 4b187eb..0efee32 100644 --- a/MDM/Services/Material/MaterialBomService.cs +++ b/MDM/Services/Material/MaterialBomService.cs @@ -156,6 +156,10 @@ namespace MDM.Services.Material for (int row = 1; row <= sheet.LastRowNum; row++) { IRow currentRow = sheet.GetRow(row); + //目前没加物料是否正确校验 + + + if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空 { MaterialBom item = new MaterialBom(); @@ -163,26 +167,23 @@ namespace MDM.Services.Material if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String) item.InvCode = currentRow.GetCell(0).ToString(); //母件名称 - if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) - item.InvName = currentRow.GetCell(1).ToString(); - //母件名称 if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) item.InvName = currentRow.GetCell(1).ToString(); //子件编码 - if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) - item.SubInvCode = currentRow.GetCell(1).ToString(); + if (currentRow.GetCell(2) != null && currentRow.GetCell(2).CellType == CellType.String) + item.SubInvCode = currentRow.GetCell(2).ToString(); //子件名称 - if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) - item.SubInvName = currentRow.GetCell(1).ToString(); + if (currentRow.GetCell(3) != null && currentRow.GetCell(3).CellType == CellType.String) + item.SubInvName = currentRow.GetCell(3).ToString(); //使用数量 - if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) - item.Iusequantity = currentRow.GetCell(1).ToString(); + if (currentRow.GetCell(4) != null && currentRow.GetCell(4).CellType == CellType.String) + item.Iusequantity = currentRow.GetCell(4).ToString(); //BOM版本号 - if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) - item.BOMVersion = currentRow.GetCell(1).ToString(); + if (currentRow.GetCell(5) != null && currentRow.GetCell(5).CellType == CellType.String) + item.BOMVersion = currentRow.GetCell(5).ToString(); materialBoms.Add(item); diff --git a/MDM/Services/Material/MaterialTypeService.cs b/MDM/Services/Material/MaterialTypeService.cs index 265dd1d..a18d0e7 100644 --- a/MDM/Services/Material/MaterialTypeService.cs +++ b/MDM/Services/Material/MaterialTypeService.cs @@ -31,7 +31,7 @@ namespace MDM.Services.Material .AndIF(!string.IsNullOrEmpty(parm.Name),it=>it.Name.Contains(parm.Name)) .AndIF(!string.IsNullOrEmpty(parm.Code),it=>it.Code.Contains(parm.Code)) .AndIF(!string.IsNullOrEmpty(parm.ParentCode),it=>it.ParentCode.Contains(parm.ParentCode)) - .AndIF(parm.Status!=null,it=>it.Status==parm.Status) + //.AndIF(parm.Status!=null,it=>it.Status==parm.Status) ; var response = Queryable()