修改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
{
[Required(ErrorMessage = "雪花id不能为空")]
public int Id { get; set; }
public string Id { get; set; }
public string? InvCode { get; set; }

View File

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

View File

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

View File

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

View File

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