| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Judge.Commons;
- using CoreFS.CA06;
- using Infragistics.Win;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Judge.Controls
- {
- public partial class QcmJudgeLockRecordCtrl : UserControl
- {
- private Dal _d;
- private string _userId;
- public QcmJudgeLockRecordCtrl(Control container, OpeBase ob, string userId)
- {
- InitializeComponent();
- _d = new Dal(ob);
- _userId = userId;
- container.Controls.Add(this);
- this.Dock = DockStyle.Fill;
- ValueList lockFlagList = new ValueList();
- lockFlagList.ValueListItems.Add("0", "未锁定");
- lockFlagList.ValueListItems.Add("1", "已锁定");
- ultraGrid1.DisplayLayout.Bands[0].Columns["lockFlag"].ValueList = lockFlagList;
- }
- private string _judgeStoveNo = "";
- private string _lockTimeB = "";
- private string _lockTimeE = "";
- private string _user = "";
- private string _orderNo = "";
- private string _lockFlag = "";
- public void Query(string judgeStoveNo, string lockTimeB, string lockTimeE, string user, string orderNo, string lockFlag)
- {
- _judgeStoveNo = judgeStoveNo;
- _lockTimeB = lockTimeB;
- _lockTimeE = lockTimeE;
- _user = user;
- _orderNo = orderNo;
- _lockFlag = lockFlag;
- DataTable dt = _d.GetTableByXmlId("JdgQcmJudgeLock.getLockRecord", judgeStoveNo, lockTimeB, lockTimeE, user, orderNo, lockFlag);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- public void Unlock()
- {
- var chkRows = ultraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择一行记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认解锁?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- string lockId = ultraGrid1.ActiveRow.GetValue("lockId");
- foreach (var row in chkRows)
- {
- jsons.Add(JsonHelper.ToJson(row));
- }
- var ccp = _d.Set("com.steering.pss.judge.Bll.BllQcmJudgeLock.unlock", jsons, _userId);
- if (ccp.ReturnInfo.ToString2() != "")
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo.ToString2());
- }
- else
- {
- MessageUtil.ShowTips("操作成功!");
- Relocate(lockId);
- }
- }
- private void Relocate(string lockId)
- {
- Query(_judgeStoveNo, _lockTimeB, _lockTimeE, _user, _orderNo, _lockFlag);
- var row = ultraGrid1.Rows.Where(a => a.GetValue("lockId") == lockId).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- }
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- e.Cell.Row.Update();
- }
- }
- }
|