示例#1
0
 // 停止
 private void button3_Click(object sender, EventArgs e)
 {
     MachineFill.sendMsg("$Q2052F101" + Rand.Str(4) + "*");
     timer1.Enabled = false;
     timer2.Enabled = false;
     this.Close();
 }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            if (dataGridView2.RowCount == 0)
            {
                label7.Text = "此药品库位可能被锁定。无需要补药的库位";
                return;
            }
            // 判断用哪一侧上药
            side = 1;
            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                if (int.Parse(dataGridView2.Rows[i].Cells[2].Value.ToString()) > 60)
                {
                    side = 2;
                    break;
                }
            }
            string code = "$Q2012F1" + side + NEIni.ReadValue(".\\config.ini", "param", "check", "0");

            code += string.Format("{0:D3}", int.Parse(drugInfo.PackageLength));
            code += string.Format("{0:D3}", int.Parse(drugInfo.PackageWidth));
            //code += string.Format("{0:D2}", int.Parse(drugInfo.StockLimit));
            code += string.Format("{0:D2}", int.Parse(dataGridView2.Rows[0].Cells[9].Value.ToString()));

            int needQty = 0;

            // 药槽
            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                code    += string.Format("{0:D2}", int.Parse(dataGridView2.Rows[i].Cells[1].Value.ToString()));
                code    += string.Format("{0:D3}", int.Parse(dataGridView2.Rows[i].Cells[2].Value.ToString()));
                code    += string.Format("{0:D2}", int.Parse(dataGridView2.Rows[i].Cells[4].Value.ToString()));
                needQty += int.Parse(dataGridView2.Rows[i].Cells[4].Value.ToString());

                if (side == 2 && int.Parse(dataGridView2.Rows[i].Cells[2].Value.ToString()) < 61)
                {
                    int hor = int.Parse(dataGridView2.Rows[i].Cells[5].Value.ToString()) - offsetHor + int.Parse(dataGridView2.Rows[i].Cells[8].Value.ToString());
                    code += hor.ToString().Length;
                    code += hor;
                }
                else
                {
                    code += dataGridView2.Rows[i].Cells[5].Value.ToString().Length;
                    code += dataGridView2.Rows[i].Cells[5].Value.ToString();//H
                }
                code += dataGridView2.Rows[i].Cells[6].Value.ToString().Length;
                code += dataGridView2.Rows[i].Cells[6].Value.ToString();//V
                code += string.Format("{0:D3}", int.Parse(dataGridView2.Rows[i].Cells[8].Value.ToString()));
            }
            code += Rand.Str(4) + "*";
            //   NELog.WriteLog(code);
            label2.Text = needQty.ToString();
            dataGridView2.CurrentRow.Selected = true;
            label8.Text = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells[11].Value.ToString();
            MachineFill.sendMsg(code);  //获取补药及位置信息-完成初始化
        }
示例#3
0
        private void button6_Click(object sender, EventArgs e)
        {
            string code   = (string)CoderQueue.ckSyncdQueue.Dequeue();
            string errKey = code.Substring(0, 5);

            if (errKey.Equals("$Q990"))
            {
                // 异常解决
                MachineFill.sendMsg("$Q3052F1" + Rand.Str(4) + "*");
            }
            button6.Visible = false;
            label1.Text     = "运行正常";
        }
示例#4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (errKey.Equals("E0"))
     {
         // 初始化继续
         timer1.Enabled = true;
     }
     else if (errKey.Equals("E1"))
     {
         // 异常解决
         MachineFill.sendMsg("$Q2112F101" + Rand.Str(4) + "*");
     }
     button2.Visible = false;
     label7.Text     = "";
 }
示例#5
0
        private void button4_Click(object sender, EventArgs e)
        {
            /*
             * 卡药,先降落-处理药品-重新加药
             */
            MachineFill.sendMsg("$Q2192F101" + Rand.Str(4) + "*");
            button4.Visible = false;

            /*
             * 异常处理完毕,放好药品点继续加药
             */
            //button2.Visible = true;
            //label7.Text = "降落后请摆放好药品,点继续操作!";
            //speech.Rate = -1;
            //speech.SpeakAsync("机械手降落到能处理的位置时拍下急停按钮打开玻璃门,将");
        }
示例#6
0
        private void button8_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("    机械手回到窗口后未完成初始化?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                MachineFill.sendMsg("$Qfwb" + Rand.Str(4) + "*");

                button8.BackColor = Color.Gray;
                button8.Enabled   = false;

                Thread.Sleep(2000);

                button8.BackColor = Color.Red;
                button8.Enabled   = true;
            }
            else
            {
            }
        }
示例#7
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (haschecked && !pause)
            {
                if (iProcess >= sList.Count)
                {
                    label2.Text    = "盘点完毕!";
                    timer1.Enabled = false;
                    label5.Text    = sList.Count + "/" + sList.Count;
                    return;
                }
                else
                {
                    label5.Text = iProcess + "/" + sList.Count;
                }
                label2.Text = "正在盘点 " + sList[iProcess].RowNO + " 行 " + sList[iProcess].ColNO + " 列";

                // 发送盘点指令
                string side = "1";
                if (int.Parse(sList[iProcess].ColNO) < 61)
                {
                    side = "1";
                }
                else
                {
                    side = "2";
                }
                NELog.WriteLog("开始盘点:" + iProcess);

                //string code = "$Q3012F1" + side + sList[iProcess].StockHor.Length + sList[iProcess].StockHor + sList[iProcess].StockVer.Length + sList[iProcess].StockVer + string.Format("{0:D3}", int.Parse(sList[iProcess].StockWidth)) + string.Format("{0:D2}", int.Parse(sList[iProcess].RowNO)) + string.Format("{0:D3}", int.Parse(sList[iProcess].ColNO)) + string.Format("{0:D3}", int.Parse(sList[iProcess].PackageLength)) + Rand.Str(4) + "*";
                string code = "$Q3012F1" + side + sList[iProcess].StockHor.Length + sList[iProcess].StockHor + sList[iProcess].StockVer.Length + sList[iProcess].StockVer + string.Format("{0:D3}", int.Parse(sList[iProcess].StockWidth)) + string.Format("{0:D2}", int.Parse(sList[iProcess].RowNO)) + string.Format("{0:D3}", int.Parse(sList[iProcess].ColNO)) + string.Format("{0:D3}", int.Parse(sList[iProcess].PackageLength)) + Rand.Str(4) + "*";

                MachineFill.sendMsg(code);
                haschecked = false;
            }
        }
示例#8
0
 private void button5_Click(object sender, EventArgs e)
 {
     MachineFill.sendMsg("$Q2032F101" + Rand.Str(4) + "*");
     button5.Enabled = false;
     label7.Text     = "";
 }