XiangdianStockerExcute.cs 2.97 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HHECS.Bll;
using HHECS.Model;
using S7.Net;

namespace HHECS.Common
{
    /// <summary>
    /// todo:湘电单叉双伸位堆垛机处理函数
    /// </summary>
    public class XiangdianStockerExcute : IStockerExcute
    {

        /// <summary>
        /// 标记这个堆垛机处理类所处理的设备类型
        /// </summary>
        public EquipmentType EquipmentType { get; set; }

        public BllResult Excute(List<Equipment> stockers, List<Plc> plcs)
        {
            throw new NotImplementedException();
        }

        public BllResult ExcuteTaskComplete(Equipment stocker, Plc plc)
        {
            throw new NotImplementedException();
        }

        public BllResult ExcuteTaskIn(Equipment stocker, Plc plc)
        {
            throw new NotImplementedException();
        }

        public BllResult ExcuteTaskOut(Equipment stocker, Plc plc)
        {
            throw new NotImplementedException();
        }

        public BllResult ExcuteTaskTransferInRoadway(Equipment stocker, Plc plc)
        {
            throw new NotImplementedException();
        }

        public BllResult ValidateStockerForCompleteTask(Equipment stocker)
        {
            throw new NotImplementedException();
        }

        public BllResult ValidateStockerIn(Equipment stocker)
        {
            try
            {
                //判断条件,这里没有判断货叉故障和堆垛机故障,这特么怎么判断,这么多字段
                //1.操作模式 = 5  联机;
                //2.双货叉原位,任务货叉上无货;
                //3.任务货叉无故障无任务;
                //4.堆垛机无故障
                //5.对应货叉任务类型:0 - 无任务
                //6.对应货叉任务标志:1待机
                if (stocker.EquipmentProps.Find(t => t.EquipmentTypePropTemplateCode == "OperationModel").Value == "5"&&stocker.EquipmentProps.Find(t=>t.EquipmentTypePropTemplateCode== "Fork1ForkHasPallet").Value=="False"&& stocker.EquipmentProps.Find(t => t.EquipmentTypePropTemplateCode == "Fork1TaskNo").Value == "0"&& stocker.EquipmentProps.Find(t => t.EquipmentTypePropTemplateCode == "Fork1TaskType").Value == "0"&& stocker.EquipmentProps.Find(t => t.EquipmentTypePropTemplateCode == "Fork1TaskExcuteStatus").Value == "1")
                {
                    return BllResultFactory.Sucess();
                }
                else
                {
                    return BllResultFactory.Error();
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"校验堆垛机{stocker.Name}入库条件异常:{ex.Message}", LogLevel.Exception);
                return BllResultFactory.Error();
            }
        }

        public BllResult ValidateStockerOut(Equipment stocker)
        {
            throw new NotImplementedException();
        }
    }
}