private void OnLoginWorkerInfo() { try { string nodeName = this.cbxCheckNodes.Text; string workerID = this.cbxWorkerIDS.Text; if (string.IsNullOrWhiteSpace(nodeName)) { MessageBox.Show("工位名称为空,请重新选择"); return; } if (string.IsNullOrWhiteSpace(workerID)) { MessageBox.Show("登录的员工号为空,请重新选择"); return; } FTDataAccess.BLL.PLNodesBll plNodesBll = new FTDataAccess.BLL.PLNodesBll(); string strWhere = string.Format(" nodeName='{0}'", nodeName); List <FTDataAccess.Model.PLNodesModel> nodeList = plNodesBll.GetModelList(strWhere); if (nodeList == null || nodeList.Count() < 1) { MessageBox.Show("没有工位信息:" + nodeName); return; } FTDataAccess.Model.PLNodesModel node = nodeList[0]; node.workerID = workerID; node.lastLoginTime = System.DateTime.Now; if (plNodesBll.Update(node)) { logRecorder.AddDebugLog(this.Text, string.Format("登录员工信息成功,工位:{0},员工号:{1}", nodeName, workerID)); } else { logRecorder.AddDebugLog(this.Text, string.Format("登录员工信息失败,工位:{0},员工号:{1}", nodeName, workerID)); MessageBox.Show(string.Format("登录员工信息失败,工位:{0},员工号:{1}", nodeName, workerID)); } } catch (Exception ex) { PoupAskmes(ex.Message); } }
private void OnRefreshWorkerCfgs() { FTDataAccess.BLL.PLNodesBll plNodesBll = new FTDataAccess.BLL.PLNodesBll(); DataSet ds = plNodesBll.GetList(string.Format("tag1='1'")); this.dataGridView1.DataSource = ds.Tables[0]; this.dataGridView1.Columns["lastLoginTime"].HeaderText = "上次登录时间"; this.dataGridView1.Columns["nodeName"].HeaderText = "工位"; this.dataGridView1.Columns["workerID"].HeaderText = "员工号"; this.dataGridView1.Columns["lastLoginTime"].Width = 200; this.dataGridView1.Columns["nodeID"].Visible = false; this.dataGridView1.Columns["checkRequired"].Visible = false; this.dataGridView1.Columns["enableRun"].Visible = false; this.dataGridView1.Columns["tag1"].Visible = false; this.dataGridView1.Columns["tag2"].Visible = false; this.dataGridView1.Columns["tag3"].Visible = false; this.dataGridView1.Columns["tag4"].Visible = false; this.dataGridView1.Columns["tag5"].Visible = false; }