|
|
@@ -19,6 +19,8 @@ namespace UAS_MES.Query
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
//经过的步骤
|
|
|
string PastStep = "";
|
|
|
+ //经过的步骤
|
|
|
+ string nextStepCode = "";
|
|
|
//拆分后的经过的步骤
|
|
|
Dictionary<int, string> Step;
|
|
|
List<Brush> PaintColor = new List<Brush>();
|
|
|
@@ -54,7 +56,7 @@ namespace UAS_MES.Query
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
|
string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id) ms_id", "ms_sncode='" + sn_code.Text + "'").ToString();
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_status,ms_paststep,ms_stepcode,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id='" + ms_id + "'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_status,ms_nextstepcode,ms_paststep,ms_stepcode,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id='" + ms_id + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
if (Step != null && Step.Count > 0)
|
|
|
@@ -66,12 +68,14 @@ namespace UAS_MES.Query
|
|
|
string ifRework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
//执行过的步骤
|
|
|
PastStep = dt.Rows[0]["ms_paststep"].ToString();
|
|
|
+ //下一步骤
|
|
|
+ nextStepCode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
//如果为不良的时候
|
|
|
string BadStep = "";
|
|
|
string RejectStep = "";
|
|
|
string currentStep = "";
|
|
|
//先判断是否是返工的
|
|
|
- if (ifRework!= "0")
|
|
|
+ if (ifRework != "0")
|
|
|
{
|
|
|
//是返工的
|
|
|
if (dt.Rows[0]["ms_reworkstatus"].ToString() == "3")
|
|
|
@@ -95,7 +99,16 @@ namespace UAS_MES.Query
|
|
|
RejectStep = dt.Rows[0]["ms_stepcode"].ToString();
|
|
|
}
|
|
|
}
|
|
|
- currentStep= dt.Rows[0]["ms_stepcode"].ToString();
|
|
|
+ currentStep = dt.Rows[0]["ms_stepcode"].ToString();
|
|
|
+ //添加开始节点绿色,除了返工单
|
|
|
+ if (BadStep==""&& ((dt.Rows[0]["ms_status"].ToString() == "3"&&ifRework=="0")||(dt.Rows[0]["ms_reworkstatus"].ToString()=="3"&&ifRework=="-1")))
|
|
|
+ {
|
|
|
+ PaintColor.Add(Brushes.Red);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PaintColor.Add(Brushes.Green);
|
|
|
+ }
|
|
|
//查询执行过的步骤
|
|
|
sql.Clear();
|
|
|
sql.Append("select CD_DETNO,CD_STEPCODE,ms_makecode from craft left join craftdetail on cd_crid = cr_id left join makeserial ");
|
|
|
@@ -111,58 +124,74 @@ namespace UAS_MES.Query
|
|
|
else
|
|
|
Step.Add(i, dt.Rows[i - 1]["CD_STEPCODE"].ToString());
|
|
|
}
|
|
|
- //添加开始节点绿色
|
|
|
- PaintColor.Add(Brushes.Green);
|
|
|
//添加中间节点
|
|
|
bool passed = true;
|
|
|
+ int index = 0;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
- //还未开始返工
|
|
|
- if (currentStep == "")
|
|
|
+ if (nextStepCode == dt.Rows[i]["CD_STEPCODE"].ToString())
|
|
|
{
|
|
|
- passed = false;
|
|
|
+ index = i;
|
|
|
}
|
|
|
- //passed==true;说明经过了这一步
|
|
|
- if (passed)
|
|
|
+ }
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ ////下一步不在途程中,不良或者报废或者完工
|
|
|
+ if (nextStepCode == ""||nextStepCode==" ")
|
|
|
{
|
|
|
+ //返工单
|
|
|
+ if (currentStep=="")
|
|
|
+ {
|
|
|
+ passed = false;
|
|
|
+ }
|
|
|
+ //找到不良步骤
|
|
|
if (BadStep == dt.Rows[i]["CD_STEPCODE"].ToString())
|
|
|
{
|
|
|
PaintColor.Add(Brushes.Red);
|
|
|
//是不良品,后面就不执行
|
|
|
passed = false;
|
|
|
}
|
|
|
+ //找到报废步骤
|
|
|
+ else if (PastStep.Contains(dt.Rows[i]["CD_STEPCODE"].ToString() + "," + RejectStep)&&RejectStep!="")
|
|
|
+ {
|
|
|
+ PaintColor.Add(Brushes.Black);
|
|
|
+ //是报废品,后面就不执行
|
|
|
+ passed = false;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
- if (!PastStep.Contains(dt.Rows[i]["CD_STEPCODE"].ToString() + "," + RejectStep) || RejectStep == "")
|
|
|
+ //通过加绿色
|
|
|
+ if (passed)
|
|
|
+ {
|
|
|
PaintColor.Add(Brushes.Green);
|
|
|
+ }
|
|
|
+ //不通过加白色
|
|
|
else
|
|
|
{
|
|
|
- //判断之前有没有添加过黑色
|
|
|
- if (PaintColor.Contains(Brushes.Black))
|
|
|
- {
|
|
|
- //移除之前的,
|
|
|
- int index = PaintColor.IndexOf(Brushes.Black);
|
|
|
- PaintColor.RemoveAt(PaintColor.IndexOf(Brushes.Black));
|
|
|
- PaintColor.Insert(index, Brushes.Green);
|
|
|
- }
|
|
|
- PaintColor.Add(Brushes.Black);
|
|
|
- //是报废品,后面也不执行
|
|
|
- passed = false;
|
|
|
+ PaintColor.Add(Brushes.White);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //还没经过
|
|
|
+ ////序列号下一步不为空
|
|
|
else
|
|
|
{
|
|
|
- PaintColor.Add(Brushes.White);
|
|
|
- }
|
|
|
- //如果返工执行到了当前步
|
|
|
- if (currentStep==dt.Rows[i]["CD_STEPCODE"].ToString()) {
|
|
|
- passed = false;
|
|
|
+ /////SN下一步是否在途程中,是则标记
|
|
|
+ //找到下一步
|
|
|
+ if (i < index)
|
|
|
+ {
|
|
|
+ //已执行
|
|
|
+ PaintColor.Add(Brushes.Green);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //未执行
|
|
|
+ PaintColor.Add(Brushes.White);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (ifRework != "0") {
|
|
|
- //完工添加绿色,未完工添加红色
|
|
|
+ if (ifRework != "0")
|
|
|
+ {
|
|
|
+ //完工添加绿色,未完工添加白色
|
|
|
if (dh.CheckExist("Makeserial", "ms_id='" + ms_id + "' and ms_reworkstatus='2'"))
|
|
|
PaintColor.Add(Brushes.Green);
|
|
|
else
|
|
|
@@ -170,7 +199,7 @@ namespace UAS_MES.Query
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //完工添加绿色,未完工添加红色
|
|
|
+ //完工添加绿色,未完工添加白色
|
|
|
if (dh.CheckExist("Makeserial", "ms_id='" + ms_id + "' and ms_status='2'"))
|
|
|
PaintColor.Add(Brushes.Green);
|
|
|
else
|
|
|
@@ -181,7 +210,7 @@ namespace UAS_MES.Query
|
|
|
sql.Clear();
|
|
|
sql.Append("select mp_makecode,ma_prodcode,sc_linecode,ma_craftcode,mp_sourcecode,mp_sncode,");
|
|
|
sql.Append("mp_indate,mp_inman,em_name from makeprocess left join make on mp_makecode=ma_code left join employee on mp_inman = em_code left join source on ");
|
|
|
- sql.Append("mp_sourcecode=sc_code where mp_sncode='" + sn_code.Text + "' and ma_code='"+dt.Rows[0]["ms_makecode"].ToString()+"'");
|
|
|
+ sql.Append("mp_sourcecode=sc_code where mp_sncode='" + sn_code.Text + "' and ma_code='" + dt.Rows[0]["ms_makecode"].ToString() + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
|
|
|
}
|
|
|
@@ -226,16 +255,16 @@ namespace UAS_MES.Query
|
|
|
Param.Text = j + " " + Step[j];
|
|
|
Param.Name = j + Step[j] + "_label";
|
|
|
Param.AutoSize = true;
|
|
|
- Param.Margin = new Padding(0,0,0,0);
|
|
|
+ Param.Margin = new Padding(0, 0, 0, 0);
|
|
|
Param.Anchor = AnchorStyles.Left;
|
|
|
Param.Anchor = AnchorStyles.Top;
|
|
|
//获取param的宽度和高度
|
|
|
Graphics graphics = Graphics.FromHwnd(Param.Handle);
|
|
|
- SizeF size = graphics.MeasureString(Param.Text,Param.Font);
|
|
|
-
|
|
|
+ SizeF size = graphics.MeasureString(Param.Text, Param.Font);
|
|
|
+
|
|
|
//设定param文本框的位置
|
|
|
//Param.Location = new Point(x + r.Width / 14 * RectangleCountEachRow, y + r.Height / 10 * 4);
|
|
|
- Param.Location = new Point(x+(int)(r.Width-size.Width)/2,y+(int)(r.Height-size.Height)/2);
|
|
|
+ Param.Location = new Point(x + (int)(r.Width - size.Width) / 2, y + (int)(r.Height - size.Height) / 2);
|
|
|
graphics.Dispose();
|
|
|
//如果在奇数行
|
|
|
if (i % 2 != 0)
|