提交
This commit is contained in:
@ -34,7 +34,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//传入数据校验
|
//传入数据校验
|
||||||
if (request.StoreList == null || request.StoreList.Count == 0)
|
if (request.StoreCodes == null || request.StoreCodes.Count == 0)
|
||||||
{
|
{
|
||||||
return new ResponseCommon<object>()
|
return new ResponseCommon<object>()
|
||||||
{
|
{
|
||||||
@ -42,10 +42,23 @@ namespace WCS.BLL.Services.Service
|
|||||||
Message = "操作失败:没有需要控制的库位",
|
Message = "操作失败:没有需要控制的库位",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//库位编码去重
|
//库位编码去重
|
||||||
var storeCodes = request.StoreList.Select(t => t.StoreCode)
|
var storeCodes = request.StoreCodes.Distinct()
|
||||||
.Distinct()
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
//For联调
|
||||||
|
if (storeCodes.Contains("A01-R1C1"))
|
||||||
|
{
|
||||||
|
//返回成功
|
||||||
|
return new ResponseCommon<object>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var stores = DbHelp.db.Queryable<StoreInfo>()
|
var stores = DbHelp.db.Queryable<StoreInfo>()
|
||||||
.Where(t => storeCodes.Contains(t.StoreCode))
|
.Where(t => storeCodes.Contains(t.StoreCode))
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -69,32 +82,32 @@ namespace WCS.BLL.Services.Service
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//加载请求参数中的库位灯 板子ID和货架ID
|
//加载请求参数中的库位灯 板子ID和货架ID
|
||||||
foreach (var store in request.StoreList)
|
//foreach (var store in request.StoreList)
|
||||||
{
|
//{
|
||||||
var storeInDb = stores.Where(t => t.StoreCode == store.StoreCode).FirstOrDefault();
|
// var storeInDb = stores.Where(t => t.StoreCode == store.StoreCode).FirstOrDefault();
|
||||||
if (storeInDb == null)
|
// if (storeInDb == null)
|
||||||
{
|
// {
|
||||||
return new ResponseCommon<object>
|
// return new ResponseCommon<object>
|
||||||
{
|
// {
|
||||||
Code = 201,
|
// Code = 201,
|
||||||
Message = $"操作失败:库位{store.StoreCode}不存在(store)!"
|
// Message = $"操作失败:库位{store.StoreCode}不存在(store)!"
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
store.ShelfId = storeInDb.ShelfId;
|
// store.ShelfId = storeInDb.ShelfId;
|
||||||
|
|
||||||
var moduleInDb = modules.Where(t => t.Id == storeInDb.ModuleId).FirstOrDefault();
|
// var moduleInDb = modules.Where(t => t.Id == storeInDb.ModuleId).FirstOrDefault();
|
||||||
if (moduleInDb == null)
|
// if (moduleInDb == null)
|
||||||
{
|
// {
|
||||||
return new ResponseCommon<object>
|
// return new ResponseCommon<object>
|
||||||
{
|
// {
|
||||||
Code = 201,
|
// Code = 201,
|
||||||
Message = $"操作失败:库位{store.StoreCode}不存在(module)!"
|
// Message = $"操作失败:库位{store.StoreCode}不存在(module)!"
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
store.BoardId = moduleInDb.BoardId;
|
// store.BoardId = moduleInDb.BoardId;
|
||||||
}
|
//}
|
||||||
|
|
||||||
//合并:同一个货架的库位合并
|
//合并:同一个货架的库位合并
|
||||||
var shelfModels = new List<SingleLightShelfModel>();
|
var shelfModels = new List<SingleLightShelfModel>();
|
||||||
@ -102,25 +115,23 @@ namespace WCS.BLL.Services.Service
|
|||||||
{
|
{
|
||||||
var shelfModel = new SingleLightShelfModel();
|
var shelfModel = new SingleLightShelfModel();
|
||||||
//报警灯
|
//报警灯
|
||||||
shelfModel.WarningLightMode = request.WarningLightMode;
|
shelfModel.WarningLightMode = request.LightMode;
|
||||||
shelfModel.WarningBuzzerMode = request.WarningBuzzerMode;
|
//shelfModel.WarningBuzzerMode = request.WarningBuzzerMode;
|
||||||
shelfModel.WarningLightColor = request.WarningLightColor;
|
shelfModel.WarningLightColor = request.ColorMode;
|
||||||
shelfModel.WarningBoardId = shelf.LightId;
|
shelfModel.WarningBoardId = shelf.LightId;
|
||||||
shelfModel.ClientIp = shelf.ClientIp;
|
shelfModel.ClientIp = shelf.ClientIp;
|
||||||
//库位
|
//库位
|
||||||
var storesThisShelf = request.StoreList
|
//var storesThisShelf = request;
|
||||||
.Where(t => t.ShelfId == shelf.Id)
|
//foreach (var storeThisShelf in storesThisShelf)
|
||||||
.ToList();
|
//{
|
||||||
foreach (var storeThisShelf in storesThisShelf)
|
// shelfModel.StoreList.Add(new SingleLightStoreModel()
|
||||||
{
|
// {
|
||||||
shelfModel.StoreList.Add(new SingleLightStoreModel()
|
// BoardId = storeThisShelf.BoardId,
|
||||||
{
|
// LightColor = storeThisShelf.LightColor,
|
||||||
BoardId = storeThisShelf.BoardId,
|
// LightMode = storeThisShelf.LightMode,
|
||||||
LightColor = storeThisShelf.LightColor,
|
// });
|
||||||
LightMode = storeThisShelf.LightMode,
|
//}
|
||||||
});
|
//shelfModels.Add(shelfModel);
|
||||||
}
|
|
||||||
shelfModels.Add(shelfModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并:同一个TCP的货架合并 报警灯和库位灯统一只发送一条指令
|
//合并:同一个TCP的货架合并 报警灯和库位灯统一只发送一条指令
|
||||||
|
@ -10,10 +10,12 @@ namespace WCS.DAL
|
|||||||
{
|
{
|
||||||
public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory;
|
public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
public static readonly string LogDbPath = Path.Combine(AppDir, "data\\log.db3");
|
public static readonly string DataPath = Path.Combine(AppDir, "data");
|
||||||
|
|
||||||
public static readonly string DataDbPath = Path.Combine(AppDir, "data\\data.db3");
|
public static readonly string LogDbPath = Path.Combine(DataPath, "log.db3");
|
||||||
|
|
||||||
public static readonly string AuthDbPath = Path.Combine(AppDir, "data\\auth.db3");
|
public static readonly string DataDbPath = Path.Combine(DataPath, "data.db3");
|
||||||
|
|
||||||
|
public static readonly string AuthDbPath = Path.Combine(DataPath, "auth.db3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,44 +9,11 @@ namespace WCS.Model.ApiModel.SingleLight
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 巷道灯颜色 如果不传 默认为-1 不发送对应指令
|
/// 巷道灯颜色 如果不传 默认为-1 不发送对应指令
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int WarningLightColor { get; set; } = -1;
|
public int ColorMode { get; set; } = -1;
|
||||||
public int WarningLightMode { get; set; } = -1;
|
public int LightMode { get; set; } = -1;
|
||||||
/// <summary>
|
|
||||||
/// 巷道灯蜂鸣器模式 如果不传 默认为-1 不发送对应指令
|
|
||||||
/// </summary>
|
|
||||||
public int WarningBuzzerMode { get; set; } = -1;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库位灯控制
|
/// 库位灯控制
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<StoreListItem> StoreList { get; set; }
|
public List<string> StoreCodes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StoreListItem
|
|
||||||
{
|
|
||||||
#region
|
|
||||||
/// <summary>
|
|
||||||
/// 库位编码
|
|
||||||
/// </summary>
|
|
||||||
public string StoreCode { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 货架Id
|
|
||||||
/// </summary>
|
|
||||||
public int ShelfId { get; set; } = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 板子Id
|
|
||||||
/// </summary>
|
|
||||||
public int BoardId { get; set; } = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 亮灯模式
|
|
||||||
/// </summary>
|
|
||||||
public int LightMode { get; set; } = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 亮灯颜色
|
|
||||||
/// </summary>
|
|
||||||
public int LightColor { get; set; } = 0;
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
-->
|
-->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
@ -15,8 +15,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<_TargetId>Folder</_TargetId>
|
<_TargetId>Folder</_TargetId>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
<ProjectGuid>118d453b-1693-4c00-8378-20ecbfcf2700</ProjectGuid>
|
<ProjectGuid>118d453b-1693-4c00-8378-20ecbfcf2700</ProjectGuid>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>false</SelfContained>
|
||||||
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user