仓库-仓库日志功能代码提交
This commit is contained in:
parent
c918e0734b
commit
15f6103c0a
@ -0,0 +1,111 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Service.Business.IBusinessService;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms;
|
||||
|
||||
//创建时间:2024-04-18
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/WmGoodsChangeLog")]
|
||||
public class WmGoodsChangeLogController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志接口
|
||||
/// </summary>
|
||||
private readonly IWmGoodsChangeLogService _WmGoodsChangeLogService;
|
||||
|
||||
public WmGoodsChangeLogController(IWmGoodsChangeLogService WmGoodsChangeLogService)
|
||||
{
|
||||
_WmGoodsChangeLogService = WmGoodsChangeLogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询仓库操作日志列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgoodschangelog:list")]
|
||||
public IActionResult QueryWmGoodsChangeLog([FromQuery] WmGoodsChangeLogQueryDto parm)
|
||||
{
|
||||
var response = _WmGoodsChangeLogService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询仓库操作日志详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgoodschangelog:query")]
|
||||
public IActionResult GetWmGoodsChangeLog(int Id)
|
||||
{
|
||||
var response = _WmGoodsChangeLogService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<WmGoodsChangeLog>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加仓库操作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:wmgoodschangelog:add")]
|
||||
[Log(Title = "仓库操作日志", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddWmGoodsChangeLog([FromBody] WmGoodsChangeLogDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmGoodsChangeLog>().ToCreate(HttpContext);
|
||||
|
||||
var response = _WmGoodsChangeLogService.AddWmGoodsChangeLog(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新仓库操作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:wmgoodschangelog:edit")]
|
||||
[Log(Title = "仓库操作日志", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateWmGoodsChangeLog([FromBody] WmGoodsChangeLogDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmGoodsChangeLog>().ToUpdate(HttpContext);
|
||||
var response = _WmGoodsChangeLogService.UpdateWmGoodsChangeLog(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除仓库操作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgoodschangelog:delete")]
|
||||
[Log(Title = "仓库操作日志", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteWmGoodsChangeLog(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _WmGoodsChangeLogService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
43
ZR.Model/MES/wms/Dto/WmGoodsChangeLogDto.cs
Normal file
43
ZR.Model/MES/wms/Dto/WmGoodsChangeLogDto.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ZR.Model.MES.wms.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志查询对象
|
||||
/// </summary>
|
||||
public class WmGoodsChangeLogQueryDto : PagerInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Type { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
public string StartTimeStr { get; set; }
|
||||
public string EndTimeStr { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 仓库操作日志输入输出对象
|
||||
/// </summary>
|
||||
public class WmGoodsChangeLogDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Type { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string JsonMsg { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
56
ZR.Model/MES/wms/WmGoodsChangeLog.cs
Normal file
56
ZR.Model/MES/wms/WmGoodsChangeLog.cs
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
namespace ZR.Model.MES.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志
|
||||
/// </summary>
|
||||
[SugarTable("wm_goods_change_log")]
|
||||
public class WmGoodsChangeLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型;0-默认1-拼箱2-拆箱3-移库4-待定。。。其余待定
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容;存入json格式字符串,根据type类型不同,灵活存储不同数据,不可解析,算作空
|
||||
/// </summary>
|
||||
public string JsonMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
24
ZR.Service/mes/wms/IService/IWmGoodsChangeLogService.cs
Normal file
24
ZR.Service/mes/wms/IService/IWmGoodsChangeLogService.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.MES.wms;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志service接口
|
||||
/// </summary>
|
||||
public interface IWmGoodsChangeLogService : IBaseService<WmGoodsChangeLog>
|
||||
{
|
||||
PagedInfo<WmGoodsChangeLogDto> GetList(WmGoodsChangeLogQueryDto parm);
|
||||
|
||||
WmGoodsChangeLog GetInfo(int Id);
|
||||
|
||||
WmGoodsChangeLog AddWmGoodsChangeLog(WmGoodsChangeLog parm);
|
||||
|
||||
int UpdateWmGoodsChangeLog(WmGoodsChangeLog parm);
|
||||
|
||||
}
|
||||
}
|
||||
93
ZR.Service/mes/wms/WmGoodsChangeLogService.cs
Normal file
93
ZR.Service/mes/wms/WmGoodsChangeLogService.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Repository;
|
||||
using ZR.Service.Business.IBusinessService;
|
||||
using System.Linq;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库操作日志Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmGoodsChangeLogService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmGoodsChangeLogService : BaseService<WmGoodsChangeLog>, IWmGoodsChangeLogService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询仓库操作日志列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmGoodsChangeLogDto> GetList(WmGoodsChangeLogQueryDto parm)
|
||||
{
|
||||
DateTime searchStartTime = DateTime.Now;
|
||||
DateTime searchEndTime = DateTime.Now;
|
||||
var predicate = Expressionable.Create<WmGoodsChangeLog>()
|
||||
.AndIF(parm.Type > 0, it => it.Type == parm.Type)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Description), it => it.Description.Contains(parm.Description))
|
||||
// 当天0点
|
||||
.AndIF(DateTime.TryParse(parm.StartTimeStr,out searchStartTime), it => it.CreatedTime > searchStartTime)
|
||||
// 当天23点59分59秒
|
||||
.AndIF(DateTime.TryParse(parm.EndTimeStr, out searchEndTime), it => it.CreatedTime < searchEndTime.AddDays(1).AddTicks(-1))
|
||||
;
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmGoodsChangeLog, WmGoodsChangeLogDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmGoodsChangeLog GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加仓库操作日志
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmGoodsChangeLog AddWmGoodsChangeLog(WmGoodsChangeLog model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改仓库操作日志
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmGoodsChangeLog(WmGoodsChangeLog model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmGoodsChangeLog()
|
||||
//{
|
||||
// Type = model.Type,
|
||||
// Description = model.Description,
|
||||
// JsonMsg = model.JsonMsg,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user