仓库管理:checklog

This commit is contained in:
qianhao.xu 2024-03-26 15:21:21 +08:00
parent 6386aef7cf
commit e620e3d8b9
5 changed files with 356 additions and 0 deletions

View File

@ -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
{
/// <summary>
/// 盘点记录
/// </summary>
[Verify]
[Route("/mes/wm//WmCheckLog")]
public class WmCheckLogController : BaseController
{
/// <summary>
/// 盘点记录接口
/// </summary>
private readonly IWmCheckLogService _WmCheckLogService;
public WmCheckLogController(IWmCheckLogService WmCheckLogService)
{
_WmCheckLogService = WmCheckLogService;
}
/// <summary>
/// 查询盘点记录列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:wmchecklog:list")]
public IActionResult QueryWmCheckLog([FromQuery] WmCheckLogQueryDto parm)
{
var response = _WmCheckLogService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询盘点记录详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:wmchecklog:query")]
public IActionResult GetWmCheckLog(int Id)
{
var response = _WmCheckLogService.GetInfo(Id);
var info = response.Adapt<WmCheckLog>();
return SUCCESS(info);
}
/// <summary>
/// 添加盘点记录
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:wmchecklog:add")]
[Log(Title = "盘点记录", BusinessType = BusinessType.INSERT)]
public IActionResult AddWmCheckLog([FromBody] WmCheckLogDto parm)
{
var modal = parm.Adapt<WmCheckLog>().ToCreate(HttpContext);
var response = _WmCheckLogService.AddWmCheckLog(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新盘点记录
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:wmchecklog:edit")]
[Log(Title = "盘点记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateWmCheckLog([FromBody] WmCheckLogDto parm)
{
var modal = parm.Adapt<WmCheckLog>().ToUpdate(HttpContext);
var response = _WmCheckLogService.UpdateWmCheckLog(modal);
return ToResponse(response);
}
/// <summary>
/// 删除盘点记录
/// </summary>
/// <returns></returns>
[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);
}
}
}

View File

@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations;
namespace ZR.Model.MES.wms.Dto
{
/// <summary>
/// 盘点记录查询对象
/// </summary>
public class WmCheckLogQueryDto : PagerInfo
{
}
/// <summary>
/// 盘点记录输入输出对象
/// </summary>
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; }
}
}

View File

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
namespace ZR.Model.MES.wms
{
/// <summary>
/// 盘点记录
/// </summary>
[SugarTable("wm_check_log")]
public class WmCheckLog
{
/// <summary>
/// 主键
/// </summary>
public int? Id { get; set; }
/// <summary>
/// 成品库主键id
/// </summary>
[SugarColumn(ColumnName = "fk_goods_now_production")]
public string FkGoodsNowProduction { get; set; }
/// <summary>
/// 零件号
/// </summary>
public string Partnumber { get; set; }
/// <summary>
/// 批次号
/// </summary>
[SugarColumn(ColumnName = "package_code_client")]
public string PackageCodeClient { get; set; }
/// <summary>
/// 原数值
/// </summary>
[SugarColumn(ColumnName = "old_value")]
public decimal OldValue { get; set; }
/// <summary>
/// 修改后
/// </summary>
[SugarColumn(ColumnName = "new_value")]
public decimal NewValue { get; set; }
/// <summary>
/// 修改类型;1-添加2-减少
/// </summary>
public int? Type { get; set; }
/// <summary>
/// 修改数值
/// </summary>
public decimal Value { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { 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; }
}
}

View File

@ -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
{
/// <summary>
/// 盘点记录service接口
/// </summary>
public interface IWmCheckLogService : IBaseService<WmCheckLog>
{
PagedInfo<WmCheckLogDto> GetList(WmCheckLogQueryDto parm);
WmCheckLog GetInfo(int Id);
WmCheckLog AddWmCheckLog(WmCheckLog parm);
int UpdateWmCheckLog(WmCheckLog parm);
}
}

View File

@ -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
{
/// <summary>
/// 盘点记录Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IWmCheckLogService), ServiceLifetime = LifeTime.Transient)]
public class WmCheckLogService : BaseService<WmCheckLog>, IWmCheckLogService
{
/// <summary>
/// 查询盘点记录列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<WmCheckLogDto> GetList(WmCheckLogQueryDto parm)
{
var predicate = Expressionable.Create<WmCheckLog>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<WmCheckLog, WmCheckLogDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public WmCheckLog GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加盘点记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public WmCheckLog AddWmCheckLog(WmCheckLog model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改盘点记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
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);
}
}
}