仓库模块_当前货物表:init

This commit is contained in:
qianhao.xu
2024-03-22 09:29:40 +08:00
parent 3e7cd97255
commit 6e27c0eb94
6 changed files with 276 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-22
namespace ZR.Admin.WebApi.Controllers
{
/// <summary>
/// 成品库当前货物表
/// </summary>
[Verify]
[Route("/mes/wm/WmGoodsNowProduction")]
public class WmGoodsNowProductionController : BaseController
{
/// <summary>
/// 成品库当前货物表接口
/// </summary>
private readonly IWmGoodsNowProductionService _WmGoodsNowProductionService;
public WmGoodsNowProductionController(IWmGoodsNowProductionService WmGoodsNowProductionService)
{
_WmGoodsNowProductionService = WmGoodsNowProductionService;
}
/// <summary>
/// 查询成品库当前货物表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:list")]
public IActionResult QueryWmGoodsNowProduction([FromQuery] WmGoodsNowProductionQueryDto parm)
{
var response = _WmGoodsNowProductionService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询成品库当前货物表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:query")]
public IActionResult GetWmGoodsNowProduction(string Id)
{
var response = _WmGoodsNowProductionService.GetInfo(Id);
var info = response.Adapt<WmGoodsNowProduction>();
return SUCCESS(info);
}
/// <summary>
/// 添加成品库当前货物表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:add")]
[Log(Title = "成品库当前货物表", BusinessType = BusinessType.INSERT)]
public IActionResult AddWmGoodsNowProduction([FromBody] WmGoodsNowProductionDto parm)
{
var modal = parm.Adapt<WmGoodsNowProduction>().ToCreate(HttpContext);
var response = _WmGoodsNowProductionService.AddWmGoodsNowProduction(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新成品库当前货物表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:edit")]
[Log(Title = "成品库当前货物表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateWmGoodsNowProduction([FromBody] WmGoodsNowProductionDto parm)
{
var modal = parm.Adapt<WmGoodsNowProduction>().ToUpdate(HttpContext);
var response = _WmGoodsNowProductionService.UpdateWmGoodsNowProduction(modal);
return ToResponse(response);
}
/// <summary>
/// 删除成品库当前货物表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:delete")]
[Log(Title = "成品库当前货物表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteWmGoodsNowProduction(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _WmGoodsNowProductionService.Delete(idsArr);
return ToResponse(response);
}
}
}

View File

@@ -0,0 +1,52 @@
using System.ComponentModel.DataAnnotations;
namespace ZR.Model.MES.wms.Dto
{
/// <summary>
/// 成品库当前货物表查询对象
/// </summary>
public class WmGoodsNowProductionQueryDto : PagerInfo
{
}
/// <summary>
/// 成品库当前货物表输入输出对象
/// </summary>
public class WmGoodsNowProductionDto
{
[Required(ErrorMessage = "雪花id不能为空")]
public string Id { get; set; }
[Required(ErrorMessage = "箱子编号MES不能为空")]
public string PackageCode { get; set; }
[Required(ErrorMessage = "箱子编号(客户)不能为空")]
public string PackageCodeClient { get; set; }
public string PackageCodeOriginal { get; set; }
[Required(ErrorMessage = "库位编号不能为空")]
public string LocationCode { get; set; }
public string Partnumber { get; set; }
public int? GoodsNumLogic { get; set; }
public int? GoodsNumAction { get; set; }
public DateTime? EntryWarehouseTime { get; set; }
public string Remark { get; set; }
public string UpdatedBy { get; set; }
public DateTime? UpdatedTime { get; set; }
public string CreatedBy { get; set; }
public DateTime? CreatedTime { get; set; }
}
}

View File

@@ -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.Business.IBusinessService
{
/// <summary>
/// 成品库当前货物表service接口
/// </summary>
public interface IWmGoodsNowProductionService : IBaseService<WmGoodsNowProduction>
{
PagedInfo<WmGoodsNowProductionDto> GetList(WmGoodsNowProductionQueryDto parm);
WmGoodsNowProduction GetInfo(string Id);
WmGoodsNowProduction AddWmGoodsNowProduction(WmGoodsNowProduction parm);
int UpdateWmGoodsNowProduction(WmGoodsNowProduction 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(IWmGoodsNowProductionService), ServiceLifetime = LifeTime.Transient)]
public class WmGoodsNowProductionService : BaseService<WmGoodsNowProduction>, IWmGoodsNowProductionService
{
/// <summary>
/// 查询成品库当前货物表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<WmGoodsNowProductionDto> GetList(WmGoodsNowProductionQueryDto parm)
{
var predicate = Expressionable.Create<WmGoodsNowProduction>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<WmGoodsNowProduction, WmGoodsNowProductionDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public WmGoodsNowProduction GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加成品库当前货物表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public WmGoodsNowProduction AddWmGoodsNowProduction(WmGoodsNowProduction model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改成品库当前货物表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateWmGoodsNowProduction(WmGoodsNowProduction model)
{
//var response = Update(w => w.Id == model.Id, it => new WmGoodsNowProduction()
//{
// PackageCode = model.PackageCode,
// PackageCodeClient = model.PackageCodeClient,
// PackageCodeOriginal = model.PackageCodeOriginal,
// LocationCode = model.LocationCode,
// Partnumber = model.Partnumber,
// GoodsNumLogic = model.GoodsNumLogic,
// GoodsNumAction = model.GoodsNumAction,
// EntryWarehouseTime = model.EntryWarehouseTime,
// Remark = model.Remark,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
//});
//return response;
return Update(model, true);
}
}
}