|
@@ -83,14 +83,22 @@ namespace UAS_MES_NEW.Query
|
|
|
em_code.Focus();
|
|
em_code.Focus();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- //一个人只能同时一条线上线
|
|
|
|
|
|
|
+ //一个人只能同时一条线上线:若已在别的线体上线,先把原线体自动下线,再在新线体上线
|
|
|
DataTable dtOn = (DataTable)dh.ExecuteSql("select lm_linecode from loadman where lm_emcode='" + emcode + "' and lm_downtime is null", "select");
|
|
DataTable dtOn = (DataTable)dh.ExecuteSql("select lm_linecode from loadman where lm_emcode='" + emcode + "' and lm_downtime is null", "select");
|
|
|
if (dtOn.Rows.Count > 0)
|
|
if (dtOn.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
- OperateResult.AppendText("<<" + emcode + "已在" + dtOn.Rows[0]["lm_linecode"].ToString() + "上线,不允许重复上线\n", Color.Red, em_code);
|
|
|
|
|
- em_code.Clear();
|
|
|
|
|
- em_code.Focus();
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ string oldLineCode = dtOn.Rows[0]["lm_linecode"].ToString();
|
|
|
|
|
+ //当前所在线体与新线体相同,提示已上线,不再重复插入
|
|
|
|
|
+ if (oldLineCode == linecode)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperateResult.AppendText("<<" + emcode + "已在" + linecode + "上线,不允许重复上线\n", Color.Red, em_code);
|
|
|
|
|
+ em_code.Clear();
|
|
|
|
|
+ em_code.Focus();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //自动下线原线体
|
|
|
|
|
+ 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)" +
|
|
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");
|
|
"values(loadman_seq.nextval,'" + linecode + "','" + emcode + "',sysdate,'" + User.UserName + "')", "insert");
|