diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs new file mode 100644 index 00000000..0b47c870 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs @@ -0,0 +1,110 @@ +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-03-26 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 盘点记录 + /// + [Verify] + [Route("/mes/wm//WmCheckLog")] + public class WmCheckLogController : BaseController + { + /// + /// 盘点记录接口 + /// + private readonly IWmCheckLogService _WmCheckLogService; + + public WmCheckLogController(IWmCheckLogService WmCheckLogService) + { + _WmCheckLogService = WmCheckLogService; + } + + /// + /// 查询盘点记录列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:wmchecklog:list")] + public IActionResult QueryWmCheckLog([FromQuery] WmCheckLogQueryDto parm) + { + var response = _WmCheckLogService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询盘点记录详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "business:wmchecklog:query")] + public IActionResult GetWmCheckLog(int Id) + { + var response = _WmCheckLogService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加盘点记录 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:wmchecklog:add")] + [Log(Title = "盘点记录", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmCheckLog([FromBody] WmCheckLogDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmCheckLogService.AddWmCheckLog(modal); + + return SUCCESS(response); + } + + /// + /// 更新盘点记录 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:wmchecklog:edit")] + [Log(Title = "盘点记录", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmCheckLog([FromBody] WmCheckLogDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmCheckLogService.UpdateWmCheckLog(modal); + + return ToResponse(response); + } + + /// + /// 删除盘点记录 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:wmchecklog:delete")] + [Log(Title = "盘点记录", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmCheckLog(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _WmCheckLogService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs b/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs new file mode 100644 index 00000000..de222317 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs @@ -0,0 +1,46 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 盘点记录查询对象 + /// + public class WmCheckLogQueryDto : PagerInfo + { + } + + /// + /// 盘点记录输入输出对象 + /// + public class WmCheckLogDto + { + public int? Id { get; set; } + + public string FkGoodsNowProduction { get; set; } + + public string Partnumber { get; set; } + + public string PackageCodeClient { get; set; } + + public decimal OldValue { get; set; } + + public decimal NewValue { get; set; } + + public int? Type { get; set; } + + public decimal Value { 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/WmCheckLog.cs b/ZR.Model/MES/wms/WmCheckLog.cs new file mode 100644 index 00000000..3048eedd --- /dev/null +++ b/ZR.Model/MES/wms/WmCheckLog.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 盘点记录 + /// + [SugarTable("wm_check_log")] + public class WmCheckLog + { + /// + /// 主键 + /// + public int? Id { get; set; } + + /// + /// 成品库主键id + /// + [SugarColumn(ColumnName = "fk_goods_now_production")] + public string FkGoodsNowProduction { get; set; } + + /// + /// 零件号 + /// + public string Partnumber { get; set; } + + /// + /// 批次号 + /// + [SugarColumn(ColumnName = "package_code_client")] + public string PackageCodeClient { get; set; } + + /// + /// 原数值 + /// + [SugarColumn(ColumnName = "old_value")] + public decimal OldValue { get; set; } + + /// + /// 修改后 + /// + [SugarColumn(ColumnName = "new_value")] + public decimal NewValue { get; set; } + + /// + /// 修改类型;1-添加2-减少 + /// + public int? Type { get; set; } + + /// + /// 修改数值 + /// + public decimal Value { get; set; } + + /// + /// 备注 + /// + public string Remark { 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/IWmCheckLogService.cs b/ZR.Service/mes/wms/IService/IWmCheckLogService.cs new file mode 100644 index 00000000..2bc42c6f --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmCheckLogService.cs @@ -0,0 +1,24 @@ +using System; +using ZR.Model; + +using System.Collections.Generic; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.Business.IBusinessService +{ + /// + /// 盘点记录service接口 + /// + public interface IWmCheckLogService : IBaseService + { + PagedInfo GetList(WmCheckLogQueryDto parm); + + WmCheckLog GetInfo(int Id); + + WmCheckLog AddWmCheckLog(WmCheckLog parm); + + int UpdateWmCheckLog(WmCheckLog parm); + + } +} diff --git a/ZR.Service/mes/wms/WmCheckLogService.cs b/ZR.Service/mes/wms/WmCheckLogService.cs new file mode 100644 index 00000000..46b6c819 --- /dev/null +++ b/ZR.Service/mes/wms/WmCheckLogService.cs @@ -0,0 +1,89 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; + +using ZR.Repository; +using ZR.Service.Business.IBusinessService; +using System.Linq; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.Business +{ + /// + /// 盘点记录Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmCheckLogService), ServiceLifetime = LifeTime.Transient)] + public class WmCheckLogService : BaseService, IWmCheckLogService + { + /// + /// 查询盘点记录列表 + /// + /// + /// + public PagedInfo GetList(WmCheckLogQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmCheckLog GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加盘点记录 + /// + /// + /// + public WmCheckLog AddWmCheckLog(WmCheckLog model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改盘点记录 + /// + /// + /// + public int UpdateWmCheckLog(WmCheckLog model) + { + //var response = Update(w => w.Id == model.Id, it => new WmCheckLog() + //{ + // FkGoodsNowProduction = model.FkGoodsNowProduction, + // Partnumber = model.Partnumber, + // PackageCodeClient = model.PackageCodeClient, + // OldValue = model.OldValue, + // NewValue = model.NewValue, + // Type = model.Type, + // Value = model.Value, + // 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