Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ALS.Model.actions model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_actions(");
            strSql.Append("customID,portName,arrCommand,actionInfo,cmdLength)");
            strSql.Append(" values (");
            strSql.Append("@customID,@portName,@arrCommand,@actionInfo,@cmdLength)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@customID",   MySqlDbType.Int32,    20),
                new MySqlParameter("@portName",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@arrCommand", MySqlDbType.Binary),
                new MySqlParameter("@actionInfo", MySqlDbType.VarChar, 255),
                new MySqlParameter("@cmdLength",  MySqlDbType.Int32,    20),
            };
            parameters[0].Value = model.customID;
            parameters[1].Value = model.portName;
            parameters[2].Value = model.arrCommand;
            parameters[3].Value = model.actionInfo;
            parameters[4].Value = model.cmdLength;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ALS.Model.actions DataRowToModel(DataRow row)
 {
     ALS.Model.actions model = new ALS.Model.actions();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = long.Parse(row["ID"].ToString());
         }
         if (row["customID"] != null && row["customID"].ToString() != "")
         {
             model.customID = long.Parse(row["customID"].ToString());
         }
         if (row["portName"] != null)
         {
             model.portName = row["portName"].ToString();
         }
         if (row["arrCommand"] != null && row["arrCommand"].ToString() != "")
         {
             model.arrCommand = (byte[])row["arrCommand"];
         }
         if (row["actionInfo"] != null)
         {
             model.actionInfo = row["actionInfo"].ToString();
         }
         if (row["cmdLength"] != null && row["cmdLength"].ToString() != "")
         {
             model.cmdLength = int.Parse(row["cmdLength"].ToString());
         }
     }
     return(model);
 }
Beispiel #3
0
        private void btnVeinOpen_Click(object sender, EventArgs e)
        {
            ALS.Model.actions modact = new ALS.Model.actions();
            ALS.BLL.actions   bllact = new ALS.BLL.actions();
            Button            b      = sender as Button;

            if (b.Tag != null)
            {
                switch (b.Tag.ToString())
                {
                case "1":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel1Up;
                    modact.actionInfo = "静脉壶液面上升";
                    break;

                case "2":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel1Down;
                    modact.actionInfo = "静脉壶液面下降";
                    break;

                case "3":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel2Up;
                    modact.actionInfo = "动脉壶液面上升";
                    break;

                case "4":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel2Down;
                    modact.actionInfo = "动脉壶液面下降";
                    break;

                case "5":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel3Up;
                    modact.actionInfo = "M1液面上升";
                    break;

                case "6":
                    modact.arrCommand = Cls.Comm_Main.LiquidLevel.liquidLevel3Down;
                    modact.actionInfo = "M1液面下降";
                    break;
                }
            }
            modact.customID  = m_customID;
            modact.portName  = Port_Main.PortName;
            modact.cmdLength = modact.arrCommand.Length;
            if (bllact.Add(modact))
            {
                ShowActions(m_customID);
            }
        }
Beispiel #4
0
        private void btnVoiseClose_Click(object sender, EventArgs e)
        {
            ALS.Model.actions modact = new ALS.Model.actions();
            ALS.BLL.actions   bllact = new ALS.BLL.actions();
            Button            b      = sender as Button;

            switch (b.Tag.ToString())
            {
            case "voise1":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.Alarm1;
                modact.actionInfo = "报警音1";
                break;

            case "voise2":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.Alarm2;
                modact.actionInfo = "报警音2";
                break;

            case "lightclose":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.AllLightClose;
                modact.actionInfo = "所有灯关闭";
                break;

            case "lightred":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.RedTwinkle;
                modact.actionInfo = "红灯闪烁";
                break;

            case "lightyellow":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.YellowTwinkle;
                modact.actionInfo = "黄灯闪烁";
                break;

            case "lightgreen":
                modact.arrCommand = Cls.Comm_Main.CmdAlarmLamp.GreenAlways;
                modact.actionInfo = "绿灯常亮";
                break;
            }
            modact.customID  = m_customID;
            modact.portName  = Port_Main.PortName;
            modact.cmdLength = modact.arrCommand.Length;
            if (bllact.Add(modact))
            {
                ShowActions(m_customID);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ALS.Model.actions model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_actions set ");
            strSql.Append("customID=@customID,");
            strSql.Append("portName=@portName,");
            strSql.Append("arrCommand=@arrCommand,");
            strSql.Append("actionInfo=@actionInfo");
            strSql.Append("cmdLength = @cmdLength");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@customID",   MySqlDbType.Int32,    20),
                new MySqlParameter("@portName",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@arrCommand", MySqlDbType.Binary),
                new MySqlParameter("@actionInfo", MySqlDbType.VarChar, 255),
                new MySqlParameter("@cmdLength",  MySqlDbType.Int32,    20),
                new MySqlParameter("@ID",         MySqlDbType.Int32, 20)
            };
            parameters[0].Value = model.customID;
            parameters[1].Value = model.portName;
            parameters[2].Value = model.arrCommand;
            parameters[3].Value = model.actionInfo;
            parameters[4].Value = model.cmdLength;
            parameters[5].Value = model.ID;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ALS.Model.actions GetModel(long ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,customID,portName,arrCommand,actionInfo,cmdLength from tb_actions ");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.Int32)
            };
            parameters[0].Value = ID;

            ALS.Model.actions model = new ALS.Model.actions();
            DataSet           ds    = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
0
        private void rbtnAddActionOfAD_Click(object sender, EventArgs e)
        {
            if (m_ADID == 0)
            {
                MessageBox.Show("请选择气泡检测器");
                return;
            }

            if (!(this.rbtnOpenAD.Checked) && !(this.rbtnCloseAD.Checked))
            {
                MessageBox.Show("请选择气泡检测器状态");
                return;
            }

            ALS.Model.actions modact = new ALS.Model.actions();
            ALS.BLL.actions   bllact = new ALS.BLL.actions();
            switch (m_ADID)
            {
            case 1:
                if (rbtnOpenAD.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.OpenBubble1;
                    modact.actionInfo = "气泡检测器1打开";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.CloseBubble1;
                    modact.actionInfo = "气泡检测器1关闭";
                }
                break;

            case 2:
                if (rbtnOpenAD.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.OpenBubble2;
                    modact.actionInfo = "气泡检测器2打开";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.CloseBubble2;
                    modact.actionInfo = "气泡检测器2关闭";
                }
                break;

            case 3:
                if (rbtnOpenAD.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.OpenBubble3;
                    modact.actionInfo = "气泡检测器3打开";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdBubble.CloseBubble3;
                    modact.actionInfo = "气泡检测器3关闭";
                }
                break;
            }
            modact.customID  = m_customID;
            modact.portName  = Port_Main.PortName;
            modact.cmdLength = modact.arrCommand.Length;
            if (bllact.Add(modact))
            {
                ShowActions(m_customID);
            }
        }
Beispiel #8
0
        private void btnAddActionOfV_Click(object sender, EventArgs e)
        {
            byte[]        vstate = new byte[6];
            StringBuilder sb     = new StringBuilder();

            ALS.Model.actions modact = new ALS.Model.actions();
            ALS.BLL.actions   bllact = new ALS.BLL.actions();

            if (chkV1.Checked)
            {
                sb.Append("V1夹管,"); vstate[0] = 0x01;
            }
            else
            {
                sb.Append("V1松管,"); vstate[0] = 0x00;
            }

            if (chkV2.Checked)
            {
                sb.Append("V2夹管,"); vstate[1] = 0x01;
            }
            else
            {
                sb.Append("V2松管,"); vstate[1] = 0x00;
            }
            if (chkV3.Checked)
            {
                sb.Append("V3夹管,"); vstate[2] = 0x01;
            }
            else
            {
                sb.Append("V3松管,"); vstate[2] = 0x00;
            }
            if (chkV4.Checked)
            {
                sb.Append("V4夹管,"); vstate[3] = 0x01;
            }
            else
            {
                sb.Append("V4松管,"); vstate[3] = 0x00;
            }
            if (chkV5.Checked)
            {
                sb.Append("V5夹管,"); vstate[4] = 0x01;
            }
            else
            {
                sb.Append("V5松管,"); vstate[4] = 0x00;
            }
            if (chkV6.Checked)
            {
                sb.Append("V6夹管."); vstate[5] = 0x01;
            }
            else
            {
                sb.Append("V6松管."); vstate[5] = 0x00;
            }

            string info = sb.ToString();

            if (DialogResult.OK == MessageBox.Show("请确认夹管阀状态是否正确:[" + info + "] ?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                modact.actionInfo = info;
                modact.customID   = m_customID;
                modact.portName   = Port_Main.PortName;
                modact.arrCommand = Cls.Comm_Main.CmdValve.SetVState(vstate[0], vstate[1], vstate[2], vstate[3], vstate[4], vstate[5]);
                modact.cmdLength  = modact.arrCommand.Length;
                if (bllact.Add(modact))
                {
                    ShowActions(m_customID);
                }
            }
        }
Beispiel #9
0
        private void btnAddActionOfPump_Click(object sender, EventArgs e)
        {
            if (m_pumpID == 0)
            {
                MessageBox.Show("请选择泵!");
                return;
            }

            if ((!rbtnClockwise.Checked) && (!rbtnAntiClockwise.Checked) && (!rbtnIsRun.Checked))
            {
                MessageBox.Show("请选择泵运转方向!");
                return;
            }

            //当选择所有泵时,必须选择rbtnIsRun
            if (rbtnAllPump.Checked)
            {
                if (rbtnIsRun.Checked == false)
                {
                    MessageBox.Show("请选择所有泵的运转状态,此处必须选择停止!");
                    return;
                }
            }

            //if (lblPumpSpeed.Text == "0.0" && (!rbtnIsRun.Checked))
            //{
            //    MessageBox.Show("请设定泵速!");
            //    return;
            //}

            if (m_modc != null)
            {
                //当前选择的自定义步骤
                m_customID = (int)m_modc.ID;
                //添加泵动作
                //针对创新模式中,预计  预冲量的确认需要计算:
                //第一部分:预冲量 以自定义步骤中 BP运转时间 * 速度;
                //第二部分:预冲量 以自定义步骤中 RP运转时间 * 速度;
                //当添加的动作里包含 BP 或 RP 运转时,需要更新该步骤中的累计流量字段;
                //注:原有字段 timeCount ,存储 累计流量
                ALS.Model.actions modact = new ALS.Model.actions();
                modact.customID   = m_customID;
                m_bPumpDirection  = rbtnClockwise.Checked ? true : false;
                m_bPumpRun        = rbtnIsRun.Checked ? false : true;
                modact.arrCommand = Cls.Comm_PeristalticPump.Command(m_pumpID, Convert.ToDouble(this.lblPumpSpeed.Text), m_bPumpRun, m_bPumpDirection);

                modact.portName  = _port_Pump.PortName;
                modact.cmdLength = modact.arrCommand.Length;
                if (m_bPumpRun)
                {
                    modact.actionInfo = m_strPumpText + "," + m_strPumpDirection + "," + lblPumpSpeed.Text + "mL/min,持续时间:" + lbltsPump.Text + ",预计流量:" + lblml.Text + "mL";
                }
                else
                {
                    modact.actionInfo = m_strPumpText + ",停止运行!";
                }
                ALS.BLL.actions bllact = new ALS.BLL.actions();

                if (bllact.Add(modact))
                {
                    ////如果泵ID为1
                    //if(m_pumpID==1)
                    //{
                    //    m_modc.timeCount = int.Parse(lblml.Text);
                    //    new BLL.customactions().Update(m_modc);
                    //}
                    DataSet dsact = bllact.GetList("customID='" + m_customID + "'", true);
                    this.dgActions.DataSource = dsact.Tables[0];
                    this.dgActions.Refresh();
                }
            }
            else
            {
                MessageBox.Show("请选择需要添加操作的步骤", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Beispiel #10
0
        private void btnAddActionOfV_Click(object sender, EventArgs e)
        {
            if (m_VID == 0)
            {
                MessageBox.Show("请选择夹管阀");
                return;
            }

            if (!(rbtnClampV.Checked) && !(rbtnLooseV.Checked))
            {
                MessageBox.Show("请选择夹管阀动作状态");
                return;
            }

            ALS.Model.actions modact = new ALS.Model.actions();
            ALS.BLL.actions   bllact = new ALS.BLL.actions();
            switch (m_VID)
            {
            case 1:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV1;
                    modact.actionInfo = "夹管阀1夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV1;
                    modact.actionInfo = "夹管阀1松管";
                }
                break;

            case 2:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV2;
                    modact.actionInfo = "夹管阀2夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV2;
                    modact.actionInfo = "夹管阀2松管";
                }
                break;

            case 3:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV3;
                    modact.actionInfo = "夹管阀3夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV3;
                    modact.actionInfo = "夹管阀3松管";
                }
                break;

            case 4:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV4;
                    modact.actionInfo = "夹管阀4夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV4;
                    modact.actionInfo = "夹管阀4松管";
                }
                break;

            case 5:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV5;
                    modact.actionInfo = "夹管阀5夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV5;
                    modact.actionInfo = "夹管阀5松管";
                }
                break;

            case 6:
                if (rbtnClampV.Checked)
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.ClampV6;
                    modact.actionInfo = "夹管阀6夹管";
                }
                else
                {
                    modact.arrCommand = Cls.Comm_Main.CmdValve.LoosenV6;
                    modact.actionInfo = "夹管阀6松管";
                }
                break;
            }
            modact.customID  = m_customID;
            modact.portName  = Port_Main.PortName;
            modact.cmdLength = modact.arrCommand.Length;
            if (bllact.Add(modact))
            {
                ShowActions(m_customID);
            }
        }
Beispiel #11
0
        private void btnAddActionOfPump_Click(object sender, EventArgs e)
        {
            if (m_pumpID == 0)
            {
                MessageBox.Show("请选择泵!");
                return;
            }

            if ((!rbtnClockwise.Checked) && (!rbtnAntiClockwise.Checked) && (!rbtnIsRun.Checked))
            {
                MessageBox.Show("请选择泵运转方向!");
                return;
            }

            //当选择所有泵时,必须选择rbtnIsRun
            if (rbtnAllPump.Checked)
            {
                if (rbtnIsRun.Checked == false)
                {
                    MessageBox.Show("请选择所有泵的运转状态,此处必须选择停止!");
                    return;
                }
            }

            if (lblPumpSpeed.Text == "0.0" && (!rbtnIsRun.Checked))
            {
                MessageBox.Show("请设定泵速!");
                return;
            }


            if (m_modc != null)
            {
                m_customID = (int)m_modc.ID;
                ALS.Model.actions modact = new ALS.Model.actions();
                modact.customID   = m_customID;
                m_bPumpDirection  = rbtnClockwise.Checked ? true : false;
                m_bPumpRun        = rbtnIsRun.Checked ? false : true;
                modact.arrCommand = Cls.Comm_PeristalticPump.Command(m_pumpID, Convert.ToDouble(this.lblPumpSpeed.Text), m_bPumpRun, m_bPumpDirection);

                modact.portName  = _port_Pump.PortName;
                modact.cmdLength = modact.arrCommand.Length;
                if (m_bPumpRun)
                {
                    modact.actionInfo = m_strPumpText + "," + m_strPumpDirection + "," + lblPumpSpeed.Text + "mL/min,持续时间:" + lbltsPump.Text + ",预计流量:" + lblml.Text + "mL";
                }
                else
                {
                    modact.actionInfo = m_strPumpText + ",停止运行!";
                }
                ALS.BLL.actions bllact = new ALS.BLL.actions();

                if (bllact.Add(modact))
                {
                    DataSet dsact = bllact.GetList("customID='" + m_customID + "'", true);
                    this.dgActions.DataSource = dsact.Tables[0];
                    this.dgActions.Refresh();
                }
            }
            else
            {
                MessageBox.Show("请选择需要添加操作的步骤", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }