Browse Source

修改维修,上料

callm 1 year ago
parent
commit
8d4ba74c3a

+ 7 - 7
UAS_MES_LGDZ/FunctionCode/Make/Make_CollectNetCode.cs

@@ -104,7 +104,7 @@ namespace UAS_MES_NEW.Make
                                 return;
                             }
                         }
-                       
+
                         OperateResult.AppendText("<<" + sncode.Text + "\n", Color.Black);
                         // 获取工单归属工单下一工序是否正确
                         if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text == "" ? oMakeCode : ms_makecode.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage2))
@@ -145,7 +145,6 @@ namespace UAS_MES_NEW.Make
                         OperateResult.AppendText(">>网标号不能为空\n", Color.Red);
                         return;
                     }
-                    #region
                     sql.Clear();
                     sql.Append("select psr_prefix,psr_length from productsnrelation where psr_prodcode = '" + ma_prodcode.Text + "' and psr_type = 'NETCODE'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -160,10 +159,11 @@ namespace UAS_MES_NEW.Make
                             return;
                         }
                     }
-                    else {
-                        OperateResult.AppendText("<<产品" + ma_prodcode.Text + "未维护网标关联信息\n", Color.Red,sncode);
+                    else
+                    {
+                        OperateResult.AppendText("<<产品" + ma_prodcode.Text + "未维护网标关联信息\n", Color.Red, sncode);
+                        return;
                     }
-                    #endregion
                     OperateResult.AppendText("<<" + sncode.Text + "\n", Color.Black);
                     string ErrorMessage = "";
                     string result = "";
@@ -199,11 +199,11 @@ namespace UAS_MES_NEW.Make
                             string si_id = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", " si_sn in (select '" + sn_code + "' from dual union select sn from makesnrelation where beforesn = '" + sn_code + "' and sn <> ' '  union select beforesn from makesnrelation where sn = '" + sn_code + "' and beforesn <> ' ') ").ToString();
                             if (si_id != "")
                             {
-                                dh.BatchInsert("update  sninfo set si_netcode = :netcode,si_indate = sysdate where si_id = :osiId", new String[] { "netcode",  "osiId" }, new string[] { sncode.Text },new string[] { si_id });
+                                dh.BatchInsert("update  sninfo set si_netcode = :netcode,si_indate = sysdate where si_id = :osiId", new String[] { "netcode", "osiId" }, new string[] { sncode.Text }, new string[] { si_id });
                             }
                             else
                             {
-                                dh.BatchInsert("insert into sninfo (si_id,si_sn,si_netcode,si_indate) values (SnInfo_seq.nextval,:si_sn,:netcode,sysdate)", new String[] { "si_sn", "netcode"}, new string[] { sn_code }, new string[] { sncode.Text });
+                                dh.BatchInsert("insert into sninfo (si_id,si_sn,si_netcode,si_indate) values (SnInfo_seq.nextval,:si_sn,:netcode,sysdate)", new String[] { "si_sn", "netcode" }, new string[] { sn_code }, new string[] { sncode.Text });
                             }
                             dh.BatchInsert("update  makeserial set ms_netcode = :netcode where ms_id = :oMsId", new String[] { "netcode", "oMsId" }, new string[] { sncode.Text }, new string[] { oMsID.ToString() });
                             OperateResult.AppendText(">>网标采集完成,执行更新\n", Color.Green);

+ 8 - 8
UAS_MES_LGDZ/FunctionCode/Make/Make_FeedingCollection.cs

@@ -206,13 +206,7 @@ namespace UAS_MES_NEW.Make
                     {
                         if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
                         {
-                            string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsid + "'").ToString();
-                            if (nextstepcode != User.CurrentStepCode)
-                            {
-                                string stname = dh.getFieldDataByCondition("step", "st_name", "st_code='" + nextstepcode + "'").ToString();
-                                OperateResult.AppendText("<<序列号:" + code.Text + "下一工序是" + stname + ",不是当前岗位的工序\n", Color.Red, code);
-                                return;
-                            }
+                           
                             sql.Clear();
                             sql.Append("select ms_firstsn,cm_makecode,cm_craftcode,nvl(cm_status,0)cm_status,cm_id,cm_stepcode,");
                             sql.Append("ms_makecode,cm_mccode,cm_materialtype from craftmaterial left join makeserial on cm_makecode");
@@ -306,6 +300,13 @@ namespace UAS_MES_NEW.Make
                     OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
                     return;
                 }
+                //string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsid + "'").ToString();
+                //if (nextstepcode != User.CurrentStepCode)
+                //{
+                //    string stname = dh.getFieldDataByCondition("step", "st_name", "st_code='" + nextstepcode + "'").ToString();
+                //    OperateResult.AppendText("<<序列号:" + code.Text + "下一工序是" + stname + ",不是当前岗位的工序\n", Color.Red, code);
+                //    return;
+                //}
                 //将录入框的值给序列号
                 sn_code.Text = code.Text;
                 sql.Clear();
@@ -335,7 +336,6 @@ namespace UAS_MES_NEW.Make
                         dt = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode,ms_craftcode,ms_status,ms_nextstepcode,ms_prodcode,ms_code from makeserial where ms_sncode='" + code.Text + "' and ms_makecode<>'" + ma_code.Text + "' order by ms_id desc", "select");
                         string make_code = "";
                         string make_prodcode = "";
-                        string nextstepcode = "";
                         string ms_status = "";
                         if (dt.Rows.Count > 0)
                         {

+ 31 - 31
UAS_MES_LGDZ/FunctionCode/Make/Make_Repair.cs

@@ -567,37 +567,37 @@ namespace UAS_MES_NEW.Make
                 }
             }
             //查询拆解的物料
-            sql.Clear();
-            sql.Append("select distinct cm_soncode from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union ");
-            sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and cm_craftcode<>'" + cr_code.Text + "' and cm_makecode<>'" + ms_makecode.Text + "' and cm_status=-1 ");
-            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            //如果含有序列号物料有被拆解过
-            if (dt.Rows.Count > 0)
-            {
-                string soncode = "";
-                for (int i = 0; i < dt.Rows.Count; i++)
-                {
-                    soncode += "'" + dt.Rows[i][0].ToString() + "',";
-                }
-                //查询对应的上料记录
-                sql.Clear();
-                sql.Append("select cm_soncode from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union  select sn from ");
-                sql.Append(" makesnrelation where firstsn='" + firstsn + "') and cm_status=0 and cm_soncode in (" + soncode.Substring(0, soncode.Length - 1) + ")");
-                DataTable LoadSoncode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                //查询的结果不相等表示未完成上料
-                if (dt.Rows.Count != LoadSoncode.Rows.Count)
-                {
-                    for (int i = 0; i < LoadSoncode.Rows.Count; i++)
-                    {
-                        if (soncode.Contains(LoadSoncode.Rows[i][0].ToString()))
-                        {
-                            soncode = soncode.Replace(LoadSoncode.Rows[i][0].ToString(), "");
-                        }
-                    }
-                    OperatResult.AppendText(">>" + soncode.Replace("'", "") + "物料尚未备料,不允许回流\n", Color.Red);
-                    return;
-                }
-            }
+            //sql.Clear();
+            //sql.Append("select distinct cm_soncode from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union ");
+            //sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and cm_craftcode<>'" + cr_code.Text + "' and cm_makecode<>'" + ms_makecode.Text + "' and cm_status=-1 ");
+            //dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            ////如果含有序列号物料有被拆解过
+            //if (dt.Rows.Count > 0)
+            //{
+            //    string soncode = "";
+            //    for (int i = 0; i < dt.Rows.Count; i++)
+            //    {
+            //        soncode += "'" + dt.Rows[i][0].ToString() + "',";
+            //    }
+            //    //查询对应的上料记录
+            //    sql.Clear();
+            //    sql.Append("select cm_soncode from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union  select sn from ");
+            //    sql.Append(" makesnrelation where firstsn='" + firstsn + "') and cm_status=0 and cm_soncode in (" + soncode.Substring(0, soncode.Length - 1) + ")");
+            //    DataTable LoadSoncode = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            //    //查询的结果不相等表示未完成上料
+            //    if (dt.Rows.Count != LoadSoncode.Rows.Count)
+            //    {
+            //        for (int i = 0; i < LoadSoncode.Rows.Count; i++)
+            //        {
+            //            if (soncode.Contains(LoadSoncode.Rows[i][0].ToString()))
+            //            {
+            //                soncode = soncode.Replace(LoadSoncode.Rows[i][0].ToString(), "");
+            //            }
+            //        }
+            //        OperatResult.AppendText(">>" + soncode.Replace("'", "") + "物料尚未备料,不允许回流\n", Color.Red);
+            //        return;
+            //    }
+            //}
             dt = (DataTable)dh.ExecuteSql("select cr_id from craft where cr_statuscode='AUDITED' and cr_code='" + cr_code.Text + "'", "select");
             if (dt.Rows.Count == 0)
                 OperatResult.AppendText(">>回流工序不存在\n", Color.Red);

+ 16 - 16
UAS_MES_LGDZ/FunctionCode/Make/Make_UpdateCollectCode.cs

@@ -82,7 +82,7 @@ namespace UAS_MES_NEW.Make
                 if (step == 0)
                 {
                     //避免第一步出错的时候添加不需要的数据
-                    if (list.Count!=0)
+                    if (list.Count != 0)
                     {
                         list.Clear();
                     }
@@ -101,7 +101,7 @@ namespace UAS_MES_NEW.Make
                         return;
                     }
                     //判断TSN或者SN是否存在
-                    ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode ='" + inputValue.Text + "'").ToString();
+                    ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode ='" + inputValue.Text + "' or ms_imei1='" + inputValue.Text + "' or ms_imei2='" + inputValue.Text + "'").ToString();
                     sncode = inputValue.Text;
                     if (ms_id == "")
                     {
@@ -109,13 +109,13 @@ namespace UAS_MES_NEW.Make
                         return;
                     }
                     //查询序列号状态
-                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_makecode from makeserial where ms_id='" + ms_id + "'", "select");
+                    //dt = (DataTable)dh.ExecuteSql("select ms_status,ms_makecode from makeserial where ms_id='" + ms_id + "'", "select");
                     //序列号状态码必须是3
-                    if (dt.Rows[0]["ms_status"].ToString() != "3")
-                    {
-                        OperateResult.AppendText("<<序列号必须是待维修状态\n", Color.Red, inputValue);
-                        return;
-                    }
+                    //if (dt.Rows[0]["ms_status"].ToString() != "3")
+                    //{
+                    //    OperateResult.AppendText("<<序列号必须是待维修状态\n", Color.Red, inputValue);
+                    //    return;
+                    //}
                     sql.Clear();
                     sql.Append("select * from (select rownum rn, ms_prodcode,ms_makecode,ms_salecode,");
                     sql.Append("ms_mac,ms_imei1,ms_bt,ms_netcode,ms_imei2,ms_imei3  from makeserial ");
@@ -182,7 +182,7 @@ namespace UAS_MES_NEW.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_NEW.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_NEW.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_NEW.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_NEW.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
             {