瀏覽代碼

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 年之前
父節點
當前提交
837f50e04a

+ 38 - 16
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -28,6 +28,8 @@ namespace UAS_MES.Make
         //当前提示的索引
         int RemainIndex = 0;
 
+        List<string> RemindItem = new List<string>();
+
         string ErrorMessage = "";
 
         System.DateTime[] indate;
@@ -130,20 +132,25 @@ namespace UAS_MES.Make
                                 code.Text = "";
                             }
                             sql.Clear();
-                            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
-                            sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
-                            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,max(sp_prefix)sp_prefix,max(sp_regex)");
-                            sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
-                            sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
-                            sql.Append("And sp_mothercode ='" + pr_code.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where (cm_sncode='" + ms_firstsn + "' or ");
-                            sql.Append("cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_soncode=");
-                            sql.Append("sp_soncode and cm_status=0) group by sp_fsoncode order by SP_DETNO asc");
+                            sql.Append("select sp_id,sp_barcoderule,sp_ifuseregex,sp_ifforsn,sp_length,sp_soncode");
+                            sql.Append(",pr_detail,sp_type,sp_prefix,sp_regex,sp_fsoncode from stepproduct left join product on pr_code=sp_soncode where ");
+                            sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "'");
+                            sql.Append("And sp_mothercode ='" + pr_code.Text + "' and sp_tracekind =1 and not exists (select 1 from ");
+                            sql.Append("craftmaterial where (cm_sncode='" + ms_firstsn + "' or cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
+                            sql.Append("sp_fsoncode and cm_status=0) order by SP_DETNO asc");
                             ListA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             //获取对应 产品的机身标的打印模板
                             if (ListA.Rows.Count > 0)
                             {
-                                string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
+                                string fsoncode= ListA.Rows[RemainIndex]["sp_fsoncode"].ToString();
                                 string prdetail = ListA.Rows[RemainIndex]["pr_detail"].ToString();
+                                string soncode = "";
+                                RemindItem.Add(fsoncode);
+                                for (int i = 0; i < ListA.Rows.Count; i++)
+                                {
+                                    if (fsoncode == ListA.Rows[i]["sp_fsoncode"].ToString())
+                                        soncode += ListA.Rows[i]["sp_soncode"].ToString() + ",";
+                                }
                                 OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
                                 code.Clear();
                             }
@@ -223,9 +230,23 @@ namespace UAS_MES.Make
                         code.Clear();
                         if (RemainIndex <= ListA.Rows.Count - 1)
                         {
-                            string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
-                            string prdetail = ListA.Rows[RemainIndex]["pr_detail"].ToString();
-                            OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                            string fsoncode = ListA.Rows[RemainIndex]["sp_fsoncode"].ToString();
+                            if (RemindItem.Contains(fsoncode))
+                            {
+                                RemainIndex = RemainIndex + 1;
+                            }
+                            else
+                            {
+                                RemindItem.Add(fsoncode);
+                                string soncode = "";
+                                for (int i = 0; i < ListA.Rows.Count; i++)
+                                {
+                                    if (fsoncode == ListA.Rows[i]["sp_fsoncode"].ToString())
+                                        soncode += ListA.Rows[i]["sp_soncode"].ToString() + ",";
+                                }
+                                string prdetail = ListA.Rows[RemainIndex]["pr_detail"].ToString();
+                                OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                            }
                         }
                         if (RemainIndex == ListA.Rows.Count)
                         {
@@ -241,12 +262,11 @@ namespace UAS_MES.Make
                             //更新半成品SN已被工单使用
                             dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id=(select max(ms_id) from makeserial where ms_sncode='" + ms_sncode.Text + "' and ms_makecode<>'" + ma_code.Text + "')", "update");
                             OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的物料已经采集完成\n", Color.Green);
-                            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode.Text, int.Parse(PrintNum.Text));
                             RemainIndex = 0;
+                            RemindItem.Clear();
                             CollectData.Clear();
                             CollectDataSonCode.Clear();
-                            BaseUtil.CleanDataTable(ListA);
+                            BaseUtil.CleanDataTableData(ListA);
                             if (LogicHandler.SetTestResult(ma_code.Text, User.UserSourceCode, ms_sncode.Text, "彩盒上料打印", "彩盒上料成功", User.UserCode, out ErrorMessage))
                             {
                                 //提示正确返回时传递的信息
@@ -255,9 +275,10 @@ namespace UAS_MES.Make
                                 mcd_okqty.Text = int.Parse(mcd_okqty.Text) + 1 + "";
                                 code.Clear();
                                 LoadCollectNum();
-                                BaseUtil.CleanDataTableData(ListA);
                             }
                             else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
+                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode.Text, int.Parse(PrintNum.Text));
                             return;
                         }
                     }
@@ -300,6 +321,7 @@ namespace UAS_MES.Make
         {
             BaseUtil.CleanDataTableData(ListA);
             RemainIndex = 0;
+            RemindItem.Clear();
             code.Clear();
             OperateResult.AppendText(">>请重新采集序列号\n");
         }

+ 41 - 12
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -30,6 +30,8 @@ namespace UAS_MES.Make
         string mabomversion;
         string ErrorMessage = "";
 
+        List<string> RemindItem = new List<string>();
+
         //用于提醒的序列B
         string[] RemainList = new string[0];
         //提醒序列的索引
@@ -312,14 +314,12 @@ namespace UAS_MES.Make
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             sql.Clear();
-            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
-            sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
-            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,max(sp_prefix)sp_prefix,max(sp_regex)");
-            sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
-            sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
-            sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where (cm_sncode='" + ms_firstsn + "' or ");
-            sql.Append("cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_soncode=");
-            sql.Append("sp_soncode and cm_status=0) group by sp_fsoncode order by SP_DETNO asc");
+            sql.Append("select sp_id,sp_barcoderule,pr_detail,sp_ifuseregex,sp_ifforsn,sp_length,sp_soncode,sp_repcode");
+            sql.Append(",pr_id,sp_type,sp_prefix,sp_fsoncode,sp_regex from stepproduct left join product on pr_code=sp_soncode where ");
+            sql.Append("sp_bomversion='" + mabomversion + "' and sp_craftcode='" + ms_craftcode + "' and sp_stepcode='" + User.CurrentStepCode + "'");
+            sql.Append("And sp_mothercode ='" + make_prodcode + "' and sp_tracekind =1 and not exists (select 1 ");
+            sql.Append("from craftmaterial where (cm_sncode='" + ms_firstsn + "' or cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
+            sql.Append("sp_fsoncode and cm_status=0) order by SP_DETNO asc");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             //用于记录提醒的数据长度
@@ -328,6 +328,7 @@ namespace UAS_MES.Make
             {
                 string soncode = dt1.Rows[i]["sp_soncode"].ToString();
                 string prdetail = dt1.Rows[i]["pr_detail"].ToString();
+                string fsoncode = dt1.Rows[i]["sp_fsoncode"].ToString();
                 RemainList[i] = soncode + "(" + prdetail + ")";
             }
             if (dt1.Rows.Count > 0)
@@ -335,9 +336,19 @@ namespace UAS_MES.Make
                 try
                 {
                     CollectDataSonCode.Add(dt1.Rows[RemainIndex]["sp_soncode"].ToString());
-                    string soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
+                    string fsoncode = dt1.Rows[RemainIndex]["sp_fsoncode"].ToString();
                     string prdetail = dt1.Rows[RemainIndex]["pr_detail"].ToString();
-                    OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                    string soncode = "";
+                    for (int i = 0; i < dt1.Rows.Count; i++)
+                    {
+                        if (fsoncode == dt1.Rows[i]["sp_fsoncode"].ToString())
+                            soncode += dt1.Rows[i]["sp_soncode"].ToString() + ",";
+                    }
+                    if (!RemindItem.Contains(fsoncode))
+                    {
+                        RemindItem.Add(fsoncode);
+                        OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                    }
                 }
                 catch (Exception)
                 {
@@ -374,10 +385,26 @@ namespace UAS_MES.Make
             OperateResult.AppendText(">>物料" + sp_soncode + "采集成功\n");
             code.Clear();
             //如果+1后不小于B序列的长度,则已采集完成,不需要进行提示了
+            string fsoncode = dt1.Rows[RemainIndex]["sp_fsoncode"].ToString();
+            if (RemindItem.Contains(fsoncode))
+            {
+                RemainIndex = RemainIndex + 1;
+            }
             if (RemainIndex < RemainList.Length)
             {
-                CollectDataSonCode.Add(dt1.Rows[RemainIndex]["sp_soncode"].ToString());
-                OperateResult.AppendText("<<请采集" + RemainList[RemainIndex] + "的物料数据\n", Color.Black);
+                string soncode = "";
+                for (int i = 0; i < dt1.Rows.Count; i++)
+                {
+                    if (fsoncode == dt1.Rows[i]["sp_fsoncode"].ToString())
+                        soncode += dt1.Rows[i]["sp_soncode"].ToString()+",";
+                }
+                string prdetail = dt1.Rows[RemainIndex]["pr_detail"].ToString();
+                if (!RemindItem.Contains(fsoncode))
+                {
+                    RemindItem.Add(fsoncode);
+                    CollectDataSonCode.Add(dt1.Rows[RemainIndex]["sp_soncode"].ToString());
+                    OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                }
             }
             else
             {
@@ -405,6 +432,7 @@ namespace UAS_MES.Make
                     dh.ExecuteSql(sql.GetString(), "insert");
                 }
                 CollectData.Clear();
+                RemindItem.Clear();
                 CollectDataSonCode.Clear();
                 //采集成功,设置序列号栏目为空
                 RemainIndex = 0;
@@ -428,6 +456,7 @@ namespace UAS_MES.Make
         {
             sn_code.Clear();
             CollectData.Clear();
+            RemindItem.Clear();
             CollectDataSonCode.Clear();
             if (dt1 != null)
                 BaseUtil.CleanDataTableData(dt1);

+ 13 - 0
UAS-MES/PublicMethod/LogicHandler.cs

@@ -693,6 +693,19 @@ namespace UAS_MES.PublicMethod
                 return false;
         }
 
+        public static String GetNextStep(string iCraftCode, string iPrCode, string iStepCode)
+        {
+            sql.Clear();
+            sql.Append("select cd_nextstepcode from craft left join craftdetail on cr_id =cd_crid where ");
+            sql.Append("cr_code='" + iCraftCode + "' and cr_prodcode='" + iPrCode + "' and cd_stepcode='" + iStepCode + "'");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                return dt.Rows[0][0].ToString();
+            }
+            return "";
+        }
+
         /// <summary>
         /// 保存Mac地址和BT地址
         /// </summary>

+ 1 - 1
UAS-MES/PublicMethod/Print.cs

@@ -76,7 +76,7 @@ namespace UAS_MES.PublicMethod
                 }
                 catch (System.Exception ex)
                 {
-                    BaseUtil.ShowError(ex.Message);
+                    MessageBox.Show("SQL维护不正确");
                 }
             }
             LogManager.DoLog(sb.ToString());