提交代码
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
|
||||
using WCS.Model;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
public interface IHomerService
|
||||
{
|
||||
|
||||
public Task<ResponseBase> GetShelfServer(RequestBase request);
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
|
||||
|
||||
public Task<ResponseBase> StartSelfCheckByGroupName(List<string> GroupNames);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,13 @@ namespace WCS.BLL.Services.IService
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标定+设置偏移量
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 查询库位列表
|
||||
/// </summary>
|
||||
|
@ -4,11 +4,35 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
public class HomerService: IHomerService
|
||||
public class HomerService : IHomerService
|
||||
{
|
||||
public HomerService() { }
|
||||
|
||||
public async Task<ResponseBase> GetShelfServer(RequestBase request)
|
||||
{
|
||||
//直接获取数据库数据 分组进行返回
|
||||
var data = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
.Where(t => !string.IsNullOrEmpty(t.BigShelfCode))
|
||||
.Select(t => new GetShelfServerResponseItem()
|
||||
{
|
||||
BigShelfCode = t.BigShelfCode,
|
||||
ServerIp = t.ServerIp,
|
||||
})
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
return new GetShelfServerResponse()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = data
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ namespace WCS.BLL.Services.Service
|
||||
Message = "success"
|
||||
};
|
||||
}
|
||||
else if (Result != null && Result.Code == 200 && Result.Data == null)
|
||||
else if (Result != null && Result.Code == 200 && (Result.Data == null || Result.Data.Count == 0))
|
||||
{
|
||||
//Mes系统中未获取到物料信息
|
||||
|
||||
@ -295,7 +295,6 @@ namespace WCS.BLL.Services.Service
|
||||
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
|
||||
if (matInfo != null)
|
||||
{
|
||||
//TODO 改成wcs的实体
|
||||
if (!request.SingleLightIn && shelf != null)
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
@ -391,8 +390,8 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
|
||||
//TODO 配置这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = 5000;
|
||||
//配置这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = LocalFile.Config.InstoreTimeOut;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
|
@ -52,7 +52,8 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"操作失败:库位【{string.Join(",", storeCodeList)}】不存在!",
|
||||
};
|
||||
}
|
||||
//第二步 获取当前所有库位任务
|
||||
|
||||
//第二步 获取库位正在进行的任务
|
||||
//模式相同视为可以继续发送任务
|
||||
var currenTasks = DbHelp.db.Queryable<CurrentTask>()
|
||||
.Where(t => storeCodeList.Contains(t.StoreCode))
|
||||
|
@ -5,7 +5,10 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
@ -63,10 +66,11 @@ namespace WCS.BLL.Services.Service
|
||||
foreach (var ip in cleintIps)
|
||||
{
|
||||
var currentIdShelfs = shelfs.Where(t => t.ClientIp == ip)
|
||||
.Where(t => t.CurrentMode == HardWare.Mode.待机模式)
|
||||
.ToList();
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach(var shelf in currentIdShelfs)
|
||||
foreach (var shelf in currentIdShelfs)
|
||||
{
|
||||
|
||||
Task.Run(() =>
|
||||
@ -116,5 +120,7 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"已成功开始自检!",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO HardCode 根据模组信息生成库位
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ResponseCommon<object>> GenerateStoreInfo()
|
||||
@ -248,32 +248,32 @@ namespace WCS.BLL.Services.Service
|
||||
//var shelfInfos = DbHelp.db.Queryable<ShelfInfo>().ToList();
|
||||
//foreach (var shelfInfo in shelfInfos)
|
||||
//{
|
||||
var ModuleInfos = await DbHelp.db.Queryable<ModuleInfo>().ToListAsync();
|
||||
ModuleInfos.ForEach(moduleInfo =>
|
||||
var ModuleInfos = await DbHelp.db.Queryable<ModuleInfo>().ToListAsync();
|
||||
ModuleInfos.ForEach(moduleInfo =>
|
||||
{
|
||||
for (int i = 1; i <= moduleInfo.LightCount; i++)
|
||||
{
|
||||
for (int i = 1; i <= moduleInfo.LightCount; i++)
|
||||
var storeInfo = new StoreInfo()
|
||||
{
|
||||
var storeInfo = new StoreInfo()
|
||||
{
|
||||
StoreCode = moduleInfo.ModuleCode + "-" + i.ToString(),
|
||||
ShelfTypeId = 1,
|
||||
ModuleId = moduleInfo.Id,
|
||||
ModuleCode = moduleInfo.ModuleCode,
|
||||
ShelfId = moduleInfo.ShelfId,
|
||||
ShelfCode = moduleInfo.ShelfCode,
|
||||
BoardId = moduleInfo.BoardId,
|
||||
LightNumber = i,
|
||||
Priority = 1,
|
||||
CurrentMatSn = string.Empty,
|
||||
BigShelfCode = moduleInfo.Bigshelfcode,
|
||||
R = moduleInfo.R,
|
||||
C = moduleInfo.C,
|
||||
Wei = i.ToString(),
|
||||
GroupName = moduleInfo.GroupName,
|
||||
};
|
||||
DbHelp.db.Insertable(storeInfo).ExecuteCommand();
|
||||
}
|
||||
});
|
||||
StoreCode = moduleInfo.ModuleCode + "-" + i.ToString(),
|
||||
ShelfTypeId = 1,
|
||||
ModuleId = moduleInfo.Id,
|
||||
ModuleCode = moduleInfo.ModuleCode,
|
||||
ShelfId = moduleInfo.ShelfId,
|
||||
ShelfCode = moduleInfo.ShelfCode,
|
||||
BoardId = moduleInfo.BoardId,
|
||||
LightNumber = i,
|
||||
Priority = 1,
|
||||
CurrentMatSn = string.Empty,
|
||||
BigShelfCode = moduleInfo.Bigshelfcode,
|
||||
R = moduleInfo.R,
|
||||
C = moduleInfo.C,
|
||||
Wei = i.ToString(),
|
||||
GroupName = moduleInfo.GroupName,
|
||||
};
|
||||
DbHelp.db.Insertable(storeInfo).ExecuteCommand();
|
||||
}
|
||||
});
|
||||
//}
|
||||
return new ResponseCommon<object>() { Message = "111" };
|
||||
}
|
||||
@ -443,6 +443,44 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var modules = await DbHelp.db.Queryable<ModuleInfo>().Where(t => request.MouduleIds.Contains(t.Id)).ToListAsync();
|
||||
var isSend = false;
|
||||
foreach (var module in modules)
|
||||
{
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ShelfId == module.ShelfId).FirstOrDefault();
|
||||
if (shelf != null && shelf is SmartShelf)
|
||||
{
|
||||
var smartShelf = (SmartShelf)shelf;
|
||||
smartShelf.CalibrationSetOffset(module.Id, request.OffSet);
|
||||
isSend = true;
|
||||
}
|
||||
}
|
||||
if (isSend)
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success"
|
||||
};
|
||||
else
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:未找到对应模组"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "操作失败:" + ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 库位管理
|
||||
@ -580,7 +618,6 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ namespace WCS.BLL.Services.Service
|
||||
.FirstAsync();
|
||||
if (user == null)
|
||||
{
|
||||
|
||||
return new ResponseCommon<UserBase>()
|
||||
{
|
||||
Code = 201,
|
||||
@ -497,6 +498,8 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
//返回字串不返回密码
|
||||
user.Password = "***";
|
||||
request.PassWord = "***";
|
||||
|
||||
var response = new ResponseCommon<UserBase>()
|
||||
{
|
||||
Code = 200,
|
||||
|
Reference in New Issue
Block a user