大标签追溯
This commit is contained in:
109
ZR.Admin.WebApi/Controllers/mes/pro/WmPackingrecordController.cs
Normal file
109
ZR.Admin.WebApi/Controllers/mes/pro/WmPackingrecordController.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
using ZR.Model.mes.pro;
|
||||
|
||||
//创建时间:2024-05-20
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("mes/pro/WmPackingrecord")]
|
||||
public class WmPackingrecordController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录接口
|
||||
/// </summary>
|
||||
private readonly IWmPackingrecordService _WmPackingrecordService;
|
||||
|
||||
public WmPackingrecordController(IWmPackingrecordService WmPackingrecordService)
|
||||
{
|
||||
_WmPackingrecordService = WmPackingrecordService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询包装记录列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "productmanagement:wmpackingrecord:list")]
|
||||
public IActionResult QueryWmPackingrecord([FromQuery] WmPackingrecordQueryDto parm)
|
||||
{
|
||||
var response = _WmPackingrecordService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询包装记录详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "productmanagement:wmpackingrecord:query")]
|
||||
public IActionResult GetWmPackingrecord(long Id)
|
||||
{
|
||||
var response = _WmPackingrecordService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<WmPackingrecord>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加包装记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "productmanagement:wmpackingrecord:add")]
|
||||
[Log(Title = "包装记录", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddWmPackingrecord([FromBody] WmPackingrecordDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmPackingrecord>().ToCreate(HttpContext);
|
||||
|
||||
var response = _WmPackingrecordService.AddWmPackingrecord(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新包装记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "productmanagement:wmpackingrecord:edit")]
|
||||
[Log(Title = "包装记录", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateWmPackingrecord([FromBody] WmPackingrecordDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmPackingrecord>().ToUpdate(HttpContext);
|
||||
var response = _WmPackingrecordService.UpdateWmPackingrecord(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除包装记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "productmanagement:wmpackingrecord:delete")]
|
||||
[Log(Title = "包装记录", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteWmPackingrecord(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _WmPackingrecordService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
53
ZR.Model/MES/pro/DTO/WmPackingrecordDto.cs
Normal file
53
ZR.Model/MES/pro/DTO/WmPackingrecordDto.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ZR.Model.MES.pro.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录查询对象
|
||||
/// </summary>
|
||||
public class WmPackingrecordQueryDto : PagerInfo
|
||||
{
|
||||
public string PartNum { get; set; }
|
||||
|
||||
public string Machine { get; set; }
|
||||
public string WorkOrderNum { get; set; }
|
||||
public DateTime? start_time { get; set; }
|
||||
public DateTime? end_time { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 包装记录输入输出对象
|
||||
/// </summary>
|
||||
public class WmPackingrecordDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
|
||||
public string PartNum { get; set; }
|
||||
|
||||
public string Machine { get; set; }
|
||||
|
||||
public string ProductCode { get; set; }
|
||||
|
||||
public string PackingCode { get; set; }
|
||||
|
||||
public string ScannerContent { get; set; }
|
||||
|
||||
public string WorkOrderNum { get; set; }
|
||||
|
||||
public string Standby3 { get; set; }
|
||||
|
||||
public string Standby4 { get; set; }
|
||||
|
||||
public string Standby5 { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "指示是否满箱不能为空")]
|
||||
public bool BFilled { get; set; }
|
||||
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
72
ZR.Model/MES/pro/WmPackingrecord.cs
Normal file
72
ZR.Model/MES/pro/WmPackingrecord.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
namespace ZR.Model.mes.pro
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录
|
||||
/// </summary>
|
||||
[SugarTable("wm_packingrecord")]
|
||||
public class WmPackingrecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 零件号
|
||||
/// </summary>
|
||||
public string PartNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称(ID)
|
||||
/// </summary>
|
||||
public string Machine { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品条码
|
||||
/// </summary>
|
||||
public string ProductCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱条码
|
||||
/// </summary>
|
||||
public string PackingCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扫码记录
|
||||
/// </summary>
|
||||
public string ScannerContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
public string WorkOrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用3
|
||||
/// </summary>
|
||||
public string Standby3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用4
|
||||
/// </summary>
|
||||
public string Standby4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备用5
|
||||
/// </summary>
|
||||
public string Standby5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指示是否满箱
|
||||
/// </summary>
|
||||
public bool BFilled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,19 @@ namespace ZR.Repository
|
||||
itenant = DbScoped.SugarScope;//设置租户接口
|
||||
}
|
||||
|
||||
public long UUID
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
return UUID;
|
||||
}
|
||||
set
|
||||
{
|
||||
UUID = SnowFlakeSingle.Instance.NextId();
|
||||
}
|
||||
}
|
||||
|
||||
#region add
|
||||
|
||||
/// <summary>
|
||||
|
||||
23
ZR.Service/mes/pro/IService/IWmPackingrecordService.cs
Normal file
23
ZR.Service/mes/pro/IService/IWmPackingrecordService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
|
||||
namespace ZR.Service.mes.pro.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录service接口
|
||||
/// </summary>
|
||||
public interface IWmPackingrecordService : IBaseService<WmPackingrecord>
|
||||
{
|
||||
PagedInfo<WmPackingrecordDto> GetList(WmPackingrecordQueryDto parm);
|
||||
|
||||
WmPackingrecord GetInfo(long Id);
|
||||
|
||||
WmPackingrecord AddWmPackingrecord(WmPackingrecord parm);
|
||||
|
||||
int UpdateWmPackingrecord(WmPackingrecord parm);
|
||||
|
||||
}
|
||||
}
|
||||
95
ZR.Service/mes/pro/WmPackingrecordService.cs
Normal file
95
ZR.Service/mes/pro/WmPackingrecordService.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
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.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
|
||||
namespace ZR.Service.mes.pro.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 包装记录Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmPackingrecordService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmPackingrecordService : BaseService<WmPackingrecord>, IWmPackingrecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询包装记录列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmPackingrecordDto> GetList(WmPackingrecordQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmPackingrecord>();
|
||||
predicate.AndIF(!string.IsNullOrEmpty(parm.PartNum), it => it.PartNum == parm.PartNum)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Machine), it => it.Machine == parm.Machine)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.WorkOrderNum), it => it.WorkOrderNum == parm.WorkOrderNum)
|
||||
.AndIF(parm.start_time > new DateTime(2021, 1, 1), it => it.CreateTime >= parm.start_time)
|
||||
.AndIF(parm.end_time > new DateTime(2021, 1, 1), it => it.CreateTime <= parm.end_time);
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmPackingrecord, WmPackingrecordDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmPackingrecord GetInfo(long Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加包装记录
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmPackingrecord AddWmPackingrecord(WmPackingrecord model)
|
||||
{
|
||||
model.Id = SnowFlakeSingle.Instance.NextId();
|
||||
model.CreateTime = DateTime.Now;
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改包装记录
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmPackingrecord(WmPackingrecord model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmPackingrecord()
|
||||
//{
|
||||
// PartNum = model.PartNum,
|
||||
// Machine = model.Machine,
|
||||
// ProductCode = model.ProductCode,
|
||||
// PackingCode = model.PackingCode,
|
||||
// ScannerContent = model.ScannerContent,
|
||||
// WorkOrderNum = model.WorkOrderNum,
|
||||
// Standby3 = model.Standby3,
|
||||
// Standby4 = model.Standby4,
|
||||
// Standby5 = model.Standby5,
|
||||
// BFilled = model.BFilled,
|
||||
// CreateTime = model.CreateTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user