初始化 异常工单

This commit is contained in:
qianhao.xu 2024-11-19 17:15:34 +08:00
parent b04ea389b8
commit d77828a202
12 changed files with 343 additions and 10 deletions

View File

@ -0,0 +1,106 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.exception;
using DOAN.Model.MES.exception.Dto;
using DOAN.Service.exception.IService;
//创建时间2024-11-19
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 工单修改日志表
/// </summary>
[Verify]
[Route("business/ProWorkorderUpdateLog")]
public class ProWorkorderUpdateLogController : BaseController
{
/// <summary>
/// 工单修改日志表接口
/// </summary>
private readonly IProWorkorderUpdateLogService _ProWorkorderUpdateLogService;
public ProWorkorderUpdateLogController(IProWorkorderUpdateLogService ProWorkorderUpdateLogService)
{
_ProWorkorderUpdateLogService = ProWorkorderUpdateLogService;
}
/// <summary>
/// 查询工单修改日志表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:proworkorderupdatelog:list")]
public IActionResult QueryProWorkorderUpdateLog([FromQuery] ProWorkorderUpdateLogQueryDto parm)
{
var response = _ProWorkorderUpdateLogService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询工单修改日志表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:proworkorderupdatelog:query")]
public IActionResult GetProWorkorderUpdateLog(string Id)
{
var response = _ProWorkorderUpdateLogService.GetInfo(Id);
var info = response.Adapt<ProWorkorderUpdateLog>();
return SUCCESS(info);
}
/// <summary>
/// 添加工单修改日志表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:proworkorderupdatelog:add")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.INSERT)]
public IActionResult AddProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm)
{
var modal = parm.Adapt<ProWorkorderUpdateLog>().ToCreate(HttpContext);
var response = _ProWorkorderUpdateLogService.AddProWorkorderUpdateLog(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新工单修改日志表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:proworkorderupdatelog:edit")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm)
{
var modal = parm.Adapt<ProWorkorderUpdateLog>().ToUpdate(HttpContext);
var response = _ProWorkorderUpdateLogService.UpdateProWorkorderUpdateLog(modal);
return ToResponse(response);
}
/// <summary>
/// 删除工单修改日志表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:proworkorderupdatelog:delete")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteProWorkorderUpdateLog(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _ProWorkorderUpdateLogService.Delete(idsArr);
return ToResponse(response);
}
}
}

View File

@ -33,6 +33,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\MES\exception\" />
<Folder Include="Properties\PublishProfiles\" />
</ItemGroup>

View File

@ -26,6 +26,7 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Compile>
<Compile Remove="MES\product\ProWorkorderUpdateLog.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
namespace DOAN.Model.MES.exception.Dto
{
/// <summary>
/// 工单修改日志表查询对象
/// </summary>
public class ProWorkorderUpdateLogQueryDto : PagerInfo
{}
/// <summary>
/// 工单修改日志表输入输出对象
/// </summary>
public class ProWorkorderUpdateLogDto
{
[Required(ErrorMessage = "雪花不能为空")]
public string Id { get; set; }
public string Workorder { get; set; }
public string Log { get; set; }
public string ResponsiblePerson { get; set; }
public string Reason { get; set; }
public DateTime? ChangeTime { get; set; }
public string Operator { get; set; }
public DateTime? CreatedTime { get; set; }
public string CreatedBy { get; set; }
public DateTime? UpdatedTime { get; set; }
public string UpdatedBy { get; set; }
}
}

View File

@ -0,0 +1,72 @@
namespace DOAN.Model.MES.exception
{
/// <summary>
/// 工单修改日志表
/// </summary>
[SugarTable("pro_workorder_update_log")]
public class ProWorkorderUpdateLog
{
/// <summary>
/// 雪花
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public string Id { get; set; }
/// <summary>
/// 工单号
/// </summary>
public string Workorder { get; set; }
/// <summary>
/// 日志
/// </summary>
public string Log { get; set; }
/// <summary>
/// 责任人
/// </summary>
[SugarColumn(ColumnName = "responsible_person")]
public string ResponsiblePerson { get; set; }
/// <summary>
/// 产生原因
/// </summary>
public string Reason { get; set; }
/// <summary>
/// 状态更改时间
/// </summary>
[SugarColumn(ColumnName = "change_time")]
public DateTime? ChangeTime { get; set; }
/// <summary>
/// 操作者
/// </summary>
public string Operator { get; set; }
/// <summary>
/// CreatedTime
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// CreatedBy
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string CreatedBy { get; set; }
/// <summary>
/// UpdatedTime
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; }
/// <summary>
/// UpdatedBy
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string UpdatedBy { get; set; }
}
}

View File

@ -10,13 +10,14 @@ using DOAN.Model.MES.quality.IPQC;
using DOAN.Service.MES.Console_.IService;
using Infrastructure.Attribute;
using System.Collections.Generic;
using DOAN.Model.MES.exception;
namespace DOAN.Service.MES.Console_;
[AppService(ServiceType = typeof(IConsoleService), ServiceLifetime = LifeTime.Transient)]
public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
{
/// <summary>
/// <summary>
/// 获取色块看板信息
/// </summary>
/// <returns></returns>
@ -62,7 +63,6 @@ public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
}
/// <summary>
/// 获取线 工单数/任务数
/// </summary>

View File

@ -1,6 +1,7 @@
using DOAN.Model.MES.bigscreen.Dto;
using DOAN.Model.MES.dev;
using DOAN.Model.mes.echarts;
using DOAN.Model.MES.exception;
using DOAN.Model.MES.product;
namespace DOAN.Service.MES.bigScreen.IService;

View File

@ -1,6 +1,7 @@
using DOAN.Model.MES.base_;
using DOAN.Model.MES.bigscreen.Dto;
using DOAN.Model.mes.echarts;
using DOAN.Model.MES.exception;
using DOAN.Model.MES.product;
using DOAN.Service.MES.bigScreen.IService;
using Infrastructure.Attribute;
@ -62,7 +63,7 @@ namespace DOAN.Service.MES.bigScreen
{
return Context.Queryable<ProWorkorder>().LeftJoin<ProReportwork>((w, r) => w.Workorder == r.FkWorkorder)
.LeftJoin<BaseGroup>((w, r, g)=>w.GroupCode==g.GroupCode)
.Where((w, r,g) => w.WorkorderDate == DateTime.Today)
.Where((w, r,g) => w.WorkorderDate == DateTime.Today&&g.Status==1)
.GroupBy((w, r,g) => w.GroupCode)
.OrderBy((w,r,g)=>g.Id)
.Select((w, r) => new TodayGroupProductionProgress()
@ -81,7 +82,7 @@ namespace DOAN.Service.MES.bigScreen
//x轴
EchartsXAxis XAxis = new EchartsXAxis();
List<string> Data = Context.Queryable<BaseGroup>().OrderBy(it => it.Id).Select(it => it.GroupCode).ToList();
List<string> Data = Context.Queryable<BaseGroup>().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode).ToList();
XAxis.Data = Data;
echartsOptions.XAxis = XAxis;
@ -157,7 +158,7 @@ namespace DOAN.Service.MES.bigScreen
//x轴
EchartsXAxis XAxis = new EchartsXAxis();
List<string> Data = Context.Queryable<BaseGroup>().OrderBy(it => it.Id).Select(it => it.GroupCode).ToList();
List<string> Data = Context.Queryable<BaseGroup>().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode).ToList();
XAxis.Data = Data;
echartsOptions.XAxis = XAxis;
@ -279,11 +280,11 @@ namespace DOAN.Service.MES.bigScreen
DateTime lastDayOfMonth =
new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month));
EchartsOptions echartsOptions = new EchartsOptions();
EchartsTitle Title = new EchartsTitle("本月生产产品种类TOP10", "本月生产产品种类TOP10");
EchartsTitle Title = new EchartsTitle("本月生产产品TOP10", "本月生产产品TOP10");
echartsOptions.Title = Title;
EchartsSeries LineSeries = new EchartsSeries();
LineSeries.Name = "不同产品种类的本月生产的数量";
LineSeries.Name = "不同产品的本月生产的数量";
LineSeries.Type = "bar";
LineSeries.Data = Context.Queryable<ProWorkorder>()
@ -369,7 +370,7 @@ namespace DOAN.Service.MES.bigScreen
// 各个组的产量系列
string[] groupArray = Context.Queryable<BaseGroup>().OrderBy(it => it.Id).Select(it => it.GroupCode)
string[] groupArray = Context.Queryable<BaseGroup>().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode)
.ToArray();
if (groupArray.Length > 0)
{

View File

@ -2,6 +2,7 @@ using System.Linq;
using DOAN.Model.MES.bigscreen.Dto;
using DOAN.Model.MES.dev;
using DOAN.Model.mes.echarts;
using DOAN.Model.MES.exception;
using DOAN.Model.MES.product;
using DOAN.Service.MES.bigScreen.IService;
using Infrastructure;

View File

@ -0,0 +1,23 @@
using System;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.exception.Dto;
using DOAN.Model.MES.exception;
using System.Collections.Generic;
namespace DOAN.Service.exception.IService
{
/// <summary>
/// 工单修改日志表service接口
/// </summary>
public interface IProWorkorderUpdateLogService : IBaseService<ProWorkorderUpdateLog>
{
PagedInfo<ProWorkorderUpdateLogDto> GetList(ProWorkorderUpdateLogQueryDto parm);
ProWorkorderUpdateLog GetInfo(string Id);
ProWorkorderUpdateLog AddProWorkorderUpdateLog(ProWorkorderUpdateLog parm);
int UpdateProWorkorderUpdateLog(ProWorkorderUpdateLog parm);
}
}

View File

@ -0,0 +1,87 @@
using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.exception.Dto;
using DOAN.Model.MES.exception;
using DOAN.Repository;
using System.Linq;
using DOAN.Service.exception.IService;
namespace DOAN.Service.exception.Service
{
/// <summary>
/// 工单修改日志表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IProWorkorderUpdateLogService), ServiceLifetime = LifeTime.Transient)]
public class ProWorkorderUpdateLogService : BaseService<ProWorkorderUpdateLog>, IProWorkorderUpdateLogService
{
/// <summary>
/// 查询工单修改日志表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<ProWorkorderUpdateLogDto> GetList(ProWorkorderUpdateLogQueryDto parm)
{
var predicate = Expressionable.Create<ProWorkorderUpdateLog>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<ProWorkorderUpdateLog, ProWorkorderUpdateLogDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public ProWorkorderUpdateLog GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加工单修改日志表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public ProWorkorderUpdateLog AddProWorkorderUpdateLog(ProWorkorderUpdateLog model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改工单修改日志表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateProWorkorderUpdateLog(ProWorkorderUpdateLog model)
{
//var response = Update(w => w.Id == model.Id, it => new ProWorkorderUpdateLog()
//{
// Workorder = model.Workorder,
// Log = model.Log,
// ResponsiblePerson = model.ResponsiblePerson,
// Reason = model.Reason,
// ChangeTime = model.ChangeTime,
// Operator = model.Operator,
// CreatedTime = model.CreatedTime,
// CreatedBy = model.CreatedBy,
// UpdatedTime = model.UpdatedTime,
// UpdatedBy = model.UpdatedBy,
//});
//return response;
return Update(model, true);
}
}
}

View File

@ -32,6 +32,7 @@ using DOAN.Model.MES.group;
using Mapster;
using Microsoft.AspNetCore.Authentication;
using System.Reflection;
using DOAN.Model.MES.exception;
using Infrastructure;
using Infrastructure.Converter;
using Microsoft.Extensions.Logging;
@ -189,13 +190,13 @@ namespace DOAN.Service.MES.product
public int UpdateProWorkorder(ProWorkorder model)
{
//增加日志
ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
/*ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
logObj.Id = XueHua;
logObj.Workorder = model.Workorder;
logObj.Log = "修改生产工单";
logObj.ChangeTime = DateTime.Now;
logObj.Operator = model.CreatedBy;
Context.Insertable(logObj).ExecuteCommand();
Context.Insertable(logObj).ExecuteCommand();*/
var response = Update(w => w.Id == model.Id, it => new ProWorkorder()
{