章政 8 年之前
父节点
当前提交
33c15ee245

+ 6 - 0
UAS-MES/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -115,6 +115,12 @@ namespace UAS_MES.Make
                         string oMsID = "";
                         if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                         {
+                            string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
+                            if (nextstepcode != User.CurrentStepCode)
+                            {
+                                OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
+                                return;
+                            }
                             //如果未打开串口设置为0
                             //if (pr_colorboxunit.Text == "kg" && !WeightChange)
                             //{

+ 9 - 9
UAS-MES/FunctionCode/Make/Make_UpdateCollectCode.cs

@@ -82,7 +82,7 @@ namespace UAS_MES.Make
                 if (step == 0)
                 {
                     //避免第一步出错的时候添加不需要的数据
-                    if (list.Count != 0)
+                    if (list.Count!=0)
                     {
                         list.Clear();
                     }
@@ -182,7 +182,7 @@ namespace UAS_MES.Make
                                 sb.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " = '" + inputValue.Text.Replace(":", "").Replace("-", "") + "',");
                                 toSi.Append("si_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " = '" + inputValue.Text.Replace(":", "").Replace("-", "") + "',");
                                 insertSninfoFields.Append("si_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ",");
-                                insertSninfoValues.Append("'" + inputValue.Text.Replace(":", "").Replace("-", "") + "',");
+                                insertSninfoValues.Append("'"+inputValue.Text.Replace(":", "").Replace("-", "") + "',");
                                 oldData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + dt.Rows[0]["ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0]].ToString() + ",");
                                 newData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text.Replace(":", "").Replace("-", "") + ",");
                             }
@@ -197,7 +197,7 @@ namespace UAS_MES.Make
                                 return;
                             }
                             //验证长度前缀通过,验证数据库
-                            if (dh.CheckExist("makeserial", "ms_status in (0,1,2,3) and  ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " ='" + inputValue.Text + "' and ms_id <>'" + ms_id + "'"))
+                            if (dh.CheckExist("makeserial", "ms_status in (0,1,2,3) and  ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " ='" + inputValue.Text + "' and ms_id <>'"+ms_id+"'"))
                             {
                                 OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text + ":" + inputValue.Text + "错误,已被使用\n", Color.Red, inputValue);
                                 return;
@@ -206,7 +206,7 @@ namespace UAS_MES.Make
                             sb.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " = '" + inputValue.Text + "',");
                             toSi.Append("si_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " = '" + inputValue.Text + "',");
                             insertSninfoFields.Append("si_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ",");
-                            insertSninfoValues.Append("'" + inputValue.Text + "',");
+                            insertSninfoValues.Append("'"+inputValue.Text+"',");
                             oldData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + dt.Rows[0]["ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text)].ToString() + ",");
                             newData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + inputValue.Text + ",");
                             break;
@@ -225,7 +225,7 @@ namespace UAS_MES.Make
                         //更新sninfo表
                         insert2Sninfo(sncode);
                         //记录日志
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录", "原:" + oldData.ToString() + ",新:" + newData.ToString(), sncode, "");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录","原:"+oldData.ToString()+",新:" + newData.ToString(), sncode, "");
                         step = 0;
                         //清除规则
                         BaseUtil.CleanDataTableData(info);
@@ -302,15 +302,15 @@ namespace UAS_MES.Make
         private void insert2Sninfo(string sn)
         {
             //查询是否有记录
-            string siid = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", "si_sn='" + sn + "'").ToString();
+            string siid = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", "si_sn='"+sn+"'").ToString();
             //是否为空
             if (siid == "")
             {
                 //插入新的数据
                 sql.Clear();
-                sql.Append("insert into sninfo(si_id,si_sn," + insertSninfoFields.ToString().Substring(0, insertSninfoFields.ToString().Length - 1) + ") values ");
-                sql.Append("(sninfo_seq.nextval,'" + sn + "'," + insertSninfoValues.ToString().Substring(0, insertSninfoValues.ToString().Length - 1) + ")");
-                dh.ExecuteSql(sql.GetString(), "insert");
+                sql.Append("insert into sninfo(si_id,si_sn,"+ insertSninfoFields.ToString().Substring(0, insertSninfoFields.ToString().Length - 1) + ") values ");
+                sql.Append("(sninfo_seq.nextval,'"+sn+"',"+ insertSninfoValues.ToString().Substring(0, insertSninfoValues.ToString().Length - 1) + ")");
+                dh.ExecuteSql(sql.GetString(),"insert");
             }
             else
             {