Browse Source

修改关联替代料表

callm 6 ngày trước cách đây
mục cha
commit
453604e64f

+ 4 - 3
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionBadOnly.cs

@@ -408,9 +408,10 @@ namespace UAS_MES_NEW.Make
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and instr('" + ms_paststep + "',sp_stepcode)>0 ");
-            sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1  and  nvl(pr_prodtype,' ')<>'包装物料' and not exists(select 1 from craftmaterial where ");
-            sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union 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 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
+            sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1  and  nvl(pr_prodtype,' ')<>'包装物料' and not exists(select 1 from craftmaterial left join makematerial on cm_makecode=mm_code " +
+                "and (cm_fsoncode=mm_prodcode or instr(mm_repprodcode,cm_fsoncode)>0) where ");
+            sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and ");
+            sql.Append("(sp_fsoncode=mm_prodcode or sp_fsoncode=mm_repprodcode or cm_fsoncode=sp_fsoncode) and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             //用于记录提醒的数据长度

+ 3 - 3
UAS_MES_YDCY/FunctionCode/Make/Make_Repair67F.cs

@@ -582,9 +582,9 @@ namespace UAS_MES_NEW.Make
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ma_bomversion + "' and sp_craftcode='" + cr_code.Text + "' and instr('" + ms_paststep + "',sp_stepcode)>0 ");
-            sql.Append("And sp_mothercode ='" + ms_prodcode.Text + "' and sp_tracekind=1  and  nvl(pr_prodtype,' ')<>'包装物料' and not exists(select 1 from craftmaterial where ");
-            sql.Append("cm_sncode in (select '" + firstsn + "' from dual union select sn from makesnrelation where firstsn='" + firstsn + "') and cm_makecode='" + ms_makecode.Text + "' and cm_fsoncode=");
-            sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
+            sql.Append("And sp_mothercode ='" + ms_prodcode.Text + "' and sp_tracekind=1  and  nvl(pr_prodtype,' ')<>'包装物料' and not exists(select 1 from craftmaterial left join makematerial on cm_makecode=mm_code and (cm_fsoncode=mm_prodcode or instr(mm_repprodcode,cm_fsoncode)>0) where ");
+            sql.Append("cm_sncode in (select '" + firstsn + "' from dual union select sn from makesnrelation where firstsn='" + firstsn + "') and cm_makecode='" + ms_makecode.Text + "' and ");
+            sql.Append("(sp_fsoncode=mm_prodcode or sp_fsoncode=mm_repprodcode or cm_fsoncode=sp_fsoncode)  and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id order by SP_DETNO asc");
            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
 
             //查询拆解的物料

+ 4 - 16
UAS_MES_YDCY/FunctionCode/Packing/Packing_PackageCollectionPallet.cs

@@ -312,12 +312,6 @@ namespace UAS_MES_NEW.Packing
                             OperateResult.AppendText("当前序列号下一道工序" + nextstepcode + ",当前资源不允许采集\n", Color.Red);
                             return;
                         }
-                        string Err = "";
-                        if (!LogicHandler.CheckMaterial(sn_code.Text, out Err))
-                        {
-                            OperateResult.AppendText(">>" + Err + "\n", Color.Red);
-                            return;
-                        }
                         PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code and cr_prodcode = ms_prodcode", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         //获取序列号信息
                         sql.Clear();
@@ -1191,23 +1185,17 @@ namespace UAS_MES_NEW.Packing
                         {
                             try
                             {
-                                //int len = serialPort1.BytesToRead;
-                                //Byte[] readBuffer = new Byte[len];
-                                //serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
-                                //string weigh = Encoding.Default.GetString(readBuffer);
-                                //if (weigh != "")
-                                //{
-                                //    weight.Text = re.Match(weigh).Value;
-                                //}
                                 weight.Text = re.Match(serialPort1.ReadLine()).Groups[0].Value;
+                                pa_remark.Text = weight.Text;
                             }
-                            catch (Exception)
+                            catch (Exception ex)
                             {
+                                OperateResult.AppendText(">>" + ex.Message + "\n", Color.Red);
                                 GetData = false;
                             }
                         }
                     }
-                    catch (IOException ex) { MessageBox.Show(ex.Message); }
+                    catch (IOException ex) { OperateResult.AppendText(">>" + ex.Message + "\n", Color.Red); }
                 }
                 else OperateResult.AppendText(">>端口已被占用,请关闭其他窗口\n", Color.Red);
             }

+ 3 - 1
UAS_MES_YDCY/FunctionCode/Packing/Packing_PalletWightCollection.cs

@@ -770,9 +770,11 @@ namespace UAS_MES_NEW.Packing
                             try
                             {
                                 weight.Text = re.Match(serialPort1.ReadLine()).Groups[0].Value;
+                                pa_remark.Text = weight.Text;
                             }
-                            catch (Exception)
+                            catch (IOException ex)
                             {
+                                { OperateResult.AppendText(">>" + ex.Message + "\n", Color.Red, outboxcode); }
                                 GetData = false;
                             }
                         }

+ 6 - 6
UAS_MES_YDCY/PublicMethod/LogicHandler.cs

@@ -92,9 +92,9 @@ namespace UAS_MES_NEW.PublicMethod
                 sql.Clear();
                 sql.Append("select wm_concat(pr_detail) sp_soncode from stepproduct left join product on pr_code=sp_fsoncode where ");
                 sql.Append("sp_bomversion='" + ms_bomversion + "' and sp_craftcode='" + ms_craftcode + "' ");
-                sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
-                sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_fsoncode=");
-                sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode)");
+                sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial left join makematerial on cm_makecode=mm_code and (cm_fsoncode=mm_prodcode or instr(mm_repprodcode,cm_fsoncode)>0) where ");
+                sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and ");
+                sql.Append("(sp_fsoncode=mm_prodcode or sp_fsoncode=mm_repprodcode or cm_fsoncode=sp_fsoncode) and cm_status=0 and cm_stepcode=sp_stepcode)");
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt1.Rows.Count > 0)
                 {
@@ -116,9 +116,9 @@ namespace UAS_MES_NEW.PublicMethod
                 sql.Clear();
                 sql.Append("select wm_concat(pr_detail) sp_soncode from stepproduct left join product on pr_code=sp_fsoncode where ");
                 sql.Append("sp_bomversion='" + ms_bomversion + "' and sp_craftcode='" + ms_craftcode + "' ");
-                sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
-                sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "')  and cm_fsoncode=");
-                sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) ");
+                sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial left join makematerial on cm_makecode=mm_code and (cm_fsoncode=mm_prodcode or instr(mm_repprodcode,cm_fsoncode)>0) where ");
+                sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and ");
+                sql.Append("(sp_fsoncode=mm_prodcode or sp_fsoncode=mm_repprodcode or cm_fsoncode=sp_fsoncode) and cm_status=0 and cm_stepcode=sp_stepcode)");
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt1.Rows.Count > 0)
                 {