/// <summary>
        /// query data from database and bind to gridview
        /// </summary>
        private void BindGridview()
        {
            //读取未开始的试验任务
            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTestInfo   = bllTest_Info.GetListNoStart();

            //将读取试验任务的任务编号、试验状态显示在lstTaskList列表中
            lstTasklist.Items.Clear();
            string temptaskNo = "";

            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();

                    //判断temptaskNo任务编号的数据在试验任务数据文件中是否存在,如果存在,表示该任务已提交
                    //否则该任务为已保存未提交状态
                    ProxyBllTESINFODB bllTestDB = new ProxyBllTESINFODB();
                    DataSet           dsTaskId  = bllTestDB.GetList(" F_TEST_TASK_ID='" + temptaskNo + "' ");
                    if (dsTaskId != null && dsTaskId.Tables[0].Rows.Count >= 0)
                    {
                        lstTasklist.Items.Add(temptaskNo + "-已提交");
                    }
                }
            }
        }
Beispiel #2
0
        private void btnSaveDis_Click(object sender, EventArgs e)
        {
            //保存中间列表数据到不显示列表数据
            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTestInfo;

            //保存临时列表数据到不显示列表中
            for (int i = 0; i < lstTempDisList.Items.Count; i++)
            {
                bllTest_Info.delete_noDisplay(" f_test_task_id='" + lstTempDisList.Items[i].ToString() + "'");
            }

            //清空中间显示列表
            lstTempDisList.Items.Clear();

            //将读取t_test_info_nodisplay表,将任务编号显示在lstTaskNoDisList列表中
            lstTaskNoDisList.Items.Clear();
            dsTestInfo = bllTest_Info.GetListNoDisplay("");
            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    string temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
                    lstTaskNoDisList.Items.Add(temptaskNo);
                }
            }

            MessageBox.Show("保存操作完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void btnDisAddTemp_Click(object sender, EventArgs e)
        {
            //保存中间列表数据到不显示列表数据
            ProxyBllTEST_INFO       bllTest_Info       = new ProxyBllTEST_INFO();
            ProxyBllTEST_ALLOCATION bllTest_Allocation = new ProxyBllTEST_ALLOCATION();

            DataSet dsTestInfo;

            string now_taskid = "";

            if (lstTasklist.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择需要继续进行爬高试验的试验编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                try
                {
                    //修改选中任务编号的试验状态
                    now_taskid = lstTasklist.SelectedItems[0].ToString();
                    bllTest_Info.update_status(now_taskid);
                    bllTest_Allocation.update_status(now_taskid);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("任务编号:" + now_taskid + "的试验基础信息修改保存错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show("爬高试验状态修改完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                BindGridview();
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            //根据界面内容生成查询条件
            string query_con = "";

            query_con = getQueryCon();

            ProxyBllTEST_INFO blltest_Info   = new ProxyBllTEST_INFO();
            DataSet           _dsCommandInfo = new DataSet();

            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //绑定数据
                _dsCommandInfo = blltest_Info.GetDevStatusInfoByQueryCondition(query_con);

                //有数据情况下绑定
                if (_dsCommandInfo != null && _dsCommandInfo.Tables.Count > 0)
                {
                    gcList.DataSource = _dsCommandInfo.Tables[0];
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
Beispiel #5
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            if (!detBegintime1.Text.Trim().Equals("") && !detBegintime2.Text.Trim().Equals(""))
            {
                if (detBegintime1.Text.CompareTo(detBegintime2.Text) > 0)
                {
                    MessageBox.Show("查询条件中开始时间结束日期不能大于起始日期!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            if (!txtFZDY1.Text.Trim().Equals("") && !txtFZDY2.Text.Trim().Equals(""))
            {
                if (Convert.ToInt16(txtFZDY1.Text.Trim()) > Convert.ToInt16(txtFZDY2.Text.Trim()))
                {
                    MessageBox.Show("查询条件负载电压范围中后值不能大于前值!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            if (!txtFZDL1.Text.Trim().Equals("") && !txtFZDL2.Text.Trim().Equals(""))
            {
                if (Convert.ToInt16(txtFZDL1.Text.Trim()) > Convert.ToInt16(txtFZDL2.Text.Trim()))
                {
                    MessageBox.Show("查询条件负载电流范围中后值不能大于前值!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            //根据界面内容生成查询条件
            string query_con = "";

            query_con = getQueryCon();

            ProxyBllTEST_INFO blltest_Info   = new ProxyBllTEST_INFO();
            DataSet           _dsCommandInfo = new DataSet();

            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //绑定数据
                _dsCommandInfo = blltest_Info.GetTestTaskInfoByQueryCondition(query_con);

                //有数据情况下绑定
                if (_dsCommandInfo != null && _dsCommandInfo.Tables.Count > 0)
                {
                    gcList.DataSource = _dsCommandInfo.Tables[0];
                }

                if (gvList.RowCount > 0)
                {
                    btnExport.Enabled = true;
                }
                else
                {
                    btnExport.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
        private void BindGridview()
        {
            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTestInfo   = bllTest_Info.GetListComplete();

            //将读取试验任务的任务编号显示在lstTaskList列表中
            lstTasklist.Items.Clear();
            string temptaskNo = "";

            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
                    lstTasklist.Items.Add(temptaskNo);
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 根据任务编号编码规则创建一个新的任务编号
        /// 返回值:新生成的任务编号
        /// </summary>
        private String createNewTaskId()
        {
            //新任务规则为"YYMMDD"+3位委托单序号("本程序中固定为'001'")+2位任务序号
            String taskId = "";

            taskId = string.Format("{0:yyyy}", DateTime.Now);
            taskId = taskId.Substring(2, 2);
            taskId = taskId + string.Format("{0:MMdd}", DateTime.Now);
            taskId = taskId + "001";
            //从数据库中读取试验任务的最大顺序号,已生成试验任务编号
            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTaskId     = bllTest_Info.GetMaxTaskID(taskId);

            String temptaskNo = "";

            if (dsTaskId != null)
            {
                if (dsTaskId.Tables[0].Rows.Count > 0)
                {
                    temptaskNo = dsTaskId.Tables[0].Rows[0][0].ToString();
                    if (temptaskNo == "")
                    {
                        temptaskNo = "01";
                    }
                    else
                    {
                        if (Convert.ToInt16(temptaskNo) >= 9 && Convert.ToInt16(temptaskNo) < 99)
                        {
                            temptaskNo = (Convert.ToInt16(temptaskNo) + 1).ToString();
                        }
                        else
                        {
                            temptaskNo = "0" + (Convert.ToInt16(temptaskNo) + 1).ToString();
                        }
                    }
                }
            }
            else
            {
                temptaskNo = "01";
            }
            taskId = taskId + temptaskNo;
            return(taskId);
        }
Beispiel #8
0
        private void baseSimpleButton1_Click_1(object sender, EventArgs e)
        {
            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTestInfo   = bllTest_Info.GetListNoStart_new();

            //将读取试验任务的任务编号显示在lstTaskList列表中
            lstTasklist.Items.Clear();
            string temptaskNo = "";
            string submit     = "";
            string allocation = "";

            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
                    submit     = dsTestInfo.Tables[0].Rows[i]["submit"].ToString();
                    allocation = dsTestInfo.Tables[0].Rows[i]["allocation"].ToString();
                    lstTasklist.Items.Add(temptaskNo);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// query data from database and bind to gridview
        /// </summary>
        private void BindGridview()
        {
            /*20170608MODIFY  试验任务列表信息通过视图显示,提高列表显示速度
             * //读取未开始的试验任务
             * ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
             * DataSet dsTestInfo = bllTest_Info.GetListNoStart();
             * //将读取试验任务的任务编号、试验状态显示在lstTaskList列表中
             * lstTasklist.Items.Clear();
             * string temptaskNo = "";
             * if (dsTestInfo != null)
             * {
             *  for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
             *  {
             *      temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
             *
             *      //判断temptaskNo任务编号的数据在试验任务数据文件中是否存在,如果存在,表示该任务已提交
             *      //否则该任务为已保存未提交状态
             *      ProxyBllTESINFODB bllTestDB = new ProxyBllTESINFODB();
             *      DataSet dsTaskId = bllTestDB.GetList(" F_TEST_TASK_ID='" + temptaskNo + "' ");
             *      if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
             *      {
             *          //lstTasklist.Items.Add(temptaskNo + "_未提交");
             *          ProxyBllTEST_ALLOCATION bllTestAllocation = new ProxyBllTEST_ALLOCATION();
             *          dsTaskId = bllTestAllocation.GetList(" F_TEST_TASK_ID='" + temptaskNo + "' and F_SAMPLE_STATUS<>11 ");
             *          {
             *              if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
             *              {
             *                  lstTasklist.Items.Add(temptaskNo + "_未提交_未分配");
             *              }
             *              else
             *              {
             *                  lstTasklist.Items.Add(temptaskNo + "_未提交_已分配");
             *              }
             *          }
             *      }
             *      else
             *      {
             *          ProxyBllTEST_ALLOCATION bllTestAllocation = new ProxyBllTEST_ALLOCATION();
             *          dsTaskId = bllTestAllocation.GetList(" F_TEST_TASK_ID='" + temptaskNo + "' and F_SAMPLE_STATUS<>11 ");
             *          {
             *              if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
             *              {
             *                  lstTasklist.Items.Add(temptaskNo + "_已提交_未分配");
             *              }
             *              else
             *              {
             *                  lstTasklist.Items.Add(temptaskNo + "_已提交_已分配");
             *              }
             *          }
             *      }
             *  }
             * }*/
            //20170608MODIFY  试验任务列表信息通过视图显示,提高列表显示速度  end


            ProxyBllTEST_INFO bllTest_Info = new ProxyBllTEST_INFO();
            DataSet           dsTestInfo   = bllTest_Info.GetListNoStart_new();

            //将读取试验任务的任务编号显示在lstTaskList列表中
            lstTasklist.Items.Clear();
            string temptaskNo = "";
            string submit     = "";
            string allocation = "";

            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
                    submit     = dsTestInfo.Tables[0].Rows[i]["submit"].ToString();
                    allocation = dsTestInfo.Tables[0].Rows[i]["allocation"].ToString();
                    lstTasklist.Items.Add(temptaskNo);
                }
            }

            //清空中间显示列表
            lstTempDisList.Items.Clear();

            //将读取t_test_info_nodisplay表,将任务编号显示在lstTaskNoDisList列表中
            lstTaskNoDisList.Items.Clear();
            dsTestInfo = bllTest_Info.GetListNoDisplay("");
            if (dsTestInfo != null)
            {
                for (int i = 0; i < dsTestInfo.Tables[0].Rows.Count; i++)
                {
                    temptaskNo = dsTestInfo.Tables[0].Rows[i]["F_TEST_TASK_ID"].ToString();
                    lstTaskNoDisList.Items.Add(temptaskNo);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 提交任务按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //只有在试验任务基础信息、试验样品信息、试验参数信息三部分的数据均保存到相应的数据表后,方可执行提交操作
            //提交操作根据3个数据表的内容生成上位机运行所需的数据文件
            //试验任务基础信息保存到T_TEST_INFO
            //试验样品信息保存到T_TEST_SAMPLE_INFO
            //试验参数信息保存到T_TEST_PAR_VALUE_KHD

            //首先判断试验任务编号数据项是否为空,如果为空,不可执行提交操作
            if (txtTaskId.Text.Trim().Equals(""))
            {
                MessageBox.Show("请选择需要执行提交操作的任务编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string now_taskid = txtTaskId.Text;
            //判断now_taskid任务编号的数据是否保存完整;
            //T_TEST_INFO、T_TEST_SAMPLE_INFO、T_TEST_PAR_VALUE_KHD中均存在该任务编号的数据

            ProxyBllTEST_INFO bllTestInfo = new ProxyBllTEST_INFO();
            DataSet           dsTaskId    = bllTestInfo.GetList(" F_TEST_TASK_ID='" + now_taskid + "' ");

            if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("任务编号:" + now_taskid + "的试验任务基础信息不存在,请先录入并保存改任务编号的试验任务基础信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ProxyBllTEST_SAMPLE_INFO bllTestSampleInfo = new ProxyBllTEST_SAMPLE_INFO();

            dsTaskId = bllTestSampleInfo.GetList(" F_TEST_TASK_ID='" + now_taskid + "' ");
            if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("任务编号:" + now_taskid + "的试验样品信息不存在,请先录入并保存改任务编号的试验样品信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ProxyBllTEST_PAR_VALUE_KHD bllTestParValue = new ProxyBllTEST_PAR_VALUE_KHD();

            dsTaskId = bllTestParValue.GetList(" F_TASK_ID='" + now_taskid + "' ");
            if (dsTaskId == null || dsTaskId.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("任务编号:" + now_taskid + "的试验参数信息不存在,请先录入并保存改任务编号的试验参数信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //执行提交任务操作,生成试验任务相关数据的access文件
            //判断access模板文件夹是否存在
            if (Directory.Exists("DataFile") == false)//如果不存在就创建file文件夹
            {
                MessageBox.Show("Access模板文件夹不存在,请检查模板文件夹DataFile是否存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                //判断模板文件是否存在Template.mdb
                if (File.Exists("DataFile/Template.mdb") == false)
                {
                    MessageBox.Show("Access模板文件不存在,请检查模板文件Template.mdb是否存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //判断当前任务编号的access数据文件是否存在;如果存在,删除原有任务文件,按当前oracle数据库数据,生成新的access数据文件
                if (File.Exists("DataFile/" + now_taskid + ".mdb") == true)
                {
                    File.Delete("DataFile/" + now_taskid + ".mdb");
                    File.Delete("DataFile/" + now_taskid + ".ldb");
                }

                FrmSubmitPrompt frm = new FrmSubmitPrompt();
                frm.Show();
                frm.Refresh();

                File.Copy("DataFile/Template.mdb", "DataFile/" + now_taskid + ".mdb");

                string         mdbpath        = "DataFile/" + now_taskid + ".mdb";
                ProxyBllCommon proxyBllCommon = new ProxyBllCommon();
                //导出试验任务基本信息到access文件中
                proxyBllCommon.FillAccessTableFromOracle("T_TEST_INFO", " F_TEST_TASK_ID='" + now_taskid + "' ", mdbpath);
                //导出试验任务样品信息到access文件中
                proxyBllCommon.FillAccessTableFromOracle("T_TEST_SAMPLE_INFO", " F_TEST_TASK_ID='" + now_taskid + "' ", mdbpath);
                //导出试验任务参数信息到access文件中
                proxyBllCommon.FillAccessTableFromOracle("T_TEST_PAR_VALUE_KHD", " F_TASK_ID='" + now_taskid + "' ", mdbpath);

                //将生成的access文件写入oracle数据库中
                if (saveMDBToOacle(mdbpath, now_taskid))
                {
                    frm.Close();
                    MessageBox.Show("试验任务信息提交完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    initData();
                    BindGridview();
                    string tempstr = "";;
                    for (int i = 0; i < lstTasklist.ItemCount; i++)
                    {
                        tempstr = lstTasklist.Items[i].ToString();
                        if (tempstr.Substring(0, tempstr.IndexOf("_")).Equals(now_taskid))
                        {
                            lstTasklist.SelectedIndex = i;
                            break;;
                        }
                    }
                    return;
                }
                else
                {
                    MessageBox.Show("将试验信息Access文件写入Oracle时错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 删除任务按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string now_taskId = "";

            now_taskId = txtTaskId.Text;

            if (now_taskId.Trim().Equals(""))
            {
                MessageBox.Show("要删除的任务编号为空,不能执行试验任务删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!selecttaskinfo.Equals("") && selecttaskinfo.IndexOf("已分配") > 0)
            {
                MessageBox.Show("要删除的任务编号中存在已分配样品,先到上位机系统清除该任务分配信息后,方可执行本试验任务的删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DialogResult dialogResult = XtraMessageBox.Show("确定要删除试验任务编号为:" + now_taskId + "的试验任务吗?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.No)
            {
                return;
            }
            else
            {
                ProxyBllTEST_INFO blltest_info = new ProxyBllTEST_INFO();
                //判断试验任务状态,只有F_TEST_STATUS=10的试验任务编号
                DataSet dsTestInfo = blltest_info.GetListByTaskId(now_taskId);
                if (dsTestInfo != null)
                {
                    string strTestStatus = dsTestInfo.Tables[0].Rows[0]["F_TEST_STATUS"].ToString().Trim();
                    //试验任务处于未开始状态
                    if (strTestStatus.Equals("10"))
                    {
                        //获取试验任务的已分配样品数量,已分配样品数量为0的试验任务,方可执行删除操作

                        //删除试验任务基本信息
                        blltest_info.Drop(now_taskId);
                        //删除试验试验任务样品信息
                        ProxyBllTEST_SAMPLE_INFO blltestSampleInfo = new ProxyBllTEST_SAMPLE_INFO();
                        blltestSampleInfo.DropByTaskId(now_taskId);
                        //删除试验任务参数信息
                        ProxyBllTEST_PAR_VALUE_KHD blltestCommParInfo = new ProxyBllTEST_PAR_VALUE_KHD();
                        blltestCommParInfo.DropByTaskId(now_taskId);
                        //删除试验任务
                        ProxyBllTESINFODB blltestDB = new ProxyBllTESINFODB();
                        blltestDB.Drop(now_taskId);
                        //删除样品分配表数据
                        ProxyBllTEST_ALLOCATION bllTestAllocation = new ProxyBllTEST_ALLOCATION();
                        bllTestAllocation.DropWhere(" F_TEST_TASK_ID='" + now_taskId + "' ");
                        //读取未开始试验的试验任务
                        BindGridview();
                    }
                    else
                    {
                        if (strTestStatus.Substring(0, 1).Equals("2"))
                        {
                            MessageBox.Show("该试验任务目前处于运行状态,不能执行删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        else if (strTestStatus.Substring(0, 1).Equals("6"))
                        {
                            MessageBox.Show("该试验任务目前处于结束状态,不能执行删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                }
            }
        }