|
|
@ -38,8 +38,10 @@ namespace Aucma.Scada.Business
|
|
|
|
private PlcPool _pool = PlcPool.Instance;
|
|
|
|
private PlcPool _pool = PlcPool.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
private PlcSpaceConfig spaceConfig = PlcSpaceConfig.Instance;
|
|
|
|
private PlcSpaceConfig spaceConfig = PlcSpaceConfig.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
private RegisterServices registerServices = RegisterServices.Instance;
|
|
|
|
private RegisterServices registerServices = RegisterServices.Instance;
|
|
|
|
private ICodeBindingRecordServices _codeBindingRecordServices;
|
|
|
|
|
|
|
|
|
|
|
|
private IRealTaskInfoService _taskInfoService;
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 私有变量
|
|
|
|
#region 私有变量
|
|
|
@ -86,8 +88,8 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
private OutStoreTaskHandle()
|
|
|
|
private OutStoreTaskHandle()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_codeBindingRecordServices = registerServices.GetService<ICodeBindingRecordServices>();
|
|
|
|
|
|
|
|
_plcDictionary = _pool.GetAll();
|
|
|
|
_plcDictionary = _pool.GetAll();
|
|
|
|
|
|
|
|
_taskInfoService = registerServices.GetService<IRealTaskInfoService>();
|
|
|
|
|
|
|
|
|
|
|
|
RealReadShellFinish();
|
|
|
|
RealReadShellFinish();
|
|
|
|
|
|
|
|
|
|
|
@ -178,7 +180,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
OutStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode);
|
|
|
|
OutStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode);
|
|
|
|
|
|
|
|
|
|
|
|
shellTaskInfos.Add(taskInfo);
|
|
|
|
//shellTaskInfos.Add(taskInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(1000);
|
|
|
@ -335,7 +337,7 @@ namespace Aucma.Scada.Business
|
|
|
|
//ReadLinerFinish_OutStore(taskCode);
|
|
|
|
//ReadLinerFinish_OutStore(taskCode);
|
|
|
|
OutStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode);
|
|
|
|
OutStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode);
|
|
|
|
|
|
|
|
|
|
|
|
linerTaskInfos.Add(taskInfo);
|
|
|
|
//linerTaskInfos.Add(taskInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(1000);
|
|
|
@ -420,13 +422,15 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList();
|
|
|
|
//var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList();
|
|
|
|
|
|
|
|
var info = GetTaskInfoByTaskStatus(appConfig.shellStoreCode);
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var item = info[i];
|
|
|
|
var item = info[i];
|
|
|
|
ReadShellFinish_OutStore(item);
|
|
|
|
ReadShellFinish_OutStore(item);
|
|
|
|
Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成");
|
|
|
|
Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成");
|
|
|
|
item.taskStatus = 3;
|
|
|
|
item.taskStatus = 3;
|
|
|
|
|
|
|
|
shellTaskInfos.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(1000);
|
|
|
@ -443,13 +447,15 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList();
|
|
|
|
//var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList();
|
|
|
|
|
|
|
|
var info = GetTaskInfoByTaskStatus(appConfig.linerStoreCode);
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
for (int i = 0; i < info.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var item = info[i];
|
|
|
|
var item = info[i];
|
|
|
|
ReadLinerFinish_OutStore(item);
|
|
|
|
ReadLinerFinish_OutStore(item);
|
|
|
|
Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成");
|
|
|
|
Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成");
|
|
|
|
item.taskStatus = 3;
|
|
|
|
item.taskStatus = 3;
|
|
|
|
|
|
|
|
linerTaskInfos.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
Thread.Sleep(1000);
|
|
|
@ -485,9 +491,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
if (shellTask != null && linerTask != null)
|
|
|
|
if (shellTask != null && linerTask != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logHelper.Info($"绑定条码:箱壳:{shellTask.materialCode};内胆:{linerTask.materialCode}");
|
|
|
|
Console.WriteLine($"绑定箱壳:{shellTask.materialCode};内胆:{linerTask.materialCode};条码");
|
|
|
|
// 条码绑定表,绑定箱壳和内胆码 shellTask.materialCode,linerTask.materialCode
|
|
|
|
|
|
|
|
_codeBindingRecordServices.BindingCode(shellTask.materialCode, linerTask.materialCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shellTaskInfos.Remove(shellTask);
|
|
|
|
shellTaskInfos.Remove(shellTask);
|
|
|
|
linerTaskInfos.Remove(linerTask);
|
|
|
|
linerTaskInfos.Remove(linerTask);
|
|
|
@ -500,6 +504,26 @@ namespace Aucma.Scada.Business
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 根据任务状态获取执行中的任务
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
|
|
|
/// <param name="taskStatus"></param>
|
|
|
|
|
|
|
|
private List<RealTaskInfo> GetTaskInfoByTaskStatus(string storeCode, int taskStatus = 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RealTaskInfo> result = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = _taskInfoService.GetTaskInfosByTaskStatus(new string[] { storeCode }, appConfig.outstoreTaskType, taskStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
logHelper.Error("根据任务状态获取执行中的任务异常", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 通过PLC获取货道信息
|
|
|
|
/// 通过PLC获取货道信息
|
|
|
|