工单进度跟踪
This commit is contained in:
parent
91a5295aa7
commit
66f27cd822
@ -15,6 +15,7 @@ using DOAN.Model.MES.base_.Dto;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Aliyun.OSS;
|
||||
using System;
|
||||
using DOAN.Infrastructure;
|
||||
|
||||
//创建时间:2024-07-16
|
||||
namespace DOAN.Admin.WebApi.Controllers
|
||||
@ -45,6 +46,8 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:list")]
|
||||
public IActionResult QueryProWorkorder([FromBody] ProWorkorderQueryDto parm)
|
||||
{
|
||||
parm.WorkorderDate[0]=ConvertDateTime.ConvertLocalDate(parm.WorkorderDate[0]);
|
||||
parm.WorkorderDate[1]=ConvertDateTime.ConvertLocalDate(parm.WorkorderDate[1]);
|
||||
var response = _ProWorkorderService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
@ -326,6 +329,17 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 获取工单进度追溯
|
||||
[HttpPost("get_workorder_trace_progress")]
|
||||
public IActionResult GetWorkorderTraceProgressList([FromBody]ProWorkorderQueryDto query)
|
||||
{
|
||||
query.WorkorderDate[0] = ConvertDateTime.ConvertLocalDate(query.WorkorderDate[0]);
|
||||
query.WorkorderDate[1] = ConvertDateTime.ConvertLocalDate(query.WorkorderDate[1]);
|
||||
if (query == null) { throw new Exception("query为空"); }
|
||||
var response= _ProWorkorderService.GetWorkorderTraceProgressList(query);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,6 +122,18 @@ namespace DOAN.Model.MES.product.Dto
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 工单开始时间
|
||||
///// </summary>
|
||||
|
||||
//public DateTime? StartTime { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 工单结束时间
|
||||
|
||||
//public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
@ -281,6 +293,102 @@ namespace DOAN.Model.MES.product.Dto
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单进度追溯
|
||||
/// </summary>
|
||||
public class ProWorkorderTranceProgressDto
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 雪花id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存货编码
|
||||
/// </summary>
|
||||
public string ProductionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品名称
|
||||
/// </summary>
|
||||
public string ProductionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string Specification { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 交货数量
|
||||
/// </summary>
|
||||
public int? DeliveryNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组别
|
||||
/// </summary>
|
||||
public string GroupCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 线别
|
||||
/// </summary>
|
||||
public string LineCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public int? Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单日期
|
||||
/// </summary>
|
||||
public DateTime? WorkorderDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优先级 1-100
|
||||
/// </summary>
|
||||
public int? Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单状态
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单开始时间
|
||||
/// </summary>
|
||||
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单结束时间
|
||||
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计划数量
|
||||
/// </summary>
|
||||
public int? PlanNum { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 实际数量
|
||||
/// </summary>
|
||||
public int? ActualNum { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -106,6 +106,18 @@ namespace DOAN.Model.MES.product
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单开始时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "start_time")]
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单结束时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "end_time")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
|
||||
@ -363,5 +363,30 @@ namespace DOAN.Repository
|
||||
page.Result = result.Adapt<List<T2>>();
|
||||
return page;
|
||||
}
|
||||
/// <summary>
|
||||
/// 分页查询 不转
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public static PagedInfo<T> ToPage_NO_Convert<T>(this ISugarQueryable<T> source, PagerInfo parm)
|
||||
{
|
||||
var page = new PagedInfo<T>();
|
||||
var total = 0;
|
||||
page.PageSize = parm.PageSize;
|
||||
page.PageIndex = parm.PageNum;
|
||||
if (parm.Sort.IsNotEmpty())
|
||||
{
|
||||
source.OrderByPropertyName(parm.Sort, parm.SortType.Contains("desc") ? OrderByType.Desc : OrderByType.Asc);
|
||||
}
|
||||
var result = source
|
||||
//.OrderByIF(parm.Sort.IsNotEmpty(), $"{parm.Sort.ToSqlFilter()} {(!string.IsNullOrWhiteSpace(parm.SortType) && parm.SortType.Contains("desc") ? "desc" : "asc")}")
|
||||
.ToPageList(parm.PageNum, parm.PageSize, ref total);
|
||||
|
||||
page.TotalNum = total;
|
||||
page.Result = result;
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,23 +175,26 @@ namespace DOAN.Service.JobKanban
|
||||
.ExecuteCommand();
|
||||
|
||||
|
||||
result= Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 2)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
result = Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 2)
|
||||
.SetColumns(it => it.StartTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
});
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int FinishWorkOrder(string workorder)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 3)
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Status == 3)
|
||||
.SetColumns(it=>it.EndTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
public ProWorkorder GetProductingWorkorder( string line_code, DateTime handleDate)
|
||||
public ProWorkorder GetProductingWorkorder(string line_code, DateTime handleDate)
|
||||
{
|
||||
//TODO 这个日期有问题??????
|
||||
if(handleDate.Kind==DateTimeKind.Utc)
|
||||
if (handleDate.Kind == DateTimeKind.Utc)
|
||||
{
|
||||
|
||||
handleDate = handleDate.ToLocalTime().Date;
|
||||
@ -200,7 +203,7 @@ namespace DOAN.Service.JobKanban
|
||||
{
|
||||
handleDate = handleDate.Date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Context.Queryable<ProWorkorder>()
|
||||
.Where(it => it.LineCode == line_code)
|
||||
@ -213,7 +216,7 @@ namespace DOAN.Service.JobKanban
|
||||
|
||||
public int AddLabelLog(string labelContext, string workOrder)
|
||||
{
|
||||
ProLabelTraceLog log = new ProLabelTraceLog();
|
||||
ProLabelTraceLog log = new ProLabelTraceLog();
|
||||
log.Id = XueHua;
|
||||
log.LabelContext = labelContext;
|
||||
log.Workorder = workOrder;
|
||||
@ -221,7 +224,7 @@ namespace DOAN.Service.JobKanban
|
||||
log.CreatedTime = DateTime.Now;
|
||||
log.CreatedBy = "MES";
|
||||
|
||||
return Context.Insertable(log).ExecuteCommand();
|
||||
return Context.Insertable(log).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
@ -235,7 +238,7 @@ namespace DOAN.Service.JobKanban
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int FinishAndReportWorkorder(string workorder, int finish_num)
|
||||
{
|
||||
|
||||
@ -22,6 +22,8 @@ namespace DOAN.Service.MES.product.IService
|
||||
{
|
||||
PagedInfo<ProWorkorderDto3> GetList(ProWorkorderQueryDto parm);
|
||||
|
||||
PagedInfo<ProWorkorderTranceProgressDto> GetWorkorderTraceProgressList(ProWorkorderQueryDto query);
|
||||
|
||||
ProWorkorder GetInfo(string Id);
|
||||
|
||||
ProWorkorder AddProWorkorder(ProWorkorder parm);
|
||||
|
||||
@ -928,6 +928,36 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单进度跟踪
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProWorkorderTranceProgressDto> GetWorkorderTraceProgressList(ProWorkorderQueryDto query)
|
||||
{
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder>()
|
||||
.AndIF(!string.IsNullOrEmpty(query.ProductionName), it => it.ProductionName.Contains(query.ProductionName))
|
||||
.AndIF(!string.IsNullOrEmpty(query.ProductionCode), it => it.ProductionCode.Contains(query.ProductionCode))
|
||||
.AndIF(!string.IsNullOrEmpty(query.LineCode), it => it.LineCode == query.LineCode)
|
||||
.AndIF(!string.IsNullOrEmpty(query.GroupCode), it => it.GroupCode == query.GroupCode)
|
||||
.AndIF(query.WorkorderDate != null && query.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= parm.WorkorderDate[0])
|
||||
.AndIF(query.WorkorderDate != null && query.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= parm.WorkorderDate[1])
|
||||
|
||||
;
|
||||
var query2 = Queryable()
|
||||
.Where(predicate.ToExpression());
|
||||
|
||||
return Context.Queryable(query2).LeftJoin<ProReportwork>((q, r) => q.Workorder == r.FkWorkorder)
|
||||
.Select((q, r) => new ProWorkorderTranceProgressDto()
|
||||
{
|
||||
PlanNum = q.DeliveryNum,
|
||||
ActualNum = r.FinishedNum,
|
||||
}, true).ToPage_NO_Convert<ProWorkorderTranceProgressDto>(query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user