|
|
@@ -33,7 +33,7 @@ namespace UAS_MES_NEW.Query
|
|
|
li_code.Condition = "li_statuscode='AUDITED'";
|
|
|
li_code.DbChange += Li_code_DbChange;
|
|
|
//初始提示
|
|
|
- OperateResult.AppendText(">>请选择线别,输入人员编号后回车执行" + (UpLoadMan.Checked ? "上线" : "下线") + "\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>请选择线别,输入人员编号后回车执行" + (UpLoadMan.Checked ? "上线" : "下线") + ";下线也可勾选列表后点\"确认下线\"批量处理\n", Color.Black);
|
|
|
LoadGridData();
|
|
|
em_code.Focus();
|
|
|
}
|
|
|
@@ -75,8 +75,9 @@ namespace UAS_MES_NEW.Query
|
|
|
OperateResult.AppendText("<<请先选择线别\n", Color.Red, li_code);
|
|
|
return;
|
|
|
}
|
|
|
- //上线:先校验人员编号存在于 SOPEMPLOYEEDETAIL
|
|
|
- if (!dh.CheckExist("SOPEMPLOYEEDETAIL", "sed_emcode='" + emcode + "'"))
|
|
|
+ //上线:先校验人员编号存在于 SOPEMPLOYEEDETAIL,并取出人员名称(同一 sed_emcode 可能多条,取最大值聚合)
|
|
|
+ string emname = dh.getFieldDataByCondition("SOPEMPLOYEEDETAIL", "max(sed_emname)", "sed_emcode='" + emcode + "'").ToString().Trim();
|
|
|
+ if (emname == "")
|
|
|
{
|
|
|
OperateResult.AppendText("<<" + emcode + "人员编号不存在\n", Color.Red, em_code);
|
|
|
em_code.Clear();
|
|
|
@@ -100,9 +101,9 @@ namespace UAS_MES_NEW.Query
|
|
|
dh.ExecuteSql("update loadman set lm_downtime=sysdate where lm_emcode='" + emcode + "' and lm_downtime is null", "update");
|
|
|
OperateResult.AppendText(">>" + emcode + "已从" + oldLineCode + "自动下线\n", Color.Black);
|
|
|
}
|
|
|
- dh.ExecuteSql("insert into loadman(lm_id,lm_linecode,lm_emcode,lm_uptime,lm_inman)" +
|
|
|
- "values(loadman_seq.nextval,'" + linecode + "','" + emcode + "',sysdate,'" + User.UserName + "')", "insert");
|
|
|
- OperateResult.AppendText("<<" + emcode + "在" + linecode + "上线成功\n", Color.Green, em_code);
|
|
|
+ dh.ExecuteSql("insert into loadman(lm_id,lm_linecode,lm_emcode,lm_emname,lm_uptime,lm_inman)" +
|
|
|
+ "values(loadman_seq.nextval,'" + linecode + "','" + emcode + "','" + emname + "',sysdate,'" + User.UserName + "')", "insert");
|
|
|
+ OperateResult.AppendText("<<" + emcode + " " + emname + " 在" + linecode + "上线成功\n", Color.Green, em_code);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -124,6 +125,69 @@ namespace UAS_MES_NEW.Query
|
|
|
em_code.Focus();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 判断DGV中是否有勾选的行
|
|
|
+ /// </summary>
|
|
|
+ private bool IfCheckRow()
|
|
|
+ {
|
|
|
+ for (int i = 0; i < DGV.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (DGV.Rows[i].Cells["choose"].Value != null && DGV.Rows[i].Cells["choose"].FormattedValue.ToString() == "True")
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 批量下线:把DGV中勾选的行按 lm_id 逐条置 lm_downtime=sysdate
|
|
|
+ /// (DGV只加载未下线记录,勾选行必然在线,直接按主键更新即可)
|
|
|
+ /// </summary>
|
|
|
+ private void ConfirmDown_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (!IfCheckRow())
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("<<请先勾选需要下线的人员\n", Color.Red, em_code);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DataGridViewRow row;
|
|
|
+ string lmId;
|
|
|
+ string emcode;
|
|
|
+ string emname;
|
|
|
+ string linecode;
|
|
|
+ int sucCount = 0;
|
|
|
+ int failCount = 0;
|
|
|
+ for (int i = 0; i < DGV.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ row = DGV.Rows[i];
|
|
|
+ //只处理勾选且有主键的行
|
|
|
+ if (row.Cells["choose"].FormattedValue == null || row.Cells["choose"].FormattedValue.ToString() != "True")
|
|
|
+ continue;
|
|
|
+ if (row.Cells["lm_id"].Value == null || row.Cells["lm_id"].Value.ToString() == "")
|
|
|
+ continue;
|
|
|
+ lmId = row.Cells["lm_id"].Value.ToString();
|
|
|
+ emcode = row.Cells["lm_emcode"].Value == null ? "" : row.Cells["lm_emcode"].Value.ToString();
|
|
|
+ emname = row.Cells["sed_emname"].Value == null ? "" : row.Cells["sed_emname"].Value.ToString();
|
|
|
+ linecode = row.Cells["lm_linecode"].Value == null ? "" : row.Cells["lm_linecode"].Value.ToString();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update loadman set lm_downtime=sysdate where lm_id='" + lmId + "' and lm_downtime is null", "update");
|
|
|
+ sucCount++;
|
|
|
+ OperateResult.AppendText("<<" + emcode + " " + emname + " 已从" + linecode + "下线\n", Color.Green);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ failCount++;
|
|
|
+ OperateResult.AppendText("<<" + emcode + " " + emname + " 下线失败:" + ex.Message + "\n", Color.Red);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(">>本次下线成功 " + sucCount + " 人" + (failCount > 0 ? ",失败 " + failCount + " 人" : "") + "\n", Color.Black);
|
|
|
+ //刷新后勾选状态会因重新绑定被清空,属预期
|
|
|
+ LoadGridData();
|
|
|
+ em_code.Focus();
|
|
|
+ }
|
|
|
+
|
|
|
private void UpLoadMan_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
if (UpLoadMan.Checked)
|
|
|
@@ -137,7 +201,7 @@ namespace UAS_MES_NEW.Query
|
|
|
{
|
|
|
if (DownLoadMan.Checked)
|
|
|
{
|
|
|
- OperateResult.AppendText(">>已切换到下线模式,输入人员编号回车下线\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>已切换到下线模式,输入人员编号回车下线,或勾选列表后点\"确认下线\"批量下线\n", Color.Black);
|
|
|
em_code.Focus();
|
|
|
}
|
|
|
}
|