设备运行绩效分析
This commit is contained in:
parent
97b6bcfe9a
commit
59469cea8a
@ -31,12 +31,12 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[HttpPost("list")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:list")]
|
||||
public IActionResult QueryDevicePerformance([FromQuery] DevicePerformanceQueryDto parm)
|
||||
public IActionResult QueryDevicePerformance([FromBody] DevicePerformanceQueryDto parm)
|
||||
{
|
||||
parm.FillDate = DOANConvertDateTime.ConvertLocalDateTime(parm.FillDate.Value);
|
||||
var response = _DevicePerformanceService.GetList(parm);
|
||||
|
||||
var response = _DevicePerformanceService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
@ -68,8 +68,18 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
var modal = parm.Adapt<DevicePerformance>().ToCreate(HttpContext);
|
||||
|
||||
var response = _DevicePerformanceService.AddDevicePerformance(modal);
|
||||
string data = "";
|
||||
if (response == -1)
|
||||
{
|
||||
data = "填写日期不能重复";
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = "成功";
|
||||
}
|
||||
|
||||
return SUCCESS(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -96,7 +106,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteDevicePerformance(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
string [] idsArr = Tools.SpitStrArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _DevicePerformanceService.Delete(idsArr);
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
},
|
||||
"dbConfigs": [
|
||||
{
|
||||
"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=GXAssembly;Port=3308",
|
||||
//"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=GXAssembly;Port=3308",
|
||||
// "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog=GXAssembly;Port=3306;AllowLoadLocalInfile=true",
|
||||
// "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=GXAssembly;Port=3306",
|
||||
"Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=GXAssembly;Port=3306",
|
||||
//"Conn": "Data Source=192.168.50.163;User ID=root;Password=123456;Initial Catalog=GXAssembly;Port=3306",
|
||||
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||
"ConfigId": "0", //多租户唯一标识
|
||||
@ -29,7 +29,7 @@
|
||||
//代码生成数据库配置
|
||||
"CodeGenDbConfig": {
|
||||
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
||||
"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308",
|
||||
"Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306",
|
||||
"DbType": 0,
|
||||
"IsAutoCloseConnection": true,
|
||||
"DbName": "GXAssembly" //代码生成默认连接数据库,Oracle库是实例的名称
|
||||
|
||||
@ -7,8 +7,8 @@ namespace DOAN.Model.MES.dev.Dto
|
||||
/// </summary>
|
||||
public class DevicePerformanceQueryDto : PagerInfo
|
||||
{
|
||||
public DateTime? FillDate { get; set; }
|
||||
}
|
||||
public DateTime[] FillDateTime { get; set; } = new DateTime[2];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备运行绩效分析输入输出对象
|
||||
|
||||
@ -9,6 +9,8 @@ using DOAN.Model.MES.dev;
|
||||
using DOAN.Repository;
|
||||
using DOAN.Service.MES.dev.IService;
|
||||
using System.Linq;
|
||||
using DOAN.Model.MES.product.Dto;
|
||||
using DOAN.Model.MES.product;
|
||||
|
||||
namespace DOAN.Service.MES.dev
|
||||
{
|
||||
@ -25,13 +27,26 @@ namespace DOAN.Service.MES.dev
|
||||
/// <returns></returns>
|
||||
public PagedInfo<DevicePerformanceDto> GetList(DevicePerformanceQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<DevicePerformance>()
|
||||
.AndIF(parm.FillDate>DateTime.MinValue,it=>it.FillDate==parm.FillDate)
|
||||
;
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<DevicePerformance, DevicePerformanceDto>(parm);
|
||||
return response;
|
||||
|
||||
var response = Queryable();
|
||||
|
||||
|
||||
if (parm.FillDateTime != null && parm.FillDateTime.Length == 2)
|
||||
{
|
||||
if (parm.FillDateTime[0] > DateTime.MinValue)
|
||||
{
|
||||
response = response.Where(it => it.FillDate >= parm.FillDateTime[0]);
|
||||
}
|
||||
|
||||
if (parm.FillDateTime[1] > DateTime.MinValue)
|
||||
{
|
||||
|
||||
response = response.Where(it => it.FillDate <= parm.FillDateTime[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return response.ToPage<DevicePerformance, DevicePerformanceDto>(parm);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -54,11 +69,19 @@ namespace DOAN.Service.MES.dev
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public DevicePerformance AddDevicePerformance(DevicePerformance model)
|
||||
public int AddDevicePerformance(DevicePerformance model)
|
||||
{
|
||||
model.Id = XueHua;
|
||||
AutoCalculation(ref model);
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
if (Queryable().Where(x => x.FillDate.Value.ToString("yyyy-MM-dd") == model.FillDate.Value.ToString("yyyy-MM-dd")).Count() > 0)
|
||||
{
|
||||
return -1;//填写日期不能重复
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Id = XueHua;
|
||||
AutoCalculation(ref model);
|
||||
return Context.Insertable(model).ExecuteCommand();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -99,6 +122,7 @@ namespace DOAN.Service.MES.dev
|
||||
|
||||
private void AutoCalculation(ref DevicePerformance model)
|
||||
{
|
||||
|
||||
|
||||
// 设备计划运行时间:(分钟)=设备可使用时间:(分钟)-节假日
|
||||
model.PlanRuntime = model.Usabletime - model.Holiday??0;
|
||||
@ -139,5 +163,6 @@ namespace DOAN.Service.MES.dev
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ namespace DOAN.Service.MES.dev.IService
|
||||
|
||||
DevicePerformance GetInfo(string Id);
|
||||
|
||||
DevicePerformance AddDevicePerformance(DevicePerformance parm);
|
||||
int AddDevicePerformance(DevicePerformance parm);
|
||||
|
||||
int UpdateDevicePerformance(DevicePerformance parm);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user