修改BUG

This commit is contained in:
quowingwang 2026-01-23 21:05:58 +08:00
parent 96abcd2232
commit 79d4c95be1
5 changed files with 8 additions and 7 deletions

View File

@ -18,7 +18,7 @@ namespace MDM.Model.Material.Dto
public class MaterialBomDto public class MaterialBomDto
{ {
[Required(ErrorMessage = "雪花id不能为空")] [Required(ErrorMessage = "雪花id不能为空")]
public int Id { get; set; } public string Id { get; set; }
public string? InvCode { get; set; } public string? InvCode { get; set; }

View File

@ -21,7 +21,7 @@ namespace MDM.Model.Material.Dto
public class MaterialListDto public class MaterialListDto
{ {
[Required(ErrorMessage = "雪花id不能为空")] [Required(ErrorMessage = "雪花id不能为空")]
public int Id { get; set; } public string Id { get; set; }
public string? FkMaterialTypeCode { get; set; } public string? FkMaterialTypeCode { get; set; }

View File

@ -63,7 +63,7 @@ namespace MDM.Model.Material
/// CreatedTime /// CreatedTime
/// </summary> /// </summary>
[SugarColumn(ColumnName = "created_time")] [SugarColumn(ColumnName = "created_time")]
public DateTime? CreatedTime { get; set; } public DateTime CreatedTime { get; set; }
/// <summary> /// <summary>
/// UpdatedBy /// UpdatedBy

View File

@ -68,12 +68,12 @@ namespace MDM.Services.Material
Iusequantity = SqlFunc.AggregateMax(it.Iusequantity), Iusequantity = SqlFunc.AggregateMax(it.Iusequantity),
BOMVersion = SqlFunc.AggregateMax(it.BOMVersion), BOMVersion = SqlFunc.AggregateMax(it.BOMVersion),
CreatedBy = SqlFunc.AggregateMax(it.CreatedBy), CreatedBy = SqlFunc.AggregateMax(it.CreatedBy),
CreatedTime = SqlFunc.AggregateMax(it.CreatedTime), //CreatedTime = SqlFunc.AggregateMax(it.CreatedTime),
UpdatedBy = SqlFunc.AggregateMax(it.UpdatedBy), UpdatedBy = SqlFunc.AggregateMax(it.UpdatedBy),
UpdatedTime = SqlFunc.AggregateMax(it.UpdatedTime) UpdatedTime = SqlFunc.AggregateMax(it.UpdatedTime)
}).OrderBy("created_time DESC"); // 核心修复:手动指定数据库列名排序; }).OrderBy(it => SqlFunc.AggregateMax(it.CreatedTime), OrderByType.Desc);
var response = query.ToPage<MaterialBomDto, MaterialBomDto>(parm); var response = query.ToPage<MaterialBomDto, MaterialBomDto>(parm);
@ -157,10 +157,10 @@ namespace MDM.Services.Material
//目前没加物料是否正确校验 //目前没加物料是否正确校验
if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空 if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空
{ {
MaterialBom item = new MaterialBom(); MaterialBom item = new MaterialBom();
item.Id = XueHua;
//母件编码 //母件编码
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();

View File

@ -109,7 +109,7 @@ namespace MDM.Services.Material
try try
{ {
IWorkbook workbook = new XSSFWorkbook(stream); IWorkbook workbook = new XSSFWorkbook(stream);
ISheet sheet = workbook.GetSheet("物料类型"); ISheet sheet = workbook.GetSheet("物料台账");
List<MaterialList> materialLists = new List<MaterialList>(); List<MaterialList> materialLists = new List<MaterialList>();
// 遍历每一行 // 遍历每一行
for (int row = 1; row <= sheet.LastRowNum; row++) for (int row = 1; row <= sheet.LastRowNum; row++)
@ -118,6 +118,7 @@ namespace MDM.Services.Material
if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空 if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空
{ {
MaterialList item = new MaterialList(); MaterialList item = new MaterialList();
item.Id = XueHua;
//物料类型code //物料类型code
if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String) if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String)
item.FkMaterialTypeCode = currentRow.GetCell(0).ToString(); item.FkMaterialTypeCode = currentRow.GetCell(0).ToString();