123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using CCWin;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using WCS_Client.UC;
- using WCS_Client.Utility;
- namespace WCS_Client.From
- {
- public partial class Form_EquLockQuery : CCSkinMain
- {
- DataTable _dt;
- DataRow _currentDr;
- public Form_EquLockQuery()
- {
- InitializeComponent();
- Bind();
- }
- private static Form_EquLockQuery childFromInstanc;
- public static Form_EquLockQuery ChildFromInstanc
- {
- get
- {
- if (childFromInstanc == null || childFromInstanc.IsDisposed)
- {
- childFromInstanc = new Form_EquLockQuery();
- }
- return childFromInstanc;
- }
- }
- //绑定数据
- private void Bind()
- {
- PageData pd = QueryPageDataMethods(1, 10000);
- if (pd != null)
- {
- _dt = pd.Dt;
- dgvTask.DataSource = _dt;
- }
- else
- {
- if (_dt != null) _dt.Clear();
- }
- }
- //获取数据集
- private PageData QueryPageDataMethods(int PageIndex, int PageSize)
- {
- string _SQLText = @"SELECT equipmentno,islock,isenablei_in,isenable_out,equtype,to_char(updatetime,'yyyy-MM-dd hh24:mi:ss') updatetime FROM wcs_equipmentlock";
- string _Orderby = " equtype asc";
- PageData pd = BaseWorkflow.QueryPageData(_SQLText, _Orderby, new List<string>(), PageIndex, PageSize);
- return pd;
- }
- private void sknBinNuLock_Click(object sender, EventArgs e)
- {
- if (_currentDr == null)
- {
- MessageBox.Show("请选择要解锁的设备。");
- }
- else
- {
- string equipmentno = _currentDr["equipmentno"].ToString();
- DialogResult dr = MessageUtil.ShowYesNoAndWarning(string.Format("设备[{0}]确定要执行[解锁]吗(谨慎操作)?", equipmentno));
- if (dr != DialogResult.Yes) return;
- BaseWorkflow.Equipment_UpdateLock(equipmentno, false);
- MessageBox.Show(string.Format("设备[{0}]解锁成功。", equipmentno));
- Bind();
- }
- }
- private void dgvTask_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- _currentDr = GetDgvRow("equipmentno");
- }
- public DataRow GetDgvRow(string cellName)
- {
- try
- {
- if (dgvTask.CurrentCell == null) return null;
- if (dgvTask.CurrentCell.RowIndex >= 0)
- {
- string no = Convert.ToString(dgvTask.Rows[dgvTask.CurrentCell.RowIndex].Cells[cellName].Value);
- return _dt.Select(cellName + "='" + no + "'")[0];
- }
- return null;
- }
- catch (Exception ex)
- {
- return null;
- }
- }
- private void skinButton1_Click(object sender, EventArgs e)
- {
- Bind();
- }
- }
- }
|