using System;
using System.Collections.Generic;
using System.Text;

namespace ICommLayer
{
    /// <summary>
    /// 发送设备命令的接口
    /// 创建者：Richard.Liu
    /// </summary>
    public interface ISendDeviceOrder

    {
        string CommLayerError
        {
            get;
            set;
        }
        /// <summary>
        /// 双叉堆垛机指令
        /// </summary>
        /// <param name="MessageIndex">指令头</param>
        /// <param name="TaskIndex">设备指令索引</param>
        /// <param name="Order">指令索引</param>
        /// <param name="DeviceIndex">设备索引</param>
        /// <param name="StartX">起点X列</param>
        /// <param name="StartY">起点Y层</param>
        /// <param name="StartZ">起点Z排</param>
        /// <param name="EndX">终点X列</param>
        /// <param name="EndY">终点Y层</param>
        /// <param name="EndZ">终点Z排</param>
        /// <param name="DoubleFork">双叉货位编码</param>
        /// <returns></returns>
        bool SendDeviceOrder(int MessageIndex, int TaskIndex, int Order, int DeviceIndex, int StartX, int StartY, int StartZ, int EndX, int EndY, int EndZ,string DoubleFork );


        /// <summary>
        /// 发送堆垛机命令
        /// </summary>
        /// <param name="MessageIndex">消息编号</param>
        /// <param name="TaskIndex">任务编号</param>
        /// <param name="Order">堆垛机命令字</param>
        ///1-复位 
        ///2-将取 
        ///3-将送
        ///4-取货
        ///5-放货
        ///6-取放货
        /// <param name="DeviceIndex">设备编号</param>
        /// <param name="StartX">起始x坐标，排-沿轨道方向</param>
        /// <param name="StartY">起始y坐标，层-高度方向</param>
        /// <param name="StartZ">起始z坐标，列-面向堆垛机操作面板，1-左侧，2-右侧</param>
        /// <param name="EndX">目标x坐标，列-沿轨道方向</param>
        /// <param name="EndY">目标y坐标，层-高度方向</param>
        /// <param name="EndZ">目标z坐标，排-面向堆垛机操作面板，1-左侧，2-右侧</param>
        /// <returns>发送堆垛机命令是否成功</returns>
        bool SendDeviceOrder(int MessageIndex, int TaskIndex, int Order, int DeviceIndex, int StartX, int StartY, int StartZ, int EndX, int EndY, int EndZ);
        /// <summary>
        /// 发送穿梭车、输送机设备命令
        /// </summary>
        /// <param name="MessageIndex">消息编号</param>
        /// <param name="TaskIndex">任务编号</param>
        /// <param name="Order">命令字</param>
        /// 穿梭车命令字： 
        ///1-复位 
        ///2-左接货
        ///3-左送货
        ///4-右接货
        ///5-右送货
        ///6-停止
        ///7-运动（运动到第4、5字节指定的目标设备所引）
        ///输送机命令字：
        ///1-入库（朝向库）
        ///2-出库（背向库）
        ///3-送货
        ///4-接货
        ///5-停止
        /// <param name="DeviceIndex">设备编号</param>
        ///<param name="ArrowDeviceIndex">对于输送机、穿梭车代表目标设备所引，
        /// 0-代表单一设备控制，无目标设备所引；1…65535代表目标设备所引（终点输送机的设备所引）</param>
        /// <returns>发送穿梭车、输送机设备命令是否成功</returns>
        bool SendDeviceOrder(int MessageIndex, int TaskIndex, int Order, int DeviceIndex,int ArrowDeviceIndex);
        /// <summary>
        /// 上位机给下位机发送烟箱按品牌码分道信息共15字节,有数据时写入实际数据，否则全部写零
        /// </summary>
        /// <param name="DeviceIndex">码垛位设备号索引</param>
        /// <param name="TobaccoCode">第3--15字节,烟箱码</param>
        /// <param name="HaveFirstProjectCode">第1字节,1-有一号工程码,0-无一号工程码</param>
        /// <param name="IfSmallTobacco">第2字节,1-小烟箱,0-正常烟箱</param>
        /// <param name="Count">第16字节,烟箱码垛数量</param>
        /// <returns></returns>
        bool SendDeviceOrder(int DeviceIndex, string TobaccoCode, bool HaveFirstProjectCode, bool IfSmallTobacco,int Count);
        /// <summary>
        /// 向PLC的DB区写入数据
        /// </summary>
        /// <param name="ItemNames">标签变量名称数组</param>
        /// <param name="ItemValues">标签值数组</param>
        /// <returns></returns>
        /// 向PLC的DB区写入数据
        /// </summary>
        /// <param name="ItemNames">标签变量名称数组</param>
        /// <param name="ItemValues">标签值数组</param>
        /// <returns></returns>
        bool WriteDBData(StringBuilder[] ItemNames, StringBuilder[] ItemValues,int deviceindex);


    }
}
