获取工单 排产工单 未排产工单

This commit is contained in:
xiaowei.song
2023-11-16 13:35:43 +08:00
parent d674489d3f
commit cac6397feb
6 changed files with 147 additions and 1 deletions

View File

@@ -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<ProWorkorder>, 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<ProWorkorder>, int) data = proWorkorderService.GetWorkorderList(pageNum, pageSize, year, week, date, "1");
return ToResponse(new ApiResult(200, "success", data));
}
}
}

View File

@@ -30,7 +30,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\MES\pro\" />
<Folder Include="Images\" />
<Folder Include="Properties\PublishProfiles\" />
</ItemGroup>

View File

@@ -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
{
/// <summary>
/// 生产工单排产表
/// </summary>
[SugarTable("pro_workorder_schedule", TableDescription = "生产工单排产表")]
public class ProWorkorderSchedule
{
/// <summary>
/// 流水号
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 工单ID
/// </summary>
[SugarColumn(ColumnName = "fk_pro_order_id")]
public string FkProOrderId { get; set; }
/// <summary>
/// 排序编号
/// </summary>
[SugarColumn(ColumnName = "order")]
public int Order { get; set; }
/// <summary>
/// 年份
/// </summary>
[SugarColumn(ColumnName = "year")]
public int Year { get; set; }
/// <summary>
/// 周数
/// </summary>
[SugarColumn(ColumnName = "week")]
public int Week { get; set; }
/// <summary>
/// 星期几
/// </summary>
[SugarColumn(ColumnName = "date")]
public int Date { get; set; }
/// <summary>
/// 租户号
///</summary>
[SugarColumn(ColumnName = "TENANT_ID")]
public string TenantId { get; set; }
/// <summary>
/// 乐观锁
///</summary>
[SugarColumn(ColumnName = "REVISION")]
public int? Revision { get; set; }
/// <summary>
/// 创建人
///</summary>
[SugarColumn(ColumnName = "CREATED_BY")]
public string CreatedBy { get; set; }
/// <summary>
/// 创建时间
///</summary>
[SugarColumn(ColumnName = "CREATED_TIME")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新人
///</summary>
[SugarColumn(ColumnName = "UPDATED_BY")]
public string UpdatedBy { get; set; }
/// <summary>
/// 更新时间
///</summary>
[SugarColumn(ColumnName = "UPDATED_TIME")]
public DateTime? UpdatedTime { get; set; }
}
}

View File

@@ -38,6 +38,12 @@ namespace ZR.Model.mes.pro
[SugarColumn(ColumnName = "date")]
public int? Date { get; set; }
/// <summary>
/// 是否已经生产
///</summary>
[SugarColumn(ColumnName = "isproduction")]
public string Isproduction { get; set; }
/// <summary>
/// 是否已经排程
///</summary>

View File

@@ -11,5 +11,6 @@ namespace ZR.Service.mes.pro.IService
{
public interface IProWorkorderService
{
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week,int date,string isSchedule);
}
}

View File

@@ -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<ProWorkorder>, IProWorkorderService
{
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, string isSchedule)
{
var predicate = Expressionable.Create<ProWorkorder>()
.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<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
return (proWorkorderList, totalCount);
}
}
}