物料管理:agv
This commit is contained in:
@@ -49,7 +49,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
public IActionResult GetMmAgvLocation(int Id)
|
public IActionResult GetMmAgvLocation(int Id)
|
||||||
{
|
{
|
||||||
var response = _MmAgvLocationService.GetInfo(Id);
|
var response = _MmAgvLocationService.GetInfo(Id);
|
||||||
|
|
||||||
var info = response.Adapt<MmAgvLocation>();
|
var info = response.Adapt<MmAgvLocation>();
|
||||||
return SUCCESS(info);
|
return SUCCESS(info);
|
||||||
}
|
}
|
||||||
@@ -102,8 +102,33 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
return ToResponse(response);
|
return ToResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 区域信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("listAreaOptions")]
|
||||||
|
public IActionResult ListAreaOptions()
|
||||||
|
{
|
||||||
|
var response = _MmAgvLocationService.ListAreaOptions();
|
||||||
|
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet("update_status")]
|
||||||
|
public IActionResult Updatestatus(int index, int status)
|
||||||
|
{
|
||||||
|
if (status == 0)
|
||||||
|
{
|
||||||
|
status = 1;
|
||||||
|
}else if (status == 1)
|
||||||
|
{
|
||||||
|
status = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = _MmAgvLocationService.Updatestatus(index, status);
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ namespace ZR.Model.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MmAgvLocationQueryDto : PagerInfo
|
public class MmAgvLocationQueryDto : PagerInfo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public int areaCode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -20,5 +20,9 @@ namespace ZR.Service.mes.mm.IService
|
|||||||
|
|
||||||
int UpdateMmAgvLocation(MmAgvLocation parm);
|
int UpdateMmAgvLocation(MmAgvLocation parm);
|
||||||
|
|
||||||
|
List<(int,string)> ListAreaOptions();
|
||||||
|
|
||||||
|
int Updatestatus(int index, int status);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ namespace ZR.Service.Business
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PagedInfo<MmAgvLocationDto> GetList(MmAgvLocationQueryDto parm)
|
public PagedInfo<MmAgvLocationDto> GetList(MmAgvLocationQueryDto parm)
|
||||||
{
|
{
|
||||||
var predicate = Expressionable.Create<MmAgvLocation>();
|
var predicate = Expressionable.Create<MmAgvLocation>()
|
||||||
|
.AndIF(parm.areaCode!=0,it=>it.AreaCode==parm.areaCode);
|
||||||
|
|
||||||
var response = Queryable()
|
var response = Queryable()
|
||||||
.Where(predicate.ToExpression())
|
.Where(predicate.ToExpression())
|
||||||
@@ -83,5 +84,41 @@ namespace ZR.Service.Business
|
|||||||
return Update(model, true);
|
return Update(model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取地域选择
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<(int, string)> ListAreaOptions()
|
||||||
|
{
|
||||||
|
// 使用 LINQ 查询获取结果
|
||||||
|
var queryResult = Context.Queryable<MmAgvLocation>()
|
||||||
|
.GroupBy(it => it.AreaCode)
|
||||||
|
.Select(it => new
|
||||||
|
{
|
||||||
|
item1 = it.AreaCode, // 使用 Key 获取分组的键值
|
||||||
|
item2 = SqlFunc.AggregateMax(it.Area), // 聚合 Area 字段的最大值
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// 将匿名对象转换为 List<(int, string)>
|
||||||
|
List<(int, string)> lists = queryResult
|
||||||
|
.Select(item => ((int)item.item1, item.item2))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return lists;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更改状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Updatestatus(int index, int status)
|
||||||
|
{
|
||||||
|
return Context.Updateable<MmAgvLocation>().Where(it=>it.Id==index).SetColumns(it=>it.Status==status).ExecuteCommand();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user