using iWareCc.Cache.Entity;
|
using iWareCc.DecomposeTask.Entity;
|
using iWareCc.Properties;
|
using iWareCc.Srm.Entity;
|
using iWareCommon.Common.Entity;
|
using iWareCommon.Utils;
|
using iWareDataCore.TASK.EnumType;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace iWareCc.DecomposeTask.Strategy.出库任务.Chain
|
{
|
public class 判断堆垛机是否空闲: IHandler
|
{
|
private MainTaskContainer LogisticalTaskContainer;
|
|
private ResultContainer ResultContainer;
|
|
/// <summary>
|
/// 该节点的下一个节点
|
/// </summary>
|
private IHandler nextHandler = null;
|
public IHandler NextHandler
|
{
|
set { nextHandler = value; }
|
}
|
|
public 判断堆垛机是否空闲(ResultContainer resultContainer, MainTaskContainer logisticalTaskContainer)
|
{
|
this.ResultContainer = resultContainer;
|
this.LogisticalTaskContainer = logisticalTaskContainer;
|
}
|
|
public void Handle()
|
{
|
try
|
{
|
StackerEntity stacker = null;
|
string stackerName = Enum.GetName(typeof(iWareDataCore.DEV.EnumType.EEquipmentCnName), iWareDataCore.DEV.EnumType.EEquipmentCnName.stacker1);
|
if (CacheEntity.DeviceRunningMode == null || CacheEntity.DeviceRunningMode.Mode == (int)EDeviceMode.双堆垛机模式)
|
{
|
stacker = CacheEntity.Stackers.FirstOrDefault(x => x.Equipment.EquipName == stackerName);
|
}
|
else
|
{
|
stacker = CacheEntity.Stackers.FirstOrDefault(x => x.Equipment.EquipName == CacheEntity.DeviceRunningMode.EquipmentName);
|
}
|
|
string msg;
|
|
if (!stacker.CanDecomposeTask(out msg))
|
{
|
ResultContainer.Msg = msg;
|
LogTextHelper.WriteLine(Resources.LogDir + @"/分解任务流程", "判断与任务匹配的堆垛机是否空闲:{0}", msg);
|
return;
|
}
|
|
var conveyor = CacheEntity.Conveyors.FirstOrDefault(x => x.Equipment.EquipName == "conveyor2");
|
var gate = conveyor.Gates.FirstOrDefault(x => x.Place.PlaceTypeName == "gate21");
|
|
if (!gate.RIsEmpty)
|
{
|
ResultContainer.Msg = "出库口不允许放货";
|
LogTextHelper.WriteLine(Resources.LogDir + @"/分解任务流程", "判断与任务匹配的堆垛机是否空闲:{0}", ResultContainer.Msg);
|
return;
|
}
|
|
LogTextHelper.WriteLine(Resources.LogDir + @"/分解任务流程", "判断与任务匹配的堆垛机是否空闲:{0}", "ok");
|
|
if (nextHandler != null)
|
{
|
nextHandler.Handle();
|
}
|
}
|
catch (Exception ex)
|
{
|
ResultContainer.Msg = ex.Message;
|
LogTextHelper.WriteLine(Resources.LogDir + @"/分解任务流程", "判断与任务匹配的堆垛机是否空闲:{0}", ex.Message);
|
LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Handle", ex.Message);
|
}
|
}
|
}
|
}
|