Пример #1
0
        //高炉铁水
        private void menuSouresHF_Click(object sender, EventArgs e)
        {
            try
            {
                AppSvrHMI.L3DataSet dsSend = (AppSvrHMI.L3DataSet)dsBFIron.Clone();
                string    strMaterialID    = dvM.Rows[bsBFIron.Position].Cells[MaterialID.Index].Value.ToString();
                DataRow[] drArray          = dsBFIron.Tables[0].Select("MaterialID = '" + strMaterialID + "'");
                foreach (DataRow dr in drArray)
                {
                    dr["Source"] = 0;
                    dsSend.Tables[0].ImportRow(dr);
                }
                dsSend.AcceptChanges();
                if (dsSend == null || dsSend.Tables[0].Rows.Count < 1)
                {
                    return;
                }

                cmdModifySource.Parameters[0].SourceObject = dsSend;
                if (cmdModifySource.Execute() >= 0)
                {
                    //string strErrorCode = cmdModifySource.Command.ErrorCode.ToString();
                    //string.Format("{0:X}", cmdFeedIrons.Command.ErrorCode));
                    int iRet = Convert.ToInt32(cmdModifySource.Command.Return);
                    if (iRet > 0)
                    {
                        MessageBox.Show("指定成功!", "提示");
                    }
                    else
                    {
                        MessageBox.Show("指定失败!", "提示");
                    }
                }
                else
                {
                    MessageBox.Show("指定失败!", "提示");
                }
                //dsBFIron.LoadData();
            }
            catch { }
        }
Пример #2
0
        private AppSvrHMI.L3DataSet SetDSOnPositon(string strbtnName)
        {
            AppSvrHMI.L3DataSet dsSend = new AppSvrHMI.L3DataSet();
            dsSend = (AppSvrHMI.L3DataSet)dsBase.Clone();
            dvBase.EndEdit();
            bsBase.EndEdit();

            int iPosition1 = 0; //上部槽
            int iPosition2 = 0; //下部槽
            int iPosition3 = 0; //热弯管

            DataRow[] drTemp = dsBase.Tables[0].Select("CheckFlag = 1");
            foreach (DataRow dr in drTemp)
            {
                dsSend.Tables[0].ImportRow(dr);
            }

            switch (strbtnName)
            {
            case "btnOnBuildPosition":
                foreach (DataRow dr in dsSend.Tables[0].Rows)
                {
                    dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_BUILD;
                }
                break;

            case "btnOnFirePositionA":    //A烘烤位
                iPosition1 = dsBase.Tables[0].Select("VacTube_Name = '1' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_A + "'").Length;
                iPosition2 = dsBase.Tables[0].Select("VacTube_Name = '2' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_A + "'").Length;
                iPosition3 = dsBase.Tables[0].Select("VacTube_Name = '3' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_A + "'").Length;
                foreach (DataRow dr in dsSend.Tables[0].Rows)
                {
                    string strType = dr["VacTube_Name"].ToString();

                    if (strType == "1")
                    {
                        if (iPosition1 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前烘烤位上不能有多个上部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_A;
                        iPosition1    += 1;
                    }
                    else if (strType == "2")
                    {
                        if (iPosition2 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前烘烤位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_A;
                        iPosition2    += 1;
                    }
                    else if (strType == "3")
                    {
                        return(null);
                    }
                }
                break;

            case "btnOnFirePositionB":    //B烘烤位
                iPosition1 = dsBase.Tables[0].Select("VacTube_Name = '1' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_B + "'").Length;
                iPosition2 = dsBase.Tables[0].Select("VacTube_Name = '2' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_B + "'").Length;
                iPosition3 = dsBase.Tables[0].Select("VacTube_Name = '3' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_B + "'").Length;

                foreach (DataRow dr in dsSend.Tables[0].Rows)
                {
                    string strType = dr["VacTube_Name"].ToString();

                    if (strType == "1")
                    {
                        if (iPosition1 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前烘烤位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_B;
                        iPosition1    += 1;
                    }
                    else if (strType == "2")
                    {
                        if (iPosition2 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前烘烤位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_FIRE_B;
                        iPosition2    += 1;
                    }
                    else if (strType == "3")
                    {
                        return(null);
                    }
                }
                break;

            case "btnOnWorkPositionA":    //A工位
                iPosition1 = dsBase.Tables[0].Select("VacTube_Name = '1' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A + "'").Length;
                iPosition2 = dsBase.Tables[0].Select("VacTube_Name = '2' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A + "'").Length;
                iPosition3 = dsBase.Tables[0].Select("VacTube_Name = '3' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A + "'").Length;

                foreach (DataRow dr in dsSend.Tables[0].Rows)
                {
                    string strType = dr["VacTube_Name"].ToString();

                    if (strType == "1")
                    {
                        if (iPosition1 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A;
                        iPosition1    += 1;
                    }
                    else if (strType == "2")
                    {
                        if (iPosition2 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A;
                        iPosition2    += 1;
                    }
                    else if (strType == "3")
                    {
                        if (iPosition3 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个热弯管!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_A;
                        iPosition3    += 1;
                    }
                }
                break;

            case "btnOnWorkPositionB":    //B工位
                iPosition1 = dsBase.Tables[0].Select("VacTube_Name = '1' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B + "'").Length;
                iPosition2 = dsBase.Tables[0].Select("VacTube_Name = '2' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B + "'").Length;
                iPosition3 = dsBase.Tables[0].Select("VacTube_Name = '3' and Position = '" + CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B + "'").Length;

                foreach (DataRow dr in dsSend.Tables[0].Rows)
                {
                    string strType = dr["VacTube_Name"].ToString();

                    if (strType == "1")
                    {
                        if (iPosition1 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B;
                        iPosition1    += 1;
                    }
                    else if (strType == "2")
                    {
                        if (iPosition2 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个下部槽!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B;
                        iPosition2    += 1;
                    }
                    else if (strType == "3")
                    {
                        if (iPosition3 > 0)
                        {
                            MessageBox.Show("上位操作不允许,当前工位上不能有多个热弯管!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(null);
                        }
                        dr["Position"] = CommDataMag.CommonData.CVACTUBE_POSITION_WORK_B;
                        iPosition3    += 1;
                    }
                }
                break;

            default:
                break;
            }
            dsSend.AcceptChanges();
            return(dsSend);
        }