소스 검색

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

Hcsy 8 년 전
부모
커밋
1b78eaa71e

+ 8 - 2
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -209,12 +209,18 @@ namespace UAS_MES.Make
                         string sp_barcoderule = ListA.Rows[RemainIndex]["sp_barcoderule"].ToString();
                         if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                         {
-                            TSN.Add(code.Text);
+                            //判断采集的条码和本次采集的也不能重复
+                            if (CollectData.Contains(code.Text))
+                            {
+                                OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red, code);
+                                return;
+                            }
+                            TSN.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                             if (sp_barcoderule == "BARCODE")
                             {
                                 sp_soncode = ErrorMessage;
                             }
-                            CollectData.Add(code.Text);
+                            CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                             SPID.Add(sp_id);
                             CollectDataSonCode.Add(sp_soncode);
                             OperateResult.AppendText(">>物料" + code.Text + "采集成功,条码号" + code.Text + "\n", Color.Green, code);

+ 9 - 3
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -144,7 +144,13 @@ namespace UAS_MES.Make
                             string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
                             if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                             {
-                                TSN.Add(code.Text);
+                                //判断采集的条码和本次采集的也不能重复
+                                if (CollectData.Contains(code.Text))
+                                {
+                                    OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red, code);
+                                    return;
+                                }
+                                TSN.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                                 if (sp_barcoderule == "BARCODE")
                                 {
                                     sp_soncode = ErrorMessage;
@@ -270,7 +276,7 @@ namespace UAS_MES.Make
                                     {
                                         CollectDataSonCode.Add(sp_soncode);
                                         SPID.Add(sp_id);
-                                        CollectData.Add(code.Text);
+                                        CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
                                         sn_code.Text = code.Text;
                                         OperateResult.AppendText(">>序列号" + code.Text + ",物料" + sp_soncode + "上料成功\n", Color.Green);
                                         RemainIndex = RemainIndex + 1;
@@ -375,7 +381,7 @@ namespace UAS_MES.Make
             CollectDataSonCode.Add(sp_soncode);
             //采集成功提示
             RemainIndex = RemainIndex + 1;
-            CollectData.Add(code.Text);
+            CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
             SPID.Add(sp_id);
             OperateResult.AppendText(">>物料" + sp_soncode + "采集成功,条码" + code.Text + "\n", Color.Green);
             code.Clear();

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

@@ -72,7 +72,7 @@ namespace UAS_MES.Make
                     OperateResult.AppendText("<<" + sncode.Text + "\n", Color.Black);
                     //查询是否存在该ms_id
                     sql.Clear();
-                    sql.Append("select max(MS_id) ms_id from makeserial where ms_sncode='" + sncode.Text + "' or ms_firstsn in (select firstsn from makesnrelation where beforesn='" + sncode.Text + "')");
+                    sql.Append("select max(ms_id) ms_id from makeserial where ms_sncode ='"+sncode.Text+"' or exists (select 1 from  makesnrelation where beforesn='"+sncode.Text+"'  and ms_makecode=makecode)");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count == 0 || dt.Rows[0]["ms_id"].ToString() == "")
                     {

+ 51 - 51
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.Designer.cs

@@ -44,6 +44,8 @@
             this.in_label = new System.Windows.Forms.Label();
             this.ClearSn_code = new System.Windows.Forms.PictureBox();
             this.sn_code_label = new System.Windows.Forms.Label();
+            this.ma_softversion = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
             this.ChangeResult = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
             this.show_sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ma_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -54,8 +56,6 @@
             this.TSNPre = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.SNLength = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.TSNLength = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
-            this.ma_softversion = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
             // 
@@ -63,7 +63,7 @@
             // 
             this.ms_macode_label.AutoSize = true;
             this.ms_macode_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ms_macode_label.Location = new System.Drawing.Point(40, 14);
+            this.ms_macode_label.Location = new System.Drawing.Point(29, 26);
             this.ms_macode_label.Name = "ms_macode_label";
             this.ms_macode_label.Size = new System.Drawing.Size(110, 31);
             this.ms_macode_label.TabIndex = 0;
@@ -73,7 +73,7 @@
             // 
             this.ma_prodcode_label.AutoSize = true;
             this.ma_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ma_prodcode_label.Location = new System.Drawing.Point(444, 14);
+            this.ma_prodcode_label.Location = new System.Drawing.Point(433, 26);
             this.ma_prodcode_label.Name = "ma_prodcode_label";
             this.ma_prodcode_label.Size = new System.Drawing.Size(110, 31);
             this.ma_prodcode_label.TabIndex = 1;
@@ -83,7 +83,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_detail_label.Location = new System.Drawing.Point(802, 14);
+            this.pr_detail_label.Location = new System.Drawing.Point(791, 26);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(110, 31);
             this.pr_detail_label.TabIndex = 2;
@@ -93,7 +93,7 @@
             // 
             this.remain_qty_label.AutoSize = true;
             this.remain_qty_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.remain_qty_label.Location = new System.Drawing.Point(40, 56);
+            this.remain_qty_label.Location = new System.Drawing.Point(29, 68);
             this.remain_qty_label.Name = "remain_qty_label";
             this.remain_qty_label.Size = new System.Drawing.Size(86, 31);
             this.remain_qty_label.TabIndex = 3;
@@ -103,7 +103,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.PrintNum_label.Location = new System.Drawing.Point(444, 56);
+            this.PrintNum_label.Location = new System.Drawing.Point(433, 68);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(62, 31);
             this.PrintNum_label.TabIndex = 4;
@@ -113,7 +113,7 @@
             // 
             this.ms_macode.AutoSize = true;
             this.ms_macode.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ms_macode.Location = new System.Drawing.Point(152, 14);
+            this.ms_macode.Location = new System.Drawing.Point(141, 26);
             this.ms_macode.Name = "ms_macode";
             this.ms_macode.Size = new System.Drawing.Size(0, 31);
             this.ms_macode.TabIndex = 5;
@@ -123,7 +123,7 @@
             // 
             this.remain_qty.AutoSize = true;
             this.remain_qty.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.remain_qty.Location = new System.Drawing.Point(152, 55);
+            this.remain_qty.Location = new System.Drawing.Point(141, 67);
             this.remain_qty.Name = "remain_qty";
             this.remain_qty.Size = new System.Drawing.Size(0, 31);
             this.remain_qty.TabIndex = 6;
@@ -132,7 +132,7 @@
             // 
             this.count.AutoSize = true;
             this.count.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.count.Location = new System.Drawing.Point(556, 56);
+            this.count.Location = new System.Drawing.Point(545, 68);
             this.count.Name = "count";
             this.count.Size = new System.Drawing.Size(28, 31);
             this.count.TabIndex = 8;
@@ -142,7 +142,7 @@
             // 
             this.TSNLength_checkBox.AutoSize = true;
             this.TSNLength_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.TSNLength_checkBox.Location = new System.Drawing.Point(46, 100);
+            this.TSNLength_checkBox.Location = new System.Drawing.Point(37, 121);
             this.TSNLength_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.TSNLength_checkBox.Name = "TSNLength_checkBox";
             this.TSNLength_checkBox.Size = new System.Drawing.Size(117, 31);
@@ -154,7 +154,7 @@
             // 
             this.SNLength_checkBox.AutoSize = true;
             this.SNLength_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.SNLength_checkBox.Location = new System.Drawing.Point(46, 146);
+            this.SNLength_checkBox.Location = new System.Drawing.Point(37, 167);
             this.SNLength_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SNLength_checkBox.Name = "SNLength_checkBox";
             this.SNLength_checkBox.Size = new System.Drawing.Size(106, 31);
@@ -166,7 +166,7 @@
             // 
             this.TSNPre_checkBox.AutoSize = true;
             this.TSNPre_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.TSNPre_checkBox.Location = new System.Drawing.Point(450, 100);
+            this.TSNPre_checkBox.Location = new System.Drawing.Point(642, 120);
             this.TSNPre_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.TSNPre_checkBox.Name = "TSNPre_checkBox";
             this.TSNPre_checkBox.Size = new System.Drawing.Size(117, 31);
@@ -178,7 +178,7 @@
             // 
             this.SNPre_checkBox.AutoSize = true;
             this.SNPre_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.SNPre_checkBox.Location = new System.Drawing.Point(450, 148);
+            this.SNPre_checkBox.Location = new System.Drawing.Point(642, 168);
             this.SNPre_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SNPre_checkBox.Name = "SNPre_checkBox";
             this.SNPre_checkBox.Size = new System.Drawing.Size(106, 31);
@@ -190,7 +190,7 @@
             // 
             this.tip.AutoSize = true;
             this.tip.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
-            this.tip.Location = new System.Drawing.Point(43, 182);
+            this.tip.Location = new System.Drawing.Point(29, 207);
             this.tip.Name = "tip";
             this.tip.Size = new System.Drawing.Size(158, 31);
             this.tip.TabIndex = 18;
@@ -200,7 +200,7 @@
             // 
             this.in_label.AutoSize = true;
             this.in_label.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.in_label.Location = new System.Drawing.Point(43, 523);
+            this.in_label.Location = new System.Drawing.Point(29, 625);
             this.in_label.Name = "in_label";
             this.in_label.Size = new System.Drawing.Size(86, 31);
             this.in_label.TabIndex = 21;
@@ -210,7 +210,7 @@
             // 
             this.ClearSn_code.Cursor = System.Windows.Forms.Cursors.Hand;
             this.ClearSn_code.Image = global::UAS_MES.Properties.Resources.bindingNavigatorDeleteItem_Image;
-            this.ClearSn_code.Location = new System.Drawing.Point(414, 481);
+            this.ClearSn_code.Location = new System.Drawing.Point(400, 572);
             this.ClearSn_code.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.ClearSn_code.Name = "ClearSn_code";
             this.ClearSn_code.Size = new System.Drawing.Size(24, 24);
@@ -222,18 +222,38 @@
             // 
             this.sn_code_label.AutoSize = true;
             this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sn_code_label.Location = new System.Drawing.Point(43, 481);
+            this.sn_code_label.Location = new System.Drawing.Point(29, 572);
             this.sn_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.sn_code_label.Name = "sn_code_label";
             this.sn_code_label.Size = new System.Drawing.Size(86, 31);
             this.sn_code_label.TabIndex = 142;
             this.sn_code_label.Text = "序列号";
             // 
+            // ma_softversion
+            // 
+            this.ma_softversion.AutoSize = true;
+            this.ma_softversion.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.ma_softversion.Location = new System.Drawing.Point(911, 56);
+            this.ma_softversion.Name = "ma_softversion";
+            this.ma_softversion.Size = new System.Drawing.Size(0, 31);
+            this.ma_softversion.TabIndex = 150;
+            // 
+            // label2
+            // 
+            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(790, 68);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(110, 31);
+            this.label2.TabIndex = 149;
+            this.label2.Text = "软件版本";
+            // 
             // ChangeResult
             // 
             this.ChangeResult.AutoSize = true;
             this.ChangeResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChangeResult.Location = new System.Drawing.Point(414, 524);
+            this.ChangeResult.Location = new System.Drawing.Point(400, 620);
             this.ChangeResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ChangeResult.Name = "ChangeResult";
             this.ChangeResult.Power = "ifspecial";
@@ -250,7 +270,7 @@
             this.show_sncode.Enabled = false;
             this.show_sncode.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.show_sncode.ID = null;
-            this.show_sncode.Location = new System.Drawing.Point(138, 481);
+            this.show_sncode.Location = new System.Drawing.Point(124, 572);
             this.show_sncode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.show_sncode.Name = "show_sncode";
             this.show_sncode.Power = null;
@@ -265,7 +285,7 @@
             this.ma_prodcode.AutoSize = true;
             this.ma_prodcode.CutLength = null;
             this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_prodcode.Location = new System.Drawing.Point(554, 14);
+            this.ma_prodcode.Location = new System.Drawing.Point(543, 26);
             this.ma_prodcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.ma_prodcode.MaximumSize = new System.Drawing.Size(164, 0);
             this.ma_prodcode.Name = "ma_prodcode";
@@ -290,7 +310,7 @@
             this.code.BackColor = System.Drawing.Color.White;
             this.code.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.code.ID = null;
-            this.code.Location = new System.Drawing.Point(138, 526);
+            this.code.Location = new System.Drawing.Point(124, 622);
             this.code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.code.Name = "code";
             this.code.Power = null;
@@ -304,10 +324,10 @@
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 15F);
-            this.OperateResult.Location = new System.Drawing.Point(46, 221);
+            this.OperateResult.Location = new System.Drawing.Point(35, 249);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1153, 240);
+            this.OperateResult.Size = new System.Drawing.Size(1153, 296);
             this.OperateResult.TabIndex = 19;
             this.OperateResult.Text = "";
             // 
@@ -317,11 +337,11 @@
             this.SNPre.BackColor = System.Drawing.Color.White;
             this.SNPre.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.SNPre.ID = null;
-            this.SNPre.Location = new System.Drawing.Point(584, 146);
+            this.SNPre.Location = new System.Drawing.Point(776, 166);
             this.SNPre.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SNPre.Name = "SNPre";
             this.SNPre.Power = null;
-            this.SNPre.Size = new System.Drawing.Size(210, 34);
+            this.SNPre.Size = new System.Drawing.Size(213, 34);
             this.SNPre.Str = null;
             this.SNPre.Str1 = null;
             this.SNPre.Str2 = null;
@@ -333,11 +353,11 @@
             this.TSNPre.BackColor = System.Drawing.Color.White;
             this.TSNPre.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.TSNPre.ID = null;
-            this.TSNPre.Location = new System.Drawing.Point(584, 98);
+            this.TSNPre.Location = new System.Drawing.Point(776, 118);
             this.TSNPre.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.TSNPre.Name = "TSNPre";
             this.TSNPre.Power = null;
-            this.TSNPre.Size = new System.Drawing.Size(210, 34);
+            this.TSNPre.Size = new System.Drawing.Size(213, 34);
             this.TSNPre.Str = null;
             this.TSNPre.Str1 = null;
             this.TSNPre.Str2 = null;
@@ -349,7 +369,7 @@
             this.SNLength.BackColor = System.Drawing.Color.White;
             this.SNLength.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.SNLength.ID = null;
-            this.SNLength.Location = new System.Drawing.Point(194, 144);
+            this.SNLength.Location = new System.Drawing.Point(185, 165);
             this.SNLength.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SNLength.Name = "SNLength";
             this.SNLength.Negative = false;
@@ -366,7 +386,7 @@
             this.TSNLength.BackColor = System.Drawing.Color.White;
             this.TSNLength.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.TSNLength.ID = null;
-            this.TSNLength.Location = new System.Drawing.Point(194, 98);
+            this.TSNLength.Location = new System.Drawing.Point(185, 119);
             this.TSNLength.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.TSNLength.Name = "TSNLength";
             this.TSNLength.Negative = false;
@@ -377,31 +397,11 @@
             this.TSNLength.Str2 = null;
             this.TSNLength.TabIndex = 14;
             // 
-            // ma_softversion
-            // 
-            this.ma_softversion.AutoSize = true;
-            this.ma_softversion.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ma_softversion.Location = new System.Drawing.Point(911, 56);
-            this.ma_softversion.Name = "ma_softversion";
-            this.ma_softversion.Size = new System.Drawing.Size(0, 31);
-            this.ma_softversion.TabIndex = 150;
-            // 
-            // label2
-            // 
-            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(801, 56);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(110, 31);
-            this.label2.TabIndex = 149;
-            this.label2.Text = "软件版本";
-            // 
             // Make_SeqProgramTransform
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1268, 590);
+            this.ClientSize = new System.Drawing.Size(1274, 681);
             this.Controls.Add(this.ma_softversion);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.ChangeResult);

+ 6 - 15
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -113,15 +113,12 @@ namespace UAS_MES.Make
                                 }
                                 //根据ms_id查询
                                 sql.Clear();
-                                sql.Append("select 1 from makeserial where ms_id='"+oMsid+"' and ms_beforesn='"+code.Text+"' and ms_nextmacode is null and ms_outboxcode is null");
+                                sql.Append("select ms_stepcode from makeserial where ms_id='" + oMsid+"' and ms_beforesn='"+code.Text+"' and ms_nextmacode is null and ms_outboxcode is null");
                                 dt = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
                                 //如果行数大于0则允许转号
                                 if (dt.Rows.Count > 0)
                                 {
-                                    sql.Clear();
-                                    sql.Append("select 1 from makeserial where ms_id='" + oMsid + "' and ms_stepcode='" + User.CurrentStepCode + "'");
-                                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    if (dt.Rows.Count > 0)
+                                    if (dt.Rows[0]["ms_stepcode"].ToString()==User.CurrentStepCode)
                                     {
                                         step = 1;
 
@@ -493,17 +490,11 @@ namespace UAS_MES.Make
                 case "BT":
                 case "MAC":
                     //验证是否符合合同防呆
-                    sql.Clear();
-                    sql.Append("select sr_startcode,sr_endcode from SaleMacBTRange where sr_sacode = '" + dh.getFieldDataByCondition("makeserial", "ms_salecode","ms_id='"+oMsid+"'") + "' and sr_type = '" + type + "'");
-                    macRange = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                    if (macRange.Rows.Count > 0)
+                    if (!LogicHandler.checkMacOrBtRange(oMsid,macOrBt,type))
                     {
-                        if (!(macRange.Rows[0]["sr_startcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(macOrBt) <= 0 && macRange.Rows[0]["sr_endcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(macOrBt) >= 0))
-                        {
-                            OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不在合同防呆范围内\n", Color.Red);
-                            OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code);
-                            return false;
-                        }
+                        OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不在合同防呆范围内\n", Color.Red);
+                        OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code);
+                        return false;
                     }
                     //验证是否已被使用
                     if (!ChangeResult.Checked && checkExist("MS_" + type + "='" + macOrBt + "' and  ms_status in (0,1,2,3)")

+ 37 - 37
UAS-MES/FunctionCode/Make/Make_SeqTransform.Designer.cs

@@ -44,6 +44,8 @@
             this.remain_qty_label = new System.Windows.Forms.Label();
             this.ClearSn_code = new System.Windows.Forms.PictureBox();
             this.sn_code_label = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.ma_softversion = new System.Windows.Forms.Label();
             this.ChangeResult = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
             this.show_sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -54,8 +56,6 @@
             this.beforeTransSNPre = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.sncode = new UAS_MES.CustomControl.TextBoxWithIcon.SnCollectionBox();
-            this.label2 = new System.Windows.Forms.Label();
-            this.ma_softversion = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
             this.SuspendLayout();
             // 
@@ -95,7 +95,7 @@
             // 
             this.sncode_label.AutoSize = true;
             this.sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sncode_label.Location = new System.Drawing.Point(25, 644);
+            this.sncode_label.Location = new System.Drawing.Point(25, 647);
             this.sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.sncode_label.Name = "sncode_label";
             this.sncode_label.Size = new System.Drawing.Size(86, 31);
@@ -109,9 +109,9 @@
             this.beforeTransSNLength_checkBox.Location = new System.Drawing.Point(28, 121);
             this.beforeTransSNLength_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.beforeTransSNLength_checkBox.Name = "beforeTransSNLength_checkBox";
-            this.beforeTransSNLength_checkBox.Size = new System.Drawing.Size(198, 31);
+            this.beforeTransSNLength_checkBox.Size = new System.Drawing.Size(117, 31);
             this.beforeTransSNLength_checkBox.TabIndex = 81;
-            this.beforeTransSNLength_checkBox.Text = "转换前序列号长度";
+            this.beforeTransSNLength_checkBox.Text = "TSN长度";
             this.beforeTransSNLength_checkBox.UseVisualStyleBackColor = true;
             // 
             // afterTransSNLength_checkBox
@@ -121,33 +121,33 @@
             this.afterTransSNLength_checkBox.Location = new System.Drawing.Point(28, 170);
             this.afterTransSNLength_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.afterTransSNLength_checkBox.Name = "afterTransSNLength_checkBox";
-            this.afterTransSNLength_checkBox.Size = new System.Drawing.Size(198, 31);
+            this.afterTransSNLength_checkBox.Size = new System.Drawing.Size(106, 31);
             this.afterTransSNLength_checkBox.TabIndex = 82;
-            this.afterTransSNLength_checkBox.Text = "转换后序列号长度";
+            this.afterTransSNLength_checkBox.Text = "SN长度";
             this.afterTransSNLength_checkBox.UseVisualStyleBackColor = true;
             // 
             // beforeTransSNPre_checkBox
             // 
             this.beforeTransSNPre_checkBox.AutoSize = true;
             this.beforeTransSNPre_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.beforeTransSNPre_checkBox.Location = new System.Drawing.Point(630, 119);
+            this.beforeTransSNPre_checkBox.Location = new System.Drawing.Point(632, 121);
             this.beforeTransSNPre_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.beforeTransSNPre_checkBox.Name = "beforeTransSNPre_checkBox";
-            this.beforeTransSNPre_checkBox.Size = new System.Drawing.Size(198, 31);
+            this.beforeTransSNPre_checkBox.Size = new System.Drawing.Size(117, 31);
             this.beforeTransSNPre_checkBox.TabIndex = 83;
-            this.beforeTransSNPre_checkBox.Text = "转换前序列号前缀";
+            this.beforeTransSNPre_checkBox.Text = "TSN前缀";
             this.beforeTransSNPre_checkBox.UseVisualStyleBackColor = true;
             // 
             // afterTransSNPre_checkBox
             // 
             this.afterTransSNPre_checkBox.AutoSize = true;
             this.afterTransSNPre_checkBox.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.afterTransSNPre_checkBox.Location = new System.Drawing.Point(630, 169);
+            this.afterTransSNPre_checkBox.Location = new System.Drawing.Point(632, 171);
             this.afterTransSNPre_checkBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.afterTransSNPre_checkBox.Name = "afterTransSNPre_checkBox";
-            this.afterTransSNPre_checkBox.Size = new System.Drawing.Size(198, 31);
+            this.afterTransSNPre_checkBox.Size = new System.Drawing.Size(106, 31);
             this.afterTransSNPre_checkBox.TabIndex = 84;
-            this.afterTransSNPre_checkBox.Text = "转换后序列号前缀";
+            this.afterTransSNPre_checkBox.Text = "SN前缀";
             this.afterTransSNPre_checkBox.UseVisualStyleBackColor = true;
             // 
             // label1
@@ -232,6 +232,26 @@
             this.sn_code_label.TabIndex = 139;
             this.sn_code_label.Text = "序列号";
             // 
+            // label2
+            // 
+            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(825, 76);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(110, 31);
+            this.label2.TabIndex = 147;
+            this.label2.Text = "软件版本";
+            // 
+            // ma_softversion
+            // 
+            this.ma_softversion.AutoSize = true;
+            this.ma_softversion.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.ma_softversion.Location = new System.Drawing.Point(935, 76);
+            this.ma_softversion.Name = "ma_softversion";
+            this.ma_softversion.Size = new System.Drawing.Size(0, 31);
+            this.ma_softversion.TabIndex = 148;
+            // 
             // ChangeResult
             // 
             this.ChangeResult.AutoSize = true;
@@ -289,7 +309,7 @@
             // afterTransSNLength
             // 
             this.afterTransSNLength.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.afterTransSNLength.Location = new System.Drawing.Point(267, 167);
+            this.afterTransSNLength.Location = new System.Drawing.Point(166, 172);
             this.afterTransSNLength.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.afterTransSNLength.Name = "afterTransSNLength";
             this.afterTransSNLength.Size = new System.Drawing.Size(250, 34);
@@ -299,7 +319,7 @@
             // beforeTransSNLength
             // 
             this.beforeTransSNLength.Font = new System.Drawing.Font("微软雅黑", 10F);
-            this.beforeTransSNLength.Location = new System.Drawing.Point(267, 116);
+            this.beforeTransSNLength.Location = new System.Drawing.Point(166, 121);
             this.beforeTransSNLength.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.beforeTransSNLength.Name = "beforeTransSNLength";
             this.beforeTransSNLength.Size = new System.Drawing.Size(250, 34);
@@ -312,7 +332,7 @@
             this.afterTransSNPre.BackColor = System.Drawing.Color.White;
             this.afterTransSNPre.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.afterTransSNPre.ID = null;
-            this.afterTransSNPre.Location = new System.Drawing.Point(870, 169);
+            this.afterTransSNPre.Location = new System.Drawing.Point(769, 169);
             this.afterTransSNPre.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.afterTransSNPre.Name = "afterTransSNPre";
             this.afterTransSNPre.Power = null;
@@ -328,7 +348,7 @@
             this.beforeTransSNPre.BackColor = System.Drawing.Color.White;
             this.beforeTransSNPre.Font = new System.Drawing.Font("微软雅黑", 10F);
             this.beforeTransSNPre.ID = null;
-            this.beforeTransSNPre.Location = new System.Drawing.Point(870, 119);
+            this.beforeTransSNPre.Location = new System.Drawing.Point(769, 119);
             this.beforeTransSNPre.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.beforeTransSNPre.Name = "beforeTransSNPre";
             this.beforeTransSNPre.Power = null;
@@ -366,26 +386,6 @@
             this.sncode.Tag = "IfRead";
             this.sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sncode_KeyDown);
             // 
-            // label2
-            // 
-            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(825, 76);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(110, 31);
-            this.label2.TabIndex = 147;
-            this.label2.Text = "软件版本";
-            // 
-            // ma_softversion
-            // 
-            this.ma_softversion.AutoSize = true;
-            this.ma_softversion.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ma_softversion.Location = new System.Drawing.Point(935, 76);
-            this.ma_softversion.Name = "ma_softversion";
-            this.ma_softversion.Size = new System.Drawing.Size(0, 31);
-            this.ma_softversion.TabIndex = 148;
-            // 
             // Make_SeqTransform
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);

+ 2 - 5
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -82,15 +82,12 @@ namespace UAS_MES.Make
                                 }
                                 //根据ms_id查询
                                 sql.Clear();
-                                sql.Append("select 1 from makeserial where ms_id='" + oMsId + "' and ms_beforesn='" + sncode.Text + "' and ms_nextmacode is null and ms_outboxcode is null");
+                                sql.Append("select ms_stepcode from makeserial where ms_id='" + oMsId + "' and ms_beforesn='" + sncode.Text + "' and ms_nextmacode is null and ms_outboxcode is null");
                                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 //如果行数大于0则允许转号
                                 if (dt.Rows.Count > 0)
                                 {
-                                    sql.Clear();
-                                    sql.Append("select 1 from makeserial where ms_id='" + oMsId + "' and ms_stepcode='" + User.CurrentStepCode + "'");
-                                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                    if (dt.Rows.Count > 0)
+                                    if (dt.Rows[0]["ms_stepcode"].ToString()==User.CurrentStepCode)
                                     {
                                         bsncode = sncode.Text;
                                         //显示序列号

+ 7 - 23
UAS-MES/FunctionCode/Make/Make_UpdateCollectCode.cs

@@ -160,34 +160,18 @@ namespace UAS_MES.Make
                             }
                             else
                             {
-                                //判断是否有合同号MAC范围
-                                //if (dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'"))
-                                //{
-                                //    //有范围的情况下看是否在范围内
-                                //    if (!dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and  sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "' AND  '" + inputValue.Text.Replace(":", "").Replace("-", "") + "' between sr_startcode and sr_endcode"))
-                                //    {
-                                //        OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + "错误,不在合同防呆范围内\n", Color.Red, inputValue);
-                                //        OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black);
-                                //        return;
-                                //    }
-                                //}
-                                sql.Clear();
-                                sql.Append("select sr_startcode,sr_endcode from SaleMacBTRange where sr_sacode = '" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type = '"+ ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'");
-                                macRange = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                if (macRange.Rows.Count > 0)
-                                {
-                                    if (!(macRange.Rows[0]["sr_startcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(inputValue.Text.Replace(":", "").Replace("-", "")) <= 0 && macRange.Rows[0]["sr_endcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(inputValue.Text.Replace(":", "").Replace("-", "")) >= 0))
-                                    {
-                                        OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + "错误,不在合同防呆范围内\n", Color.Red, inputValue);
-                                        OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black);
-                                        return;
-                                    }
-                                }
                                 //验证长度前缀
                                 if (!checkPrefixAndLength())
                                 {
                                     return;
                                 }
+                                //验证MAC和BT合同合同防呆
+                                if (!LogicHandler.checkMacOrBtRange(ms_id, inputValue.Text.Replace(":", "").Replace("-", ""), ((CheckBox)list[step - 1]).Text.Split('/')[0]))
+                                {
+                                    OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + "错误,不在合同防呆范围内\n", Color.Red, inputValue);
+                                    OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black);
+                                    return;
+                                }
                                 //验证长度前缀通过,验证数据库
                                 if (dh.CheckExist("makeserial", "ms_status in (0,1,2,3) and  ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " ='" + inputValue.Text.Replace(":", "").Replace("-", "") + "'"))
                                 {