13
This commit is contained in:
parent
27b218ec4a
commit
13f58300dd
@ -8,6 +8,7 @@ using MiniExcelLibs;
|
||||
using DOAN.Model.System.Dto;
|
||||
using DOAN.Model;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Aliyun.OSS;
|
||||
|
||||
|
||||
namespace DOAN.Admin.WebApi.Controllers
|
||||
@ -38,5 +39,47 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取工序
|
||||
/// </summary>
|
||||
/// <param name="WorkRouteID">工一路线id</param>
|
||||
/// <returns>工艺路线绑定的工序列表</returns>
|
||||
[HttpGet("get_work_process")]
|
||||
public IActionResult GetworkProcess(int WorkRouteID)
|
||||
{
|
||||
var response = _ProWorkorderSchedule.GetworkProcess(WorkRouteID);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取工位
|
||||
/// </summary>
|
||||
/// <param name="WorkRouteID">工序id</param>
|
||||
/// <returns>工序绑定的工位列表</returns>
|
||||
[HttpGet("get_work_station")]
|
||||
public IActionResult GetworkStation(int WorkProcessID)
|
||||
{
|
||||
var response = _ProWorkorderSchedule.GetworkStation(WorkProcessID);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备
|
||||
/// </summary>
|
||||
/// <param name="WorkRouteID">工序id</param>
|
||||
/// <returns>工序绑定的工位列表</returns>
|
||||
[HttpGet("get_work_device")]
|
||||
public IActionResult GetWorkDevice(int WorkStationID)
|
||||
{
|
||||
var response = _ProWorkorderSchedule.GetWorkDevice(WorkStationID);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,11 +13,6 @@ namespace DOAN.Model.MES.base_
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_work_station")]
|
||||
public int? FkWorkStation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备编号
|
||||
|
||||
53
DOAN.Model/MES/base/BaseRelStationDevice.cs
Normal file
53
DOAN.Model/MES/base/BaseRelStationDevice.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace DOAN.Model.MES.base_
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位与设备关联表
|
||||
/// </summary>
|
||||
[SugarTable("base_rel_station_device")]
|
||||
public class BaseRelStationDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_station_id")]
|
||||
public int? FkStationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_device_id")]
|
||||
public int? FkDeviceId { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -30,7 +30,7 @@ namespace DOAN.Model.MES.base_.Dto
|
||||
[Required(ErrorMessage = "主键不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? FkWorkStation { get; set; }
|
||||
|
||||
|
||||
public string DeviceCode { get; set; }
|
||||
|
||||
|
||||
@ -124,6 +124,9 @@ namespace DOAN.Model.MES.dev.Dto
|
||||
[ExcelColumnName("任务执行——结束时间")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
//耗时
|
||||
public double ConsumeTime { get; set; }
|
||||
|
||||
[ExcelColumn(Name = "状态")]
|
||||
[ExcelColumnName("状态")]
|
||||
public int? Status { get; set; }
|
||||
|
||||
@ -39,6 +39,7 @@ namespace DOAN.Service.MES.base_
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
|
||||
.ToPage<BaseDevice, BaseDeviceDto>(parm);
|
||||
|
||||
return response;
|
||||
@ -50,8 +51,12 @@ namespace DOAN.Service.MES.base_
|
||||
/// <returns></returns>
|
||||
public List<BaseDeviceDto> GetList_nobind(int id)
|
||||
{
|
||||
var response= Context.Queryable<BaseDevice>().Where(it => (it.Status==1&&it.FkWorkStation == null) || (it.Status == 1 && it.FkWorkStation == id))
|
||||
.ToList().Adapt<List<BaseDeviceDto>>();
|
||||
var response= Context.Queryable<BaseDevice>()
|
||||
.Where(it => (it.Status==1&&it.FkWorkStation == null) || (it.Status == 1 && it.FkWorkStation == id))
|
||||
.ToList()
|
||||
.Adapt<List<BaseDeviceDto>>();
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,17 @@ namespace DOAN.Service.MES.dev
|
||||
.OrderByDescending(x => x.Id)
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<DeviceTaskExecute, DeviceTaskExecuteDto>(parm);
|
||||
foreach(DeviceTaskExecuteDto item in response.Result )
|
||||
{
|
||||
if(item.StartTime>DateTime.MinValue&&item.EndTime>DateTime.MinValue)
|
||||
{
|
||||
TimeSpan timeDifference = item.EndTime.Value - item.StartTime.Value;
|
||||
|
||||
double minutes = timeDifference.TotalMinutes;
|
||||
double roundedMinutes = Math.Round(minutes, 1);
|
||||
item.ConsumeTime = roundedMinutes;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using DOAN.Model;
|
||||
using DOAN.Model.MES.base_.Dto;
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Model.MES.product.Dto;
|
||||
using System;
|
||||
@ -13,5 +14,12 @@ namespace DOAN.Service.MES.product.IService
|
||||
public interface IProWorkorderSchedule : IBaseService<ProWorkorder>
|
||||
{
|
||||
PagedInfo<ProWorkorderDto> GetList(ProWorkorderQueryDto parm);
|
||||
|
||||
List<BaseWorkProcessesDto> GetworkProcess(int WorkRouteId);
|
||||
|
||||
List<BaseWorkStationDto> GetworkStation(int WorkProcessID);
|
||||
|
||||
|
||||
List<BaseDeviceDto> GetWorkDevice(int WorkStationID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DOAN.Repository;
|
||||
using DOAN.Model.MES.base_.Dto;
|
||||
using Mapster;
|
||||
using Org.BouncyCastle.Asn1.Bsi;
|
||||
|
||||
|
||||
|
||||
@ -57,5 +60,50 @@ namespace DOAN.Service.MES.product
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取工序
|
||||
/// </summary>
|
||||
/// <param name="WorkRouteId"></param>
|
||||
/// <returns></returns>
|
||||
public List<BaseWorkProcessesDto> GetworkProcess(int WorkRouteId)
|
||||
{
|
||||
var query = Context.Queryable<BaseRelWorkRouteProcesses>().Where(it => it.FkWorkRoute == WorkRouteId);
|
||||
return Context.Queryable(query)
|
||||
.LeftJoin<BaseWorkProcesses>((q, p) => q.FkWorkProcesses == p.Id)
|
||||
.Select((q, p) => p)
|
||||
.ToList()
|
||||
.Adapt<List<BaseWorkProcessesDto>>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取工位
|
||||
/// </summary>
|
||||
/// <param name="WorkProcessID"></param>
|
||||
/// <returns></returns>
|
||||
public List<BaseWorkStationDto> GetworkStation(int WorkProcessID)
|
||||
{
|
||||
return Context.Queryable<BaseWorkStation>()
|
||||
.Where(it => it.FkWorkProcesses == WorkProcessID)
|
||||
.ToList()
|
||||
.Adapt<List<BaseWorkStationDto>>();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取设备
|
||||
/// </summary>
|
||||
/// <param name="WorkProcessID"></param>
|
||||
/// <returns></returns>
|
||||
public List<BaseDeviceDto> GetWorkDevice(int WorkStationID)
|
||||
{
|
||||
var query = Context.Queryable<BaseRelStationDevice>().Where(it => it.FkStationId == WorkStationID);
|
||||
return Context.Queryable(query)
|
||||
.LeftJoin<BaseDevice>((q, p) => q.FkDeviceId == p.Id)
|
||||
.Select((q, p) => p)
|
||||
.ToList()
|
||||
.Adapt<List<BaseDeviceDto>>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user