From 6da606967869b6c7ae23a29245c057dcaecb385e Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Fri, 26 Apr 2024 11:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/mm/MmAgvLocationController.cs | 109 ++++++++++++++++++ ZR.Model/MES/mm/Dto/MmAgvLocationDto.cs | 42 +++++++ .../mm/{AgvLocation.cs => MmAgvLocation.cs} | 16 +-- .../mes/mm/IService/IMmAgvLocationService.cs | 24 ++++ ZR.Service/mes/mm/MaterialInputService.cs | 6 +- ZR.Service/mes/mm/MmAgvLocationService.cs | 87 ++++++++++++++ 6 files changed, 274 insertions(+), 10 deletions(-) create mode 100644 ZR.Admin.WebApi/Controllers/mes/mm/MmAgvLocationController.cs create mode 100644 ZR.Model/MES/mm/Dto/MmAgvLocationDto.cs rename ZR.Model/MES/mm/{AgvLocation.cs => MmAgvLocation.cs} (83%) create mode 100644 ZR.Service/mes/mm/IService/IMmAgvLocationService.cs create mode 100644 ZR.Service/mes/mm/MmAgvLocationService.cs diff --git a/ZR.Admin.WebApi/Controllers/mes/mm/MmAgvLocationController.cs b/ZR.Admin.WebApi/Controllers/mes/mm/MmAgvLocationController.cs new file mode 100644 index 00000000..46cb061d --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/mm/MmAgvLocationController.cs @@ -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 +{ + /// + /// agv位置表 + /// + [Verify] + [Route("mes/mm/MmAgvLocation")] + public class MmAgvLocationController : BaseController + { + /// + /// agv位置表接口 + /// + private readonly IMmAgvLocationService _MmAgvLocationService; + + public MmAgvLocationController(IMmAgvLocationService MmAgvLocationService) + { + _MmAgvLocationService = MmAgvLocationService; + } + + /// + /// 查询agv位置表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:list")] + public IActionResult QueryMmAgvLocation([FromQuery] MmAgvLocationQueryDto parm) + { + var response = _MmAgvLocationService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询agv位置表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:query")] + public IActionResult GetMmAgvLocation(int Id) + { + var response = _MmAgvLocationService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加agv位置表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:add")] + [Log(Title = "agv位置表", BusinessType = BusinessType.INSERT)] + public IActionResult AddMmAgvLocation([FromBody] MmAgvLocationDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _MmAgvLocationService.AddMmAgvLocation(modal); + + return SUCCESS(response); + } + + /// + /// 更新agv位置表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:edit")] + [Log(Title = "agv位置表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateMmAgvLocation([FromBody] MmAgvLocationDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _MmAgvLocationService.UpdateMmAgvLocation(modal); + + return ToResponse(response); + } + + /// + /// 删除agv位置表 + /// + /// + [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); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/mm/Dto/MmAgvLocationDto.cs b/ZR.Model/MES/mm/Dto/MmAgvLocationDto.cs new file mode 100644 index 00000000..365a8910 --- /dev/null +++ b/ZR.Model/MES/mm/Dto/MmAgvLocationDto.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.Dto +{ + /// + /// agv位置表查询对象 + /// + public class MmAgvLocationQueryDto : PagerInfo + { + } + + /// + /// agv位置表输入输出对象 + /// + 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; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/mm/AgvLocation.cs b/ZR.Model/MES/mm/MmAgvLocation.cs similarity index 83% rename from ZR.Model/MES/mm/AgvLocation.cs rename to ZR.Model/MES/mm/MmAgvLocation.cs index 91d60bf7..e6e75d9b 100644 --- a/ZR.Model/MES/mm/AgvLocation.cs +++ b/ZR.Model/MES/mm/MmAgvLocation.cs @@ -8,8 +8,8 @@ namespace ZR.Model.MES.mm /// /// agv位置表 /// - [SugarTable("agv_location")] - public class AgvLocation + [SugarTable("mm_agv_location")] + public class MmAgvLocation { /// /// Id @@ -17,15 +17,12 @@ namespace ZR.Model.MES.mm [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } - /// - /// 区域 + /// AreaCode /// - [SugarColumn(ColumnName = "area_code")] + [SugarColumn(ColumnName = "area_code")] public int? AreaCode { get; set; } - - /// /// 区域 /// @@ -41,6 +38,11 @@ namespace ZR.Model.MES.mm /// public string Coordinate { get; set; } + /// + /// 状态(0,无托盘,1有托盘,2未知) + /// + public int Status { get; set; } + /// /// 创建人 /// diff --git a/ZR.Service/mes/mm/IService/IMmAgvLocationService.cs b/ZR.Service/mes/mm/IService/IMmAgvLocationService.cs new file mode 100644 index 00000000..bf7ef14d --- /dev/null +++ b/ZR.Service/mes/mm/IService/IMmAgvLocationService.cs @@ -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 +{ + /// + /// agv位置表service接口 + /// + public interface IMmAgvLocationService : IBaseService + { + PagedInfo GetList(MmAgvLocationQueryDto parm); + + MmAgvLocation GetInfo(int Id); + + MmAgvLocation AddMmAgvLocation(MmAgvLocation parm); + + int UpdateMmAgvLocation(MmAgvLocation parm); + + } +} diff --git a/ZR.Service/mes/mm/MaterialInputService.cs b/ZR.Service/mes/mm/MaterialInputService.cs index 23ddda4e..67e4915e 100644 --- a/ZR.Service/mes/mm/MaterialInputService.cs +++ b/ZR.Service/mes/mm/MaterialInputService.cs @@ -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, IMaterialInputService + public class MaterialInputService : BaseService, IMaterialInputService { /// /// 获取AGV上料起点 @@ -26,7 +26,7 @@ namespace ZR.Service.mes.mm /// public string[] Getstart_AGV_points() { - List positions = Context.Queryable() + List positions = Context.Queryable() .Where(it => it.AreaCode == 2) .Where(it => it.Type == 0) .ToList(); @@ -44,7 +44,7 @@ namespace ZR.Service.mes.mm /// public string[] Getend_AGV_points() { - List positions = Context.Queryable() + List positions = Context.Queryable() .Where(it => it.AreaCode == 2) .Where(it => it.Type == 1) .ToList(); diff --git a/ZR.Service/mes/mm/MmAgvLocationService.cs b/ZR.Service/mes/mm/MmAgvLocationService.cs new file mode 100644 index 00000000..bcfaa660 --- /dev/null +++ b/ZR.Service/mes/mm/MmAgvLocationService.cs @@ -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 +{ + /// + /// agv位置表Service业务层处理 + /// + [AppService(ServiceType = typeof(IMmAgvLocationService), ServiceLifetime = LifeTime.Transient)] + public class MmAgvLocationService : BaseService, IMmAgvLocationService + { + /// + /// 查询agv位置表列表 + /// + /// + /// + public PagedInfo GetList(MmAgvLocationQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public MmAgvLocation GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加agv位置表 + /// + /// + /// + public MmAgvLocation AddMmAgvLocation(MmAgvLocation model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改agv位置表 + /// + /// + /// + 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); + } + + } +} \ No newline at end of file