From 27b218ec4a7d2eecbced0ce4203ab9bf841d1978 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Wed, 17 Jul 2024 17:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=8E=92=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/ProWorkorderScheduleController.cs | 42 +++++++++ .../product/Dto/ProWorkorderScheduleDto.cs | 57 ++++++++++++ .../MES/product/ProWorkorderSchedule.cs | 88 +++++++++++++++++++ .../product/IService/IProWorkorderSchedule.cs | 17 ++++ .../MES/product/ProWorkorderSchedule.cs | 61 +++++++++++++ 5 files changed, 265 insertions(+) create mode 100644 DOAN.Admin.WebApi/Controllers/MES/product/ProWorkorderScheduleController.cs create mode 100644 DOAN.Model/MES/product/Dto/ProWorkorderScheduleDto.cs create mode 100644 DOAN.Model/MES/product/ProWorkorderSchedule.cs create mode 100644 DOAN.Service/MES/product/IService/IProWorkorderSchedule.cs create mode 100644 DOAN.Service/MES/product/ProWorkorderSchedule.cs diff --git a/DOAN.Admin.WebApi/Controllers/MES/product/ProWorkorderScheduleController.cs b/DOAN.Admin.WebApi/Controllers/MES/product/ProWorkorderScheduleController.cs new file mode 100644 index 0000000..c42186f --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/MES/product/ProWorkorderScheduleController.cs @@ -0,0 +1,42 @@ +using DOAN.Service.MES.product; +using DOAN.Model.MES.product.Dto; +using DOAN.Service.MES.product.IService; +using DOAN.Admin.WebApi.Filters; +using Org.BouncyCastle.Crypto; +using DOAN.Model.System; +using MiniExcelLibs; +using DOAN.Model.System.Dto; +using DOAN.Model; +using Microsoft.AspNetCore.Mvc; + + +namespace DOAN.Admin.WebApi.Controllers +{ + /// + /// 生产排产 + /// + [Verify] + [Route("mes/productManagement/ProWorkorderSchedule")] + public class ProWorkorderScheduleController : BaseController + { + private readonly IProWorkorderSchedule _ProWorkorderSchedule; + + public ProWorkorderScheduleController(IProWorkorderSchedule ProWorkorderSchedule) + { + _ProWorkorderSchedule = ProWorkorderSchedule; + } + /// + /// 查询生产工单列表 + /// + /// + /// + [HttpPost("list")] + [ActionPermissionFilter(Permission = "productManagement:proworkorder:list")] + public IActionResult QueryProWorkorder([FromBody] ProWorkorderQueryDto parm) + { + var response = _ProWorkorderSchedule.GetList(parm); + return SUCCESS(response); + } + + } +} diff --git a/DOAN.Model/MES/product/Dto/ProWorkorderScheduleDto.cs b/DOAN.Model/MES/product/Dto/ProWorkorderScheduleDto.cs new file mode 100644 index 0000000..04f5663 --- /dev/null +++ b/DOAN.Model/MES/product/Dto/ProWorkorderScheduleDto.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.MES.product.Dto +{ + /// + /// 工单排产查询对象 + /// + public class ProWorkorderScheduleQueryDto : PagerInfo + { + } + + /// + /// 工单排产输入输出对象 + /// + public class ProWorkorderScheduleDto + { + [Required(ErrorMessage = "工位任务id不能为空")] + public string TaskId { get; set; } + + [Required(ErrorMessage = "工单id不能为空")] + public string FkWorkorderId { get; set; } + + [Required(ErrorMessage = "工艺路线id不能为空")] + public int FkWorkRouteId { get; set; } + + [Required(ErrorMessage = "工序id不能为空")] + public int FkWorkProcessId { get; set; } + + [Required(ErrorMessage = "工位id不能为空")] + public int FkWorkStationId { get; set; } + + [Required(ErrorMessage = "设备id不能为空")] + public int FkDeviceId { get; set; } + + [Required(ErrorMessage = "班组id不能为空")] + public int FkGroupId { get; set; } + + [Required(ErrorMessage = "人员不能为空")] + public string FkOperatorId { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string CreatedBy { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } +} diff --git a/DOAN.Model/MES/product/ProWorkorderSchedule.cs b/DOAN.Model/MES/product/ProWorkorderSchedule.cs new file mode 100644 index 0000000..5ce4085 --- /dev/null +++ b/DOAN.Model/MES/product/ProWorkorderSchedule.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.MES.product +{ + /// + /// 工单排产 + /// + [SugarTable("pro_workorder_schedule")] + public class ProWorkorderSchedule + { + /// + /// 工位任务id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "task_id")] + public string TaskId { get; set; } + + /// + /// 工单id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_workorder_id")] + public string FkWorkorderId { get; set; } + + /// + /// 工艺路线id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_work_route_id")] + public int FkWorkRouteId { get; set; } + + /// + /// 工序id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_work_process_id")] + public int FkWorkProcessId { get; set; } + + /// + /// 工位id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_work_station_id")] + public int FkWorkStationId { get; set; } + + /// + /// 设备id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_device_id")] + public int FkDeviceId { get; set; } + + /// + /// 班组id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_group_id")] + public int FkGroupId { get; set; } + + /// + /// 人员 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_operator_id")] + public string FkOperatorId { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "cREATED_TIME")] + public DateTime? CreatedTime { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "cREATED_BY")] + public string CreatedBy { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "uPDATED_BY")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "uPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/DOAN.Service/MES/product/IService/IProWorkorderSchedule.cs b/DOAN.Service/MES/product/IService/IProWorkorderSchedule.cs new file mode 100644 index 0000000..ac434a2 --- /dev/null +++ b/DOAN.Service/MES/product/IService/IProWorkorderSchedule.cs @@ -0,0 +1,17 @@ +using DOAN.Model; +using DOAN.Model.MES.product; +using DOAN.Model.MES.product.Dto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service.MES.product.IService +{ + + public interface IProWorkorderSchedule : IBaseService + { + PagedInfo GetList(ProWorkorderQueryDto parm); + } +} diff --git a/DOAN.Service/MES/product/ProWorkorderSchedule.cs b/DOAN.Service/MES/product/ProWorkorderSchedule.cs new file mode 100644 index 0000000..6acda01 --- /dev/null +++ b/DOAN.Service/MES/product/ProWorkorderSchedule.cs @@ -0,0 +1,61 @@ +using DOAN.Model.MES.base_; +using DOAN.Model; +using DOAN.Model.MES.product; +using DOAN.Model.MES.product.Dto; +using DOAN.Service.MES.product.IService; +using Infrastructure.Attribute; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DOAN.Repository; + + + +namespace DOAN.Service.MES.product +{ + /// + /// 生产工单Service业务层处理 + /// + [AppService(ServiceType = typeof(IProWorkorderSchedule), ServiceLifetime = LifeTime.Transient)] + public class ProWorkorderSchedule : BaseService, IProWorkorderSchedule + { + /// + /// 查询生产工单列表 + /// + /// + /// + public PagedInfo GetList(ProWorkorderQueryDto parm) + { + if (parm.WorkorderDate != null && parm.WorkorderDate.Length > 0) + { + parm.WorkorderDate[0] = parm.WorkorderDate[0].Date; + parm.WorkorderDate[1] = parm.WorkorderDate[1].Date; + + } + + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.ProductionName), it => it.ProductionName.Contains(parm.ProductionName)) + .AndIF(!string.IsNullOrEmpty(parm.ProductionCode), it => it.ProductionCode.Contains(parm.ProductionCode)) + .AndIF(!string.IsNullOrEmpty(parm.CustomCode), it => it.CustomCode.Contains(parm.CustomCode)) + .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= parm.WorkorderDate[0]) + .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= parm.WorkorderDate[1]) + .AndIF(parm.Year > 0, it => it.Year == parm.Year) + .AndIF(parm.Week > 0, it => it.Week == parm.Week) + .AndIF(parm.Date > 0, it => it.Date == parm.Date) + ; + + var response = Queryable() + .Where(predicate.ToExpression()) + .OrderBy(it => it.WorkorderDate) + .ToPage(parm); + + + + + return response; + } + + } +} \ No newline at end of file