| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using CoreFS.CA06;
- using Core.StlMes.Client.LgCommon;
- using Infragistics.Win.UltraWinEditors;
- namespace Core.StlMes.Client.LgIntegrationQuery
- {
- public partial class FrmShiftItems : Core.StlMes.Client.LgCommon.frmStyleBase
- {
- private bool ok_flag = false;
- private bool refreshflag = true;
- public FrmShiftItems(OpeBase oba)
- {
- InitializeComponent();
- this.ob = oba;
- }
- private void FrmShiftItems_Load(object sender, EventArgs e)
- {
- shiftConfigQuery();
- SetColumnModeClass(ugdShift);
- }
- // 查询班次配置的信息
- /// <summary>
- /// 查询班次配置的信息
- /// </summary>
- private void shiftConfigQuery()
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_CON0002", 5, arry, out strErr);
- if (strErr == "" && ds != null)
- {
- udsConfig.Rows.Clear();
- if (ds.Tables.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- udsConfig.Rows.Add(new object[] {
- dr["ID"].ToString(),
- dr["SHIFTNAME"].ToString(),
- dr["SHIFTTYPE"].ToString(),
- dr["SHIFTTYPENAME"].ToString(),
- dr["CYCLES"].ToString(),
- dr["OPTPERSONNEL"].ToString(),
- dr["OPTPERDATE"].ToString()
- }
- );
- }
- }
- PublicMethod.RefreshAndAutoSize(ugdConfig);
- }
- else
- MessageBox.Show("信息查询失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch { }
- }
- // 查询具体配置的信息
- /// <summary>
- /// 查询具体配置的信息
- /// </summary>
- private void DetailConfigQuery(String strID)
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add(strID);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_CON0003", 5, arry, out strErr);
- if (strErr == "" && ds != null)
- {
- udsShift.Rows.Clear();
- if (ds.Tables.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- udsShift.Rows.Add(new object[] {
- dr["CURDATE"].ToString(),
- dr["FUNC"].ToString(),
- dr["NO1"].ToString(),
- dr["NO2"].ToString(),
- dr["NO3"].ToString(),
- dr["NO4"].ToString()
- }
- );
- }
- }
- // PublicMethod.RefreshAndAutoSize(ugdShift);
- }
- else
- MessageBox.Show("信息查询失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch { }
- }
- // 查询配置方案的最大id
- /// <summary>
- /// 查询配置方案的最大id
- /// </summary>
- private string MaxIDQuery()
- {
- try
- {
- string strInfo = "";
- string strErr = "";
- ArrayList arry = new ArrayList();
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_CON0006", 5, arry, out strErr);
- if (strErr == "" && ds != null)
- {
- if (ds.Tables.Count > 0)
- {
- strInfo = ds.Tables[0].Rows[0]["MAXID"].ToString();
- }
- }
- else
- MessageBox.Show("信息查询失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return strInfo;
- }
- catch { return ""; }
- }
- // 执行排班操作
- /// <summary>
- /// 执行排班操作
- /// </summary>
- private void proc_Exe()
- {
- try
- {
- if (textName.Text.Length == 0)
- {
- MessageBox.Show("方案名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- textName.Focus();
- return;
- }
- if (cboShift1.SelectedIndex < 0 || cboShift2.SelectedIndex < 0)
- {
- MessageBox.Show("排班类型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cboShift1.Focus();
- return;
- }
- if (udtBeginTime.Value == null)
- {
- MessageBox.Show("开始时间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- udtBeginTime.Focus();
- return;
- }
- if (cboJia.SelectedIndex < 0)
- {
- MessageBox.Show("甲班不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cboJia.Focus();
- return;
- }
- if (cboYi.SelectedIndex < 0)
- {
- MessageBox.Show("乙班不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cboYi.Focus();
- return;
- }
- if (cboBing.SelectedIndex < 0)
- {
- MessageBox.Show("丙班不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cboBing.Focus();
- return;
- }
- if (cboDing.SelectedIndex < 0)
- {
- MessageBox.Show("丁班不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- cboDing.Focus();
- return;
- }
- int nJ = cboJia.SelectedIndex; //甲班
- int nY = cboYi.SelectedIndex; //乙班
- int nB = cboBing.SelectedIndex; //丙班
- int nD = cboDing.SelectedIndex; //丁班
- int nCount = 0;
- int nCount1 = 0;
- string strName = textName.Text.Trim();
- int tBZ = Convert.ToInt16(cboShift1.Value.ToString()); //总共班组
- int yBZ = Convert.ToInt16(cboShift2.Value.ToString()); //运转班组
- int cycles = Convert.ToInt16(numericUpDown1.Value); //循环次数
- DateTime dt = Convert.ToDateTime(udtBeginTime.Value);
- if (yBZ == 3)
- {
- if (nJ == 0)
- {
- nCount++;
- }
- else
- {
- nCount1++;
- }
- if (nY == 0)
- {
- nCount++;
- }
- else
- {
- nCount1++;
- }
- if (nB == 0)
- {
- nCount++;
- }
- else
- {
- nCount1++;
- }
- if (nD == 0)
- {
- nCount++;
- }
- else
- {
- nCount1++;
- }
- if (nCount > 1)
- {
- MessageBox.Show("你选择了三运转至少要选择三个班!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (nCount1 > 3)
- {
- MessageBox.Show("你选择了三运转最多只能选择三个班!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- cboShift1.Value.ToString();
- if (udsConfig.Rows.Count == 0)
- {
- udsConfig.Rows.Add(new object[] {
- "",
- strName,
- tBZ.ToString()+yBZ.ToString(),
- cboShift1.SelectedItem.DisplayText.ToString()+cboShift2.SelectedItem.DisplayText.ToString(),
- cycles.ToString(),
- "",
- ""});
- }
- for (int i = 0; i < cycles; i++)
- {
- udsShift.Rows.Add(new object[] {
- dt.ToString("yyyy-MM-dd"),
- "",
- cboJia.Value.ToString(),
- cboYi.Value.ToString(),
- cboBing.Value.ToString(),
- cboDing.Value.ToString()});
- dt = dt.AddDays(1);
- }
- udtBeginTime.Value = dt;
- cboJia.SelectedIndex = 0;
- cboYi.SelectedIndex = 0;
- cboBing.SelectedIndex = 0;
- cboDing.SelectedIndex = 0;
- }
- catch { }
- }
- // 新增配置方案
- /// <summary>
- /// 新增配置方案
- /// </summary>
- private void proc_Add()
- {
- try
- {
- if (ugdConfig.Rows.Count == 0)
- {
- MessageBox.Show("配置方案不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (ugdShift.Rows.Count == 0)
- {
- MessageBox.Show("具体方案不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- ArrayList listDate = new ArrayList();
- ArrayList listNo1 = new ArrayList();
- ArrayList listNo2 = new ArrayList();
- ArrayList listNo3 = new ArrayList();
- ArrayList listNo4 = new ArrayList();
- string strName = ugdConfig.Rows[0].Cells["SHIFTNAME"].Value.ToString();
- string vType = ugdConfig.Rows[0].Cells["SHIFTTYPE"].Value.ToString(); //运转班组
- string vTypeName = ugdConfig.Rows[0].Cells["SHIFTTYPENAME"].Value.ToString(); //运转班组名称
- string cycles = ugdConfig.Rows[0].Cells["CYCLES"].Value.ToString(); //循环次数
- for (int i = 0; i < ugdShift.Rows.Count; i++)
- {
- listDate.Add(ugdShift.Rows[i].Cells["CURDATE"].Value.ToString());
- listNo1.Add(ugdShift.Rows[i].Cells["NO1"].Value.ToString());
- listNo2.Add(ugdShift.Rows[i].Cells["NO2"].Value.ToString());
- listNo3.Add(ugdShift.Rows[i].Cells["NO3"].Value.ToString());
- listNo4.Add(ugdShift.Rows[i].Cells["NO4"].Value.ToString());
- }
- string strErr = "";
- string strSqlID = "STL_CON0004"; //SQLID
- object[] sArgs = new object[11];
- sArgs[0] = strName; //方案名称
- sArgs[1] = vType; //运转班组
- sArgs[2] = vTypeName; //运转班组名称
- sArgs[3] = cycles; //循环次数
- sArgs[4] = ugdShift.Rows.Count.ToString(); //配置总数
- sArgs[5] = listDate; //班次日期
- sArgs[6] = listNo1; //甲班
- sArgs[7] = listNo2; //乙班
- sArgs[8] = listNo3; //丙班
- sArgs[9] = listNo4; //丁班
- sArgs[10] = this.UserInfo.GetUserName(); //操作人
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- CoreClientParam ccp = ccTs.ExecuteProcedureFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "ExecProcWithCollParam", strSqlID, 5, sArgs, out strErr);
- if (strErr == "")
- {
- ok_flag = true;
- shiftConfigQuery();
- FrmShiftConfig frm = (FrmShiftConfig)this.Tag;
- frm.shiftConfigQuery();
- MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- MessageBox.Show("保存失败!" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- catch { }
- }
- private void proc_Edit()
- {
- try
- {
- }
- catch { }
- }
- // 删除配置方案
- /// <summary>
- /// 删除配置方案
- /// </summary>
- private void proc_Delete()
- {
- try
- {
- if (ugdConfig.Rows.Count == 0)
- {
- MessageBox.Show("没有可以删除的配置方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (ugdConfig.ActiveRow == null)
- {
- MessageBox.Show("请选择要删除的配置方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- DialogResult dr = MessageBox.Show("是否确认删除名称为【" + ugdConfig.ActiveRow.Cells["SHIFTNAME"].Value.ToString() + "】的配置信息?",
- "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
- if (dr == DialogResult.No) return;
- string strErr = "";
- string strSqlID = "STL_CON0005"; //SQLID
- object[] sArgs = new object[1];
- sArgs[0] = ugdConfig.ActiveRow.Cells["ID"].Value.ToString(); //方案ID
- CommonClientToServer ccTs = new CommonClientToServer();
- ccTs.ob = ob;
- CoreClientParam ccp = ccTs.ExecuteProcedureFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "ExecProcWithCollParam", strSqlID, 5, sArgs, out strErr);
- if (strErr == "")
- {
- shiftConfigQuery();
- FrmShiftConfig frm = (FrmShiftConfig)this.Tag;
- frm.shiftConfigQuery();
- MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- MessageBox.Show("删除失败!" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- catch { }
- }
- // 测试存储方案
- /// <summary>
- /// 测试存储方案
- /// </summary>
- private void pro_Test()
- {
- try
- {
- if (textTestName.Text.Length == 0)
- {
- MessageBox.Show("没有选择配置方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- DateTime dt = DateTime.Now;
- try
- {
- dt = Convert.ToDateTime(ute_TestTime.Text.ToString());
- }
- catch
- {
- MessageBox.Show("日期格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- string strShift = "";
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add(dt.ToString("yyyy-MM-dd HH:mm:ss")); //时间
- arry.Add(ugdConfig.ActiveRow.Cells["ID"].Value.ToString()); //方案ID
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = this.ob;
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_CON0010", 5, arry, out strErr);
- if (strErr == "" & ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- strShift = ds.Tables[0].Rows[0][0].ToString();
- }
- if (strShift.Length == 2)
- {
- string strBC = "";
- string strBZ = "";
- switch (strShift.Substring(0, 1))
- {
- case "1":
- strBC = "白班";
- break;
- case "2":
- strBC = "小夜";
- break;
- case "3":
- strBC = "大夜";
- break;
- }
- switch (strShift.Substring(1, 1))
- {
- case "1":
- strBZ = "甲班";
- break;
- case "2":
- strBZ = "乙班";
- break;
- case "3":
- strBZ = "丙班";
- break;
- case "4":
- strBZ = "丁班";
- break;
- }
- textTextValue.Text = strBC + "-" + strBZ;
- }
- else
- {
- textTextValue.Text = "测试失败";
- }
- //string
- }
- catch { }
- }
- // 设置班组
- /// <summary>
- /// 设置班组
- /// </summary>
- /// <param name="Grid"></param>
- private void SetColumnModeClass(Infragistics.Win.UltraWinGrid.UltraGridBase Grid)
- {
- DataTable dt = new DataTable();
- dt.TableName = "CLASS";
- DataColumn dc = new DataColumn("BCBM", Type.GetType("System.String"));
- dt.Columns.Add(dc);
- dc = new DataColumn("BCNA", Type.GetType("System.String"));
- dt.Columns.Add(dc);
- DataRow dr = dt.NewRow();
- dr["BCBM"] = "0";
- dr["BCNA"] = "无";
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["BCBM"] = "1";
- dr["BCNA"] = "白班";
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["BCBM"] = "2";
- dr["BCNA"] = "小夜";
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["BCBM"] = "3";
- dr["BCNA"] = "大夜";
- dt.Rows.Add(dr);
- ClsControlPack.SetGridDropDownListCell("NO1", 0, "甲班", 60, Grid, dt, "BCBM", "BCNA");
- ClsControlPack.SetGridDropDownListCell("NO2", 0, "乙班", 60, Grid, dt, "BCBM", "BCNA");
- ClsControlPack.SetGridDropDownListCell("NO3", 0, "丙班", 60, Grid, dt, "BCBM", "BCNA");
- ClsControlPack.SetGridDropDownListCell("NO4", 0, "丁班", 60, Grid, dt, "BCBM", "BCNA");
- }
- // 设置编辑区域是否可编辑
- /// <summary>
- /// 设置编辑区域是否可编辑
- /// </summary>
- /// <param name="t_Enable"></param>
- private void setToolEnable(bool t_Enable)
- {
- try
- {
- textName.ReadOnly = t_Enable;
- cboShift1.ReadOnly = t_Enable;
- cboShift2.ReadOnly = t_Enable;
- numericUpDown1.ReadOnly = t_Enable;
- udtBeginTime.ReadOnly = t_Enable;
- cboJia.ReadOnly = t_Enable;
- cboYi.ReadOnly = t_Enable;
- cboBing.ReadOnly = t_Enable;
- cboDing.ReadOnly = t_Enable;
- butExe.Enabled = !t_Enable;
- textTestName.ReadOnly = t_Enable;
- ute_TestTime.ReadOnly = t_Enable;
- butTest.Enabled = t_Enable;
- }
- catch { }
- }
- // 清空编辑区域
- /// <summary>
- /// 清空编辑区域
- /// </summary>
- private void clearWidget()
- {
- textName.Text = "配置"+MaxIDQuery();
- cboShift1.SelectedIndex = 0;
- cboShift2.SelectedIndex = 0;
- numericUpDown1.Value = 1;
- udtBeginTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
- cboJia.SelectedIndex = 0;
- cboYi.SelectedIndex = 0;
- cboBing.SelectedIndex = 0;
- cboDing.SelectedIndex = 0;
- }
- // 点击修改或删除时显示确认和取消按钮
- /// <summary>
- /// 点击修改或删除时显示确认和取消按钮
- /// </summary>
- /// <param name="bEnable"></param>
- private void SetDetailToolBarEnable(bool bEnable, string flag)
- {
- int count = this.uTbMTool.Tools.Count;
- for (int i = 0; i < count; i++)
- {
- this.uTbMTool.Tools[i].SharedProps.Enabled = !bEnable;
- }
- this.uTbMTool.Tools["ok"].SharedProps.Enabled = bEnable;
- this.uTbMTool.Tools["cancel"].SharedProps.Enabled = bEnable;
- this.uTbMTool.Tools["ok"].SharedProps.Visible = bEnable;
- this.uTbMTool.Tools["cancel"].SharedProps.Visible = bEnable;
- refreshflag = !bEnable;
- }
- private void ultraToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Query":
- shiftConfigQuery();
- break;
- case "add":
- SetDetailToolBarEnable(true, "add");
- setToolEnable(false);
- this.uTbMTool.Tools["ok"].Tag = "add";
- clearWidget();
- ok_flag = false;
- udsConfig.Rows.Clear();
- udsShift.Rows.Clear();
- break;
- case "edit":
- if (ugdConfig.Rows.Count == 0)
- {
- MessageBox.Show("没有可修改的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (ugdConfig.ActiveRow == null)
- {
- MessageBox.Show("请选择要修改的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- SetDetailToolBarEnable(true, "edit");
- setToolEnable(false);
- this.uTbMTool.Tools["ok"].Tag = "edit";
- ok_flag = false;
- break;
- case "del":
- proc_Delete();
- break;
- case "ok":
- string flag = this.uTbMTool.Tools["ok"].Tag.ToString();
- if (flag == "edit")
- {
- proc_Edit();
- }
- if (flag == "add")
- {
- proc_Add();
- }
- if (ok_flag)
- {
- SetDetailToolBarEnable(false, "");
- setToolEnable(true);
- }
- break;
- case "cancel":
- SetDetailToolBarEnable(false, "");
- setToolEnable(true);
- ugdConfig_AfterRowActivate(null, null);
- shiftConfigQuery();
- break;
- case "left":
- if (ugdConfig.Rows.Count == 0) return;
- //将位置移动到前一条记录
- try
- {
- if (ugdConfig.ActiveRow == null)
- {
- ugdConfig.Rows[0].Activate();
- }
- else
- {
- int nIndex = ugdConfig.ActiveRow.Index;
- nIndex = nIndex - 1;
- if (nIndex < 0) nIndex = ugdConfig.Rows.Count - 1;
- ugdConfig.Rows[nIndex].Activate();
- }
- }
- catch { }
- break;
- case "right":
- if (ugdConfig.Rows.Count == 0) return;
- //将位置移动到后一条记录
- try
- {
- if (ugdConfig.ActiveRow == null)
- {
- ugdConfig.Rows[0].Activate();
- }
- else
- {
- int nIndex = ugdConfig.ActiveRow.Index;
- nIndex = nIndex + 1;
- if (nIndex >= ugdConfig.Rows.Count) nIndex = 0;
- ugdConfig.Rows[nIndex].Activate();
- }
- }
- catch { }
- break;
- }
- }
- private void butExe_Click(object sender, EventArgs e)
- {
- proc_Exe();
- }
- private void ugdConfig_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- UltraGridRow row = ugdConfig.ActiveRow;
- try
- {
- textName.Text = row.Cells["SHIFTNAME"].Value.ToString();
- textTestName.Text = row.Cells["SHIFTNAME"].Value.ToString();
- cboShift1.Text = row.Cells["SHIFTTYPE"].Value.ToString().Substring(0, 1);
- cboShift2.Text = row.Cells["SHIFTTYPE"].Value.ToString().Substring(1, 1);
- }
- catch { }
- string ID = row.Cells["ID"].Value.ToString();
- if (refreshflag)
- {
- DetailConfigQuery(ID);
- }
- }
- catch { }
- }
- private void cboBZ_ValueChanged(object sender, EventArgs e)
- {
- try
- {
- UltraComboEditor ucbo = (UltraComboEditor)sender;
- string strName = ucbo.Name;
- int nCbo = ucbo.SelectedIndex;
- int nJ = cboJia.SelectedIndex; //甲班
- int nY = cboYi.SelectedIndex; //乙班
- int nB = cboBing.SelectedIndex; //丙班
- int nD = cboDing.SelectedIndex; //丁班
- if(nCbo!=0)
- {
- if (strName == "cboJia")
- {
- if (nCbo == nY || nCbo == nB || nCbo == nD)
- {
- cboJia.SelectedIndex = 0;
- cboJia.Focus();
- MessageBox.Show("班次重复请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- if (strName == "cboYi")
- {
- if (nCbo == nJ || nCbo == nB || nCbo == nD)
- {
- cboYi.SelectedIndex = 0;
- cboYi.Focus();
- MessageBox.Show("班次重复请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- if (strName == "cboBing")
- {
- if (nCbo == nJ || nCbo == nY || nCbo == nD)
- {
- cboBing.SelectedIndex = 0;
- cboBing.Focus();
- MessageBox.Show("班次重复请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- if (strName == "cboDing")
- {
- if (nCbo == nY || nCbo == nB || nCbo == nJ)
- {
- cboDing.SelectedIndex = 0;
- cboDing.Focus();
- MessageBox.Show("班次重复请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- }
- }
- }
- catch { }
- }
- private void butTest_Click(object sender, EventArgs e)
- {
- pro_Test();
- }
- private void ute_TestTime_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- try
- {
- frmSetTime frm = new frmSetTime(e.Context);
- //frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
- frm.Location = new Point(300, 200);//ClsControlPack.GetChildWindowLocation(frm.Size);
- frm.AutoSize = true;
- if (frm.ShowDialog() == DialogResult.OK)
- {
- ute_TestTime.Text = (Convert.ToDateTime(frm.SelectDate.ToString())).ToString("yyyy-MM-dd HH:mm:ss");
- ute_TestTime.Update();
- }
- }
- catch { }
- }
- }
- }
|