diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs new file mode 100644 index 00000000..340450d9 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs @@ -0,0 +1,111 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; + +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms.Dto; +using ZR.Model.MES.wms; + +//创建时间:2024-03-17 +namespace ZR.Admin.WebApi.Controllers.mes.wms +{ + /// + /// 客户信息 + /// + [Verify] + [Route("/mes/wm/WmCustom")] + public class WmCustomController : BaseController + { + /// + /// 客户信息接口 + /// + private readonly IWmCustomService _WmCustomService; + + public WmCustomController(IWmCustomService WmCustomService) + { + _WmCustomService = WmCustomService; + } + + /// + /// 查询客户信息列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:list")] + public IActionResult QueryWmCustom([FromQuery] WmCustomQueryDto parm) + { + var response = _WmCustomService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询客户信息详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:query")] + public IActionResult GetWmCustom(int Id) + { + var response = _WmCustomService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加客户信息 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:add")] + [Log(Title = "客户信息", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmCustom([FromBody] WmCustomDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmCustomService.AddWmCustom(modal); + + return SUCCESS(response); + } + + /// + /// 更新客户信息 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:edit")] + [Log(Title = "客户信息", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmCustom([FromBody] WmCustomDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmCustomService.UpdateWmCustom(modal); + + return ToResponse(response); + } + + /// + /// 删除客户信息 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:delete")] + [Log(Title = "客户信息", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmCustom(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _WmCustomService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-客户信息-0317153123.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-客户信息-0317153123.zip new file mode 100644 index 00000000..73777ba7 Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-客户信息-0317153123.zip differ diff --git a/ZR.Model/MES/wms/Dto/WmCustomDto.cs b/ZR.Model/MES/wms/Dto/WmCustomDto.cs new file mode 100644 index 00000000..69fa44d8 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmCustomDto.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 客户信息查询对象 + /// + public class WmCustomQueryDto : PagerInfo + { + public string CustomNo { get; set; } + + public string CustomName { get; set; } + } + + /// + /// 客户信息输入输出对象 + /// + public class WmCustomDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + public string CustomNo { get; set; } + + public string CustomName { get; set; } + + public string CustomAddress { 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/Dto/WmMaterialDto.cs b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs index b007e34d..630e54aa 100644 --- a/ZR.Model/MES/wms/Dto/WmMaterialDto.cs +++ b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs @@ -5,8 +5,47 @@ namespace ZR.Model.MES.wms.Dto /// /// 物料记录表查询对象 /// - public class WmMaterialQueryDto : PagerInfo + public class WmMaterialQueryDto : PagerInfo { + + + public string Id { get; set; } + + public string Partnumber { get; set; } + + public string U8InventoryCode { get; set; } + + public string BlankNum { get; set; } + + public string Unit { get; set; } + + public string ProductName { get; set; } + + public string Color { get; set; } + + public string Specification { get; set; } + + public string Description { get; set; } + + public string Version { get; set; } + + public string Remarks { get; set; } + + public int? Sort { get; set; } + + public string Search1 { get; set; } + + public string Search2 { get; set; } + + 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; } } /// diff --git a/ZR.Model/MES/wms/WmCustom.cs b/ZR.Model/MES/wms/WmCustom.cs index 8ae834c5..be91ec97 100644 --- a/ZR.Model/MES/wms/WmCustom.cs +++ b/ZR.Model/MES/wms/WmCustom.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using SqlSugar; @@ -6,54 +6,62 @@ namespace ZR.Model.MES.wms { /// /// 客户信息 - /// + /// [SugarTable("wm_custom")] public class WmCustom { /// /// 主键 - /// - [SugarColumn(ColumnName="id" ,IsPrimaryKey = true ,IsIdentity = true )] - public int Id { get; set; } + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + /// /// 客户代码 - /// - [SugarColumn(ColumnName="custom_no" )] - public string CustomNo { get; set; } + /// + [SugarColumn(ColumnName = "custom_no")] + public string CustomNo { get; set; } + /// /// 客户名称 - /// - [SugarColumn(ColumnName="custom_name" )] - public string CustomName { get; set; } + /// + [SugarColumn(ColumnName = "custom_name")] + public string CustomName { get; set; } + /// /// 客户地址 - /// - [SugarColumn(ColumnName="custom_address" )] - public string CustomAddress { get; set; } + /// + [SugarColumn(ColumnName = "custom_address")] + public string CustomAddress { get; set; } + /// /// 备注 - /// - [SugarColumn(ColumnName="remark" )] - public string Remark { get; set; } + /// + public string Remark { get; set; } + /// /// 创建人 - /// - [SugarColumn(ColumnName="CREATED_BY" )] - public string CreatedBy { get; set; } + /// + [SugarColumn(ColumnName = "cREATED_BY")] + public string CreatedBy { get; set; } + /// /// 创建时间 - /// - [SugarColumn(ColumnName="CREATED_TIME" )] - public DateTime? CreatedTime { get; set; } + /// + [SugarColumn(ColumnName = "cREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// /// 更新人 - /// - [SugarColumn(ColumnName="UPDATED_BY" )] - public string UpdatedBy { get; set; } + /// + [SugarColumn(ColumnName = "uPDATED_BY")] + public string UpdatedBy { get; set; } + /// /// 更新时间 - /// - [SugarColumn(ColumnName="UPDATED_TIME" )] - public DateTime? UpdatedTime { 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/IWmCustomService.cs b/ZR.Service/mes/wms/IService/IWmCustomService.cs new file mode 100644 index 00000000..af900888 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmCustomService.cs @@ -0,0 +1,25 @@ +using System; +using ZR.Model; +using ZR.Model.Dto; + +using System.Collections.Generic; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.mes.wms.IService +{ + /// + /// 客户信息service接口 + /// + public interface IWmCustomService : IBaseService + { + PagedInfo GetList(WmCustomQueryDto parm); + + WmCustom GetInfo(int Id); + + WmCustom AddWmCustom(WmCustom parm); + + int UpdateWmCustom(WmCustom parm); + + } +} diff --git a/ZR.Service/mes/wms/WmCustomService.cs b/ZR.Service/mes/wms/WmCustomService.cs new file mode 100644 index 00000000..c466d777 --- /dev/null +++ b/ZR.Service/mes/wms/WmCustomService.cs @@ -0,0 +1,91 @@ +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.Service.mes.wms.IService; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.mes.wms +{ + + /// + /// 客户信息Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmCustomService), ServiceLifetime = LifeTime.Transient)] + public class WmCustomService : BaseService, IWmCustomService + { + /// + /// 查询客户信息列表 + /// + /// + /// + public PagedInfo GetList(WmCustomQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.CustomNo), it => it.CustomNo.Contains(parm.CustomNo)) + .AndIF(!string.IsNullOrEmpty(parm.CustomName), it => it.CustomName.Contains(parm.CustomName)); + + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmCustom GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加客户信息 + /// + /// + /// + public WmCustom AddWmCustom(WmCustom model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改客户信息 + /// + /// + /// + public int UpdateWmCustom(WmCustom model) + { + //var response = Update(w => w.Id == model.Id, it => new WmCustom() + //{ + // CustomNo = model.CustomNo, + // CustomName = model.CustomName, + // CustomAddress = model.CustomAddress, + // Remark = model.Remark, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/wms/WmMaterialService.cs b/ZR.Service/mes/wms/WmMaterialService.cs index bcecf225..e844ea36 100644 --- a/ZR.Service/mes/wms/WmMaterialService.cs +++ b/ZR.Service/mes/wms/WmMaterialService.cs @@ -27,11 +27,21 @@ namespace ZR.Service.mes.wms /// public PagedInfo GetList(WmMaterialQueryDto parm) { - var predicate = Expressionable.Create(); + var predicate = Expressionable.Create() + .AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber)) + .AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode)) + .AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName)) + .AndIF(parm.Color != null, it => it.Color.Contains(parm.Color)) + .AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification)) + .AndIF(parm.Description != null, it => it.Description.Contains(parm.Description)) + .AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1)) + .AndIF(parm.Status > -1, it => it.Status == parm.Status); + var response = Queryable() - .Where(predicate.ToExpression()) + .Where(predicate.ToExpression()).OrderByDescending(it=>it.CreatedTime) .ToPage(parm); + return response; }