AC_BOX_Bean_Shelf.cs 26.3 KB
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 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OnlineStore.DeviceLibrary
{
    /// <summary>
    /// 料架新增的出入库逻辑
    /// </summary>
    partial class AC_BOX_Bean
    {
        private List<string> LastScanCodes = new List<string>();
        private int ComTargetPosition = 0;
        private int LastWidth = 0;
        private int LastHeight = 0;

        private void ClearLastTrayInfo()
        {
            LastScanCodes = new List<string>();
            ComTargetPosition = 0;
            LastWidth = 0;
            LastHeight = 0;
        }

        /// <summary>
        /// 开始入库移动移动
        /// </summary> 
        public void StartShelfInStore()
        {

            if (storeRunStatus == StoreRunStatus.Runing)
            {
                if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.HIGH))
                {
                    LogInfo(" 空闲中,检测到入料口有信号,料架入库:入料口移门打开,");
                    storeRunStatus = StoreRunStatus.Busy;
                    storeStatus = StoreStatus.InStoreExecute;
                    MoveInfo.NewMove(StoreMoveType.InStore, new InOutParam());
                    MoveInfo.MoveParam.MoveP = new LineMoveP();

                    MoveInfo.MoveParam.MoveP.ComPress_P1 = Config.CompAxis_P1_Position;
                    MoveInfo.MoveParam.MoveP.InOut_P1 = Config.InOutAxis_P1_Position;
                    MoveInfo.MoveParam.MoveP.Middle_P1 = Config.MiddleAxis_P1; 
                    MoveInfo.MoveParam.MoveP.UpDown_P1 = Config.UpDownAxis_P1; 
                    MoveInfo.MoveParam.MoveP.UpDown_P2 = Config.UpDownAxis_P2;

                    MoveInfo.ShelfPositionList = new List<string>(ShelfPosList);
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
                    CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);

                }
            }
        }
        private void ShelfInStoreProcess()
        {
            LineMoveP moveP = MoveInfo.MoveParam.MoveP;
            #region 料架移入料仓内部处理
            if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_01_LineIn_Check))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
                InOutStoreLog("料架入库:入料口移门打开");
                CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_02_DoorOpen))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_03_LineRun);
                InOutStoreLog("料架入库:线体正转,等待取料位检测到信号");
                IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
                IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);

                MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
                MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineTake_Check, IO_VALUE.HIGH));
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_03_LineRun))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_04_LineStop);
                InOutStoreLog("料架入库:取料位检测到信号,停止线体正转");
                IOMove(IO_Type.Line_Run, IO_VALUE.LOW);

            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_04_LineStop))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_05_DoorClose);
                InOutStoreLog("料架入库:入料口移门关闭");
                CylinderMove(MoveInfo, IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Close);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_05_DoorClose))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_06_LocationUp);
                InOutStoreLog("料架入库:定位装置上升");
                CylinderMove(MoveInfo, IO_Type.LocationCylinder_Down, IO_Type.LocationCylinder_Up);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_06_LocationUp))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_07_TopCylinderUp);
                InOutStoreLog("料架入库:顶升装置上升");
                CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_07_TopCylinderUp))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_08_StartGetTray);
                InOutStoreLog("料架入库:开始循环从第一个空位逐个取料盘,扫码入库");

            }
            #endregion

            #region 料架取料盘扫码获取POSID
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_08_StartGetTray))
            {
                if (MoveInfo.NextShelfPos())
                {
                    //新的料架库位
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
                    InOutStoreLog("料架取料:叉子后退到待机点P1, 重置盘信息");
                    ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
                    ClearLastTrayInfo();
                }
                else
                {
                    //所有料盘已取料完成
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_11_InoutToP1))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_12_MoveToShelf);
                InOutStoreLog("料架取料:升降轴移动到PA1低点,旋转轴移动到PA1点,压紧轴到压紧前点");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LPA1, Config.UpDownAxis_PA1_Speed);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_PA, Config.MiddleAxis_PA_Speed);
                ACAxisMove(Config.Comp_Axis, Config.CompAxis_P3_Position, Config.CompAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_12_MoveToShelf))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_13_InoutToPA);
                InOutStoreLog("料架取料:叉子前进到PA点");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_PA, Config.InOutAxis_PA_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_13_InoutToPA))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_14_UpdownToPA2);
                InOutStoreLog("料架取料:升降轴上升到PA2点");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HPA2, Config.UpDownAxis_PA2_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_14_UpdownToPA2))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_15_StartCompress);
                InOutStoreLog("料架取料:压紧轴开始缓慢压紧到P4");
                MoveInfo.WaitList.Add(WaitResultInfo.WaitComAxis(Config.Comp_Axis, Config.CompAxis_P4_Position, Config.CompAxis_P4_Speed));
                Config.Comp_Axis.TargetPosition = Config.CompAxis_P4_Position;
                ACServerManager.AbsMove(Config.Comp_Axis.DeviceName, Config.Comp_Axis.GetAxisValue(), Config.CompAxis_P4_Position, Config.CompAxis_P4_Speed);
                ComAxisStartCheck();
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_15_StartCompress))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_16_ComAxisDownMove);
                InOutStoreLog("料架取料:检测到料叉压紧确认信号,再次向下压紧指定的值");
                int currPosition = ACServerManager.GetActualtPosition(Config.Comp_Axis);
                ComTargetPosition = currPosition;
                int targetP = currPosition + Config.CompAxis_Down_Position;
                ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);

            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_16_ComAxisDownMove))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_17_InoutBack);
                InOutStoreLog("料架取料:记录压紧高度,叉子后退到扫码点");
                ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.CompAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_17_InoutBack))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_18_ScanCode);
                InOutStoreLog("料架取料:记录宽度,开始扫码");
                MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
                MoveInfo.WaitList.Add(WaitResultInfo.WaitCode());
                Task.Factory.StartNew(delegate
                {
                    IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
                    LastScanCodes = CodeManager.CameraScan();
                    IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
                });

                if (IOValue(IO_Type.TrayCheck_3).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.TrayCheck_4).Equals(IO_VALUE.HIGH))
                {
                    LastWidth = 13;
                }
                else if (IOValue(IO_Type.TrayCheck_1).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.TrayCheck_2).Equals(IO_VALUE.HIGH))
                {
                    LastWidth = 7;
                }
                else
                {
                    LogUtil.info("未检测到识别区料盘检测信号, 默认高度为7");
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_18_ScanCode))
            {
                if (LastScanCodes.Count <= 0)
                {
                    StartSendTray("扫码失败");
                }
                else
                {
                    MoveInfo.NextMoveStep(StoreMoveStep.BI_19_GetPosId);
                    InOutStoreLog("料架取料:扫码成功,从服务器获取库位号");
                    MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
                    bool result = GetPosIdByCode();
                    if (result)
                    {
                        MoveInfo.NextMoveStep(StoreMoveStep.BI_20_SetInstoreParam);
                        InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库");
                    }
                    else
                    { 
                        StartSendTray("获取入库库位失败");
                    }
                }
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_19_GetPosId))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_20_SetInstoreParam);
                InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库"); 
            }

            #endregion

            #region 入库逻辑
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_20_SetInstoreParam))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_21_MoveToBag);
                InOutStoreLog("入库:移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)");
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_21_MoveToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_22_DeviceToBag);
                InOutStoreLog("入库:叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_22_DeviceToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_23_PutWareToBag);
                InOutStoreLog("入库:放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)");

                // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)   
                string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
                lastPosId = posId;
                lastPosIdStatus = StoreStatus.InStoreEnd;
                storeStatus = StoreStatus.InStoreEnd;
                //手动发给服务器状态,防止没有手动
                //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
                 
                ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_23_PutWareToBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_24_DeviceBackFromBag);
                InOutStoreLog("入库:叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)");
                ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_24_DeviceBackFromBag))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_25_GoBack);
                InOutStoreLog("入库:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始");
                ComMoveToPosition(moveP.ComPress_P1, Config.CompAxis_P1_Speed);
                ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_25_GoBack))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_08_StartGetTray);
                InOutStoreLog("料架入库:开始循环逐个取料盘,扫码入库");
            }
            #endregion

            #region 把料盘送到NG逻辑

            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_31_ToNGDoor))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_32_NGDoorUp);
                InOutStoreLog("送出料盘:NG料口升降门上升");
                CylinderMove(MoveInfo, IO_Type.NGDoorCylinder_Down, IO_Type.NGDoowCylinder_Up);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_32_NGDoorUp))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_33_InoutToNGDoor);
                InOutStoreLog("送出料盘:进出轴前进到NG料门口位置");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_33_InoutToNGDoor))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_34_UpdownDown);
                InOutStoreLog("送出料盘:升降轴缓慢下降,放下料盘");
                ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
                ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_34_UpdownDown))
            { 
                MoveInfo.NextMoveStep(StoreMoveStep.BI_35_InoutToP1);
                InOutStoreLog("送出料盘:叉子后退到P1");
                ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_35_InoutToP1))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BI_36_NGDoorDown);
                InOutStoreLog("送出料盘:关门NG料门,送出料盘结束");
                CylinderMove(MoveInfo, IO_Type.NGDoowCylinder_Up, IO_Type.NGDoorCylinder_Down);
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_36_NGDoorDown))
            {

                MoveInfo.NextMoveStep(StoreMoveStep.BI_08_StartGetTray);
                InOutStoreLog("料架入库:开始循环逐个取料盘,扫码入库");
            }
            #endregion
            else
            {
                LogInfo(" 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
            } 
        } 

        private void StartSendTray( string str="扫码失败")
        { 
            MoveInfo.NextMoveStep(StoreMoveStep.BI_31_ToNGDoor);
            InOutStoreLog("送出料盘:"+str+",升降轴移动到NG料门口上端,旋转轴移动到NG料门口");

            ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
            ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
        }


        private void StartSendShelfOut()
        {
            MoveInfo.NextMoveStep(StoreMoveStep.BS_01_TopCylinder_Down);
            InOutStoreLog("送出料架:顶升气缸下降");
            CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
        }
        private void SendShelfProcess()
        {
            if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_01_TopCylinder_Down))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_02_LocatinCylinder_Down);
                InOutStoreLog("送出料架:定位气缸下降");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_02_LocatinCylinder_Down))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_03_DoorOpen);
                InOutStoreLog("送出料架:打开仓门");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_03_DoorOpen))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_04_LineBack);
                InOutStoreLog("送出料架:线体反转");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_04_LineBack))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_05_WaitInLineSingle);
                InOutStoreLog("送出料架:等待取料工位无信号,入料口有信号");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_05_WaitInLineSingle))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_06_WaitTime);
                InOutStoreLog("送出料架:再转动300时间");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_06_WaitTime))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_07_LineStop);
                InOutStoreLog("送出料架:停止转动");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_LineStop))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_08_CallAGV);
                InOutStoreLog("送出料架:通知调度系统拿走");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_CallAGV))
            {
                MoveInfo.NextMoveStep(StoreMoveStep.BS_09_CloseDoor);
                InOutStoreLog("送出料架:关闭仓门");
            }
            else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_CloseDoor))
            {
            }

        }
        #region 扫码获取库位

        private string ProcessCode()
        {
            string message = "";
            string spiltStr = "##";
            string codeSize = LastWidth + "x" +LastHeight;
            foreach (string str in LastScanCodes)
            {
                if (str.Trim().Equals(""))
                {
                    continue;
                }
                string code = "=1+0x0-" + codeSize + "=" + str.Trim(); 
                
                if (!String.IsNullOrEmpty(code))
                {
                    message = message + code + spiltStr;
                }
            }return message;
        }

        /// <summary>
        /// 扫码枪数据接收
        /// </summary>
        /// <param name="message"></param>
        private bool GetPosIdByCode()
        {
            try
            {
                string message = ProcessCode();
                if (message.Equals("") || string.IsNullOrEmpty(message))
                {
                    CodeMsg = "未扫到二维码";
                    LogInfo("未扫到二维码");
                    return false;
                }

                if (storeRunStatus.Equals(StoreRunStatus.Wait))
                {
                    LogInfo("二维码【 " + message + "】,设备未启动,不需要发送服务器");
                    return false;
                }
                // CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
                LogUtil.info(Name + "二维码【 " + message + "】,发送给服务器获取入库PosID");
                //发送扫码内容到服务器进行入库操作
                Operation operation = getLineBoxStatus();
                operation.op = 1;
                operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", DeviceID.ToString() } };
                string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
                Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
                if (resultOperation == null)
                {
                    CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
                    LogInfo("二维码【 " + message + "】没有收到服务器反馈!");
                    return false;
                }
                else if (!string.IsNullOrEmpty(resultOperation.msg))
                {
                    //如果有提示消息,直接显示提示
                    LogInfo("二维码【 " + message + "】  :" + resultOperation.msg);
                    return false;
                }


                if (resultOperation.op.Equals(1))
                {
                    Dictionary<string, string> data = resultOperation.data;
                    if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
                    {
                        //服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
                        //postId格式BoxId#位置
                        string posId = data[ParamDefine.posId];
                        string plateW = data[ParamDefine.plateW];
                        string plateH = data[ParamDefine.plateH];
                        string[] posArray = posId.Split('#');
                        if (!(posArray.Length == 2))
                        {
                            WarnMsg = Name + "入库库位格式错误:二维码【" + message + "】库位【" + posId + "】";
                            LogUtil.error(Name + "服务器反馈   入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");

                            return false;
                        }

                        int storeId = int.Parse(posArray[0]);
                        //根据发送的posId获取位置列表
                        ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
                        if (position == null)
                        {   //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
                            WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
                            LogUtil.error(Name + "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
                            return false;
                        }
                        LogInfo(" 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】设置入库参数 , 开始入库!");
                        MoveInfo.MoveParam.UpdatePosId(message, posId, plateW, plateH, ComTargetPosition);
                        return true;
                    }
                }
                else if (resultOperation.op.Equals(2))
                {
                    ReviceOutStoreProcess(resultOperation);
                }
                else if (resultOperation.op.Equals(5))
                {
                    ProcessHumidityCMD(resultOperation);
                }
                else
                {
                    LogUtil.error("收到服务器命令:op=" + resultOperation.op + ",未找到对应处理");
                }
            }
            catch (Exception ex)
            {
                LogUtil.error(Name + "GetPosIdByCode" + ex.StackTrace);
            }
            return false;
        }
      

        #endregion

        #region 压紧轴压紧处理 
        private System.Timers.Timer axisCheckTimer = null;
        private string TargetIoType = IO_Type.Compress_Check;
        private IO_VALUE TargetIoValue = IO_VALUE.HIGH;
        private bool ComAxisStartCheck(string targetIo = "", IO_VALUE value = IO_VALUE.HIGH)
        {
            if (String.IsNullOrEmpty(targetIo))
            {
                targetIo = IO_Type.Compress_Check;
            }
            if (axisCheckTimer == null)
            {
                axisCheckTimer = new System.Timers.Timer();
                axisCheckTimer.AutoReset = true;
                axisCheckTimer.Interval += 30;
                axisCheckTimer.Elapsed += CheckTimer_Elapsed;
                axisCheckTimer.Enabled = false;
            }
            TargetIoValue = value;
            TargetIoType = targetIo;
            axisCheckTimer.Start();
            return true;
        }

        private bool ComAxisStopCheck()
        {
            if (!(axisCheckTimer == null))
            {
                axisCheckTimer.Stop();
            }
            return true;
        }
        private bool IsInProcess = false;
        private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (IsInProcess) { return; }
            IsInProcess = true;
            if (IOValue(TargetIoType).Equals(TargetIoValue))
            {
                LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
                ACServerManager.SuddenStop(Config.Comp_Axis.DeviceName, Config.Comp_Axis.GetAxisValue());
                ComAxisStopCheck();
            }
            IsInProcess = false;
        }
        #endregion
    }
}