/// <summary>
        /// 读取堆垛机信息
        /// </summary>
        /// <param name="co"></param>
        public void CraneRead(ref CRCObject co)
        {
            if (coc.connectstatus == 0)
            {
                coc.connectstatus = 1;
                cPLCList[co.ScNo].HsServerCloseConnect();
                CarneConnect();
            }
            buffer = new byte[bytlength];
            bool flag = cPLCList[co.ScNo].HsRead($"DB{dbnumber}.{value}", bytlength, ref buffer);

            if (flag)
            {
                #region 入库出库
                runorder = co.runorder;
                if (runorder == 1)
                {
                    co.runorder = 2;
                }
                else if (runorder == 2)
                {
                    co.runorder = 1;
                }
                #endregion

                BindCraneStr(co.ScNo, buffer);
            }
            else
            {
                coc.connectstatus = 0;
                NotifyShowEvent?.Invoke("C", $"堆垛机{co.ScNo}读取数据失败");
                cPLCList[co.ScNo].HsServerCloseConnect();
                CarneConnect();
            }
        }
Exemplo n.º 2
0
 private void TimeScan(object ob)
 {
     while (true)
     {
         CRCObject co = ob as CRCObject;
         co.BllSrm.CraneRead(ref co);
         Thread.Sleep(500);
     }
 }