瀏覽代碼

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

Hcsy 8 年之前
父節點
當前提交
1a26c93b09

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -133,10 +133,10 @@ namespace UAS_MES.Make
                     if (PR_CHECKCARTONW != "0" && PA_STANDARDQTY == PA_CURRENTQTY)
                     {
                         //称量合格或不合格都记录重量
-                        if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
+                        if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight && ActualWeight != 0)
                         {
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量合格:" + weight.Text.Trim(), outboxcode.Text, "");
-                            LogicHandler.RecordProdWeight(outboxcode.Text,"CARTON", float.Parse(ActualWeight.ToString()),"kg",User.UserLineCode,pr_code.Text,User.UserSourceCode,User.UserName);
+                            LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
                             OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
                         }
                         else

+ 26 - 26
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.Designer.cs

@@ -125,7 +125,7 @@
             // 
             this.pa_code_label.AutoSize = true;
             this.pa_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_code_label.Location = new System.Drawing.Point(17, 64);
+            this.pa_code_label.Location = new System.Drawing.Point(17, 63);
             this.pa_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_code_label.Name = "pa_code_label";
             this.pa_code_label.Size = new System.Drawing.Size(52, 27);
@@ -136,7 +136,7 @@
             // 
             this.PrintList_label.AutoSize = true;
             this.PrintList_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintList_label.Location = new System.Drawing.Point(9, 63);
+            this.PrintList_label.Location = new System.Drawing.Point(9, 62);
             this.PrintList_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintList_label.Name = "PrintList_label";
             this.PrintList_label.Size = new System.Drawing.Size(112, 27);
@@ -147,7 +147,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintNum_label.Location = new System.Drawing.Point(244, 154);
+            this.PrintNum_label.Location = new System.Drawing.Point(244, 153);
             this.PrintNum_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(52, 27);
@@ -193,7 +193,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(9, 110);
+            this.label3.Location = new System.Drawing.Point(9, 109);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(92, 27);
@@ -409,7 +409,7 @@
             // 
             this.OutBoxLength_label.AutoSize = true;
             this.OutBoxLength_label.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLength_label.Location = new System.Drawing.Point(137, 25);
+            this.OutBoxLength_label.Location = new System.Drawing.Point(137, 24);
             this.OutBoxLength_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.OutBoxLength_label.Name = "OutBoxLength_label";
             this.OutBoxLength_label.Size = new System.Drawing.Size(46, 24);
@@ -474,7 +474,7 @@
             // 
             this.pa_currentqty_label.AutoSize = true;
             this.pa_currentqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty_label.Location = new System.Drawing.Point(292, 111);
+            this.pa_currentqty_label.Location = new System.Drawing.Point(292, 110);
             this.pa_currentqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty_label.Name = "pa_currentqty_label";
             this.pa_currentqty_label.Size = new System.Drawing.Size(92, 27);
@@ -485,7 +485,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(292, 149);
+            this.pr_detail_label.Location = new System.Drawing.Point(292, 148);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
@@ -496,7 +496,7 @@
             // 
             this.pa_currentqty.AutoSize = true;
             this.pa_currentqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty.Location = new System.Drawing.Point(404, 111);
+            this.pa_currentqty.Location = new System.Drawing.Point(404, 110);
             this.pa_currentqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty.Name = "pa_currentqty";
             this.pa_currentqty.Size = new System.Drawing.Size(0, 27);
@@ -506,7 +506,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(17, 149);
+            this.pr_code_label.Location = new System.Drawing.Point(17, 148);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(92, 27);
@@ -517,7 +517,7 @@
             // 
             this.pr_detail.AutoSize = true;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(404, 149);
+            this.pr_detail.Location = new System.Drawing.Point(404, 148);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -527,7 +527,7 @@
             // 
             this.pr_outboxinnerqty_label.AutoSize = true;
             this.pr_outboxinnerqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(17, 111);
+            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(17, 110);
             this.pr_outboxinnerqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_outboxinnerqty_label.Name = "pr_outboxinnerqty_label";
             this.pr_outboxinnerqty_label.Size = new System.Drawing.Size(92, 27);
@@ -538,7 +538,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(136, 149);
+            this.pr_code.Location = new System.Drawing.Point(136, 148);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -549,7 +549,7 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Location = new System.Drawing.Point(297, 64);
+            this.AutoGenBoxCode.Location = new System.Drawing.Point(297, 63);
             this.AutoGenBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(114, 31);
@@ -609,7 +609,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(371, 21);
+            this.label1.Location = new System.Drawing.Point(371, 20);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(92, 27);
@@ -621,7 +621,7 @@
             this.checkweightlabel.AutoSize = true;
             this.checkweightlabel.CutLength = null;
             this.checkweightlabel.ForeColor = System.Drawing.Color.Black;
-            this.checkweightlabel.Location = new System.Drawing.Point(147, 24);
+            this.checkweightlabel.Location = new System.Drawing.Point(147, 23);
             this.checkweightlabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.checkweightlabel.MaximumSize = new System.Drawing.Size(267, 0);
             this.checkweightlabel.Name = "checkweightlabel";
@@ -632,7 +632,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(479, 110);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(479, 109);
             this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 27);
@@ -642,7 +642,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty.Location = new System.Drawing.Point(479, 63);
+            this.ob_batchqty.Location = new System.Drawing.Point(479, 62);
             this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 27);
@@ -652,7 +652,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(371, 110);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(371, 109);
             this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(92, 27);
@@ -663,7 +663,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty_label.Location = new System.Drawing.Point(371, 63);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(371, 62);
             this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(92, 27);
@@ -715,7 +715,7 @@
             // 
             this.ob_checkno.AutoSize = true;
             this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_checkno.Location = new System.Drawing.Point(479, 21);
+            this.ob_checkno.Location = new System.Drawing.Point(479, 20);
             this.ob_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_checkno.Name = "ob_checkno";
             this.ob_checkno.Size = new System.Drawing.Size(0, 27);
@@ -769,7 +769,7 @@
             // 
             this.pr_cartonunit1.AutoSize = true;
             this.pr_cartonunit1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit1.Location = new System.Drawing.Point(115, 148);
+            this.pr_cartonunit1.Location = new System.Drawing.Point(115, 159);
             this.pr_cartonunit1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit1.Name = "pr_cartonunit1";
             this.pr_cartonunit1.Size = new System.Drawing.Size(25, 27);
@@ -782,7 +782,7 @@
             // 
             this.pr_cartonunit.AutoSize = true;
             this.pr_cartonunit.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit.Location = new System.Drawing.Point(73, 21);
+            this.pr_cartonunit.Location = new System.Drawing.Point(73, 32);
             this.pr_cartonunit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit.Name = "pr_cartonunit";
             this.pr_cartonunit.Size = new System.Drawing.Size(25, 27);
@@ -794,7 +794,7 @@
             // 
             this.pr_cartonboxgw.AutoSize = true;
             this.pr_cartonboxgw.Font = new System.Drawing.Font("微软雅黑", 35F);
-            this.pr_cartonboxgw.Location = new System.Drawing.Point(33, 200);
+            this.pr_cartonboxgw.Location = new System.Drawing.Point(33, 211);
             this.pr_cartonboxgw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonboxgw.Name = "pr_cartonboxgw";
             this.pr_cartonboxgw.Size = new System.Drawing.Size(0, 78);
@@ -804,7 +804,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(17, 148);
+            this.label4.Location = new System.Drawing.Point(17, 159);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(92, 27);
@@ -816,7 +816,7 @@
             this.weight.AutoSize = true;
             this.weight.Font = new System.Drawing.Font("微软雅黑", 35F);
             this.weight.ForeColor = System.Drawing.Color.DarkGreen;
-            this.weight.Location = new System.Drawing.Point(31, 65);
+            this.weight.Location = new System.Drawing.Point(31, 73);
             this.weight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.weight.Name = "weight";
             this.weight.Size = new System.Drawing.Size(0, 78);
@@ -826,7 +826,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(17, 21);
+            this.label2.Location = new System.Drawing.Point(17, 32);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(52, 27);

+ 4 - 4
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -39,7 +39,7 @@ namespace UAS_MES.Make
         //最小重量
         double MinWeight;
 
-        string ActWeigh;
+        string ActWeigh = "0";
 
         decimal StandardQTY = 0;
 
@@ -245,7 +245,7 @@ namespace UAS_MES.Make
                             oMsStatus = dt.Rows[0]["ms_status"].ToString();
                             oMakeCode = dt.Rows[0]["ms_makecode"].ToString();
                         }
-                        // PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
+                        //PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         sql.Clear();
                         sql.Append("select nvl(ms_iostatus,0) ms_iostatus,ms_outno,ms_makecode,ms_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_sccode,pa_checkno,pr_packrule,");
                         sql.Append("nvl(pr_outboxinnerqty,0)pr_outboxinnerqty from makeserial left join product on ms_prodcode=pr_code left join packagedetail ");
@@ -415,7 +415,7 @@ namespace UAS_MES.Make
                                         float weigh = float.Parse(ActWeigh);
                                         if (PR_CHECKCARTONW != "0")
                                         {
-                                            if (!(weigh >= MinWeight && weigh <= MaxWeight))
+                                            if (!(weigh >= MinWeight && weigh <= MaxWeight) || weigh == 0)
                                             {
                                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
                                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
@@ -504,7 +504,7 @@ namespace UAS_MES.Make
                     {
                         ActWeigh = weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim();
                         float weigh = float.Parse(ActWeigh);
-                        if (!(weigh >= MinWeight && weigh <= MaxWeight))
+                        if (!(weigh >= MinWeight && weigh <= MaxWeight) || weigh == 0)
                         {
                             OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量,不能完成工序过站\n", Color.Red);
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");

+ 21 - 130
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -39,8 +39,6 @@ namespace UAS_MES.Make
         //存放包含IMEI的规则的值,方便拼接
         StringBuilder imei = new StringBuilder();
         LogStringBuilder logsql = new LogStringBuilder();
-        //存储最后插入数据库的赋值语句部分
-        StringBuilder s1 = new StringBuilder();
         //存放工单中数量
         int ma_qty;
         //存放所有关联信息的类型和录入的值
@@ -54,12 +52,6 @@ namespace UAS_MES.Make
 
         DataTable macRange;//记录macBT范围
 
-        StringBuilder insertSninfoFields;//存插入sninfo的字段
-
-        StringBuilder insertSninfoValues;//存插入sninfo的值
-
-        StringBuilder toSi;//存更新sninfo的值
-
         string macOrBt = "";//存储去掉":"或者"-"的mac和bt
 
         string imeif = "";
@@ -266,9 +258,6 @@ namespace UAS_MES.Make
                                 }
                                 //step+1
                                 step = 2;
-                                insertSninfoFields = new StringBuilder();
-                                insertSninfoValues = new StringBuilder();
-                                toSi = new StringBuilder();
                             }
                             else
                             {
@@ -436,10 +425,6 @@ namespace UAS_MES.Make
                     }
                     //通过校验,将包含IMEI的值拼接
                     imei.Append("'" + imeif + "',");
-                    s1.Append("MS_" + type + " = '" + imeif + "',");
-                    insertSninfoFields.Append("si_" + type + ",");
-                    insertSninfoValues.Append("'" + imeif + "',");
-                    toSi.Append("si_" + type + " = '" + imeif + "',");
                     break;
                 case "BT":
                 case "MAC":
@@ -467,11 +452,6 @@ namespace UAS_MES.Make
                             return false;
                         }
                     }
-                    //通过校验,将包含IMEI的值拼接
-                    s1.Append("MS_" + type + " = '" + macOrBt + "',");
-                    insertSninfoFields.Append("si_" + type + ",");
-                    insertSninfoValues.Append("'" + macOrBt + "',");
-                    toSi.Append("si_" + type + " = '" + macOrBt + "',");
                     break;
                 case "NETCODE":
                     if (checkExist("MS_" + type + "='" + imeif + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'"))
@@ -490,11 +470,6 @@ namespace UAS_MES.Make
                             return false;
                         }
                     }
-                    //通过校验,将包含IMEI的值拼接
-                    s1.Append("MS_" + type + " = '" + imeif + "',");
-                    insertSninfoFields.Append("si_" + type + ",");
-                    insertSninfoValues.Append("'" + imeif + "',");
-                    toSi.Append("si_" + type + " = '" + imeif + "',");
                     break;
             }
             //满足规则,则采集
@@ -509,95 +484,33 @@ namespace UAS_MES.Make
             //说明已经是最后一个校验规则
             if (step == ListA.Rows.Count + 1)
             {
-                //校验已经完成,此时要再次校验之前的SN和关联采集信息
-                //再次校验SN
-                if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_id='" + oMsid + "' and  ms_sncode='" + SN + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + SN + "'") || (!ChangeResult.Checked && (TSN == SN)))
+                //通过存储过程二次校验
+                if (LogicHandler.snChangeAndBurn(TSN,SN,User.UserSourceCode,User.UserCode,ms_macode.Text,ChangeResult.Checked?1:0,(hs.ContainsKey("IMEI1")?hs["IMEI1"].ToString():""), (hs.ContainsKey("IMEI2") ? hs["IMEI2"].ToString() : ""), (hs.ContainsKey("IMEI3") ? hs["IMEI3"].ToString() : ""),"", (hs.ContainsKey("NETCODE") ? hs["NETCODE"].ToString() : ""),"","","","", (hs.ContainsKey("MAC") ? hs["MAC"].ToString() : ""), (hs.ContainsKey("BT") ? hs["BT"].ToString() : ""),"","","",out errorMessage))
                 {
-                    bool flag = true;
-                    //遍历判断已采集的信息是否已存在
-                    foreach (DictionaryEntry de in hs)
+                    OperateResult.AppendText("<<序列号转换成功\n<<关联采集成功\n", Color.Green);
+                    //写入日志
+                    LogManager.DoLog("修改序列号:" + TSN + "为" + SN + "成功!" + "操作人:" + User.UserCode);
+                    //记录日志
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_macode.Text, User.UserLineCode, User.UserSourceCode, "序列烧录转换", "转换成功", TSN, "");
+                    //获取剩余数,刷新页面
+                    sql.Clear();
+                    sql.Append("select mcd_inqty from makecraftdetail where mcd_macode='" + ms_macode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    if (dt.Rows.Count > 0)
                     {
-                        if (dh.CheckExist("makeserial", "MS_" + (de.Key.ToString()) + "='" + de.Value + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'"))
-                        {
-                            flag = false;
-                            OperateResult.AppendText("<<" + de.Key + "已被使用,请重新输入TSN,重新转换\n", Color.Red);
-                            //清空信息
-                            clearInfo();
-                            break;
-                        }
-                        else
-                        {
-                            //校验sninfo中是否存在
-                            if (dh.CheckExist("sninfo", "si_" + (de.Key.ToString()) + "='" + de.Value + "' and si_id <>'" + siid + "'"))
-                            {
-                                flag = false;
-                                OperateResult.AppendText("<<" + de.Key + "已被使用,请重新输入TSN,重新转换\n", Color.Red);
-                                //清空信息
-                                clearInfo();
-                                break;
-                            }
-                        }
-                    }
-
-                    //根据flag判断关联采集信息二次校验结果
-                    if (flag == true)
-                    {
-                        //说明SN和关联采集信息二次校验通过,则进行转换和采集信息绑定
-                        string firstsn = "";
-                        string updateSql = "";
-                        //勾选了修改转换结果
-                        if (ChangeResult.Checked)
-                        {
-                            //查询ms_firstsn
-                            firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_id='" + oMsid + "' and  ms_beforesn='" + TSN + "'").ToString();
-                            //记录本次修改,存入makesnrelation表中
-                            updateSql = "update makeserial set ms_sncode='" + SN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_id='" + oMsid + "' and  ms_beforesn='" + TSN + "'";
-                            //删除最近一条转换记录
-                            dh.ExecuteSql("delete from makesnrelation where BEFORESN='" + TSN + "' and makecode='" + ms_macode.Text + "'", "delete");
-                        }
-                        //未勾选修改转换结果
-                        else
-                        {
-                            //查询ms_firstsn
-                            firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", " ms_id='" + oMsid + "' and ms_sncode='" + TSN + "'").ToString();
-                            //记录本次修改,存入makesnrelation表中
-                            updateSql = "update makeserial set ms_sncode='" + SN + "', ms_beforesn='" + TSN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_id='" + oMsid + "' and  ms_sncode='" + TSN + "'";
-                        }
-                        string insertSql = "insert into  makesnrelation (BEFORESN,SN,FIRSTSN,MAKECODE,msr_indate, msr_inman)values('" + TSN + "','" + SN + "','" + firstsn + "','" + ms_macode.Text + "', sysdate ,'" + User.UserCode + "')";
-                        dh.ExecuteSQLTran(updateSql, insertSql);
-                        OperateResult.AppendText("<<序列号转换成功\n<<关联采集成功\n", Color.Green);
-                        //写入日志
-                        LogManager.DoLog("修改序列号:" + TSN + "为" + SN + "成功!" + "操作人:" + User.UserCode);
-                        //记录日志
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_macode.Text, User.UserLineCode, User.UserSourceCode, "序列烧录转换", "转换成功", TSN, "");
-                        //写入sninfo表
-                        insert2Sninfo(SN);
-                        //输出提示用户“>>序列号转换成功”,“>>关联采集成功”
-                        //完成该道工序 setFinish
-                        if (!LogicHandler.SetStepResult(ms_macode.Text, User.UserSourceCode, SN, "序列烧录转换", "序列烧录转换成功", User.UserCode, out errorMessage))
-                        {
-                            OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red, code);
-                        }
-                        //获取剩余数,刷新页面
-                        sql.Clear();
-                        sql.Append("select mcd_inqty from makecraftdetail where mcd_macode='" + ms_macode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
-                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                        if (dt.Rows.Count > 0)
-                        {
-                            remain_qty.Text = ma_qty - int.Parse(dt.Rows[0]["mcd_inqty"].ToString()) + "";
-                        }
-                        //更新页面计数+1
-                        count.Text = int.Parse(count.Text) + 1 + "";
-                        //完成之后,清除信息
-                        clearInfo();
-                        OperateResult.AppendText(">>请输入TSN号\n", Color.Black);
+                        remain_qty.Text = ma_qty - int.Parse(dt.Rows[0]["mcd_inqty"].ToString()) + "";
                     }
+                    //更新页面计数+1
+                    count.Text = int.Parse(count.Text) + 1 + "";
+                    //完成之后,清除信息
+                    clearInfo();
+                    OperateResult.AppendText(">>请输入TSN号\n", Color.Black);
                 }
                 else
                 {
-                    OperateResult.AppendText("<<序列号" + SN + "已存在\n", Color.Red);
+                    OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red, code);
                     OperateResult.AppendText(">>请重新输入TSN\n", Color.Black, code);
-                    //清空信息
+                    //    //清空信息
                     clearInfo();
                 }
                 code.Text = "";
@@ -647,7 +560,7 @@ namespace UAS_MES.Make
                 return;
             }
             //查询表工单序列号防呆规则表
-            rules = (DataTable)dh.ExecuteSql("select msr_startno,msr_endno,msr_system,msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ms_macode.Text + "'", "select");
+            rules = (DataTable)dh.ExecuteSql("select msr_startno from makesnrule where msr_makecode='" + ms_macode.Text + "' and msr_type='after'", "select");
             if (rules.Rows.Count > 0)
             {
                 hasMakeRule = true;
@@ -701,7 +614,6 @@ namespace UAS_MES.Make
             }
             imei.Clear();
             logsql.Clear();
-            s1.Clear();
             show_sncode.Text = "";
             ChangeResult.Enabled = true;
         }
@@ -722,27 +634,6 @@ namespace UAS_MES.Make
                 OperateResult.AppendText(">>请输入TSN号\n", Color.Black);
             }
         }
-        private void insert2Sninfo(string sn)
-        {
-            //是否为空
-            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");
-            }
-            else
-            {
-                //更新sninfo
-                sql.Clear();
-                sql.Append("update sninfo set "+(ChangeResult.Checked?("si_sn='"+sn+"',"):""));
-                sql.Append(toSi.ToString().Substring(0, toSi.ToString().Length - 1));
-                sql.Append(" where si_id='" + siid + "'");
-                dh.ExecuteSql(sql.GetString(), "update");
-            }
-        }
 
         private void Make_SeqProgramTransform_SizeChanged(object sender, EventArgs e)
         {

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -333,7 +333,7 @@ namespace UAS_MES.Make
                 return;
             }
             //查询表工单序列号防呆规则表
-            rules = (DataTable)dh.ExecuteSql("select msr_startno,msr_endno,msr_system,msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ma_code.Text + "'", "select");
+            rules = (DataTable)dh.ExecuteSql("select msr_startno from makesnrule where msr_makecode='" + ma_code.Text + "' and msr_type='after'", "select");
             if (rules.Rows.Count > 0)
             {
                 hasMakeRule = true;

+ 36 - 0
UAS-MES/PublicMethod/LogicHandler.cs

@@ -1411,5 +1411,41 @@ namespace UAS_MES.PublicMethod
             }
             return true;
         }
+        /// <summary>
+        /// 序列烧录转换
+        /// </summary>
+        /// <param name="iTSN"></param>
+        /// <param name="iSN"></param>
+        /// <param name="iSourcecode"></param>
+        /// <param name="iUsercode"></param>
+        /// <param name="iMacode"></param>
+        /// <param name="iifrechange"></param>
+        /// <param name="iMEI1"></param>
+        /// <param name="iMEI2"></param>
+        /// <param name="iMEI3"></param>
+        /// <param name="iMEID"></param>
+        /// <param name="iNETCODE"></param>
+        /// <param name="iPSN"></param>
+        /// <param name="iID1"></param>
+        /// <param name="iID2"></param>
+        /// <param name="iID3"></param>
+        /// <param name="iMAC"></param>
+        /// <param name="iBT"></param>
+        /// <param name="iCODE1"></param>
+        /// <param name="iCODE2"></param>
+        /// <param name="iCODE3"></param>
+        /// <param name="oErrorMessage"></param>
+        /// <returns></returns>
+        public static bool snChangeAndBurn(string iTSN, string iSN, string iSourcecode, string iUsercode, string iMacode, int iifrechange,string iMEI1,string iMEI2,string iMEI3,string iMEID,string iNETCODE, string iPSN, string iID1, string iID2, string iID3,string iMAC,string iBT,string iCODE1,string iCODE2,string iCODE3, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            string[] param = new string[] { iTSN,iSN,iSourcecode,iUsercode,iMacode,iifrechange+"", iMEI1, iMEI2, iMEI3, iMEID, iNETCODE, iPSN, iID1, iID2, iID3,iMAC,iBT,iCODE1,iCODE2,iCODE3, oErrorMessage };
+            dh.CallProcedure("CS_SNCHANGEANDBURN", ref param);
+            oErrorMessage = param[20];
+            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null" || oErrorMessage.Contains("AFTERSUCCESS"))
+                return true;
+            else
+                return false;
+        }
     }
 }