Browse Source

工单执行进度界面界面修改,NEW客户端代码同步

Hcsy 7 years ago
parent
commit
24885c9053

+ 21 - 2
UAS-MES/FunctionCode/Query/Query_ExeProgress.cs

@@ -22,6 +22,8 @@ namespace UAS_MES.Query
         string PastStep = "";
         string PastStep = "";
         //经过的步骤
         //经过的步骤
         string nextStepCode = "";
         string nextStepCode = "";
+        //序列号对应抽检批
+        string checkno = "";
         //拆分后的经过的步骤
         //拆分后的经过的步骤
         Dictionary<int, string> Step;
         Dictionary<int, string> Step;
         List<Brush> PaintColor = new List<Brush>();
         List<Brush> PaintColor = new List<Brush>();
@@ -87,7 +89,7 @@ namespace UAS_MES.Query
                     ms_ids.Append("'"+ms_id.Rows[i]["ms_id"].ToString()+"',");
                     ms_ids.Append("'"+ms_id.Rows[i]["ms_id"].ToString()+"',");
                 }
                 }
                 ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_sncode,ms_firstsn,ms_makecode from makeserial where ms_id in (" + ms_ids.ToString().Substring(0,ms_ids.ToString().Length-1)+")","select");
                 ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_sncode,ms_firstsn,ms_makecode from makeserial where ms_id in (" + ms_ids.ToString().Substring(0,ms_ids.ToString().Length-1)+")","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 in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id", "select");
+                dt = (DataTable)dh.ExecuteSql("select ms_status,ms_nextstepcode,ms_paststep,ms_stepcode,ms_checkno,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id", "select");
                 if (dt.Rows.Count > 0)
                 if (dt.Rows.Count > 0)
                 {
                 {
                     if (Step != null && Step.Count > 0)
                     if (Step != null && Step.Count > 0)
@@ -101,6 +103,8 @@ namespace UAS_MES.Query
                     PastStep = dt.Rows[idCount - 1]["ms_paststep"].ToString();
                     PastStep = dt.Rows[idCount - 1]["ms_paststep"].ToString();
                     //下一步骤
                     //下一步骤
                     nextStepCode = dt.Rows[idCount - 1]["ms_nextstepcode"].ToString();
                     nextStepCode = dt.Rows[idCount - 1]["ms_nextstepcode"].ToString();
+                    //序列号所属抽检批
+                    checkno = dt.Rows[idCount - 1]["ms_checkno"].ToString();
                     //如果为不良的时候
                     //如果为不良的时候
                     string BadStep = "";
                     string BadStep = "";
                     string RejectStep = "";
                     string RejectStep = "";
@@ -232,7 +236,22 @@ namespace UAS_MES.Query
                                 if (i < index)
                                 if (i < index)
                                 {
                                 {
                                     //已执行
                                     //已执行
-                                    PaintColor.Add(Brushes.Green);
+                                    //判断是否为OQC工序
+                                    string st_ifoqc = dh.getFieldDataByCondition("Step", "st_ifoqc", "st_code = '" + dt.Rows[i]["CD_STEPCODE"].ToString() + "'").ToString();
+                                    if (st_ifoqc == "-1")
+                                    {
+                                        string oqcpass = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + checkno + "'").ToString();
+                                        if (oqcpass == "OK")
+                                        {
+                                            PaintColor.Add(Brushes.Green);
+                                        }
+                                        else
+                                        {
+                                            PaintColor.Add(Brushes.White);
+                                        }
+                                    }
+                                    else
+                                        PaintColor.Add(Brushes.Green);
                                 }
                                 }
                                 else
                                 else
                                 {
                                 {

+ 2 - 0
UAS_MES_NEW/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -576,6 +576,7 @@ namespace UAS_MES_NEW.Make
                             return false;
                             return false;
                         }
                         }
                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text);
                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text);
+                        OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black);
                         if (CollectRemark.Checked)
                         if (CollectRemark.Checked)
                         {
                         {
                             Remark.Text = "";
                             Remark.Text = "";
@@ -589,6 +590,7 @@ namespace UAS_MES_NEW.Make
                             return false;
                             return false;
                         }
                         }
                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text);
                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text);
+                        OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black);
                         if (CollectRemark.Checked)
                         if (CollectRemark.Checked)
                         {
                         {
                             Remark.Text = "";
                             Remark.Text = "";

+ 2 - 0
UAS_MES_NEW/FunctionCode/Make/Make_SeqTransform.cs

@@ -243,6 +243,7 @@ namespace UAS_MES_NEW.Make
                                             return;
                                             return;
                                         }
                                         }
                                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", oMakeCode, ma_prodcode.Text, Remark.Text);
                                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", oMakeCode, ma_prodcode.Text, Remark.Text);
+                                        OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black);
                                         if (CollectRemark.Checked)
                                         if (CollectRemark.Checked)
                                         {
                                         {
                                             Remark.Text = "";
                                             Remark.Text = "";
@@ -255,6 +256,7 @@ namespace UAS_MES_NEW.Make
                                             return;
                                             return;
                                         }
                                         }
                                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", oMakeCode, ma_prodcode.Text, Remark.Text);
                                         LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", oMakeCode, ma_prodcode.Text, Remark.Text);
+                                        OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black);
                                         if (CollectRemark.Checked)
                                         if (CollectRemark.Checked)
                                         {
                                         {
                                             Remark.Text = "";
                                             Remark.Text = "";

+ 3 - 1
UAS_MES_NEW/FunctionCode/Packing/Packing_ProdWeightSet.cs

@@ -28,6 +28,8 @@ namespace UAS_MES_NEW.Packing
         //创建串口实例
         //创建串口实例
         SerialPort serialPort1 = new SerialPort();
         SerialPort serialPort1 = new SerialPort();
 
 
+        Regex re = new Regex("\\d+.\\d+\\w+");
+
         DataHelper dh;
         DataHelper dh;
 
 
         Thread thread;
         Thread thread;
@@ -139,7 +141,7 @@ namespace UAS_MES_NEW.Packing
                         {
                         {
                             try
                             try
                             {
                             {
-                                weight.Text = serialPort1.ReadLine();
+                                weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                                 //weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
                                 //weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
                             }
                             }
                             catch (Exception)
                             catch (Exception)

+ 33 - 14
UAS_MES_NEW/FunctionCode/Query/Query_ExeProgress.cs

@@ -22,6 +22,8 @@ namespace UAS_MES_NEW.Query
         string PastStep = "";
         string PastStep = "";
         //经过的步骤
         //经过的步骤
         string nextStepCode = "";
         string nextStepCode = "";
+        //序列号对应抽检批
+        string checkno = "";
         //拆分后的经过的步骤
         //拆分后的经过的步骤
         Dictionary<int, string> Step;
         Dictionary<int, string> Step;
         List<Brush> PaintColor = new List<Brush>();
         List<Brush> PaintColor = new List<Brush>();
@@ -72,7 +74,7 @@ namespace UAS_MES_NEW.Query
                     //没有过转号
                     //没有过转号
                     ms_id = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode from makeserial where ms_sncode='" + sn_code.Text + "' order by ms_id", "select");
                     ms_id = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode from makeserial where ms_sncode='" + sn_code.Text + "' order by ms_id", "select");
                 }
                 }
-                if (ms_id.Rows.Count==0)
+                if (ms_id.Rows.Count == 0)
                 {
                 {
                     //无值则提示
                     //无值则提示
                     MessageBox.Show("序列号" + sn_code.Text + "不存在");
                     MessageBox.Show("序列号" + sn_code.Text + "不存在");
@@ -80,14 +82,14 @@ namespace UAS_MES_NEW.Query
                 }
                 }
                 StringBuilder ms_ids = new StringBuilder();//存所有的ms_id
                 StringBuilder ms_ids = new StringBuilder();//存所有的ms_id
                 //设置界面工单号
                 //设置界面工单号
-                ma_code.Text = ms_id.Rows[ms_id.Rows.Count-1]["ms_makecode"].ToString();
+                ma_code.Text = ms_id.Rows[ms_id.Rows.Count - 1]["ms_makecode"].ToString();
                 int idCount = ms_id.Rows.Count;
                 int idCount = ms_id.Rows.Count;
-                for (int i=0;i<idCount;i++)
+                for (int i = 0; i < idCount; i++)
                 {
                 {
-                    ms_ids.Append("'"+ms_id.Rows[i]["ms_id"].ToString()+"',");
+                    ms_ids.Append("'" + ms_id.Rows[i]["ms_id"].ToString() + "',");
                 }
                 }
-                ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_firstsn,ms_sncode,ms_makecode from makeserial where ms_id in (" + ms_ids.ToString().Substring(0,ms_ids.ToString().Length-1)+")","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 in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id", "select");
+                ListA = (DataTable)dh.ExecuteSql("select ms_beforesn,ms_sncode,ms_firstsn,ms_makecode from makeserial where ms_id in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ")", "select");
+                dt = (DataTable)dh.ExecuteSql("select ms_status,ms_nextstepcode,ms_paststep,ms_stepcode,ms_checkno,NVL(ms_ifrework, 0) ms_ifrework,NVL(ms_reworkstatus, 0) ms_reworkstatus from makeserial where ms_id in (" + ms_ids.ToString().Substring(0, ms_ids.ToString().Length - 1) + ") order by ms_id", "select");
                 if (dt.Rows.Count > 0)
                 if (dt.Rows.Count > 0)
                 {
                 {
                     if (Step != null && Step.Count > 0)
                     if (Step != null && Step.Count > 0)
@@ -96,11 +98,13 @@ namespace UAS_MES_NEW.Query
                         SerialPanel.Controls.Clear();
                         SerialPanel.Controls.Clear();
                         PaintColor.Clear();
                         PaintColor.Clear();
                     }
                     }
-                    string ifRework = dt.Rows[idCount-1]["ms_ifrework"].ToString();
+                    string ifRework = dt.Rows[idCount - 1]["ms_ifrework"].ToString();
                     //执行过的步骤
                     //执行过的步骤
                     PastStep = dt.Rows[idCount - 1]["ms_paststep"].ToString();
                     PastStep = dt.Rows[idCount - 1]["ms_paststep"].ToString();
                     //下一步骤
                     //下一步骤
                     nextStepCode = dt.Rows[idCount - 1]["ms_nextstepcode"].ToString();
                     nextStepCode = dt.Rows[idCount - 1]["ms_nextstepcode"].ToString();
+                    //序列号所属抽检批
+                    checkno = dt.Rows[idCount - 1]["ms_checkno"].ToString();
                     //如果为不良的时候
                     //如果为不良的时候
                     string BadStep = "";
                     string BadStep = "";
                     string RejectStep = "";
                     string RejectStep = "";
@@ -175,7 +179,7 @@ namespace UAS_MES_NEW.Query
                     for (int i = 0; i < dt.Rows.Count; i++)
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
                     {
                         //正在生产的途程才算
                         //正在生产的途程才算
-                        if (dt.Rows[i]["ms_id"].ToString()==ms_id.Rows[ms_id.Rows.Count-1]["ms_id"].ToString())
+                        if (dt.Rows[i]["ms_id"].ToString() == ms_id.Rows[ms_id.Rows.Count - 1]["ms_id"].ToString())
                         {
                         {
                             if (nextStepCode == dt.Rows[i]["CD_STEPCODE"].ToString())
                             if (nextStepCode == dt.Rows[i]["CD_STEPCODE"].ToString())
                             {
                             {
@@ -232,7 +236,22 @@ namespace UAS_MES_NEW.Query
                                 if (i < index)
                                 if (i < index)
                                 {
                                 {
                                     //已执行
                                     //已执行
-                                    PaintColor.Add(Brushes.Green);
+                                    //判断是否为OQC工序
+                                    string st_ifoqc = dh.getFieldDataByCondition("Step", "st_ifoqc", "st_code = '" + dt.Rows[i]["CD_STEPCODE"].ToString() + "'").ToString();
+                                    if (st_ifoqc == "-1")
+                                    {
+                                        string oqcpass = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + checkno + "'").ToString();
+                                        if (oqcpass == "OK")
+                                        {
+                                            PaintColor.Add(Brushes.Green);
+                                        }
+                                        else
+                                        {
+                                            PaintColor.Add(Brushes.White);
+                                        }
+                                    }
+                                    else
+                                        PaintColor.Add(Brushes.Green);
                                 }
                                 }
                                 else
                                 else
                                 {
                                 {
@@ -275,17 +294,17 @@ namespace UAS_MES_NEW.Query
                     StringBuilder mp_sncodes = new StringBuilder();
                     StringBuilder mp_sncodes = new StringBuilder();
                     StringBuilder makecodes = new StringBuilder();
                     StringBuilder makecodes = new StringBuilder();
                     //拼接序列号的和工单号的
                     //拼接序列号的和工单号的
-                    for (int i=0;i<ListA.Rows.Count;i++)
+                    for (int i = 0; i < ListA.Rows.Count; i++)
                     {
                     {
                         //sql  mp_sncode
                         //sql  mp_sncode
-                        mp_sncodes.Append("'" + ListA.Rows[i]["ms_sncode"].ToString() + "',"+(ListA.Rows[i]["ms_firstsn"].ToString()==""?"":(" '"+ListA.Rows[i]["ms_firstsn"].ToString()+"',")));
+                        mp_sncodes.Append("'" + ListA.Rows[i]["ms_sncode"].ToString() + "'," + (ListA.Rows[i]["ms_firstsn"].ToString() == "" ? "" : (" '" + ListA.Rows[i]["ms_firstsn"].ToString() + "',")));
                         //sql ma_code
                         //sql ma_code
-                        makecodes.Append("'"+ListA.Rows[i]["ms_makecode"].ToString()+"',");
+                        makecodes.Append("'" + ListA.Rows[i]["ms_makecode"].ToString() + "',");
                     }
                     }
                     sql.Clear();
                     sql.Clear();
                     sql.Append("select mp_makecode,ma_prodcode,sc_linecode,ma_craftcode,mp_sourcecode,mp_sncode,");
                     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_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 in ("+mp_sncodes.ToString().Substring(0,mp_sncodes.ToString().Length-1)+") and ma_code in (" + makecodes.ToString().Substring(0,makecodes.ToString().Length-1)+ ") order by mp_indate");
+                    sql.Append("mp_sourcecode=sc_code where mp_sncode in (" + mp_sncodes.ToString().Substring(0, mp_sncodes.ToString().Length - 1) + ") and ma_code in (" + makecodes.ToString().Substring(0, makecodes.ToString().Length - 1) + ") order by mp_indate");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
                     BaseUtil.FillDgvWithDataTable(CraftInfDgv, dt);
                 }
                 }
@@ -355,7 +374,7 @@ namespace UAS_MES_NEW.Query
                             //如果是一行中的箭头
                             //如果是一行中的箭头
                             if (j + 1 < RectangleCountEachRow * i)
                             if (j + 1 < RectangleCountEachRow * i)
                             {
                             {
-                                g.DrawLine(p, SerialPanel.AutoScrollPosition.X+ x + r.Width + 10, SerialPanel.AutoScrollPosition.Y + y + r.Height / 2, SerialPanel.AutoScrollPosition.X + x + ScreenWidth / (RectangleCountEachRow), SerialPanel.AutoScrollPosition.Y + y + r.Height / 2);
+                                g.DrawLine(p, SerialPanel.AutoScrollPosition.X + x + r.Width + 10, SerialPanel.AutoScrollPosition.Y + y + r.Height / 2, SerialPanel.AutoScrollPosition.X + x + ScreenWidth / (RectangleCountEachRow), SerialPanel.AutoScrollPosition.Y + y + r.Height / 2);
                                 x += ScreenWidth / RectangleCountEachRow;
                                 x += ScreenWidth / RectangleCountEachRow;
                             }
                             }
                             //如果是行的最后一个的箭头
                             //如果是行的最后一个的箭头

+ 2 - 1
UAS_MES_NEW/FunctionCode/SystemSetting/SystemSetting_ScaleTest.cs

@@ -24,6 +24,7 @@ namespace UAS_MES_NEW.SystemSetting
         bool ReadData = true;
         bool ReadData = true;
 
 
         SerialPort serialPort1 = new SerialPort();
         SerialPort serialPort1 = new SerialPort();
+        Regex re = new Regex("\\d+.\\d+\\w+");
 
 
         public SystemSetting_ScaleTest()
         public SystemSetting_ScaleTest()
         {
         {
@@ -76,7 +77,7 @@ namespace UAS_MES_NEW.SystemSetting
                         {
                         {
                             try
                             try
                             {
                             {
-                                Weight.Text = serialPort1.ReadLine();
+                                Weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
                             }
                             }
                             catch (Exception)
                             catch (Exception)
                             {
                             {