IQC
This commit is contained in:
parent
7ba84f96cd
commit
2a6ccc616e
@ -44,6 +44,24 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 甘特图
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetGanttList")]
|
||||
public IActionResult GetGanttList(int year = -1, int week = -1, int date = -1)
|
||||
{
|
||||
GanttTaskDTO data = proWorkorderService.GetGanttList(year, week, date);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有排产工单
|
||||
/// </summary>
|
||||
|
||||
@ -7,13 +7,14 @@ using Newtonsoft.Json.Linq;
|
||||
using System.Text.Json;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Service.mes.pro;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
using ZR.Service.mes.qu.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.qu
|
||||
{
|
||||
[Route("mes/qu/rough")]
|
||||
[Route("mes/qc/IQC")]
|
||||
public class QcRoughController : BaseController
|
||||
{
|
||||
private readonly IQcRoughService quRoughService;
|
||||
@ -32,10 +33,10 @@ namespace ZR.Admin.WebApi.Controllers.mes.qu
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getworkorderList")]
|
||||
public IActionResult GetWorkorderList(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
||||
[HttpGet("getStatisticslist")]
|
||||
public IActionResult GetStatisticslist(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
||||
{
|
||||
(List<ProWorkorder>, int) data = quRoughService.GetWorkorderList(pageNum, pageSize, year, week, date, 1);
|
||||
(List<Mr_QuRoughDTO>, int) data = quRoughService.GetStatisticslist(pageNum, pageSize, year, week, date, 1);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
74
ZR.Model/MES/pro/DTO/GanttTaskDTO.cs
Normal file
74
ZR.Model/MES/pro/DTO/GanttTaskDTO.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Model.MES.pro.DTO
|
||||
{
|
||||
public class GanttTaskDTO
|
||||
{
|
||||
public List<GanttTask_data> Data { get; set; }
|
||||
public List<GanttTask_link> Links { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class GanttTask_data
|
||||
{
|
||||
// id
|
||||
public string id { set; get; }
|
||||
/// <summary>
|
||||
/// 文字
|
||||
/// </summary>
|
||||
public string text { set; get; }
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public string start_date { set; get; }
|
||||
/// <summary>
|
||||
/// 任务时长
|
||||
/// </summary>
|
||||
public decimal? duration { set; get; }
|
||||
/// <summary>
|
||||
/// 完成进度
|
||||
/// </summary>
|
||||
public decimal? progress { set; get; }
|
||||
/// <summary>
|
||||
/// 父任务id
|
||||
/// </summary>
|
||||
public int? parent { set; get; }
|
||||
/// <summary>
|
||||
/// 使用者
|
||||
/// </summary>
|
||||
public string user { set; get; }
|
||||
/// <summary>
|
||||
/// 计划结束时间
|
||||
/// </summary>
|
||||
public string planned_end { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
public string planned_start { set; get; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public bool? show { set; get; }
|
||||
|
||||
public bool? open { set; get; }
|
||||
|
||||
public string type { set; get; }
|
||||
|
||||
}
|
||||
public class GanttTask_link
|
||||
{
|
||||
public int? id { set; get; }
|
||||
public int? source { set; get; }
|
||||
public int? target { set; get; }
|
||||
public int? type { set; get; }
|
||||
}
|
||||
|
||||
}
|
||||
93
ZR.Model/MES/qc/DTO/Mr_QuRoughDTO.cs
Normal file
93
ZR.Model/MES/qc/DTO/Mr_QuRoughDTO.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Model.MES.qc.DTO
|
||||
{
|
||||
public class Mr_QuRoughDTO
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 流水号
|
||||
///</summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 领料单id
|
||||
///</summary>
|
||||
public string FkMaterialrequisitionId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 毛坯零件号
|
||||
///</summary>
|
||||
|
||||
public string Workblankpartnumber { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 需要数量
|
||||
///</summary>
|
||||
|
||||
public int? Requirenum { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态 (0:未领料 1已经领料)
|
||||
/// </summary>
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 年
|
||||
///</summary>
|
||||
|
||||
public int? Year { get; set; }
|
||||
/// <summary>
|
||||
/// 周
|
||||
///</summary>
|
||||
|
||||
public int? Week { get; set; }
|
||||
/// <summary>
|
||||
/// 日
|
||||
///</summary>
|
||||
|
||||
public int? Date { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应到数量
|
||||
///</summary>
|
||||
public int? RequireNum { get; set; }
|
||||
/// <summary>
|
||||
/// 实际到达数量
|
||||
///</summary>
|
||||
public int? ActualNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 抽检比例%
|
||||
///</summary>
|
||||
public int? RandomRate { get; set; }
|
||||
/// <summary>
|
||||
/// 合格数
|
||||
///</summary>
|
||||
public int? Oks { get; set; }
|
||||
/// <summary>
|
||||
/// 不合格数
|
||||
///</summary>
|
||||
public int? Ngs { get; set; }
|
||||
/// <summary>
|
||||
/// 合格率
|
||||
///</summary>
|
||||
public decimal? OksRatio { get; set; }
|
||||
/// <summary>
|
||||
/// 是否可以上料
|
||||
///</summary>
|
||||
public string IsFeeding { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,8 @@ namespace ZR.Model.MES.qu
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "fk_materialRequisition_id")]
|
||||
public string FkMaterialrequisitionId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应到数量
|
||||
///</summary>
|
||||
|
||||
@ -24,8 +24,4 @@
|
||||
<ItemGroup>
|
||||
<None Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MES\qc\DTO\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@ -7,6 +8,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.op.DTO;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
|
||||
namespace ZR.Service.mes.pro.IService
|
||||
{
|
||||
@ -21,6 +23,9 @@ namespace ZR.Service.mes.pro.IService
|
||||
public int SortWorkorderSchedule(string id, int sort);
|
||||
|
||||
public int ReleaseProduction(string id, HttpContext httpContext);
|
||||
|
||||
|
||||
|
||||
public GanttTaskDTO GetGanttList(int year,int week,int date);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ using static System.Net.WebRequestMethods;
|
||||
|
||||
using JinianNet.JNTemplate;
|
||||
using static Aliyun.OSS.Model.LiveChannelStat;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
|
||||
namespace ZR.Service.mes.pro
|
||||
{
|
||||
@ -150,5 +151,64 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取甘特图
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public GanttTaskDTO GetGanttList(int year, int week, int date)
|
||||
{
|
||||
|
||||
|
||||
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)
|
||||
.And(it=>it.Wrokerorder_status==1)
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToList();
|
||||
|
||||
|
||||
GanttTaskDTO ganttTask = new GanttTaskDTO();
|
||||
|
||||
List<GanttTask_data> ganttTask_data = new List<GanttTask_data>();
|
||||
List<GanttTask_link> ganttTask_Links = new List<GanttTask_link>();
|
||||
|
||||
foreach (var item in proWorkorderList)
|
||||
{
|
||||
GanttTask_data data = new GanttTask_data();
|
||||
data.id = item.Id;
|
||||
data.text = item.ProductionName;
|
||||
data.start_date = ((DateTime)item.ArrangeStarttime).ToString("yyyy-MM-dd");
|
||||
data.duration = item.ProductionTime;
|
||||
data.planned_start = ((DateTime)item.ArrangeStarttime).ToString("yyyy-MM-dd");
|
||||
data.planned_end = ((DateTime)item.ArrangeEndtime).ToString("yyyy-MM-dd");
|
||||
data.progress = 1;
|
||||
data.show = false;
|
||||
data.open = true;
|
||||
data.type = "project";
|
||||
|
||||
|
||||
GanttTask_link link = new GanttTask_link();
|
||||
link.id = item.Order;
|
||||
link.source = item.Order;
|
||||
int index = proWorkorderList.IndexOf(item);
|
||||
if (index < proWorkorderList.Count-1)
|
||||
link.target = (int)proWorkorderList[index + 1]?.Order;
|
||||
link.type = 0;
|
||||
|
||||
ganttTask_data.Add(data);
|
||||
ganttTask_Links.Add(link);
|
||||
|
||||
|
||||
}
|
||||
ganttTask.Data = ganttTask_data;
|
||||
ganttTask.Links = ganttTask_Links;
|
||||
return ganttTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
|
||||
|
||||
@ -11,6 +12,6 @@ namespace ZR.Service.mes.qu.IService
|
||||
{
|
||||
public interface IQcRoughService
|
||||
{
|
||||
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule);
|
||||
public (List<Mr_QuRoughDTO>, int) GetStatisticslist(int pageNum, int pageSize, int year, int week, int date, int isSchedule);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
@ -8,9 +9,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
using ZR.Service.mes.qu.IService;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Service.mes.qu
|
||||
{
|
||||
@ -18,19 +22,40 @@ namespace ZR.Service.mes.qu
|
||||
public class QcRoughService : BaseService<QcRough>, IQcRoughService
|
||||
{
|
||||
|
||||
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
public (List<Mr_QuRoughDTO>, int) GetStatisticslist(int pageNum, int pageSize, int year, int week, int date, int 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.Wrokerorder_status==isSchedule)
|
||||
var predicate = Expressionable.Create<WmMaterialrequisition>()
|
||||
.AndIF(year > 0, wm => wm.Year == year)
|
||||
.AndIF(week > 0, wm => wm.Week == week)
|
||||
.AndIF(date > 0, wm => wm.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (proWorkorderList, totalCount);
|
||||
//联表查询
|
||||
List<Mr_QuRoughDTO> mr_QusList = Context.Queryable<WmMaterialrequisition>()
|
||||
.LeftJoin<QcRough>((wm, qc) =>wm.Id==qc.FkMaterialrequisitionId)
|
||||
.Where(predicate)
|
||||
.Select((wm,qc) => new Mr_QuRoughDTO {
|
||||
Id = qc.Id,
|
||||
FkMaterialrequisitionId=qc.FkMaterialrequisitionId,
|
||||
Workblankpartnumber=wm.Workblankpartnumber,
|
||||
Requirenum=wm.Requirenum,
|
||||
Status = wm.Status,
|
||||
Year = wm.Year,
|
||||
Week = wm.Week,
|
||||
Date = wm.Date,
|
||||
RequireNum= qc.RequireNum,
|
||||
ActualNumber=qc.ActualNumber,
|
||||
RandomRate = qc.RandomRate,
|
||||
Oks = qc.Oks,
|
||||
Ngs = qc.Ngs,
|
||||
OksRatio = qc.OksRatio,
|
||||
IsFeeding = qc.IsFeeding
|
||||
})
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (mr_QusList, totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user