Procházet zdrojové kódy

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

章政 před 8 roky
rodič
revize
3ee96decca
1 změnil soubory, kde provedl 27 přidání a 8 odebrání
  1. 27 8
      UAS-MES/FunctionCode/Make/Make_Decompose.cs

+ 27 - 8
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -251,10 +251,7 @@ namespace UAS_MES.Make
                             String ErrorMessage;
                             string sp_soncode = dtbar.Rows[0]["sp_soncode"].ToString();
                             string sp_prefix = dtbar.Rows[0]["sp_prefix"].ToString();
-                            string sp_regex = dtbar.Rows[0]["sp_regex"].ToString();
                             string length = dtbar.Rows[0]["sp_length"].ToString();
-                            string sp_ifforsn = dtbar.Rows[0]["sp_ifforsn"].ToString();
-                            string sp_tracekind = dtbar.Rows[0]["sp_tracekind"].ToString();
                             string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                             if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                             {
@@ -268,12 +265,34 @@ namespace UAS_MES.Make
                             sql.Append("cm_dropsccode='" + User.CurrentStepCode + "' where cm_id='" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
                             dh.ExecuteSql(sql.GetString(), "update");
                             //MakeBad表插入物料批号不良信息
+
+                            //获取物料生产类型属性
                             sql.Clear();
-                            sql.Append("insert into makebad (mb_id, mb_inman,mb_indate,mb_stepcode,mb_sourcecode,");
-                            sql.Append("mb_bgcode,mb_mscode,mb_sncode, mb_badcode, mb_makecode)");
-                            sql.Append("values (MakeBad_seq.nextval,'"+User.UserName+"',sysdate,'"+User.CurrentStepCode+"','"+User.UserSourceCode+ "',:bg_code ,'"+ LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "','"+ LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "',");
-                            sql.Append(":bc_code,'"+ms_makecode.Text+"')");
-                            dh.BatchInsert(sql.GetString(), new string[] { "bg_code", "bc_code" },bgcode,bccode);
+                            sql.Append("select cm_soncode,cm_barcode, pr_manutype from craftmaterial left join product on cm_soncode=pr_code where cm_id ='"+ LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
+                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                            string pr_manutype = dt.Rows[0]["pr_manutype"].ToString();
+                            //制造件
+                            if (pr_manutype == "MAKE")
+                            {
+                                //MakeBad表插入物料批号不良信息
+                                sql.Clear();
+                                sql.Append("insert into makebad (mb_id, mb_inman,mb_indate,mb_stepcode,mb_sourcecode,");
+                                sql.Append("mb_bgcode,mb_mscode,mb_sncode, mb_badcode, mb_makecode)");
+                                sql.Append("values (MakeBad_seq.nextval,'" + User.UserName + "',sysdate,'" + User.CurrentStepCode + "','" + User.UserSourceCode + "',:bg_code ,'" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "','" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "',");
+                                sql.Append(":bc_code,'" + ms_makecode.Text + "')");
+                                dh.BatchInsert(sql.GetString(), new string[] { "bg_code", "bc_code" }, bgcode, bccode);
+                                //更新子件序列号为待维修
+                                sql.Clear();
+                                sql.Append("update makeserial set ms_status=3 where ms_sncode='" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "' and ms_prodcode='" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
+                                dh.ExecuteSql(sql.GetString(), "update");
+                            }
+                            //采购件,则将不良信息插入不良零件表中MAKEBADRSPART
+                            else {
+                                sql.Clear();
+                                sql.Append("insert into  MAKEBADRSPART(mbp_id,mbp_indate,mbp_inman,mbp_sncode, mbp_badcode, mbp_part, mbp_makecode, mbp_sccode)values");
+                                sql.Append("(MAKEBADRSPART_seq.nextval, sysdate, '"+User.UserCode+"','"+ LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "',:bc_code,'"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "','"+ms_makecode.Text+"','"+User.UserSourceCode+"')");
+                                dh.BatchInsert(sql.GetString(), new string[] {"bc_code"},bccode);
+                            }
                             //将新批号绑定到序列号中
                             dt = (DataTable)dh.ExecuteSql("select sp_id from stepproduct where sp_mothercode='" + ms_prodcode.Text + "'", "select");
                             string sp_id = dt.Rows[0]["sp_id"].ToString();