| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmControlPointBasics : FrmBase
- {
- //查询条件
- private string _stationType = "";
- public string StationType
- {
- get { return _stationType; }
- set { _stationType = value; }
- }
- public FrmControlPointBasics()
- {
- InitializeComponent();
- ExceptionHelper.RegistException();
- this.IsLoadUserView = true; //平台F1功能
- }
- public void PopupLoad(OpeBase ob)
- {
- this.ob = ob;
- this.OnLoad(EventArgs.Empty);
- }
- private void FrmControlPointBasics_Load(object sender, EventArgs e)
- {
- Init();
- }
- private void Init()
- {
- //绑定工序点类型数据源
- BindCmbPointType();
- //绑定工序数据源
- BindCmbProcess();
- //绑定监视级别数据源
- BindCmbMonitorLv();
- cmbPointType.SelectedIndex = 0;
- cmbProcess.SelectedIndex = 0;
- cmbMonitorLv.SelectedIndex = 0;
- }
- /// <summary>
- /// 绑定监视级别数据源
- /// </summary>
- private void BindCmbMonitorLv()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetMonitorLv", null, this.ob);
- cmbMonitorLv.DataSource = dt;
- cmbMonitorLv.DisplayMember = "BASENAME";
- cmbMonitorLv.ValueMember = "BASECODE";
- }
- /// <summary>
- /// 获取工序数据源
- /// </summary>
- private void BindCmbProcess()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetProcess", null, this.ob);
- cmbProcess.DataSource = dt;
- cmbProcess.DisplayMember = "PROCESS_DESC";
- cmbProcess.ValueMember = "PROCESS_CODE";
- }
- /// <summary>
- /// 绑定工序点类型数据源
- /// </summary>
- private void BindCmbPointType()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetPointType", null, this.ob);
- cmbPointType.DataSource = dt;
- cmbPointType.DisplayMember = "BASENAME";
- cmbPointType.ValueMember = "BASECODE";
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doAdd":
- doAdd();
- break;
- case "doModify":
- doModify();
- break;
- case "doGrouping":
- doGrouping();
- break;
- case "doDelete":
- this.doDeleteOrResume(true);
- break;
- case "doResume":
- this.doDeleteOrResume(false);
- break;
- case "Refresh":
- Init();
- break;
- case "Cancel":
- CancelGroup();
- break;
- case "Export":
- Export();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(ultraGrid2, "工序点管理");
- }
- /// <summary>
- /// 取消分组
- /// </summary>
- private void CancelGroup()
- {
- ultraGrid2.UpdateData();
- int isselect = 0;
- string _code = ""; //用于定位
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid2.Rows)
- {
- if (ugr.Cells["CHK"].Value.ToString() == "True")
- {
- if (!ugr.Cells["VALIDFLAG"].Value.Equals("1"))
- {
- MessageUtil.ShowWarning("无效数据,不能进行此操作!");
- return;
- }
- if (ugr.Cells["MONITOR_LV2"].Value.ToString() == "")
- {
- MessageUtil.ShowWarning("未分组数据,不能取消分组!");
- return;
- }
- string code = ugr.Cells["STATION_CODE"].Value.ToString();
- isselect += 1;
- list.Add(code);
- _code = code;
- }
- }
- if (isselect == 0)
- {
- MessageUtil.ShowWarning("请选择你要取消分组的记录 !");
- return;
- }
- if (MessageBox.Show("是否确认对选择记录取消分组?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreControlPointBasics.cancelGroup", new object[] { list }, this.ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("取消分组成功!");
- doQuery();
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- row = ultraGrid2.Rows[i];
- if (row.Cells["STATION_CODE"].Value.ToString().Equals(_code))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- /// <summary>
- /// 分组功能实现
- /// </summary>
- private void doGrouping()
- {
- //从数据库中获取最大分组索引号+1
- int GroupId = GetMaxGrouping();
- //将勾选项索引号改成最大索引号。
- UpdateGrouping(GroupId);
- }
- /// <summary>
- /// 将勾选项索引号改成最大索引号。
- /// </summary>
- private void UpdateGrouping(int GroupId)
- {
- //更新数据源。
- ultraGrid2.UpdateData();
- //判断是否有勾选项,没有则提示。
- int chkbool = 0;
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow dr = ultraGrid2.Rows[i];
- if ((Boolean)dr.Cells["CHK"].Value)
- {
- chkbool += 1;
- }
- }
- if (chkbool <= 0)
- {
- MessageBox.Show("请先勾选您要分组的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否确认分组?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- ArrayList groupingParams = new ArrayList();
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid2.Rows[i];
- if ((Boolean)row.Cells["CHK"].Value)
- {
- ArrayList parm = new ArrayList();
- parm.Add(GroupId);
- //工序点代码
- parm.Add(row.Cells["STATION_CODE"].Value);
- groupingParams.Add(parm);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.CoreControlPointBasics";
- //类里的方法名
- ccp.MethodName = "doGrouping";
- ccp.ServerParams = new object[] { groupingParams };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- else
- {
- MessageBox.Show("分组成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- //聚焦
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- row = ultraGrid2.Rows[i];
- if (!row.Cells["MONITOR_LV2"].Value.ToString().Equals(""))
- {
- if (Convert.ToInt32(row.Cells["MONITOR_LV2"].Value) == GroupId)
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// 获取最大分组索引号
- /// </summary>
- private int GetMaxGrouping()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetMaxGrouping", null, this.ob);
- int maxCode = 1;
- if (dt.Rows.Count > 0)
- {
- if (!"".Equals(dt.Rows[0][0].ToString()))
- {
- maxCode = Convert.ToInt32(dt.Rows[0][0]) + 1;
- }
- }
- return maxCode;
- }
- /// <summary>
- /// 非空项验证
- /// </summary>
- /// <returns></returns>
- private bool ValidInput(string actionType)
- {
- if (string.IsNullOrEmpty(txtStationDesc.Text.Trim()))
- {
- MessageBox.Show("请输入工序点名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (cmbPointType.SelectedItem == null)
- {
- MessageUtil.ShowWarning("请选择工序点类型");
- cmbPointType.Focus();
- return false;
- }
- string stationCode = txtStationCode.Text.Trim();
- if (txtStationCode.Text.Trim().Length < 6 && txtStationCode.Text.Trim() != "")
- {
- stationCode = txtStationCode.Text.Trim();
- stationCode = stationCode.PadLeft(5, '0');
- txtStationCode.Text = stationCode;
- }
- if (IsExistStationCode(actionType) == true)
- {
- MessageUtil.ShowWarning("已存在此工序点代码!");
- txtStationCode.Focus();
- return false;
- }
- if (cmbProcess.Value == null)
- {
- MessageUtil.ShowWarning("请选择二级工序!");
- cmbProcess.Focus();
- return false;
- }
- return true;
- }
- private bool IsExistStationCode(string actionType)
- {
- string oldStationCode = "";
- if (ultraGrid2.ActiveRow != null)
- {
- oldStationCode = ultraGrid2.ActiveRow.Cells["STATION_CODE"].Value.ToString();
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.isExistStationCode",
- new object[] { oldStationCode, txtStationCode.Text.Trim(), actionType }, ob);
- if (dt != null)
- {
- if (dt.Rows[0][0].ToString() != "0")
- {
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 获取工序点顺序号最大值
- /// </summary>
- /// <returns></returns>
- private int GetMaxStation()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetMaxStation", null, this.ob);
- int maxCode = 1;
- if (dt.Rows.Count > 0)
- {
- if (!"".Equals(dt.Rows[0][0].ToString()))
- {
- maxCode = Convert.ToInt32(dt.Rows[0][0]) + 1;
- }
- }
- return maxCode;
- }
- /// <summary>
- /// 获取工序点代码最大值
- /// </summary>
- /// <returns></returns>
- private string GetMaxCode()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetMaxCode", null, this.ob);
- string maxCode = "";
- if (dt.Rows.Count > 0)
- {
- if (!"".Equals(dt.Rows[0][0].ToString()))
- {
- maxCode = dt.Rows[0][0].ToString();
- }
- else
- {
- maxCode = "C000";
- }
- }
- return maxCode;
- }
- /// <summary>
- /// 验证描述是否重复。
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- private bool isRepeatName(string name)
- {
- DataTable dt = new DataTable();
- dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.GetName", new Object[] { name }, this.ob);
- if (dt.Rows.Count > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doAdd()
- {
- if (ValidInput("Insert"))
- {
- //判断名称是否重复
- string name = txtStationDesc.Text.Trim();
- if (isRepeatName(name))
- {
- MessageBox.Show("工序点名称\"" + name + "\"已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- txtStationDesc.Focus();
- return;
- }
- if (txtStationId.Text.Trim() != "")
- {
- if (IsExistStationId(txtStationId.Value.ToString()) == true)
- {
- MessageUtil.ShowWarning("系统已存在该工序点顺序号!");
- txtStationId.Focus();
- return;
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否新增记录?") == DialogResult.No)
- {
- return;
- }
- //txtStationCode,txtStationDesc,txtStationType,txtStationId,txtProcessCode,
- //txtProcessDesc,txtProcessCodeC,txtProcessDescC,txtCost,txtChoose,
- //txtReturnResult,txtSendCheckplan,txtMonitorLv
- ArrayList parm = new ArrayList();
- //编号自动生成
- //自动生成编号
- string stationCode = "";
- if (txtStationCode.Text.Trim() != "")
- {
- stationCode = txtStationCode.Text.Trim();
- }
- else
- {
- stationCode = StringUtil.SequenceIncrease(GetMaxCode());
- }
- parm.Add(stationCode);
- parm.Add(txtStationDesc.Text);
- parm.Add(cmbPointType.Value.ToString());
- parm.Add(cmbProcess.Value.ToString());
- parm.Add(cmbProcess.Text.ToString());
- //parm.Add(cmbProcessC.Value.ToString());
- //parm.Add(cmbProcessC.Text.ToString());
- parm.Add(txtCost.Text == "" ? "0" : txtCost.Value.ToString());
- //必经项,是否
- if (chkChoose.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- //执行返回,是否
- if (chkReturnResult.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- //是否发送检验计划
- if (chkSendCheckplan.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- //监制级别
- parm.Add(cmbMonitorLv.Text.Trim());
- //顺序号STATION_ID,从数据库读取最大顺序号+1返回。
- int stationId = GetMaxStation();
- if (txtStationId.Text.ToString() == "")
- {
- parm.Add(stationId);
- }
- else
- {
- parm.Add(txtStationId.Text.Trim());
- }
- parm.Add(this.UserInfo.GetUserName());
- parm.Add(txtMemo.Text);
- parm.Add(che_COST_POINT.Checked?"1":"0");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.CoreControlPointBasics";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- return;
- MessageUtil.ShowTips("新增成功!");
- doQuery();
- //高亮显示新增的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- row = ultraGrid2.Rows[i];
- if (row.Cells["STATION_CODE"].Value.ToString().Equals(stationCode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- private bool IsExistStationId(string strStationId)
- {
- ArrayList list = new ArrayList();
- list.Add(strStationId);
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.isExistStationId",
- new object[] { list }, ob);
- if (dt != null)
- {
- if (dt.Rows[0][0].ToString() != "0")
- {
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void doModify()
- {
- if (ultraGrid2.ActiveRow == null)
- {
- MessageBox.Show("请选择需要修改的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string validflagStr = ultraGrid2.ActiveRow.Cells["VALIDFLAG"].Value.ToString();
- //无效数据不允许修改
- if ("0".Equals(validflagStr))
- {
- MessageBox.Show("无效数据不支持修改操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (txtStationId.Text.Trim() != ultraGrid2.ActiveRow.Cells["STATION_ID"].Value.ToString())
- {
- if (IsExistStationId(txtStationId.Value.ToString()) == true)
- {
- MessageUtil.ShowWarning("系统已存在该工序点顺序号!");
- txtStationId.Focus();
- return;
- }
- }
- if (ValidInput("Update"))
- {
- //验证描述不允许重复。
- string name = txtStationDesc.Text.Trim();
- if (!name.Equals(ultraGrid2.ActiveRow.Cells["STATION_DESC"].Value.ToString()))
- {
- if (isRepeatName(name))
- {
- MessageBox.Show("工序点名称\"" + name + "\"已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- //确认修改吗?
- if (MessageBox.Show("是否确认修改选中的数据!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- ArrayList parm = new ArrayList();
- string stationCode = "";
- if (txtStationCode.Text.Trim() != "")
- {
- stationCode = txtStationCode.Text.Trim();
- }
- else
- {
- stationCode = ultraGrid2.ActiveRow.Cells["STATION_CODE"].Value.ToString();
- }
- parm.Add(stationCode);
- parm.Add(txtStationDesc.Text);
- parm.Add(cmbPointType.Value.ToString());
- parm.Add(cmbProcess.Value.ToString());
- parm.Add(cmbProcess.Text.ToString());
- parm.Add(txtCost.Value == null ? "0" : txtCost.Value.ToString());
- //必经项,是否
- if (chkChoose.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- //执行返回,是否
- if (chkReturnResult.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- //是否发送检验计划
- if (chkSendCheckplan.Checked)
- {
- parm.Add(1);
- }
- else
- {
- parm.Add(0);
- }
- parm.Add(cmbMonitorLv.Text.Trim());
- parm.Add(this.UserInfo.GetUserName());
- parm.Add(txtMemo.Text);
- parm.Add(txtStationId.Value == null ? ultraGrid2.ActiveRow.Cells["STATION_ID"].Value.ToString() : txtStationId.Value.ToString());
- parm.Add(che_COST_POINT.Checked ? "1" : "0");
- parm.Add(ultraGrid2.ActiveRow.Cells["STATION_CODE"].Value.ToString());
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.CoreControlPointBasics";
- ccp.MethodName = "doModify";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips("修改成功!");
- doQuery();
- //高亮显示新增的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- row = ultraGrid2.Rows[i];
- if (row.Cells["STATION_CODE"].Value.ToString().Equals(stationCode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- bool validFlag = chkValid.Checked;
- string titleName = "";
- if (ultraCheckEditor1.Checked)
- {
- titleName = txtTitleName.Text.Trim();
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreControlPointBasics.getLineList",
- new Object[] { validFlag, titleName, _stationType }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //不同颜色区分是否有效数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- row = ultraGrid2.Rows[i];
- if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
- {
- row.Appearance.ForeColor = Color.Red;
- row.Cells["CHK"].Activation = Activation.Disabled;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid2, new UltraGridColumn[] {
- ultraGrid2.DisplayLayout.Bands[0].Columns["MEMO"],
- ultraGrid2.DisplayLayout.Bands[0].Columns["CHK"]
- });
- }
- /// <summary>
- /// GRID ROW激活时信息带至编辑区
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid2.ActiveRow;
- if (row != null)
- {
- //STATION_CODE,STATION_DESC,STATION_TYPE ,STATION_ID
- //PROCESS_CODE,PROCESS_DESC,PROCESS_CODE_C,PROCESS_DESC_C
- // COST,CHOOSE,RETURN_RESULT,SEND_CHECKPLAN,MONITOR_LV
- //txtStationCode,txtStationDesc,txtStationType,txtStationId,txtProcessCode,
- //txtProcessDesc,txtProcessCodeC,txtProcessDescC,txtCost,txtChoose,
- //txtReturnResult,txtSendCheckplan,txtMonitorLv
- txtStationCode.Text = row.Cells["STATION_CODE"].Value.ToString();
- txtStationDesc.Text = row.Cells["STATION_DESC"].Value.ToString();
- cmbPointType.Text = row.Cells["STATION_TYPE"].Value.ToString();
- cmbProcess.Value = row.Cells["PROCESS_CODE"].Value.ToString();
- //cmbProcessC.Value = row.Cells["PROCESS_CODE_C"].Value.ToString();
- txtCost.Value = row.Cells["COST"].Value.ToString();
- if ("1".Equals(row.Cells["CHOOSE"].Value.ToString()))
- {
- chkChoose.Checked = true;
- }
- else
- {
- chkChoose.Checked = false;
- }
- if ("1".Equals(row.Cells["RETURN_RESULT"].Value.ToString()))
- {
- chkReturnResult.Checked = true;
- }
- else
- {
- chkReturnResult.Checked = false;
- }
- if ("1".Equals(row.Cells["SEND_CHECKPLAN"].Value.ToString()))
- {
- chkSendCheckplan.Checked = true;
- }
- else
- {
- chkSendCheckplan.Checked = false;
- }
- che_COST_POINT.Checked = row.Cells["COST_POINT"].Value.ToString2().Equals("是") ? true : false;
- cmbMonitorLv.Text = row.Cells["MONITOR_LV"].Value.ToString();
- txtMemo.Text = row.Cells["MEMO"].Value.ToString();
- txtStationId.Value = row.Cells["STATION_ID"].Value.ToString();
- }
- }
- /// <summary>
- /// 作废或恢复
- /// </summary>
- /// <param name="isDelete">true作废 false恢复</param>
- private void doDeleteOrResume(bool isDelete)
- {
- if (ultraGrid2.ActiveRow == null)
- {
- MessageBox.Show("请选择需要" + (isDelete ? "作废" : "恢复") + "的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string validflagStr = ultraGrid2.ActiveRow.Cells["VALIDFLAG"].Value.ToString();
- //无效数据不允许作废
- if ("0".Equals(validflagStr))
- {
- if (isDelete)
- {
- MessageBox.Show("无效数据不支持作废操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- else
- {
- //有效数据不允许恢复
- if (!isDelete)
- {
- MessageBox.Show("有效数据不支持恢复操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- ArrayList param = new ArrayList();
- string stationCode = ultraGrid2.ActiveRow.Cells["STATION_CODE"].Value.ToString();
- param.Add(stationCode);
- if (param.Count > 0 && MessageBox.Show("是否确认" + (isDelete ? "作废" : "恢复") + "选中的数据!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreControlPointBasics.deleteLineInfo", new Object[] { param, UserInfo.GetUserName(), isDelete }, this.ob);
- if (count > 0)
- {
- doQuery();
- Infragistics.Win.UltraWinGrid.UltraGridRow rowD = null;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- rowD = ultraGrid2.Rows[i];
- if (rowD.Cells["STATION_CODE"].Value.ToString().Equals(stationCode))
- {
- rowD.Activate();
- break;
- }
- }
- }
- }
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckEditor1.Checked)
- {
- txtTitleName.ReadOnly = false;
- }
- else
- {
- txtTitleName.ReadOnly = true;
- }
- }
- }
- }
|