Merge branch 'main' of https://gitee.com/doan-tech/shanghaigangxiangtuzhuangMES
# Conflicts: # server/ZR.Admin.WebApi/Controllers/mes/qc/FQC/CommonFQCController.cs # server/ZR.Admin.WebApi/Extensions/SqlSugarCache.cs # server/ZR.Model/MES/qc/DTO/QcCommonFqcDto.cs # server/ZR.Service/mes/qc/CommonFQCService.cs # server/ZR.Service/mes/qc/IService/ICommonFQCService.cs
This commit is contained in:
111
ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs
Normal file
111
ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Service.mes.mm.IService;
|
||||
using ZR.Service.mes.mm;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
using ZR.Model.MES.mm;
|
||||
|
||||
//创建时间:2024-06-05
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 配料任务清单
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("mes/mm/MmIngredientTask")]
|
||||
public class MmIngredientTaskController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 配料任务清单接口
|
||||
/// </summary>
|
||||
private readonly IMmIngredientTaskService _MmIngredientTaskService;
|
||||
|
||||
public MmIngredientTaskController(IMmIngredientTaskService MmIngredientTaskService)
|
||||
{
|
||||
_MmIngredientTaskService = MmIngredientTaskService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询配料任务清单列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:mmingredienttask:list")]
|
||||
public IActionResult QueryMmIngredientTask([FromQuery] MmIngredientTaskQueryDto parm)
|
||||
{
|
||||
var response = _MmIngredientTaskService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询配料任务清单详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:mmingredienttask:query")]
|
||||
public IActionResult GetMmIngredientTask(int Id)
|
||||
{
|
||||
var response = _MmIngredientTaskService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<MmIngredientTask>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加配料任务清单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:mmingredienttask:add")]
|
||||
[Log(Title = "配料任务清单", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddMmIngredientTask([FromBody] MmIngredientTaskDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<MmIngredientTask>().ToCreate(HttpContext);
|
||||
|
||||
var response = _MmIngredientTaskService.AddMmIngredientTask(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新配料任务清单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:mmingredienttask:edit")]
|
||||
[Log(Title = "配料任务清单", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateMmIngredientTask([FromBody] MmIngredientTaskDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<MmIngredientTask>().ToUpdate(HttpContext);
|
||||
var response = _MmIngredientTaskService.UpdateMmIngredientTask(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除配料任务清单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:mmingredienttask:delete")]
|
||||
[Log(Title = "配料任务清单", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteMmIngredientTask(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _MmIngredientTaskService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
54
ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs
Normal file
54
ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ZR.Model.MES.mm.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 配料任务清单查询对象
|
||||
/// </summary>
|
||||
public class MmIngredientTaskQueryDto : PagerInfo
|
||||
{
|
||||
public string Workorder { get; set; }
|
||||
|
||||
public DateTime Starttime { get; set; }
|
||||
public DateTime Endtime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配料任务清单输入输出对象
|
||||
/// </summary>
|
||||
public class MmIngredientTaskDto
|
||||
{
|
||||
[Required(ErrorMessage = "id不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string AgvPosition { get; set; }
|
||||
|
||||
public string AgvPositionEnd { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "配料任务id不能为空")]
|
||||
public string TaskId { get; set; }
|
||||
|
||||
public string Workorder { get; set; }
|
||||
|
||||
public string Blanknumber { get; set; }
|
||||
|
||||
public int? Isfinal { get; set; }
|
||||
|
||||
public int? PreviousNumber { get; set; }
|
||||
|
||||
public int? PreviousNumbered { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
24
ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs
Normal file
24
ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.MES.mm;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZR.Service.mes.mm.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 配料任务清单service接口
|
||||
/// </summary>
|
||||
public interface IMmIngredientTaskService : IBaseService<MmIngredientTask>
|
||||
{
|
||||
PagedInfo<MmIngredientTaskDto> GetList(MmIngredientTaskQueryDto parm);
|
||||
|
||||
MmIngredientTask GetInfo(int Id);
|
||||
|
||||
MmIngredientTask AddMmIngredientTask(MmIngredientTask parm);
|
||||
|
||||
int UpdateMmIngredientTask(MmIngredientTask parm);
|
||||
|
||||
}
|
||||
}
|
||||
92
ZR.Service/mes/mm/MmIngredientTaskService.cs
Normal file
92
ZR.Service/mes/mm/MmIngredientTaskService.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
|
||||
using ZR.Repository;
|
||||
using ZR.Model.MES.mm;
|
||||
using ZR.Service.mes.mm.IService;
|
||||
using System.Linq;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
|
||||
namespace ZR.Service.mes.mm
|
||||
{
|
||||
/// <summary>
|
||||
/// 配料任务清单Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IMmIngredientTaskService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MmIngredientTaskService : BaseService<MmIngredientTask>, IMmIngredientTaskService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询配料任务清单列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<MmIngredientTaskDto> GetList(MmIngredientTaskQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<MmIngredientTask>()
|
||||
.AndIF(parm.Starttime!=null&&parm.Starttime>new DateTime(1899,1,1),it=>it.CreatedTime>=parm.Starttime)
|
||||
.AndIF(parm.Endtime!=null&&parm.Starttime>new DateTime(1899,1,1),it=>it.CreatedTime<=parm.Endtime)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Workorder),it=>it.Workorder.Contains(parm.Workorder));
|
||||
|
||||
var response = Queryable()
|
||||
.OrderByDescending(it=>it.CreatedTime)
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<MmIngredientTask, MmIngredientTaskDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public MmIngredientTask GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加配料任务清单
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public MmIngredientTask AddMmIngredientTask(MmIngredientTask model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改配料任务清单
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateMmIngredientTask(MmIngredientTask model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new MmIngredientTask()
|
||||
//{
|
||||
// AgvPosition = model.AgvPosition,
|
||||
// AgvPositionEnd = model.AgvPositionEnd,
|
||||
// Workorder = model.Workorder,
|
||||
// Blanknumber = model.Blanknumber,
|
||||
// Isfinal = model.Isfinal,
|
||||
// PreviousNumber = model.PreviousNumber,
|
||||
// PreviousNumbered = model.PreviousNumbered,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
132
server/ZR.Admin.WebApi/Extensions/SqlSugarCache.cs
Normal file
132
server/ZR.Admin.WebApi/Extensions/SqlSugarCache.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
<<<<<<< HEAD:ZR.Admin.WebApi/Extensions/SqlSugarCache.cs
|
||||
namespace ZR.Admin.WebApi.Extensions
|
||||
{
|
||||
public class SqlSugarCache : SqlSugar.ICacheService
|
||||
{
|
||||
public void Add<V>(string key, V value)
|
||||
{
|
||||
//RedisServer.Cache.Set(key, value, 3600 + RedisHelper.RandomExpired(5, 30));
|
||||
CacheHelper.SetCache(key, value);
|
||||
}
|
||||
|
||||
public void Add<V>(string key, V value, int cacheDurationInSeconds)
|
||||
{
|
||||
//RedisServer.Cache.Set(key, value, cacheDurationInSeconds);
|
||||
CacheHelper.SetCaches(key, value, cacheDurationInSeconds);
|
||||
}
|
||||
|
||||
public bool ContainsKey<V>(string key)
|
||||
{
|
||||
//return RedisServer.Cache.Exists(key);
|
||||
return CacheHelper.Exists(key);
|
||||
}
|
||||
|
||||
public V Get<V>(string key)
|
||||
{
|
||||
//return RedisServer.Cache.Get<V>(key);
|
||||
return (V)CacheHelper.Get(key);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllKey<V>()
|
||||
{
|
||||
//return RedisServer.Cache.Keys("*");
|
||||
return CacheHelper.GetCacheKeys();
|
||||
}
|
||||
|
||||
public V GetOrCreate<V>(string cacheKey, Func<V> create, int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
if (ContainsKey<V>(cacheKey))
|
||||
{
|
||||
var result = Get<V>(cacheKey);
|
||||
if (result == null)
|
||||
{
|
||||
return create();
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var restul = create();
|
||||
|
||||
Add(cacheKey, restul, cacheDurationInSeconds);
|
||||
return restul;
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove<V>(string key)
|
||||
{
|
||||
//RedisServer.Cache.Del(key);
|
||||
CacheHelper.Remove(key);
|
||||
}
|
||||
}
|
||||
=======
|
||||
using ZR.Common;
|
||||
|
||||
namespace ZR.Admin.WebApi.Extensions
|
||||
{
|
||||
public class SqlSugarCache : SqlSugar.ICacheService
|
||||
{
|
||||
public void Add<V>(string key, V value)
|
||||
{
|
||||
//RedisServer.Cache.Set(key, value, 3600 + RedisHelper.RandomExpired(5, 30));
|
||||
CacheHelper.SetCache(key, value);
|
||||
}
|
||||
|
||||
public void Add<V>(string key, V value, int cacheDurationInSeconds)
|
||||
{
|
||||
//RedisServer.Cache.Set(key, value, cacheDurationInSeconds);
|
||||
CacheHelper.SetCaches(key, value, cacheDurationInSeconds);
|
||||
}
|
||||
|
||||
public bool ContainsKey<V>(string key)
|
||||
{
|
||||
//return RedisServer.Cache.Exists(key);
|
||||
return CacheHelper.Exists(key);
|
||||
}
|
||||
|
||||
public V Get<V>(string key)
|
||||
{
|
||||
//return RedisServer.Cache.Get<V>(key);
|
||||
return (V)CacheHelper.Get(key);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllKey<V>()
|
||||
{
|
||||
//return RedisServer.Cache.Keys("*");
|
||||
return CacheHelper.GetCacheKeys();
|
||||
}
|
||||
|
||||
public V GetOrCreate<V>(string cacheKey, Func<V> create, int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
if (ContainsKey<V>(cacheKey))
|
||||
{
|
||||
var result = Get<V>(cacheKey);
|
||||
if (result == null)
|
||||
{
|
||||
return create();
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var restul = create();
|
||||
|
||||
Add(cacheKey, restul, cacheDurationInSeconds);
|
||||
return restul;
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove<V>(string key)
|
||||
{
|
||||
//RedisServer.Cache.Del(key);
|
||||
CacheHelper.Remove(key);
|
||||
}
|
||||
}
|
||||
>>>>>>> 80b1bbccf9a33424c3a3126c05ea829a35a78c2c:server/ZR.Admin.WebApi/Extensions/SqlSugarCache.cs
|
||||
}
|
||||
Reference in New Issue
Block a user