uc_boxdebug.cs 23.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 558 559 560 561 562 563 564 565 566 567
using log4net;
using OnlineStore.AutoInOutStore;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static OnlineStore.AutoInOutStore.ResourceCulture;

namespace OnlineStore.ACSingleStore.useControl
{
    public partial class uc_boxdebug : UserControl
    {
        static AxisManager ACServerManager = AxisManager.instance;
        private AC_SA_BoxBean store;
        private string StartAuto = ResourceCulture.GetString("开始自动出入库");
        private string StopAuto = ResourceCulture.GetString("停止自动出入库");
        private string AutoOut = ResourceCulture.GetString("自动出库:");
        private string AutoIn = ResourceCulture.GetString("自动入库:");
        public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        Dictionary<string,PosState> posState = new Dictionary<string, PosState>();
        //如果总配置文件存在,保存到总的配置文件
        static string appPath = Application.StartupPath;
        static string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config);
        class PosState {
            public int InStoreCheck = 0;
            public int OutStoreCheck = 0;

        }
        public uc_boxdebug()
        {
            InitializeComponent();
            
        }
        public void Init(AC_SA_BoxBean store)
        {
            this.store = this.store = store;
            if (store == null)
            {
                LogUtil.error(LOGGER, "找不到对应的料仓");
                return;
            }
            StartAuto = ResourceCulture.GetString("开始自动出入库");
            StopAuto = ResourceCulture.GetString("停止自动出入库");
            AutoOut = ResourceCulture.GetString("自动出库:");
            AutoIn = ResourceCulture.GetString("自动入库:");


            FillBoxPos();
            store.InOutEndProcessEvent += Store_InOutEndProcessEvent;
            timer1.Enabled = true;
            return;
        }

        private void Store_InOutEndProcessEvent(string arg1, StoreMoveType arg2, bool arg3)
        {
            //LogUtil.info($"出入库完成状态:{arg2},库位:{arg1}");
            int InStoreCheck = 0;
            int OutStoreCheck = 0;
            if (arg2 == StoreMoveType.InStore)
                InStoreCheck = 1;
            else if (arg2 == StoreMoveType.OutStore)
                OutStoreCheck = 1;
            var pps = SavePosCheck(arg1, InStoreCheck, OutStoreCheck);

            if (htpp.ContainsKey(arg1))
            {
                var pp = (PosPos)htpp[arg1];
                var cells = dataGridView1.Rows[pp.row].Cells[pp.col];
                cells.Style = GetStyle(arg1);
            }
        }
        DataGridViewCellStyle GetStyle(string posid) {
            if (htpp.ContainsKey(posid) && posState.ContainsKey(posid))
            {
                var pp = (PosPos)htpp[posid];
                var pps = (PosState)posState[posid];
                var cells = dataGridView1.Rows[pp.row].Cells[pp.col];
                cells.Selected = true;
                if (pps.InStoreCheck == 1 && pps.OutStoreCheck == 1)
                    return dgv_ok;
                else if (pps.InStoreCheck == 1)
                    return dgv_oin;
                else if (pps.OutStoreCheck == 1)
                    return dgv_oout;
            }
            return dgv_none;
        }
        Hashtable htpp = new Hashtable();
        class PosPos {
            public string Posid;
            public int index;
            public int row;
            public int col;
        }
        int PosCompare(string a, string b) {
            string[] pa = a.Split('_');
            string[] pb = b.Split('_');

            if (pa[1].Length == 1)
                pa[1] += "A";
            if (pb[1].Length == 1)
                pb[1] += "A";
            var isa = pa[1][0]+(pa[1][1].Equals('A') ? "1" : "2") + pa[2][0] +   pa[3].PadLeft(2, '0');
            var isb = pb[1][0]+(pb[1][1].Equals('A') ? "1" : "2") + pb[2][0] +   pb[3].PadLeft(2, '0');


            if (int.Parse(isa) == int.Parse(isb))
                return 0;
            else if (int.Parse(isa) > int.Parse(isb))
                return 1;
            else
                return -1;

        }
        void LoadPosCheck() {
            var poscheckfile = positionConfigFile + ".check";
            if (File.Exists(poscheckfile))
            {
                try
                {
                    posState = JsonHelper.DeserializeJsonToObject<Dictionary<string, PosState>>(File.ReadAllText(poscheckfile));
                    File.Copy(poscheckfile, poscheckfile + ".backup", true);
                }
                catch {
                    if (File.Exists(poscheckfile + ".backup"))
                    {
                        File.Copy(poscheckfile + ".backup", poscheckfile, true);
                        File.Delete(poscheckfile + ".backup");
                        LoadPosCheck();
                    }
                }
            }
            else
            {
                File.WriteAllText(poscheckfile, JsonHelper.SerializeObject(posState));
            }
        }
        PosState SavePosCheck(string posid,int inStoreCheck,int outStoreCheck) {

            if (!posState.ContainsKey(posid))
                posState.Add(posid, new PosState());
            if (inStoreCheck>0)
                posState[posid].InStoreCheck = inStoreCheck;
            if (outStoreCheck > 0)
                posState[posid].OutStoreCheck = outStoreCheck;
            var poscheckfile = positionConfigFile + ".check";
            File.WriteAllText(poscheckfile, JsonHelper.SerializeObject(posState));
            return posState[posid];
        }
        static Font font = new Font("宋体",10);
        DataGridViewCellStyle dgv_ok = new DataGridViewCellStyle() { BackColor = Color.LightGreen, Font = font };
        DataGridViewCellStyle dgv_oin = new DataGridViewCellStyle() { BackColor = Color.LightGray, Font = font };
        DataGridViewCellStyle dgv_oout = new DataGridViewCellStyle() { BackColor = Color.LightSeaGreen, Font = font };
        DataGridViewCellStyle dgv_none = new DataGridViewCellStyle() { BackColor = Color.White,Font= font };
        void FillBoxPos() {
            LoadPosCheck();
            Comparison<string> comparison = new Comparison<string>(PosCompare);
            store.PositionNumList.Sort(comparison);
            //store.PositionNumList.Reverse();

            string[] posstr = store.PositionNumList[store.PositionNumList.Count-1].Split('_');
            int colcount = int.Parse(posstr[1][0].ToString())+1;
            for (int i = 0; i < colcount; i++)
            {
                dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A");
                dataGridView1.Columns.Add("Col" + i + "_B", "Col" + i + "_B");
                
            }
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                dataGridView1.Columns[i].Width = 64;
                dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            dataGridView1.Rows.Add();
            int currentRowIndex = 0;
            int lastcol = -1;
            string lastAB = "";
            for (int i = 0; i < store.PositionNumList.Count; i++)
            {
                int ci = store.PositionNumList.Count-1 - i;
                string posname = store.PositionNumList[ci];
                string[] _posstr = posname.Split('_');
                int col = int.Parse(_posstr[1][0].ToString());
                string ab = "A";
                if (_posstr[1].Length>1)
                    ab = _posstr[1][1].ToString();

                if (col != lastcol || lastAB!= ab)
                    currentRowIndex = 0;

                lastcol = col;
                lastAB = ab;
                if (currentRowIndex >= dataGridView1.Rows.Count-1)
                {
                    int x = dataGridView1.Rows.Add();
                }
                
                var currentRow = dataGridView1.Rows[currentRowIndex];

                int currentColIndex = col * 2;
                if (ab.ToLower() == "b")
                    currentColIndex++;
                currentRow.Cells[currentColIndex].Value = $"{_posstr[1]}_{_posstr[2]}_{_posstr[3]}";
                currentRow.Cells[currentColIndex].Tag = posname;
                htpp.Add(posname, new PosPos() { Posid = posname, index = i, row = currentRowIndex, col = currentColIndex });
                currentRow.Cells[currentColIndex].Style = GetStyle(posname);
                
                currentRowIndex++;                
            }
            dataGridView1.Rows.RemoveAt(dataGridView1.Rows.Count - 1);
        }
        void setData(string posid) {
            AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(posid);
            cmbPosition.Text = posid;
            if (ktkPosition != null)
            {
                txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
                txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
                txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
                txtUpDownP5.Text = ktkPosition.UpDownAxis_OHPosition_P5.ToString();
                txtUpDownP6.Text = ktkPosition.UpDownAxis_OLPosition_P6.ToString();
                txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString();
                txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString();
                txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString();
                txtInOutP2.Text = ktkPosition.InOutAxis_DoorOutPosition_P4.ToString();
            }

        }

        private void btnInStore_Click(object sender, EventArgs e)
        {
            if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
            {
                string selectPositionNum = cmbPosition.Text;
                LineMoveP ktk = LoadPostion();
                store.StartInStoreMove(new InOutStoreParam("", selectPositionNum, ktk));
            }
            else
            {
                MyMessage.Show("请先启动料仓!");
            }
        }

        private void btnOutStore_Click(object sender, EventArgs e)
        {
            if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
            {
                string selectPositionNum = cmbPosition.Text;
                LineMoveP ktk = LoadPostion();
                store.StartOutStoreMove(new InOutStoreParam("", selectPositionNum, ktk),false);
            }
            else
            {
                MyMessage.Show("请先启动料仓!");
            }
        }
        private void btnStartAuTo_Click(object sender, EventArgs e)
        {
            if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
            {
                if (store.autoNext)
                {
                    store.autoNext = false;
                    btnStartAuTo.Text = StartAuto;
                }
                else
                {
                    DialogResult res = MyMessage.Show("确定开始自动出入库?", "提示", MessageBoxButtons.YesNo);
                    if (res.Equals(DialogResult.Yes))
                    {
                        store.autoNext = true;
                        int jiange = FormUtil.GetIntValue(txtJiange);
                        store.autoJiange = jiange;
                        if (!string.IsNullOrEmpty(cmbPosition.Text))
                        {
                            int currIndex = store.PositionNumList.IndexOf(cmbPosition.Text); ;
                            store.autoPositionIndex = currIndex;
                            store.AutoStartIndex = currIndex;
                            //store.Double_Alternate = checkBox_Double_Alternate.Checked;
                            //store.Alternate = false;
                            //store.hasDoublePlate = false;
                            string poText = cmbPosition.Text;
                            store.autoMsg = AutoIn + ":" + poText;
                            LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
                            //store.StartOutStoreMove(new InOutStoreParam("", poText));
                            store.StartInStoreMove(new InOutStoreParam("", poText));
                        }
                        btnStartAuTo.Text = StopAuto;
                    }
                }
            }
            else
            {
                MyMessage.Show("请先启动料仓!");
            }
        }
        private LineMoveP LoadPostion()
        {
            LineMoveP ktk = new LineMoveP();
            //ktk.ComPress_P1 = FormUtil.GetIntValue(txtComP1);
            ktk.ComPress_P1 = store.Config.CompressAxis_P1_Position;
            ktk.ComPress_P2 = FormUtil.GetIntValue(txtComP2);
            ktk.ComPress_P3 = FormUtil.GetIntValue(txtComP3);
            //ktk.InOut_P1 = FormUtil.GetIntValue(txtInOutP1);
            ktk.InOut_P1 = store.Config.InOutAxis_P1_Position;
            ktk.InOut_P2 = FormUtil.GetIntValue(txtInOutP2);
            ktk.InOut_P3 = FormUtil.GetIntValue(txtInOutP3);
            //ktk.Middle_P1 = FormUtil.GetIntValue(txtMiddleP1);
            ktk.Middle_P1 = store.Config.MiddleAxis_P1_Position;
            ktk.Middle_P2 = FormUtil.GetIntValue(txtMiddleP2);

            //ktk.UpDown_P1 = FormUtil.GetIntValue(txtUpDownP1);
            //ktk.UpDown_P1 = store.Config.UpDownAxis_DoorOPosition_P1;
            //ktk.UpDown_P2 = FormUtil.GetIntValue(txtUpDownP2);
            //ktk.UpDown_P2 = store.Config.UpDownAxis_DoorIPosition_P2;
            ktk.UpDown_P3 = FormUtil.GetIntValue(txtUpDownP3);
            ktk.UpDown_P4 = FormUtil.GetIntValue(txtUpDownP4);
            ktk.UpDown_P5 = FormUtil.GetIntValue(txtUpDownP5);
            ktk.UpDown_P6 = FormUtil.GetIntValue(txtUpDownP6);
            //ktk.UpDown_P7 = FormUtil.GetIntValue(txtUpDownP7);
            //ktk.UpDown_P7 = store.Config.UpDownAxis_DoorOBPosition_P7;
            //ktk.UpDown_P8 = FormUtil.GetIntValue(txtUpDownP8);
            //ktk.UpDown_P8 = store.Config.UpDownAxis_DoorIBPosition_P8;
            return ktk;
        }
        private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
        {
            moveAxis.TargetPosition = targetPosition;
            ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);
        }
        /// <summary>
        /// 判断进出轴是否在P1点
        /// </summary> 
        private bool InOutIsIsP1()
        {
            int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
            int currValue = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
            if (currValue <= InOutDefaultPosition)
            {
                return true;
            }
            MyMessage.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return false;
        }      


        private void btnUpDownP3_Click(object sender, EventArgs e)
        {
            if (InOutIsIsP1())
            {
                int value = FormUtil.GetIntValue(txtUpDownP3);
                AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_P3_Speed);
            }
        }

        private void btnUpDownP4_Click(object sender, EventArgs e)
        {
            if (InOutIsIsP1())
            {
                int value = FormUtil.GetIntValue(txtUpDownP4);
                AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_P4_Speed);
            }
        }

        private void btnUpDownP5_Click(object sender, EventArgs e)
        {
            if (InOutIsIsP1())
            {
                int value = FormUtil.GetIntValue(txtUpDownP5);
                AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_P5_Speed);
            }
        }

        private void btnUpDownP6_Click(object sender, EventArgs e)
        {
            if (InOutIsIsP1())
            {
                int value = FormUtil.GetIntValue(txtUpDownP6);
                AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_P6_Speed);
            }
        }

        private void btnMiddleP2_Click(object sender, EventArgs e)
        {
            if (InOutIsIsP1())
            {
                int value = FormUtil.GetIntValue(txtMiddleP2);
                AxisABSMove(store.Config.Middle_Axis, value, store.Config.MiddleAxis_P2_Speed);
            }
        }


        private void btnInOutP3_Click(object sender, EventArgs e)
        {
            //if (store.InOutAxisCanMove().Equals(false))
            //{
            //    MyMessage.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}
            int value = FormUtil.GetIntValue(txtInOutP3);
            AxisABSMove(store.Config.InOut_Axis, value, store.Config.InOutAxis_P3_Speed);
        }

        private void btnInOutP2_Click(object sender, EventArgs e)
        {
            //if (store.InOutAxisCanMove().Equals(false))
            //{
            //    MyMessage.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}
            int value = FormUtil.GetIntValue(txtInOutP2);
            AxisABSMove(store.Config.InOut_Axis, value, store.Config.InOutAxis_P2_Speed);
        }

        private void btnComP2_Click(object sender, EventArgs e)
        {
            int value = FormUtil.GetIntValue(txtComP2);
            AxisABSMove(store.Config.Comp_Axis, value, store.Config.CompAxis_P2_Speed);
            //ShuoKeControls.AbsMove(store.Config.CompressAxis_Slv, value);
        }


        private void btnComP3_Click(object sender, EventArgs e)
        {
            int value = FormUtil.GetIntValue(txtComP3);
            AxisABSMove(store.Config.Comp_Axis, value, store.Config.CompAxis_P3_Speed);
            //ShuoKeControls.AbsMove(store.Config.CompressAxis_Slv, value);
        }

        private void btnSavePosition_Click(object sender, EventArgs e)
        {
            //料仓格子位置保存
            string selectPositionNum = cmbPosition.Text;
            AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(selectPositionNum);
            if (ktkPosition != null)
            {
                ktkPosition.MiddleAxis_Position_P2 = FormUtil.GetIntValue(txtMiddleP2);
                ktkPosition.UpDownAxis_IHPosition_P3 = FormUtil.GetIntValue(txtUpDownP3);
                ktkPosition.UpDownAxis_ILPosition_P4 = FormUtil.GetIntValue(txtUpDownP4);

                ktkPosition.UpDownAxis_ILPosition_P4 = FormUtil.GetIntValue(txtUpDownP4);
                ktkPosition.InOutAxis_Position_P3 = FormUtil.GetIntValue(txtInOutP3);
                ktkPosition.CompressAxis_CPosition_P3 = FormUtil.GetIntValue(txtComP3);
                ktkPosition.UpDownAxis_OHPosition_P5 = FormUtil.GetIntValue(txtUpDownP5);
                ktkPosition.UpDownAxis_OLPosition_P6 = FormUtil.GetIntValue(txtUpDownP6);
                ktkPosition.CompressAxis_Position_P2 = FormUtil.GetIntValue(txtComP2);
                //ktkPosition.InOutAxis_DoorPosition_P4 = FormUtil.GetIntValue(txtInOutP2);
            }
            //位置配置

            if (!File.Exists(positionConfigFile))
            {
                positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config, "_" + store.StoreID.ToString());
            }
            bool result = CSVPositionReader<AutoStorePosition>.SavePostion(positionConfigFile, ktkPosition);
            if (!result)
            {
                MyMessage.Show("保存位置失败!");
            }

        }
        bool preOpen = false;
        public void StoreOpenStatus(bool isOpen)
        {
            if (preOpen.Equals(isOpen))
            {
                return;
            }
            preOpen = isOpen;

            btnOutStore.Enabled = isOpen;
            btnInStore.Enabled = isOpen;

        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!Visible)
                return;

            if (store.storeRunStatus == StoreRunStatus.Wait)
            {
                btnStartAuTo.Text = StartAuto;
                return;
            }

                if (store.autoNext)
            {
                string msg = store.autoMsg;
                lblMsg.Text = msg;
                if (btnStartAuTo.Text.Equals(StartAuto))
                {
                    btnStartAuTo.Text = StopAuto;
                }
                try
                {
                    msg = msg.Replace(AutoOut, "");
                    msg = msg.Replace(AutoIn, "");
                    if (htpp.ContainsKey(msg))
                    {
                        var pp = (PosPos)htpp[msg];
                        dataGridView1.Rows[pp.row].Cells[pp.col].Selected=true;
                        setData(msg);
                    }
                }
                catch (Exception ex) { }
            }
            else
            {
                // lblMsg.Text = "没有开启自动出入库";
                if (btnStartAuTo.Text.Equals(StopAuto))
                {
                    btnStartAuTo.Text = StartAuto;
                }
            }
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex<0 || dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == null)
                return;
            var posid = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag.ToString();
            setData(posid);
        }

        private void checkBox_Double_Alternate_CheckedChanged(object sender, EventArgs e)
        {
            var obj = sender as CheckBox;
            //store.Double_Alternate = obj.Checked;
            if (obj.Checked)
            {
                txtJiange.Text = "1";
                txtJiange.Enabled = false;
            }
            else
                txtJiange.Enabled = true;
        }

        private void btnInOutP1_Click(object sender, EventArgs e)
        {
            //if (store.InOutAxisCanMove().Equals(false))
            //{
            //    MyMessage.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}
            AxisABSMove(store.Config.InOut_Axis, store.Config.InOutAxis_P1_Position, store.Config.InOutAxis_P1_Speed);
        }

        private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == null)
                return;
            var posid = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag.ToString();
            setData(posid);
        }
    }
}