Beispiel #1
0
 /// <summary>
 /// 调节货叉位置
 /// </summary>
 private void SetFork(int Zero)
 {
     using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
     {
         int maxForkDistance = Zero * 100;
         if (maxForkDistance > 0)
         {
             for (int l = 0; l < maxForkDistance; l += 2)
             {
                 srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "INT18", l);//模拟伸叉位置 1排为正,二排为负
             }
             wait(1000);
             for (int l = maxForkDistance; l >= 0; l -= 2)
             {
                 srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "INT18", l);//模拟收叉位置 1排为正,二排为负
             }
         }
         if (maxForkDistance < 0)
         {
             for (int l = 0; l > maxForkDistance; l -= 2)
             {
                 srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "INT18", l);//模拟伸叉位置 1排为正,二排为负
             }
             wait(300);
             for (int l = maxForkDistance; l <= 0; l += 2)
             {
                 srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "INT18", l);//模拟收叉位置 1排为正,二排为负
             }
         }
     }
 }
Beispiel #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
     {
         string write_TaskFinish = LOCALSERVER + StackerRead + "X1.2";
         srv.OPC_WritePoint(write_TaskFinish, true);
         string write_NewTask = LOCALSERVER + StackerRead + "W52";
         srv.OPC_WritePoint(write_NewTask, 0);
     }
 }
Beispiel #3
0
        private void btn_AlarmReset_Click(object sender, EventArgs e)
        {
            btn_AlarmReset.Enabled = false;
            var itemName = stk.Write_Index[Stacker.WRITE_Index_Srm_Reset];

            srv.OPC_WritePoint(itemName, 1);
            wait(1000);
            btn_AlarmReset.Enabled = true;
        }
Beispiel #4
0
 private void btnDown_KeyUp(object sender, KeyEventArgs e)
 {
     bSt2 = false;
     FormMain.wait(200);
     using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
     {
         srv.OPC_WritePoint(Items[1], 0);
     }
 }
Beispiel #5
0
 private void btnUp_MouseUp(object sender, MouseEventArgs e)
 {
     bSt1 = false;
     FormMain.wait(200);
     using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
     {
         srv.OPC_WritePoint(Items[0], 0);
     }
 }
Beispiel #6
0
 private void DeleteTask(OD_Task tsk)
 {
     if (tsk.HADFINISH == "N" && tsk.RELEASESTATUS == "Y")
     {
         using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
         {
             string containerID = tsk.CONTAINERNO;
             if (srv.Od_Task_deleteOne(tsk.TASKID))  //删除当前任务
             {
                 srv.Place_Vs_Container_DeleteOne(containerID);
                 srv.Container_Vs_Items_DeleteOneByContainerID(containerID);
                 bool bl = srv.OPC_WritePoint("S7:[300]DB540,B1", 2);   //删除堆垛机任务
                 if (bl)
                 {
                     MessageBox.Show("删除成功!");
                 }
             }
         }
     }
     if (tsk.HADFINISH == "N" && tsk.RELEASESTATUS == "N")
     {
         if (tsk.TASKTYPEDESCRIPTION.Contains("出库"))   //如果出库的话
         {
             using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
             {
                 string placeId     = tsk.SOURCEPLACE;
                 string containerID = tsk.CONTAINERNO;
                 if (srv.Od_Task_deleteOne(tsk.TASKID))
                 {
                     List <IV_place_vs_container> lstPVC = srv.Place_Vs_Container_GetRelationshipByContainer(containerID).ToList();
                     IV_place_vs_container        pvc    = new IV_place_vs_container();
                     if (lstPVC.Count > 0)
                     {
                         pvc         = lstPVC[0];
                         pvc.PLACEID = placeId;
                         srv.Place_Vs_Container_UpdateOne(pvc);
                     }
                 }
             }
         }
         else if (tsk.TASKTYPEDESCRIPTION.Contains("入库")) //否则入库
         {
             using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
             {
                 string containerID = tsk.CONTAINERNO;
                 if (srv.Od_Task_deleteOne(tsk.TASKID))
                 {
                     srv.Place_Vs_Container_DeleteOne(containerID);
                     srv.Container_Vs_Items_DeleteOneByContainerID(containerID);
                 }
             }
         }
     }
 }
Beispiel #7
0
 private void ctrlST2(object obj)
 {
     if (bSt2)
     {
         using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
         {
             srv.OPC_WritePoint(Items[1], 1);
             FormMain.wait(50);
         }
     }
 }
Beispiel #8
0
        private void button3_Click(object sender, EventArgs e)
        {
            using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                if (btn_Alert.Text == "报警")
                {
                    {
                        srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W90", alertSec++);//发送报警信号
                        switch (comboBox1.SelectedIndex)
                        {
                        case 0:
                            srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W6", 111);
                            break;

                        case 1:
                            srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W6", 105);
                            break;

                        case 2:
                            srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W6", 23);
                            break;

                        case 3:
                            srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W6", 11);
                            break;
                        }
                        btn_Alert.Text = "解除";
                    }
                }
                else
                {
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W90", 0);//发送报警解除
                    btn_Alert.Text = "报警";
                }
        }
Beispiel #9
0
        private void handshakeProc()
        {
            CheckForIllegalCrossThreadCalls = false;
            string WRITE_HandShake = LOCALSERVER + StackerWrite + "W999";//写入握手信号

            while (true)
            {
                if (handShake > 20000)
                {
                    handShake = 0;
                }
                else
                {
                    handShake++;
                }
                wait(1000);
                using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                {
                    srv.OPC_WritePoint(WRITE_HandShake, handShake);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 将值写入OPC服务器
        /// </summary>
        /// <param name="ItemName">地址</param>
        /// <param name="itemValues">值</param>
        /// <returns></returns>
        public bool WriteValuePoint(string ItemName, object itemValues)
        {
            object ItemValues = itemValues;

            try
            {
                using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                {
                    if (srv.OPC_WritePoint(ItemName, ItemValues))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #11
0
        private void SRMRun()
        {
            CheckForIllegalCrossThreadCalls = false;
            ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient();
            ArrayOfString          tmp = new ArrayOfString();

            tmp.Add(LOCALSERVER + StackerRead + "D10");
            int YLocation = Int32.Parse(srv.OPC_Read(tmp)[0].ToString());//堆垛机水平距离

            while (true)
            {
                srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 0);//空闲
                if (IsNewTask == "是")
                {
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.2", false); //任务完成
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.3", false); //取货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", false); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true);  //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.4", false); //放货完毕

                    lsBRunning.Items.Add(DateTime.Now.ToString() + "堆垛机开始执行任务....");
                    wait(1000);
                    lsBRunning.Items.Add("开始定位准备取货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 2);//定位
                    int lenth = int.Parse(lbFromLie.Text) * 100;
                    while (lenth != YLocation)
                    {
                        if (YLocation > lenth)
                        {
                            YLocation--;
                        }
                        else
                        {
                            YLocation++;
                        }
                        srv.OPC_WritePoint(LOCALSERVER + StackerRead + "D10", YLocation);//写入当前水平坐标
                    }
                    wait(300);
                    lsBRunning.Items.Add("定位完毕,开始取货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 3);       //取货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", false); //货叉原点

                    wait(300);
                    int zero = 1;
                    if (lbfromPai.Text.Trim() == "2")
                    {
                        zero = -1;
                    }
                    SetFork(zero);

                    wait(300);
                    lsBRunning.Items.Add("取货完毕,开始定位准备放货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.3", true); //取货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", true); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true); //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "INT18", 0);   //伸叉位置 1排为正,二排为负
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 2);      //定位
                    lenth = int.Parse(lbToLie.Text) * 100;
                    while (lenth != YLocation)
                    {
                        if (YLocation > lenth)
                        {
                            YLocation--;
                        }
                        else
                        {
                            YLocation++;
                        }
                        srv.OPC_WritePoint(LOCALSERVER + StackerRead + "D10", YLocation);//写入当前水平坐标
                    }
                    wait(500);
                    lsBRunning.Items.Add("定位完毕,开始放货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 4);       //放货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", false); //货叉原点
                    wait(800);
                    zero = 1;
                    if (lbToPai.Text.Trim() == "2")
                    {
                        zero = -1;
                    }
                    SetFork(zero);
                    wait(300);
                    lsBRunning.Items.Add("放货完毕,执行完成");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.4", true);  //放货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", false); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true);  //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "INT18", 0);
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 0);       //空闲
                    wait(200);
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.2", true);  //任务完成
                    srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "W52", 0);     //新任务下达
                    IsNewTask = "否";
                    wait(1000);
                }
            }
        }