1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;


namespace OnlineStore.Common
{
    public class LineGetPosOp
    {
        public LineGetPosOp(string cids, string code)
        {
            this.cids = cids;
            this.code = code;
        }
        public string cids = "";
        public string code = "";
    }

    public class LineOperation
    {
        //  //{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
        //    返回: {"code": 0, "msg":"ok", data:7}
        /// <summary>
        /// 0=成功
        /// </summary>
        public int result;
        public string cid;
        public string msg = "";
        public string pos = "";
        public string barcode = "";

    }
    /// <summary>
    /// 与服务器通信用对象
    /// </summary>
    public class Operation
    {
        /// <summary>
        /// 料仓唯一标识,分号分割
        /// </summary>
        private string _cid = "";
        public string cid
        {
            get { return _cid; }
            set { _cid = value; }
        }

        /// <summary>
        /// 请求序列号
        /// </summary>
        public int seq { get; set; }
        /// <summary>
        /// 操作码(0无操作(发送料仓状态给服务器),
        /// 1扫码入库(扫码成功后发送给服务器),
        /// 2 出库(服务器发送),3表示错误信息 )
        /// 4,发送给服务表示二维码扫码入库,收到开始扫码
        /// </summary>
        public int op { get; set; }
        /// <summary>
        /// 操作相关数据,
        /// op=1时,客户端发送 code 二维码给服务器,服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度
        /// 如果需要更新温湿度的报警值,服务器会发送alarmTemperature,alarmHumidity给客户端,客户端缓存,如果没有发送,不处理 
        /// op=3时,data发送BoxID和AlarmCode
        /// =4时扫码入库
        /// =5时服务器发送预警温度
        /// </summary>
        private Dictionary<string, string> _data = new Dictionary<string, string>();
        public Dictionary<string, string> data
        {
            get { return _data; }
            set { _data = value; }
        }
        //public Dictionary<String, Dictionary<String, String>> mimoOpMap = new Dictionary<string, Dictionary<string, string>>();
        /// <summary>
        /// agv的日志信息
        /// </summary>
        //public List<AgvLogInfo> logList = new List<AgvLogInfo>();
        /// <summary>
        /// 整体料仓状态
        /// 1=正常运行中
        /// 2=急停中
        /// 3=故障(气压检测不到等,用msg发送详细故障说明)
        /// 4=警告(用msg发送提醒,如出库到达工位但是没有工人操作)
        /// </summary>
        public int status { get; set; }
        /// <summary>
        /// 提示消息
        /// 出入库错误: BOX正在调试中,不能出入库
        /// 出入库错误: 急停了不能出入库
        /// 入库错误:料盘过大,放不到指定的位置中去
        /// 故障:气压信号检测不到
        /// 警告:出库盘到达工位但是没有工人操作
        /// </summary>
        public string msg { get; set; }
        //public Dictionary<string, string> msgData { get; set; } = new Dictionary<string, string>() { {"zh","" },{ "en", "" }, { "jp", "" } };
        public Dictionary<string, string> msgData { get; set; } = new Dictionary<string, string>();
        public string msgParam { get; set; }
        public string msgCode { get; set; }
        public string msgEn { get; set; }
        public string msgJp { get; set; }
        /// <summary>
        /// 包含的多个 BOX 的状态信息
        /// </summary>
        //public Dictionary<int, BoxStatus> boxStatus = new Dictionary<int, BoxStatus>();
        /// <summary>
        /// 报警集合
        /// </summary>
        public List<AlarmInfo> alarmList = new List<AlarmInfo>();

        public List<EquipMsg> showLogs = new List<EquipMsg>();
        public String type { get; set; } = "NS200";
        /// <summary>
        /// 消息集合
        /// </summary>
        public List<MsgInfo> msgList;
    }

    [Serializable]
    public class MsgInfo
    {
        /**
         * 提示消息
         */
        public string msg = "";
        /**
         * 消息类型,INFO,WARNING,ERROR,DATA
         */
        public string type;
        /**
         * 英文提示消息
         */
        public string msgEn = "";
        public string msgJp = "";
        /**
         * 翻译key
         */
        public string msgKey = "";
        /**
         * 翻译参数
         */
        public string[] msgParam;
        /**
         * 报警类型
         */
        public string alarmType = "";
        /**
         *报警错误码
         */
        public string alarmCode = "";
        /**
         * 模块
         */
        public string moudle = "";
    }
    /**
* agv日志信息
*/
    public class AgvLogInfo
    {
        /**
         * 消息字符串Code
         */
        public String msgCode { get; set; }
        /**
         * 消息内容
         */
        public String msg { get; set; }
        /**
         * 参数
         */
        public String[] msgParams { get; set; }
        /**
         * 出现时间
         */
        public long time { get; set; }
        public AgvLogInfo(string msg)
        {
            this.msgCode = msgCode;
            this.msg = msg;
            this.msgParams = msgParams;
            this.time = DateTime.Now.Ticks;
        }
    }
    /// <summary>
    /// 单台料仓状态(包含流水线)
    /// </summary>
    public class BoxStatus
    {
        /// <summary>
        /// Box编号,从1开始
        /// </summary>
        public int boxId { get; set; }
        /// <summary>
        /// 单台BOX状态
        /// 急停,故障,调试中,就绪状态(正常待机)
        /// 入库执行中,入库完成,入库失败
        /// 出库执行中,出库完成,出库失败
        /// </summary>
        public int status { get; set; }
        /// <summary>
        /// 单台BOX的消息
        /// 正在调试中,不能出入库
        /// 入库失败原因:
        /// 出库失败原因:
        /// </summary>
        public string msg { get; set; }
        /// <summary>
        /// 温度
        /// </summary>
        public string temperature { get; set; }
        /// <summary>
        /// 湿度
        /// </summary>
        public string humidity { get; set; }

        /// <summary>
        /// 操作相关数据,
        /// 出库完成后发送posId库位编号给服务器  
        /// 需要将打印数量和ng数量发送给服务器
        /// </summary>
        private Dictionary<string, string> _data = new Dictionary<string, string>();
        public Dictionary<string, string> data
        {
            get { return _data; }
            set { _data = value; }
        }
    }
    public class AlarmInfo
    {

        public AlarmInfo(int StoreID, int aType, string alarmDetial, string WarnMsg, int inoutStatus)
        {
            // TODO: Complete member initialization
            this.boxId = StoreID;
            this.alarmType = aType;
            this.alarmDetail = alarmDetial;
            this.alarmMsg = WarnMsg;
            this.inOutStatus = inoutStatus;
        }

        public AlarmInfo()
        {
            // TODO: Complete member initialization
        }
        /// <summary>
        /// 料仓ID,0表示流水线
        /// </summary>
        public int boxId { get; set; }
        /// <summary>
        /// 报警类型,
        /// </summary>
        public int alarmType { get; set; }
        /// <summary>
        /// 报警详情
        ///AlarmType= 0	消息	"1=原点返回
        //AlarmType= 0	消息   2=复位"
        //AlarmType=1	总体错误	"1=急停
        //AlarmType=1	总体错误    2=没有气压信号
        //AlarmType=1	总体错误,3=盘错乱"
        //AlarmType=2		运动轴错误	1=第一轴(旋转)
        //AlarmType=2		运动轴错误	2=第二轴(上下轴)
        //AlarmType=2		运动轴错误	3=第三轴(前进轴)
        //AlarmType=2		运动轴错误	4=第四轴(压紧轴)"
        //AlarmType=2 	电钢报警	    5=上下电钢
        //AlarmType=3		 IO报警,信号超时	io电器定义(电器定义)
        /// </summary>
        public string alarmDetail { get; set; }
        /// <summary>
        /// 报警消息
        /// </summary>
        public string alarmMsg { get; set; }
        /// <summary>
        /// 0,1=入库,2=出库
        /// </summary>
        public int inOutStatus { get; set; }
    }

    public class ParamDefine
    {
        /// <summary>
        /// 库位 ID
        /// </summary>
        public static string posId = "posId";
        /// <summary>
        /// 料盘宽
        /// </summary>
        public static string plateW = "plateW";
        /// <summary>
        /// 料盘高
        /// </summary>
        public static string plateH = "plateH";
        /// <summary>
        /// 料仓ID
        /// </summary>
        public static string storeId = "storeId";
        /// <summary>
        /// 报警码
        /// </summary>
        public static string alarmCode = "alarmCode";
        /// <summary>
        /// 报警详情或参数
        /// </summary>
        public static string alarmDetial = "alarmDetial";
        /// <summary>
        /// 湿度报警值
        /// </summary>
        public static string maxHumidity = "humi";
        /// <summary>
        /// 温度报警值
        /// </summary>
        public static string maxTemperature = "temp";

        /// <summary>
        /// urgentReel: true 表示紧急料,需要出到料串上
        /// </summary>
        public static string urgentReel = "urgentReel";
        /// <summary>
        /// cutReel: true 表示分盘料,需要出到料串上
        /// </summary>
        public static string cutReel = "cutReel";
        /// <summary>
        /// smallReel: true  小料(7x8),放置到小料串上
        /// </summary>
        public static string smallReel = "smallReel";
        /// <summary>
        /// rfid: 分配的料串RFID
        /// </summary>
        public static string rfid = "rfid";
        /// <summary>
        /// rfidLoc: 料串的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 
        /// 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
        /// </summary>
        public static string rfidLoc = "rfidLoc";

        public static string barcode = "barcode";

        /// <summary>
        /// 贴标机交互按钮,出口 满料串取出
        /// </summary>
        public static string SendFullShelf = "SendFullShelf";
        /// <summary>
        /// 贴标机交互按钮,出口 空料串送入
        /// </summary>
        public static string NeedEmptySHelf = "NeedEmptySHelf";
        /// <summary>
        /// 贴标机交互按钮,入口 满料串送入
        /// </summary>
        public static string NeedFullShelf = "NeedFullShelf";
        /// <summary>
        /// 贴标机交互按钮,入口 空料串取出
        /// </summary>
        public static string SendEmptyShelf = "SendEmptyShelf";
        public static string doit = "doit";
        public static string disable = "disable";
        public static string enable = "enable";
    }

    /// <summary>
    /// 步骤消息类
    /// </summary>
    public class EquipMsg
    {
        /// <summary>
        /// 设备模块
        /// </summary>
        public String module;
        /// <summary>
        /// 消息类型,为:INFO,WARNING,ERROR,DATA
        /// </summary>
        //private String type;
        /// <summary>
        /// 中英文字符串 key
        /// </summary>
        public String msgCode;
        /// <summary>
        /// 消息内容
        /// </summary>
        public String msg;
        /// <summary>
        /// 参数
        /// </summary>
        public String[] msgParams;
    }

    public class NsMesInfo
    {
        private String status = "OK";

        private DateTime time;

        private String request = "";

        private String response = "";
    }

    public enum ShelfEnum
    {
        IDLE ,//= 空闲;
        LOADING,//= 入库中;
        UNLOADING,//= 出库中;
        NEED_EMPTY,//= 需要空料串出库;
        EMPTY_OUT,//= 空料串需要取走
        FULL_OUT,//= 满料串需要取走
    }

    public enum ShelfType
    {
        smallReel, 
        bigReel,
        tray
    }
}