11
This commit is contained in:
@@ -15,6 +15,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -124,27 +125,28 @@ namespace Tnb.EquipMgr
|
||||
dic.Add("26149312750101", "外协");
|
||||
dic.Add("26149320818965", "维修");
|
||||
List<dynamic> result = new();
|
||||
var BasLocations = await _db.Queryable<ToolLocation>().ToListAsync();
|
||||
var ToolMolds = await _db.Queryable<ToolMolds>()
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.keyword),p=>p.mold_code!.Contains(toolinput.keyword!)|| p.mold_name!.Contains(toolinput.keyword!))
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status== dic.Where(p=>p.Value== toolinput.status).First().Key)
|
||||
.ToListAsync();
|
||||
if (string.IsNullOrEmpty(toolinput.sort))
|
||||
{
|
||||
if(toolinput.sort== "mold_code")
|
||||
ToolMolds= ToolMolds.OrderByDescending(p=>p.mold_code).ToList();
|
||||
{
|
||||
if (toolinput.sort == "mold_code")
|
||||
ToolMolds = ToolMolds.OrderByDescending(p => p.mold_code).ToList();
|
||||
}
|
||||
foreach (var tool in ToolMolds)
|
||||
{
|
||||
dynamic info = new ExpandoObject();
|
||||
info.id=tool.id;
|
||||
info.mold_code=tool.mold_code;
|
||||
info.mold_name = tool.mold_name;
|
||||
info.mold_status= dic.Where(p=>p.Key==tool.mold_status).Any()? dic.Where(p => p.Key == tool.mold_status).First().Value:"";
|
||||
info.warehosue_id=tool.warehosue_id;
|
||||
info.location_id=tool.location_id;
|
||||
info.location_id= BasLocations.Where(p => p.id == tool.location_id).Any() ? BasLocations.Where(p => p.id == tool.location_id).First().location_code : "";
|
||||
result.Add(info);
|
||||
}
|
||||
|
||||
return ToolMolds;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user