Browse Source

拆解更换半成品物料更新此物料下一工单号字段数据

Hcsy 8 years ago
parent
commit
cca21935af
1 changed files with 8 additions and 4 deletions
  1. 8 4
      UAS-MES/FunctionCode/Make/Make_Decompose.cs

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

@@ -120,7 +120,7 @@ namespace UAS_MES.Make
                 {
                     LabelDataGridView.Rows[i].Cells["cm_barcode"].Value = dh.getFieldDataByCondition("CRAFTMATERIAL", "CM_BARCODE", "cm_id = '" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
                     LabelDataGridView.Rows[i].Cells["pr_detail_"].Value = dh.getFieldDataByCondition("product", "pr_detail", "pr_code = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
-                    LabelDataGridView.Rows[i].Cells["cm_status_1"].Value = (LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString()=="-1")?"已拆解":"上线";
+                    LabelDataGridView.Rows[i].Cells["cm_status_1"].Value = (LabelDataGridView.Rows[i].Cells["cm_status"].Value.ToString() == "-1") ? "已拆解" : "上线";
                 }
             }
             else
@@ -204,7 +204,7 @@ namespace UAS_MES.Make
                                 bgcode[h] = badcodetol[h].Split(':')[0].Trim();
                                 bccode[h] = badcodetol[h].Split(':')[1].Trim();
                             }
-                        }  
+                        }
                         if (change.Checked)
                         {
                             dt1 = new DataTable();
@@ -237,16 +237,20 @@ namespace UAS_MES.Make
                                 if (sp_tracekind != "2")
                                 {
                                     //上料校验规则判断
-                                    if (!LogicHandler.CheckSNBeforeLoad(ms_makecode.Text, LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                                    if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString(), LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                                     {
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                         LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));
                                         continue;
                                     }
+                                    if (sp_barcoderule == "TSN")
+                                    {
+                                        dh.UpdateByCondition("makeserial", "ms_nextmacode='" + LabelDataGridView.Rows[i].Cells["cm_makecode"].Value.ToString() + "'", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "')");
+                                    }
                                 }
                                 else
                                 {
-                                    if (!dh.CheckExist("makesourcestock"," (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'"))
+                                    if (!dh.CheckExist("makesourcestock", " (MSS_FPRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "' or MSS_PRODCODE = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "') and mss_barcode = '" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "'"))
                                     {
                                         OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value.ToString() + "岗位备料无条码" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + "\n", Color.Red);
                                         continue;