From 4fdd6272a736c43171ab349e7345986fdcb3d070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Thu, 10 Oct 2024 17:38:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=9B=E5=85=89=E4=BB=93=E5=BA=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/wms/WmPolishWarehouseController.cs | 107 ++++++++++++++++++ ZR.Model/MES/wms/Dto/WmPolishWarehouseDto.cs | 48 ++++++++ ZR.Model/MES/wms/WmPolishWarehouse.cs | 82 ++++++++++++++ .../wms/IService/IWmPolishWarehouseService.cs | 20 ++++ .../mes/wms/WmPolishWarehouseService.cs | 85 ++++++++++++++ 5 files changed, 342 insertions(+) create mode 100644 ZR.Admin.WebApi/Controllers/mes/wms/WmPolishWarehouseController.cs create mode 100644 ZR.Model/MES/wms/Dto/WmPolishWarehouseDto.cs create mode 100644 ZR.Model/MES/wms/WmPolishWarehouse.cs create mode 100644 ZR.Service/mes/wms/IService/IWmPolishWarehouseService.cs create mode 100644 ZR.Service/mes/wms/WmPolishWarehouseService.cs diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmPolishWarehouseController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmPolishWarehouseController.cs new file mode 100644 index 00000000..0a09fe73 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmPolishWarehouseController.cs @@ -0,0 +1,107 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.Business.IBusinessService; + +//创建时间:2024-10-10 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 三楼抛光仓库 + /// + [Verify] + [Route("/mes/wm/WmPolishWarehouse")] + public class WmPolishWarehouseController : BaseController + { + /// + /// 三楼抛光仓库接口 + /// + private readonly IWmPolishWarehouseService _WmPolishWarehouseService; + + public WmPolishWarehouseController(IWmPolishWarehouseService WmPolishWarehouseService) + { + _WmPolishWarehouseService = WmPolishWarehouseService; + } + + /// + /// 查询三楼抛光仓库列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:wmpolishwarehouse:list")] + public IActionResult QueryWmPolishWarehouse([FromQuery] WmPolishWarehouseQueryDto parm) + { + var response = _WmPolishWarehouseService.GetList(parm); + return SUCCESS(response); + } + + /// + /// 查询三楼抛光仓库详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "business:wmpolishwarehouse:query")] + public IActionResult GetWmPolishWarehouse(int Id) + { + var response = _WmPolishWarehouseService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加三楼抛光仓库 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:wmpolishwarehouse:add")] + [Log(Title = "三楼抛光仓库", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmPolishWarehouse([FromBody] WmPolishWarehouseDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmPolishWarehouseService.AddWmPolishWarehouse(modal); + + return SUCCESS(response); + } + + /// + /// 更新三楼抛光仓库 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:wmpolishwarehouse:edit")] + [Log(Title = "三楼抛光仓库", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmPolishWarehouse([FromBody] WmPolishWarehouseDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmPolishWarehouseService.UpdateWmPolishWarehouse(modal); + + return ToResponse(response); + } + + /// + /// 删除三楼抛光仓库 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:wmpolishwarehouse:delete")] + [Log(Title = "三楼抛光仓库", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmPolishWarehouse(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) + { + return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); + } + + var response = _WmPolishWarehouseService.Delete(idsArr); + + return ToResponse(response); + } + } +} diff --git a/ZR.Model/MES/wms/Dto/WmPolishWarehouseDto.cs b/ZR.Model/MES/wms/Dto/WmPolishWarehouseDto.cs new file mode 100644 index 00000000..426afbc2 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmPolishWarehouseDto.cs @@ -0,0 +1,48 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 三楼抛光仓库查询对象 + /// + public class WmPolishWarehouseQueryDto : PagerInfo + { + public string Location { get; set; } + public string Remark { get; set; } + } + + /// + /// 三楼抛光仓库输入输出对象 + /// + public class WmPolishWarehouseDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + [Required(ErrorMessage = "库位不能为空")] + public string Location { get; set; } + + public int? PartCapacity { get; set; } + + public int? TankCapacity { get; set; } + + public int? BuildCapacity { get; set; } + + public int? BoxPartNum { get; set; } + + public string StorePartList { get; set; } + + public string Remark { 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/wms/WmPolishWarehouse.cs b/ZR.Model/MES/wms/WmPolishWarehouse.cs new file mode 100644 index 00000000..996239c1 --- /dev/null +++ b/ZR.Model/MES/wms/WmPolishWarehouse.cs @@ -0,0 +1,82 @@ + +namespace ZR.Model.MES.wms +{ + /// + /// 三楼抛光仓库 + /// + [SugarTable("wm_polish_warehouse")] + public class WmPolishWarehouse + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 库位 + /// + public string Location { get; set; } + + /// + /// 零件容量 + /// + [SugarColumn(ColumnName = "part_capacity")] + public int? PartCapacity { get; set; } + + /// + /// 箱容量 + /// + [SugarColumn(ColumnName = "tank_capacity")] + public int? TankCapacity { get; set; } + + /// + /// 每幢容量 + /// + [SugarColumn(ColumnName = "build_capacity")] + public int? BuildCapacity { get; set; } + + /// + /// 一箱产品数 + /// + [SugarColumn(ColumnName = "box_part_num")] + public int? BoxPartNum { get; set; } + + /// + /// 库描述 + /// + [SugarColumn(ColumnName = "remark")] + public string Remark { get; set; } + + /// + /// 存放产品描述 + /// + [SugarColumn(ColumnName = "store_part_list")] + public string StorePartList { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "cREATED_BY")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "cREATED_TIME")] + public DateTime? CreatedTime { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "uPDATED_BY")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "uPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/wms/IService/IWmPolishWarehouseService.cs b/ZR.Service/mes/wms/IService/IWmPolishWarehouseService.cs new file mode 100644 index 00000000..144c93ea --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmPolishWarehouseService.cs @@ -0,0 +1,20 @@ +using ZR.Model; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.Business.IBusinessService +{ + /// + /// 三楼抛光仓库service接口 + /// + public interface IWmPolishWarehouseService : IBaseService + { + PagedInfo GetList(WmPolishWarehouseQueryDto parm); + + WmPolishWarehouse GetInfo(int Id); + + WmPolishWarehouse AddWmPolishWarehouse(WmPolishWarehouse parm); + + int UpdateWmPolishWarehouse(WmPolishWarehouse parm); + } +} diff --git a/ZR.Service/mes/wms/WmPolishWarehouseService.cs b/ZR.Service/mes/wms/WmPolishWarehouseService.cs new file mode 100644 index 00000000..8eddb660 --- /dev/null +++ b/ZR.Service/mes/wms/WmPolishWarehouseService.cs @@ -0,0 +1,85 @@ +using Infrastructure.Attribute; +using SqlSugar; +using ZR.Model; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Repository; +using ZR.Service.Business.IBusinessService; + +namespace ZR.Service.mes.wms +{ + /// + /// 三楼抛光仓库Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmPolishWarehouseService), ServiceLifetime = LifeTime.Transient)] + public class WmPolishWarehouseService : BaseService, IWmPolishWarehouseService + { + /// + /// 查询三楼抛光仓库列表 + /// + /// + /// + public PagedInfo GetList(WmPolishWarehouseQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.Location),it=>it.Location.Contains(parm.Location)) + .AndIF(!string.IsNullOrEmpty(parm.Remark), it => it.Remark.Contains(parm.Remark)); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmPolishWarehouse GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加三楼抛光仓库 + /// + /// + /// + public WmPolishWarehouse AddWmPolishWarehouse(WmPolishWarehouse model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改三楼抛光仓库 + /// + /// + /// + public int UpdateWmPolishWarehouse(WmPolishWarehouse model) + { + //var response = Update(w => w.Id == model.Id, it => new WmPolishWarehouse() + //{ + // Location = model.Location, + // PartCapacity = model.PartCapacity, + // TankCapacity = model.TankCapacity, + // BuildCapacity = model.BuildCapacity, + // BoxPartNum = model.BoxPartNum, + // StorePartList = model.StorePartList, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file