单灯区域增加看板接口
This commit is contained in:
@ -131,6 +131,19 @@ namespace WCS.DAL.DbModels
|
|||||||
[SugarColumn(ColumnName = "single_light_number", IsNullable = false, DefaultValue = "1", ColumnDescription = "单灯货架灯的个数,用于煤科院大库位灯")]
|
[SugarColumn(ColumnName = "single_light_number", IsNullable = false, DefaultValue = "1", ColumnDescription = "单灯货架灯的个数,用于煤科院大库位灯")]
|
||||||
public int SingleLightNumber { get; set; }
|
public int SingleLightNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 灯当前模式
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "light_mode", IsNullable = true, ColumnDescription = "亮灯模式")]
|
||||||
|
public int LightMode { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 灯当前颜色
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "color_mode", IsNullable = true, ColumnDescription = "灯当前颜色")]
|
||||||
|
public int ColorMode { get; set; }= 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序号
|
/// 序号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -88,10 +88,10 @@ namespace WCS.BLL.Services.Service
|
|||||||
var shelfs = DbHelp.db.Queryable<ShelfInfo>().Where(t => shelfIds.Contains(t.Id))
|
var shelfs = DbHelp.db.Queryable<ShelfInfo>().Where(t => shelfIds.Contains(t.Id))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//对应模组信息
|
////对应模组信息
|
||||||
var moduleIds = stores.Select(t => t.ModuleId).Distinct().ToList();
|
//var moduleIds = stores.Select(t => t.ModuleId).Distinct().ToList();
|
||||||
var modules = DbHelp.db.Queryable<ModuleInfo>().Where(t => moduleIds.Contains(t.Id))
|
//var modules = DbHelp.db.Queryable<ModuleInfo>().Where(t => moduleIds.Contains(t.Id))
|
||||||
.ToList();
|
// .ToList();
|
||||||
|
|
||||||
//合并:同一个货架的库位合并
|
//合并:同一个货架的库位合并
|
||||||
var shelfModels = new List<SingleLightShelfModel>();
|
var shelfModels = new List<SingleLightShelfModel>();
|
||||||
@ -165,6 +165,11 @@ namespace WCS.BLL.Services.Service
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logs.Write($"【单灯单独控制】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
|
Logs.Write($"【单灯单独控制】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
|
||||||
|
return new ResponseCommon<object>()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = $"【单灯单独控制】{client}指令发送中遇到异常{ex.Message}",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -179,6 +184,16 @@ namespace WCS.BLL.Services.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新数据库灯的状态
|
||||||
|
stores.ForEach(t =>
|
||||||
|
{
|
||||||
|
t.LightMode = request.ColorMode;
|
||||||
|
t.ColorMode = request.LightMode;
|
||||||
|
});
|
||||||
|
DbHelp.db.Updateable(stores)
|
||||||
|
.UpdateColumns(t => new { t.LightMode, t.ColorMode })
|
||||||
|
.ExecuteCommand();
|
||||||
|
|
||||||
//返回成功
|
//返回成功
|
||||||
return new ResponseCommon<object>()
|
return new ResponseCommon<object>()
|
||||||
{
|
{
|
||||||
@ -276,6 +291,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logs.Write($"【熄灯】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
|
Logs.Write($"【熄灯】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -290,6 +306,17 @@ namespace WCS.BLL.Services.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新灯状态为熄灭
|
||||||
|
//var stores = DbHelp.db.Queryable<StoreInfo>().Where(t => t.Area == request.Area).ToList();
|
||||||
|
stores.ForEach(t =>
|
||||||
|
{
|
||||||
|
t.ColorMode = 0;
|
||||||
|
t.LightMode = 0;
|
||||||
|
});
|
||||||
|
DbHelp.db.Updateable(stores)
|
||||||
|
.UpdateColumns(t => new { t.LightMode, t.ColorMode })
|
||||||
|
.ExecuteCommand();
|
||||||
|
|
||||||
//返回成功
|
//返回成功
|
||||||
return new ResponseCommon<object>()
|
return new ResponseCommon<object>()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WCS.BLL.Services.IService;
|
using WCS.BLL.Services.IService;
|
||||||
using WCS.BLL.Services.Service;
|
using WCS.BLL.Services.Service;
|
||||||
|
using WCS.DAL.Db;
|
||||||
|
using WCS.DAL.DbModels;
|
||||||
using WCS.Model;
|
using WCS.Model;
|
||||||
using WCS.Model.ApiModel;
|
using WCS.Model.ApiModel;
|
||||||
using WCS.Model.ApiModel.SelfCheck;
|
using WCS.Model.ApiModel.SelfCheck;
|
||||||
@ -62,5 +64,41 @@ namespace WCS.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("GetKanBanData")]
|
||||||
|
[HttpGet(Name = "GetKanBanData")]
|
||||||
|
public async Task<ResponseBase> GetKanBanData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//获取单灯类型的库位
|
||||||
|
var stores = DbHelp.db.Queryable<StoreInfo>()
|
||||||
|
.Where(t => t.ShelfTypeId == 2)
|
||||||
|
.OrderBy(t => t.Area)
|
||||||
|
.OrderBy(t => t.StoreCode)
|
||||||
|
.Select(t => new
|
||||||
|
{
|
||||||
|
Area = t.Area,
|
||||||
|
StoreCode = t.StoreCode,
|
||||||
|
LightMode = t.LightMode,
|
||||||
|
ColorMode = t.ColorMode,
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
Data = stores
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user