diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs new file mode 100644 index 00000000..fe39d92b --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; +using ZR.Admin.WebApi.Extensions; +using ZR.Model.mes.md; +using ZR.Model.mes.pro; +using ZR.Service.mes.pro; +using ZR.Service.mes.pro.IService; +using ZR.Service.MES.md; + + +namespace ZR.Admin.WebApi.Controllers.MES.pro +{ + + [Route("mes/pro/workorder")] + public class ProWorkorderController : BaseController + { + private readonly IProWorkorderService proWorkorderService; + + public ProWorkorderController(IProWorkorderService proWorkorderService) + { + this.proWorkorderService = proWorkorderService; + } + + + [HttpGet("getworkorderListwithoutschedule")] + public IActionResult GetWorkorderListWithoutSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1) + { + (List, int) data = proWorkorderService.GetWorkorderList(pageNum, pageSize, year, week, date, "0"); + + return ToResponse(new ApiResult(200, "success", data)); + } + + [HttpGet("getworkorderListwithschedule")] + public IActionResult GetWorkorderListWithSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1) + { + (List, int) data = proWorkorderService.GetWorkorderList(pageNum, pageSize, year, week, date, "1"); + + return ToResponse(new ApiResult(200, "success", data)); + } + } +} diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 5caac064..7b6e1fba 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -30,7 +30,6 @@ - diff --git a/ZR.Model/MES/pro/ProWorkorderSchedule.cs b/ZR.Model/MES/pro/ProWorkorderSchedule.cs new file mode 100644 index 00000000..25fae5e1 --- /dev/null +++ b/ZR.Model/MES/pro/ProWorkorderSchedule.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.pro +{ + /// + /// 生产工单排产表 + /// + [SugarTable("pro_workorder_schedule", TableDescription = "生产工单排产表")] + public class ProWorkorderSchedule + { + /// + /// 流水号 + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public string Id { get; set; } + + /// + /// 工单ID + /// + [SugarColumn(ColumnName = "fk_pro_order_id")] + public string FkProOrderId { get; set; } + + /// + /// 排序编号 + /// + [SugarColumn(ColumnName = "order")] + public int Order { get; set; } + + /// + /// 年份 + /// + [SugarColumn(ColumnName = "year")] + public int Year { get; set; } + + /// + /// 周数 + /// + [SugarColumn(ColumnName = "week")] + public int Week { get; set; } + + /// + /// 星期几 + /// + [SugarColumn(ColumnName = "date")] + public int Date { get; set; } + + /// + /// 租户号 + /// + [SugarColumn(ColumnName = "TENANT_ID")] + public string TenantId { get; set; } + /// + /// 乐观锁 + /// + [SugarColumn(ColumnName = "REVISION")] + public int? Revision { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + + } +} diff --git a/ZR.Model/mes/pro/ProWorkorder.cs b/ZR.Model/mes/pro/ProWorkorder.cs index 23abd31b..3771ef3d 100644 --- a/ZR.Model/mes/pro/ProWorkorder.cs +++ b/ZR.Model/mes/pro/ProWorkorder.cs @@ -38,6 +38,12 @@ namespace ZR.Model.mes.pro [SugarColumn(ColumnName = "date")] public int? Date { get; set; } + /// + /// 是否已经生产 + /// + [SugarColumn(ColumnName = "isproduction")] + public string Isproduction { get; set; } + /// /// 是否已经排程 /// diff --git a/ZR.Service/mes/pro/IService/IProWorkorderService.cs b/ZR.Service/mes/pro/IService/IProWorkorderService.cs index 90830ca4..160fd2c2 100644 --- a/ZR.Service/mes/pro/IService/IProWorkorderService.cs +++ b/ZR.Service/mes/pro/IService/IProWorkorderService.cs @@ -11,5 +11,6 @@ namespace ZR.Service.mes.pro.IService { public interface IProWorkorderService { + public (List, int) GetWorkorderList(int pageNum, int pageSize, int year, int week,int date,string isSchedule); } } diff --git a/ZR.Service/mes/pro/ProWorkorderService.cs b/ZR.Service/mes/pro/ProWorkorderService.cs index 0d7e2e84..30a21600 100644 --- a/ZR.Service/mes/pro/ProWorkorderService.cs +++ b/ZR.Service/mes/pro/ProWorkorderService.cs @@ -1,5 +1,6 @@ using Infrastructure.Attribute; using Microsoft.Extensions.DependencyInjection; +using SqlSugar; using System; using System.Collections.Generic; using System.Drawing; @@ -16,5 +17,20 @@ namespace ZR.Service.mes.pro [AppService(ServiceType = typeof(IProWorkorderService), ServiceLifetime = LifeTime.Transient)] public class ProWorkorderService : BaseService, IProWorkorderService { + + public (List, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, string isSchedule) + { + var predicate = Expressionable.Create() + .AndIF(year > 0, it => it.Year == year) + .AndIF(week > 0, it => it.Week == week) + .AndIF(date > 0, it => it.Date == date) + .AndIF(date > 0, it => it.Isarrange.Equals(isSchedule)) + .ToExpression(); + + int totalCount = 0; + List proWorkorderList = Context.Queryable().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount); + + return (proWorkorderList, totalCount); + } } }