|
|
@ -94,20 +94,24 @@ namespace Aucma.Scada.Business
|
|
|
|
_baseSpaceDetailService = registerServices.GetService<IBaseSpaceDetailService>();
|
|
|
|
_baseSpaceDetailService = registerServices.GetService<IBaseSpaceDetailService>();
|
|
|
|
_baseBomInfoService = registerServices.GetService<IBaseBomInfoService>();
|
|
|
|
_baseBomInfoService = registerServices.GetService<IBaseBomInfoService>();
|
|
|
|
_recordInStore = registerServices.GetService<IRecordInStoreService>();
|
|
|
|
_recordInStore = registerServices.GetService<IRecordInStoreService>();
|
|
|
|
taskHandle.InStoreFinsihEvent += TaskFeedback;
|
|
|
|
|
|
|
|
|
|
|
|
taskHandle.InStoreFinsihEvent += InStoreFinish;
|
|
|
|
|
|
|
|
taskHandle.InStoreAnswerEvent += InStoreAnswer;
|
|
|
|
|
|
|
|
|
|
|
|
grabImage.RefreshMaterialCodeStrEvent += InStore;
|
|
|
|
grabImage.RefreshMaterialCodeStrEvent += InStore;
|
|
|
|
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
|
|
|
|
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
|
|
|
|
|
|
|
|
|
|
|
|
StartPassDown();
|
|
|
|
StartPassDown();
|
|
|
|
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Thread.Sleep(6000);
|
|
|
|
Thread.Sleep(6000);
|
|
|
|
for (int i = 1; i < 12; i++)
|
|
|
|
for (int i = 1; i < 4; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//InStore(appConfig.shellStoreCode, "B2360000078110600" + i.ToString().PadLeft(2, '0'));
|
|
|
|
//InStore(appConfig.shellStoreCode, "B23600000781110800" + i.ToString().PadLeft(2, '0'));
|
|
|
|
//Thread.Sleep(1000*60*1);
|
|
|
|
//Thread.Sleep(1000*60*1);
|
|
|
|
//InStore(appConfig.linerStoreCode, "L2360000078110600" + i.ToString().PadLeft(2, '0'));
|
|
|
|
InStore(appConfig.linerStoreCode, "L23600000781110800" + i.ToString().PadLeft(2, '0'));
|
|
|
|
//Thread.Sleep(1000 * 60 * 1);
|
|
|
|
Thread.Sleep(1000 * 30);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -195,26 +199,28 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
private SemaphoreSlim linerSemaphore = new SemaphoreSlim(0);
|
|
|
|
private SemaphoreSlim linerSemaphore = new SemaphoreSlim(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 任务下发
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
private void StartPassDown()
|
|
|
|
private void StartPassDown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PassDownShellTask();
|
|
|
|
PassDownShellTask();
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PassDownLinerTask();
|
|
|
|
PassDownLinerTask();
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -227,28 +233,26 @@ namespace Aucma.Scada.Business
|
|
|
|
/// <param name="e"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void PassDownShellTask()
|
|
|
|
private void PassDownShellTask()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RealTaskInfo taskInfo = GetAwaitSendTask(appConfig.shellStoreCode);
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RealTaskInfo taskInfo = taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, appConfig.instoreTaskType);
|
|
|
|
if (taskInfo != null)
|
|
|
|
if (taskInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage($"下发箱壳入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
|
|
|
|
PrintLogInfoMessage($"下发箱壳入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
|
|
|
|
//taskHandle.SendShellTask_InStore(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskHandle.SendShellTask_InStore(taskInfo))
|
|
|
|
if (taskHandle.SendShellTask_InStore(taskInfo))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈");
|
|
|
|
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈");
|
|
|
|
taskInfo.taskStatus = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_taskInfoService.UpdateTaskInfo(taskInfo);
|
|
|
|
shellSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
taskHandle.WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false);
|
|
|
|
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};开始执行");
|
|
|
|
|
|
|
|
|
|
|
|
shellSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
taskInfo.taskStatus = 2;
|
|
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};执行完成");
|
|
|
|
_taskInfoService.UpdateTaskInfo(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo,true);
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -260,7 +264,10 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage("未获取到需要下发的箱壳入库任务");
|
|
|
|
PrintLogInfoMessage("未获取到需要下发的箱壳入库任务");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogErrorMessage("依次获取箱壳任务队列进行下发逻辑异常", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -268,7 +275,9 @@ namespace Aucma.Scada.Business
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private void PassDownLinerTask()
|
|
|
|
private void PassDownLinerTask()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RealTaskInfo taskInfo = GetAwaitSendTask(appConfig.linerStoreCode);
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RealTaskInfo taskInfo = taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.linerStoreCode, appConfig.instoreTaskType);
|
|
|
|
if (taskInfo != null)
|
|
|
|
if (taskInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage($"下发内胆入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
|
|
|
|
PrintLogInfoMessage($"下发内胆入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
|
|
|
@ -276,19 +285,16 @@ namespace Aucma.Scada.Business
|
|
|
|
if (taskHandle.SendLinerTask_InStore(taskInfo))
|
|
|
|
if (taskHandle.SendLinerTask_InStore(taskInfo))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈");
|
|
|
|
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈");
|
|
|
|
taskInfo.taskStatus = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_taskInfoService.UpdateTaskInfo(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
linerSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
|
|
|
|
|
|
|
|
taskHandle.WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false);
|
|
|
|
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};开始执行");
|
|
|
|
|
|
|
|
|
|
|
|
linerSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
taskInfo.taskStatus = 2;
|
|
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};执行完成");
|
|
|
|
_taskInfoService.UpdateTaskInfo(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo,true);
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -298,91 +304,70 @@ namespace Aucma.Scada.Business
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage("未获取到需要下发的内胆入库任务");
|
|
|
|
PrintLogInfoMessage("未获取到需要下发的内胆入库任务");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogErrorMessage("依次获取内胆任务队列进行下发逻辑异常", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 获取待执行的入库任务
|
|
|
|
/// 入库应答,PLC收到入库任务后进行应答
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
private RealTaskInfo GetAwaitSendTask(string storeCode)
|
|
|
|
private void InStoreAnswer(string storeCode, string taskCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RealTaskInfo taskInfo = null;
|
|
|
|
if (storeCode == appConfig.shellStoreCode)
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
taskInfo = _taskInfoService.GetTaskInfoByStoreCode(storeCode, 1);
|
|
|
|
PrintLogInfoMessage("箱壳应答成功,自动释放信号量,进行下发新任务");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shellSemaphore.Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogErrorMessage("获取待执行的入库任务异常", ex);
|
|
|
|
PrintLogInfoMessage("内胆应答成功,自动释放信号量,进行下发新任务");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return taskInfo;
|
|
|
|
linerSemaphore.Release();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 任务反馈(入库完成)
|
|
|
|
/// 入库完成
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
private void TaskFeedback(string storeCode,string taskCode)
|
|
|
|
private void InStoreFinish(string storeCode, string taskCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(storeCode == appConfig.shellStoreCode)
|
|
|
|
if (storeCode == appConfig.shellStoreCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ShellTaskFeedback(taskCode);
|
|
|
|
PrintLogInfoMessage($"箱壳任务:{taskCode};执行完成");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InStoreFinishHandle(taskCode, appConfig.shellStoreCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LinerTaskFeedback(taskCode);
|
|
|
|
PrintLogInfoMessage($"内胆任务:{taskCode};执行完成");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 箱壳执行反馈
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private void ShellTaskFeedback(string taskCode)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳执行完成,自动释放信号量");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InStoreFinish(taskCode, appConfig.shellStoreCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shellSemaphore.Release();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InStoreFinishHandle(taskCode, appConfig.linerStoreCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 内胆执行反馈
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private void LinerTaskFeedback(string taskCode)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage("内胆执行完成,自动释放信号量");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InStoreFinish(taskCode, appConfig.linerStoreCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
linerSemaphore.Release();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 入库完成
|
|
|
|
/// 入库完成逻辑处理
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
private void InStoreFinish(string taskCode, string storeCode)
|
|
|
|
private void InStoreFinishHandle(string taskCode, string storeCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var taskInfo = _taskInfoService.GetTaskInfoByTaskCode(taskCode, storeCode);
|
|
|
|
var taskInfo = _taskInfoService.GetTaskInfoByTaskCode(taskCode, storeCode);
|
|
|
|
if (taskInfo != null)
|
|
|
|
if (taskInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode);
|
|
|
|
var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode);
|
|
|
|
|
|
|
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
if (spaceInfo != null)
|
|
|
@ -431,7 +416,7 @@ namespace Aucma.Scada.Business
|
|
|
|
//清除任务信息
|
|
|
|
//清除任务信息
|
|
|
|
_taskInfoService.DeleteTaskInfo(taskCode, storeCode);
|
|
|
|
_taskInfoService.DeleteTaskInfo(taskCode, storeCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -439,27 +424,6 @@ namespace Aucma.Scada.Business
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 日志输出,界面刷新同时记录文件
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
|
|
|
private void PrintLogInfoMessage(string message)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RefreshLogMessageEvent?.Invoke(message);
|
|
|
|
|
|
|
|
logHelper.Info(message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 异常日志输出
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
|
|
|
/// <param name="ex"></param>
|
|
|
|
|
|
|
|
private void PrintLogErrorMessage(string message, Exception ex = null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RefreshLogMessageEvent?.Invoke(message);
|
|
|
|
|
|
|
|
logHelper.Error(message, ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 截取条码
|
|
|
|
/// 截取条码
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -476,9 +440,13 @@ namespace Aucma.Scada.Business
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取已创建的所有入库任务
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
public List<RealTaskInfo> GetInStoreTask()
|
|
|
|
public List<RealTaskInfo> GetInStoreTask()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _taskInfoService.GetTaskInfosByStoreCode(new string[] { appConfig.shellStoreCode,appConfig.linerStoreCode }, 1);
|
|
|
|
return _taskInfoService.GetTaskInfosByStoreCode(new string[] { appConfig.shellStoreCode,appConfig.linerStoreCode }, appConfig.instoreTaskType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -507,13 +475,14 @@ namespace Aucma.Scada.Business
|
|
|
|
return _spaceInfoService.GetMaterialStock(appConfig.shellStoreCode, appConfig.linerStoreCode);
|
|
|
|
return _spaceInfoService.GetMaterialStock(appConfig.shellStoreCode, appConfig.linerStoreCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 通过PLC读取货道信息:在库、在途、货道状态
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 通过PLC读取货道信息(在途数量、在库数量、货道状态)
|
|
|
|
/// 通过PLC读取货道信息(在途数量、在库数量、货道状态)
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
private BaseSpaceInfo GetSpaceInfoByMaterialType(string storeCode,string materialType)
|
|
|
|
private BaseSpaceInfo GetSpaceInfoByMaterialType(string storeCode, string materialType)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BaseSpaceInfo result = null;
|
|
|
|
BaseSpaceInfo result = null;
|
|
|
|
|
|
|
|
|
|
|
@ -527,7 +496,7 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result = GetSpaceInfosByPlc(info);
|
|
|
|
result = GetSpaceInfosByPlc(info);
|
|
|
|
|
|
|
|
|
|
|
|
if(result == null)
|
|
|
|
if (result == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list = _spaceInfoService.GetEmptySpaceInfo(storeCode);
|
|
|
|
var list = _spaceInfoService.GetEmptySpaceInfo(storeCode);
|
|
|
|
|
|
|
|
|
|
|
@ -536,7 +505,8 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception ex)
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogErrorMessage("货道信息读取异常", ex);
|
|
|
|
PrintLogErrorMessage("货道信息读取异常", ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -569,7 +539,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
var list = info.Where(x => x.spaceStock > 0 ? x.spaceCapacity > (x.spaceStock + x.onRouteAmount) : 1 == 1 && x.spaceStatus == 1).ToList();
|
|
|
|
var list = info.Where(x => x.spaceStock > 0 ? x.spaceCapacity > (x.spaceStock + x.onRouteAmount) : 1 == 1 && x.spaceStatus == 1).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if(list.Count > 0)
|
|
|
|
if (list.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result = list.OrderByDescending(x => x.spaceStock).OrderBy(x => x.spaceCode).First();
|
|
|
|
result = list.OrderByDescending(x => x.spaceStock).OrderBy(x => x.spaceCode).First();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -578,5 +548,29 @@ namespace Aucma.Scada.Business
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 日志输出
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 日志输出,界面刷新同时记录文件
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
|
|
|
private void PrintLogInfoMessage(string message)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RefreshLogMessageEvent?.Invoke(message);
|
|
|
|
|
|
|
|
logHelper.Info(message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 异常日志输出
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
|
|
|
/// <param name="ex"></param>
|
|
|
|
|
|
|
|
private void PrintLogErrorMessage(string message, Exception ex = null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RefreshLogMessageEvent?.Invoke(message);
|
|
|
|
|
|
|
|
logHelper.Error(message, ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|