物料管理

This commit is contained in:
qianhao.xu 2024-04-26 11:20:39 +08:00
parent 9c77c90f5d
commit 6da6069678
6 changed files with 274 additions and 10 deletions

View File

@ -0,0 +1,109 @@
using Microsoft.AspNetCore.Mvc;
using ZR.Model.Dto;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Service.mes.mm.IService;
using ZR.Model.MES.mm;
//创建时间2024-04-26
namespace ZR.Admin.WebApi.Controllers
{
/// <summary>
/// agv位置表
/// </summary>
[Verify]
[Route("mes/mm/MmAgvLocation")]
public class MmAgvLocationController : BaseController
{
/// <summary>
/// agv位置表接口
/// </summary>
private readonly IMmAgvLocationService _MmAgvLocationService;
public MmAgvLocationController(IMmAgvLocationService MmAgvLocationService)
{
_MmAgvLocationService = MmAgvLocationService;
}
/// <summary>
/// 查询agv位置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:list")]
public IActionResult QueryMmAgvLocation([FromQuery] MmAgvLocationQueryDto parm)
{
var response = _MmAgvLocationService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询agv位置表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:query")]
public IActionResult GetMmAgvLocation(int Id)
{
var response = _MmAgvLocationService.GetInfo(Id);
var info = response.Adapt<MmAgvLocation>();
return SUCCESS(info);
}
/// <summary>
/// 添加agv位置表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:add")]
[Log(Title = "agv位置表", BusinessType = BusinessType.INSERT)]
public IActionResult AddMmAgvLocation([FromBody] MmAgvLocationDto parm)
{
var modal = parm.Adapt<MmAgvLocation>().ToCreate(HttpContext);
var response = _MmAgvLocationService.AddMmAgvLocation(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新agv位置表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:edit")]
[Log(Title = "agv位置表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateMmAgvLocation([FromBody] MmAgvLocationDto parm)
{
var modal = parm.Adapt<MmAgvLocation>().ToUpdate(HttpContext);
var response = _MmAgvLocationService.UpdateMmAgvLocation(modal);
return ToResponse(response);
}
/// <summary>
/// 删除agv位置表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:delete")]
[Log(Title = "agv位置表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteMmAgvLocation(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _MmAgvLocationService.Delete(idsArr);
return ToResponse(response);
}
}
}

View File

@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
namespace ZR.Model.Dto
{
/// <summary>
/// agv位置表查询对象
/// </summary>
public class MmAgvLocationQueryDto : PagerInfo
{
}
/// <summary>
/// agv位置表输入输出对象
/// </summary>
public class MmAgvLocationDto
{
[Required(ErrorMessage = "Id不能为空")]
public int Id { get; set; }
public int? AreaCode { get; set; }
public string Area { get; set; }
public int? Type { get; set; }
public string Coordinate { get; set; }
[Required(ErrorMessage = "状态0无托盘1有托盘2未知不能为空")]
public int Status { get; set; }
public string CreatedBy { get; set; }
public DateTime? CreatedTime { get; set; }
public string UpdatedBy { get; set; }
public DateTime? UpdatedTime { get; set; }
}
}

View File

@ -8,8 +8,8 @@ namespace ZR.Model.MES.mm
/// <summary>
/// agv位置表
/// </summary>
[SugarTable("agv_location")]
public class AgvLocation
[SugarTable("mm_agv_location")]
public class MmAgvLocation
{
/// <summary>
/// Id
@ -17,15 +17,12 @@ namespace ZR.Model.MES.mm
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 区域
/// AreaCode
/// </summary>
[SugarColumn(ColumnName = "area_code")]
[SugarColumn(ColumnName = "area_code")]
public int? AreaCode { get; set; }
/// <summary>
/// 区域
/// </summary>
@ -41,6 +38,11 @@ namespace ZR.Model.MES.mm
/// </summary>
public string Coordinate { get; set; }
/// <summary>
/// 状态0无托盘1有托盘2未知
/// </summary>
public int Status { get; set; }
/// <summary>
/// 创建人
/// </summary>

View File

@ -0,0 +1,24 @@
using System;
using ZR.Model;
using ZR.Model.Dto;
using System.Collections.Generic;
using ZR.Model.MES.mm;
namespace ZR.Service.mes.mm.IService
{
/// <summary>
/// agv位置表service接口
/// </summary>
public interface IMmAgvLocationService : IBaseService<MmAgvLocation>
{
PagedInfo<MmAgvLocationDto> GetList(MmAgvLocationQueryDto parm);
MmAgvLocation GetInfo(int Id);
MmAgvLocation AddMmAgvLocation(MmAgvLocation parm);
int UpdateMmAgvLocation(MmAgvLocation parm);
}
}

View File

@ -18,7 +18,7 @@ using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ZR.Service.mes.mm
{
[AppService(ServiceType = typeof(IMaterialInputService), ServiceLifetime = LifeTime.Transient)]
public class MaterialInputService : BaseService<AgvLocation>, IMaterialInputService
public class MaterialInputService : BaseService<MmAgvLocation>, IMaterialInputService
{
/// <summary>
/// 获取AGV上料起点
@ -26,7 +26,7 @@ namespace ZR.Service.mes.mm
/// <returns></returns>
public string[] Getstart_AGV_points()
{
List<AgvLocation> positions = Context.Queryable<AgvLocation>()
List<MmAgvLocation> positions = Context.Queryable<MmAgvLocation>()
.Where(it => it.AreaCode == 2)
.Where(it => it.Type == 0)
.ToList();
@ -44,7 +44,7 @@ namespace ZR.Service.mes.mm
/// <returns></returns>
public string[] Getend_AGV_points()
{
List<AgvLocation> positions = Context.Queryable<AgvLocation>()
List<MmAgvLocation> positions = Context.Queryable<MmAgvLocation>()
.Where(it => it.AreaCode == 2)
.Where(it => it.Type == 1)
.ToList();

View File

@ -0,0 +1,87 @@
using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.Model;
using ZR.Model.Dto;
using ZR.Repository;
using System.Linq;
using ZR.Model.MES.mm;
using ZR.Service.mes.mm.IService;
namespace ZR.Service.Business
{
/// <summary>
/// agv位置表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IMmAgvLocationService), ServiceLifetime = LifeTime.Transient)]
public class MmAgvLocationService : BaseService<MmAgvLocation>, IMmAgvLocationService
{
/// <summary>
/// 查询agv位置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MmAgvLocationDto> GetList(MmAgvLocationQueryDto parm)
{
var predicate = Expressionable.Create<MmAgvLocation>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<MmAgvLocation, MmAgvLocationDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public MmAgvLocation GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加agv位置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MmAgvLocation AddMmAgvLocation(MmAgvLocation model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改agv位置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateMmAgvLocation(MmAgvLocation model)
{
//var response = Update(w => w.Id == model.Id, it => new MmAgvLocation()
//{
// AreaCode = model.AreaCode,
// Area = model.Area,
// Type = model.Type,
// Coordinate = model.Coordinate,
// Status = model.Status,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}