Bom修改

This commit is contained in:
quowingwang 2026-01-15 14:51:20 +08:00
parent e570e4164b
commit 6ea2d596f4
4 changed files with 15 additions and 14 deletions

View File

@ -151,7 +151,7 @@ namespace MDM.Controllers.Material
//TODO 导入excel //TODO 导入excel
[HttpPost("importData")] [HttpPost("importData")]
[Log(Title = "物料类型导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)] [Log(Title = "BOM导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)]
[AllowAnonymous] [AllowAnonymous]
public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile) public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile)
{ {

View File

@ -53,7 +53,7 @@ namespace MDM.Model.Plant.Dto
public string? FunctionGroupName { get; set; } public string? FunctionGroupName { get; set; }
public int IsReplaceable { get; set; } public int? IsReplaceable { get; set; }
public string? CreatedBy { get; set; } public string? CreatedBy { get; set; }

View File

@ -156,6 +156,10 @@ namespace MDM.Services.Material
for (int row = 1; row <= sheet.LastRowNum; row++) for (int row = 1; row <= sheet.LastRowNum; row++)
{ {
IRow currentRow = sheet.GetRow(row); IRow currentRow = sheet.GetRow(row);
//目前没加物料是否正确校验
if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空 if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空
{ {
MaterialBom item = new MaterialBom(); MaterialBom item = new MaterialBom();
@ -163,26 +167,23 @@ namespace MDM.Services.Material
if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String) if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String)
item.InvCode = currentRow.GetCell(0).ToString(); 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) if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String)
item.InvName = currentRow.GetCell(1).ToString(); item.InvName = currentRow.GetCell(1).ToString();
//子件编码 //子件编码
if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) if (currentRow.GetCell(2) != null && currentRow.GetCell(2).CellType == CellType.String)
item.SubInvCode = currentRow.GetCell(1).ToString(); item.SubInvCode = currentRow.GetCell(2).ToString();
//子件名称 //子件名称
if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) if (currentRow.GetCell(3) != null && currentRow.GetCell(3).CellType == CellType.String)
item.SubInvName = currentRow.GetCell(1).ToString(); item.SubInvName = currentRow.GetCell(3).ToString();
//使用数量 //使用数量
if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) if (currentRow.GetCell(4) != null && currentRow.GetCell(4).CellType == CellType.String)
item.Iusequantity = currentRow.GetCell(1).ToString(); item.Iusequantity = currentRow.GetCell(4).ToString();
//BOM版本号 //BOM版本号
if (currentRow.GetCell(1) != null && currentRow.GetCell(1).CellType == CellType.String) if (currentRow.GetCell(5) != null && currentRow.GetCell(5).CellType == CellType.String)
item.BOMVersion = currentRow.GetCell(1).ToString(); item.BOMVersion = currentRow.GetCell(5).ToString();
materialBoms.Add(item); materialBoms.Add(item);

View File

@ -31,7 +31,7 @@ namespace MDM.Services.Material
.AndIF(!string.IsNullOrEmpty(parm.Name),it=>it.Name.Contains(parm.Name)) .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.Code),it=>it.Code.Contains(parm.Code))
.AndIF(!string.IsNullOrEmpty(parm.ParentCode),it=>it.ParentCode.Contains(parm.ParentCode)) .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() var response = Queryable()