Эх сурвалжийг харах

将上料前的校验封装成公共方法

章政 8 жил өмнө
parent
commit
622adf459d

+ 90 - 61
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.Designer.cs

@@ -53,6 +53,7 @@
             this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.ms_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
+            this.ma_craftcode = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             this.SuspendLayout();
             // 
@@ -60,9 +61,10 @@
             // 
             this.ms_makecode_label.AutoSize = true;
             this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(19, 16);
+            this.ms_makecode_label.Location = new System.Drawing.Point(25, 20);
+            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_makecode_label.Name = "ms_makecode_label";
-            this.ms_makecode_label.Size = new System.Drawing.Size(74, 21);
+            this.ms_makecode_label.Size = new System.Drawing.Size(92, 27);
             this.ms_makecode_label.TabIndex = 125;
             this.ms_makecode_label.Text = "归属工单";
             // 
@@ -70,9 +72,10 @@
             // 
             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(238, 16);
+            this.pr_code_label.Location = new System.Drawing.Point(317, 20);
+            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(74, 21);
+            this.pr_code_label.Size = new System.Drawing.Size(92, 27);
             this.pr_code_label.TabIndex = 126;
             this.pr_code_label.Text = "产品编号";
             // 
@@ -80,9 +83,10 @@
             // 
             this.mcd_okqty_label.AutoSize = true;
             this.mcd_okqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_okqty_label.Location = new System.Drawing.Point(238, 62);
+            this.mcd_okqty_label.Location = new System.Drawing.Point(317, 78);
+            this.mcd_okqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.mcd_okqty_label.Name = "mcd_okqty_label";
-            this.mcd_okqty_label.Size = new System.Drawing.Size(74, 21);
+            this.mcd_okqty_label.Size = new System.Drawing.Size(92, 27);
             this.mcd_okqty_label.TabIndex = 127;
             this.mcd_okqty_label.Text = "打印计数";
             // 
@@ -90,9 +94,10 @@
             // 
             this.mcd_remainqty_label.AutoSize = true;
             this.mcd_remainqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_remainqty_label.Location = new System.Drawing.Point(457, 62);
+            this.mcd_remainqty_label.Location = new System.Drawing.Point(609, 78);
+            this.mcd_remainqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.mcd_remainqty_label.Name = "mcd_remainqty_label";
-            this.mcd_remainqty_label.Size = new System.Drawing.Size(58, 21);
+            this.mcd_remainqty_label.Size = new System.Drawing.Size(72, 27);
             this.mcd_remainqty_label.TabIndex = 128;
             this.mcd_remainqty_label.Text = "剩余数";
             // 
@@ -100,9 +105,10 @@
             // 
             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(733, 112);
+            this.label4.Location = new System.Drawing.Point(977, 140);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(74, 21);
+            this.label4.Size = new System.Drawing.Size(92, 27);
             this.label4.TabIndex = 129;
             this.label4.Text = "打印张数";
             // 
@@ -112,9 +118,10 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_sncode_label.AutoSize = true;
             this.ms_sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode_label.Location = new System.Drawing.Point(19, 62);
+            this.ms_sncode_label.Location = new System.Drawing.Point(25, 78);
+            this.ms_sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_sncode_label.Name = "ms_sncode_label";
-            this.ms_sncode_label.Size = new System.Drawing.Size(58, 21);
+            this.ms_sncode_label.Size = new System.Drawing.Size(72, 27);
             this.ms_sncode_label.TabIndex = 145;
             this.ms_sncode_label.Text = "序列号";
             // 
@@ -122,9 +129,10 @@
             // 
             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(457, 16);
+            this.pr_detail_label.Location = new System.Drawing.Point(609, 20);
+            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(74, 21);
+            this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
             this.pr_detail_label.TabIndex = 146;
             this.pr_detail_label.Text = "产品名称";
             // 
@@ -132,9 +140,10 @@
             // 
             this.PrintLabel_label.AutoSize = true;
             this.PrintLabel_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintLabel_label.Location = new System.Drawing.Point(730, 62);
+            this.PrintLabel_label.Location = new System.Drawing.Point(973, 78);
+            this.PrintLabel_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintLabel_label.Name = "PrintLabel_label";
-            this.PrintLabel_label.Size = new System.Drawing.Size(42, 21);
+            this.PrintLabel_label.Size = new System.Drawing.Size(52, 27);
             this.PrintLabel_label.TabIndex = 160;
             this.PrintLabel_label.Text = "标签";
             // 
@@ -142,9 +151,10 @@
             // 
             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(730, 14);
+            this.label2.Location = new System.Drawing.Point(973, 18);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(58, 21);
+            this.label2.Size = new System.Drawing.Size(72, 27);
             this.label2.TabIndex = 161;
             this.label2.Text = "打印机";
             // 
@@ -152,20 +162,19 @@
             // 
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrintLabel.FormattingEnabled = true;
-            this.PrintLabel.Location = new System.Drawing.Point(808, 62);
-            this.PrintLabel.Margin = new System.Windows.Forms.Padding(2);
+            this.PrintLabel.Location = new System.Drawing.Point(1077, 78);
+            this.PrintLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.PrintLabel.Name = "PrintLabel";
-            this.PrintLabel.Size = new System.Drawing.Size(152, 20);
+            this.PrintLabel.Size = new System.Drawing.Size(201, 23);
             this.PrintLabel.TabIndex = 162;
             // 
             // ms_sncode
             // 
             this.ms_sncode.AutoSize = true;
             this.ms_sncode.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.ms_sncode.Location = new System.Drawing.Point(112, 62);
-            this.ms_sncode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.ms_sncode.Location = new System.Drawing.Point(149, 78);
             this.ms_sncode.Name = "ms_sncode";
-            this.ms_sncode.Size = new System.Drawing.Size(0, 21);
+            this.ms_sncode.Size = new System.Drawing.Size(0, 27);
             this.ms_sncode.TabIndex = 163;
             // 
             // load
@@ -173,10 +182,10 @@
             this.load.AutoSize = true;
             this.load.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.load.ForeColor = System.Drawing.Color.Blue;
-            this.load.Location = new System.Drawing.Point(22, 422);
-            this.load.Margin = new System.Windows.Forms.Padding(2);
+            this.load.Location = new System.Drawing.Point(29, 528);
+            this.load.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.load.Name = "load";
-            this.load.Size = new System.Drawing.Size(60, 25);
+            this.load.Size = new System.Drawing.Size(73, 31);
             this.load.TabIndex = 164;
             this.load.TabStop = true;
             this.load.Text = "上料";
@@ -187,10 +196,10 @@
             this.unload.AutoSize = true;
             this.unload.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.unload.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
-            this.unload.Location = new System.Drawing.Point(126, 422);
-            this.unload.Margin = new System.Windows.Forms.Padding(2);
+            this.unload.Location = new System.Drawing.Point(168, 528);
+            this.unload.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.unload.Name = "unload";
-            this.unload.Size = new System.Drawing.Size(60, 25);
+            this.unload.Size = new System.Drawing.Size(73, 31);
             this.unload.TabIndex = 165;
             this.unload.TabStop = true;
             this.unload.Text = "下料";
@@ -200,18 +209,18 @@
             // 
             this.code_label.AutoSize = true;
             this.code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.code_label.Location = new System.Drawing.Point(254, 423);
-            this.code_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.code_label.Location = new System.Drawing.Point(339, 529);
             this.code_label.Name = "code_label";
-            this.code_label.Size = new System.Drawing.Size(58, 21);
+            this.code_label.Size = new System.Drawing.Size(72, 27);
             this.code_label.TabIndex = 167;
             this.code_label.Text = "录入框";
             // 
             // PrintNum
             // 
-            this.PrintNum.Location = new System.Drawing.Point(808, 112);
+            this.PrintNum.Location = new System.Drawing.Point(1077, 140);
+            this.PrintNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.PrintNum.Name = "PrintNum";
-            this.PrintNum.Size = new System.Drawing.Size(149, 21);
+            this.PrintNum.Size = new System.Drawing.Size(199, 25);
             this.PrintNum.TabIndex = 168;
             this.PrintNum.Value = new decimal(new int[] {
             1,
@@ -224,10 +233,11 @@
             this.ma_bomversion.AutoSize = true;
             this.ma_bomversion.CutLength = null;
             this.ma_bomversion.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_bomversion.Location = new System.Drawing.Point(772, 187);
-            this.ma_bomversion.MaximumSize = new System.Drawing.Size(150, 0);
+            this.ma_bomversion.Location = new System.Drawing.Point(1029, 234);
+            this.ma_bomversion.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ma_bomversion.MaximumSize = new System.Drawing.Size(200, 0);
             this.ma_bomversion.Name = "ma_bomversion";
-            this.ma_bomversion.Size = new System.Drawing.Size(0, 21);
+            this.ma_bomversion.Size = new System.Drawing.Size(0, 27);
             this.ma_bomversion.TabIndex = 169;
             this.ma_bomversion.Visible = false;
             // 
@@ -236,11 +246,11 @@
             this.code.AllPower = null;
             this.code.BackColor = System.Drawing.Color.White;
             this.code.ID = null;
-            this.code.Location = new System.Drawing.Point(325, 425);
-            this.code.Margin = new System.Windows.Forms.Padding(2);
+            this.code.Location = new System.Drawing.Point(433, 531);
+            this.code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.code.Name = "code";
             this.code.Power = null;
-            this.code.Size = new System.Drawing.Size(132, 21);
+            this.code.Size = new System.Drawing.Size(175, 25);
             this.code.Str = null;
             this.code.Str1 = null;
             this.code.Str2 = null;
@@ -249,19 +259,20 @@
             // 
             // Printer
             // 
-            this.Printer.Location = new System.Drawing.Point(808, 14);
-            this.Printer.Margin = new System.Windows.Forms.Padding(4);
+            this.Printer.Location = new System.Drawing.Point(1077, 18);
+            this.Printer.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
             this.Printer.Name = "Printer";
-            this.Printer.Size = new System.Drawing.Size(152, 25);
+            this.Printer.Size = new System.Drawing.Size(203, 31);
             this.Printer.TabIndex = 159;
             // 
             // mcd_remainqty
             // 
             this.mcd_remainqty.AutoSize = true;
             this.mcd_remainqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_remainqty.Location = new System.Drawing.Point(550, 62);
+            this.mcd_remainqty.Location = new System.Drawing.Point(733, 78);
+            this.mcd_remainqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.mcd_remainqty.Name = "mcd_remainqty";
-            this.mcd_remainqty.Size = new System.Drawing.Size(19, 21);
+            this.mcd_remainqty.Size = new System.Drawing.Size(24, 27);
             this.mcd_remainqty.TabIndex = 158;
             this.mcd_remainqty.Text = "0";
             // 
@@ -269,9 +280,10 @@
             // 
             this.mcd_okqty.AutoSize = true;
             this.mcd_okqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.mcd_okqty.Location = new System.Drawing.Point(331, 62);
+            this.mcd_okqty.Location = new System.Drawing.Point(441, 78);
+            this.mcd_okqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.mcd_okqty.Name = "mcd_okqty";
-            this.mcd_okqty.Size = new System.Drawing.Size(19, 21);
+            this.mcd_okqty.Size = new System.Drawing.Size(24, 27);
             this.mcd_okqty.TabIndex = 157;
             this.mcd_okqty.Text = "0";
             // 
@@ -280,10 +292,11 @@
             this.pr_code.AutoSize = true;
             this.pr_code.CutLength = null;
             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(331, 16);
-            this.pr_code.MaximumSize = new System.Drawing.Size(150, 0);
+            this.pr_code.Location = new System.Drawing.Point(441, 20);
+            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";
-            this.pr_code.Size = new System.Drawing.Size(0, 21);
+            this.pr_code.Size = new System.Drawing.Size(0, 27);
             this.pr_code.TabIndex = 156;
             this.pr_code.TextChanged += new System.EventHandler(this.pr_code_TextChanged);
             // 
@@ -292,10 +305,11 @@
             this.pr_detail.AutoSize = true;
             this.pr_detail.CutLength = null;
             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(550, 16);
-            this.pr_detail.MaximumSize = new System.Drawing.Size(150, 0);
+            this.pr_detail.Location = new System.Drawing.Point(733, 20);
+            this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.pr_detail.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_detail.Name = "pr_detail";
-            this.pr_detail.Size = new System.Drawing.Size(0, 21);
+            this.pr_detail.Size = new System.Drawing.Size(0, 27);
             this.pr_detail.TabIndex = 154;
             // 
             // ms_makecode
@@ -303,26 +317,39 @@
             this.ms_makecode.AutoSize = true;
             this.ms_makecode.CutLength = null;
             this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(112, 16);
-            this.ms_makecode.MaximumSize = new System.Drawing.Size(150, 0);
+            this.ms_makecode.Location = new System.Drawing.Point(149, 20);
+            this.ms_makecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_makecode.MaximumSize = new System.Drawing.Size(200, 0);
             this.ms_makecode.Name = "ms_makecode";
-            this.ms_makecode.Size = new System.Drawing.Size(0, 21);
+            this.ms_makecode.Size = new System.Drawing.Size(0, 27);
             this.ms_makecode.TabIndex = 152;
             // 
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(22, 105);
+            this.OperateResult.Location = new System.Drawing.Point(29, 131);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(691, 305);
+            this.OperateResult.Size = new System.Drawing.Size(920, 380);
             this.OperateResult.TabIndex = 143;
             this.OperateResult.Text = "";
             // 
+            // ma_craftcode
+            // 
+            this.ma_craftcode.AutoSize = true;
+            this.ma_craftcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_craftcode.Location = new System.Drawing.Point(977, 207);
+            this.ma_craftcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ma_craftcode.Name = "ma_craftcode";
+            this.ma_craftcode.Size = new System.Drawing.Size(0, 27);
+            this.ma_craftcode.TabIndex = 170;
+            // 
             // Make_ColorBoxLoadPrint
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(969, 452);
+            this.ClientSize = new System.Drawing.Size(1292, 565);
+            this.Controls.Add(this.ma_craftcode);
             this.Controls.Add(this.ma_bomversion);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.code_label);
@@ -348,6 +375,7 @@
             this.Controls.Add(this.pr_code_label);
             this.Controls.Add(this.ms_makecode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Make_ColorBoxLoadPrint";
             this.Tag = "Make!ColorBoxLoadPrint";
             this.Text = "s";
@@ -385,5 +413,6 @@
         private System.Windows.Forms.Label code_label;
         private System.Windows.Forms.NumericUpDown PrintNum;
         private CustomControl.ValueLabel.ValueLabel ma_bomversion;
+        private System.Windows.Forms.Label ma_craftcode;
     }
 }

+ 57 - 93
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -9,6 +9,7 @@ using UAS_MES.Entity;
 using LabelManager2;
 using System.Threading;
 using UAS_MES.PublicForm;
+using System.Collections.Generic;
 
 namespace UAS_MES.Make
 {
@@ -35,6 +36,10 @@ namespace UAS_MES.Make
 
         Thread InitPrint;
 
+        List<string> CollectData = new List<string>();
+
+        List<string> CollectDataSonCode = new List<string>();
+
         public Make_ColorBoxLoadPrint()
         {
             InitializeComponent();
@@ -90,7 +95,7 @@ namespace UAS_MES.Make
                         if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text, User.UserSourceCode, code.Text, User.UserCode, out ma_code, out Msid, out ErrorMessage) || ListA.Rows.Count > 0)
                         {
                             sql.Clear();
-                            sql.Append("select ms_makecode,ms_sncode,ma_qty,pr_detail,pr_code,ma_bomversion from makeserial left join make on ");
+                            sql.Append("select ms_makecode,ma_craftcode,ms_sncode,ma_qty,pr_detail,pr_code,ma_bomversion from makeserial left join make on ");
                             sql.Append("ms_makecode=ma_code left join product on ms_prodcode=pr_code where ms_sncode=:sncode");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", code.Text);
                             if (dt.Rows.Count > 0)
@@ -108,36 +113,20 @@ namespace UAS_MES.Make
                             if (load.Checked == true)
                             {
                                 OperateResult.AppendText(">>开始执行上料工序\n");
-                                //判断当前工序是否是上料工序cd_ifinput或者是否是测试工序cd_iftest
                                 sql.Clear();
-                                sql.Append("select cr_code,cd_stepcode,cd_ifinput,cd_iftest from makeserial left join  craft on ms_craftcode=cr_code left join craftdetail on cd_crid=cr_id and ");
-                                sql.Append("cd_stepcode=ms_nextstepcode where ms_sncode='" + code.Text + "' and ms_makecode='" + ms_makecode.Text + "'");
-                                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                if (dt.Rows.Count > 0)
+                                sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
+                                sql.Append("sp_repcode,pr_id,sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
+                                sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion.Text + "' and ");
+                                sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' And sp_mothercode ='" + pr_code.Text + "' ");
+                                sql.Append("and((sp_type = '物料' and(sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
+                                ListA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                //获取对应 产品的机身标的打印模板
+                                if (ListA.Rows.Count > 0)
                                 {
-                                    //如果是上料工序
-                                    if (dt.Rows[0]["cd_ifinput"].ToString() != "0")
-                                    {
-                                        // 查询没有结果,提示该上料工序没有需要上料的数据,请先维护对应的数据
-                                        sql.Clear();
-                                        sql.Append("select sp_id,sp_description,sp_soncode,pr_detail,pr_spec,sp_repcode,pr_id,sp_type,");
-                                        sql.Append("'未采集' sp_ifpick ,sp_prefix,sp_length,sp_regex,sp_regex,sp_ifforsn from stepproduct ");
-                                        sql.Append("left join product on pr_code=sp_soncode  where sp_craftcode='" + dt.Rows[0]["cr_code"].ToString() + "' ");
-                                        sql.Append("and sp_bomversion='" + ma_bomversion.Text + "' and sp_stepcode='" + dt.Rows[0]["cd_stepcode"].ToString() + "' And sp_mothercode='" + pr_code.Text + "' and ");
-                                        sql.Append("((sp_type='物料' and pr_tracekind<>2)or sp_type<>'物料') order by SP_DETNO asc");
-                                        ListA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                        //获取对应 产品的机身标的打印模板
-                                        if (ListA.Rows.Count > 0)
-                                        {
-                                            OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
-                                            code.Clear();
-                                        }
-                                    }
-                                    if (dt.Rows[0]["cd_iftest"].ToString() != "0")
-                                        DoTestProcedure();
+                                    OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
+                                    code.Clear();
                                 }
                             }
-                            //如果执行的是下料操作
                             else if (unload.Checked == true)
                             {
                                 OperateResult.AppendText(">>开始执行下料工序\n");
@@ -147,51 +136,58 @@ namespace UAS_MES.Make
                                     OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                             }
                         }
-                        else  OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                        else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     }
                     else
                     {
-                        //如果ListA中没有数据执行的是测试工序
-                        if (ListA.Rows.Count == 0)
+                        //获取上料需要传递的参数,sp_soncode,sp_id
+                        string sp_soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
+                        string sp_prefix = ListA.Rows[RemainIndex]["sp_prefix"].ToString();
+                        string sp_regex = ListA.Rows[RemainIndex]["sp_regex"].ToString();
+                        string length = ListA.Rows[RemainIndex]["sp_length"].ToString();
+                        string sp_id = ListA.Rows[RemainIndex]["sp_id"].ToString();
+                        string sp_ifforsn = ListA.Rows[RemainIndex]["sp_ifforsn"].ToString();
+                        string sp_tracekind = ListA.Rows[RemainIndex]["sp_tracekind"].ToString();
+                        string sp_barcoderule = ListA.Rows[RemainIndex]["sp_barcoderule"].ToString();
+                        if (LogicHandler.CheckSNBeforeLoad(code.Text, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                         {
-                            DoTestProcedure();
+                            CollectData.Add(code.Text);
+                            CollectDataSonCode.Add(ListA.Rows[RemainIndex]["sp_soncode"].ToString());
+                            RemainIndex = RemainIndex + 1;
                         }
-                        //存在数据执行的是上料采集
                         else
                         {
-                            //获取上料需要传递的参数,sp_soncode,sp_id
-                            string soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
-                            string sonID = ListA.Rows[RemainIndex]["sp_id"].ToString();
-                            if (!dh.CheckExist("barcode", "bar_code='" + code.Text + "' and bar_prodcode='" + soncode + "'"))
-                            {
-                                OperateResult.AppendText(">>必须采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "对应的条码\n", Color.Red);
-                                code.Clear();
-                                return;
-                            }
-                            //执行上料
-                            if (LogicHandler.SetMaterialUp(ms_sncode.Text, ms_makecode.Text, code.Text, soncode, User.UserSourceCode, User.UserName, sonID, out ErrorMessage))
+                            OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                            return;
+                        }
+                        code.Clear();
+                        if (RemainIndex <= ListA.Rows.Count - 1)
+                            OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
+                        if (RemainIndex == ListA.Rows.Count)
+                        {
+                            sql.Clear();
+                            sql.Append("insert into Craftmaterial (cm_id ,cm_makecode,cm_maid,cm_maprodcode, cm_soncode, cm_mscode, cm_sncode, cm_stepcode, cm_stepname,");
+                            sql.Append("cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate,cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn)");
+                            sql.Append("select Craftmaterial_seq.nextval, ma_code, ma_id, ma_prodcode,:soncode,ms_code,ms_sncode,mcd_stepcode,");
+                            sql.Append("mcd_stepname,ma_craftcode,ma_craftname,:barcode,1,sysdate,'" + User.UserCode + "',ma_linecode,ma_wccode,");
+                            sql.Append("'" + User.UserSourceCode + "','" + sp_id + "',0,1,ms_firstsn from make left join makecraftdetail on mcd_macode=ma_code  left join stepproduct on sp_stepcode=mcd_stepcode ");
+                            sql.Append("and sp_craftcode=ma_craftcode and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code ");
+                            sql.Append("where ma_code='" + ma_code + "'and sp_id=" + sp_id + " and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode.Text + "'");
+                            dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode" }, CollectDataSonCode.ToArray(), CollectData.ToArray());
+                            OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的工单已经采集完成\n", Color.Green);
+                            Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
+                            RemainIndex = 0;
+                            CollectData.Clear();
+                            CollectDataSonCode.Clear();
+                            if (LogicHandler.CS_SetResult(ms_makecode.Text, User.UserSourceCode, ms_sncode.Text, User.UserCode, "彩盒上料成功", out ErrorMessage))
                             {
-                                RemainIndex = RemainIndex + 1;
+                                mcd_okqty.Text = int.Parse(mcd_okqty.Text) + 1 + "";
                                 code.Clear();
-                                if (RemainIndex <= ListA.Rows.Count - 1)
-                                    OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
-                                if (RemainIndex == ListA.Rows.Count)
-                                {
-                                    OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的工单已经采集完成\n", Color.Green);
-                                    Print.CodeSoft(lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
-                                    RemainIndex = 0;
-                                    if (LogicHandler.UpdateMakeMessage(ms_sncode.Text, ms_makecode.Text, "彩盒上料打印", User.UserSourceCode, User.UserCode, "上料成功", out ErrorMessage))
-                                    {
-                                        mcd_okqty.Text = int.Parse(mcd_okqty.Text) + 1 + "";
-                                        code.Clear();
-                                        LoadCollectNum();
-                                        BaseUtil.CleanDataTableData(ListA);
-                                    }
-                                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
-                                    return;
-                                }
+                                LoadCollectNum();
+                                BaseUtil.CleanDataTableData(ListA);
                             }
                             else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                            return;
                         }
                     }
                 }
@@ -204,38 +200,6 @@ namespace UAS_MES.Make
             asc.controlAutoSize(this);
         }
 
-        //执行测试工序
-        private void DoTestProcedure()
-        {
-            //局部变量ErrorMessage1
-            string ErrorMessage1;
-            //由于打印驱动暂时不可用,暂时注释打印方法
-            if (LogicHandler.SetCollectionFinish(code.Text, ms_makecode.Text, User.UserName, User.UserSourceCode, out ErrorMessage1))
-            {
-                //如果值为空默认设置为0
-                if (int.Parse(mcd_remainqty.Text) > 0)
-                {
-                    dh.UpdateByCondition("makecraftdetail", "mcd_okqty=mcd_okqty+1,mcd_inqty=mcd_inqty+1", "mcd_macode='" + ms_makecode.Text + "'");
-                    sql.Clear();
-                    sql.Append("select mcd_okqty,ma_qty-mcd_inqty mcd_remainqty from makecraftdetail left join make on ");
-                    sql.Append("ma_code=mcd_macode where mcd_macode='" + ms_makecode.Text + "'");
-                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                    BaseUtil.SetFormValue(this.Controls, dt);
-                    if (mcd_remainqty.Text == "0")
-                    {
-                        OperateResult.AppendText(">>工单" + ms_makecode.Text + "采集完成\n", Color.Green);
-                        BaseUtil.CleanForm(this);
-                    }
-                }
-                else
-                {
-                    BaseUtil.CleanForm(this);
-                    OperateResult.AppendText(">>该序列号所属工单" + ms_makecode.Text + "已全部采集完成\n", Color.Green);
-                }
-            }
-            else OperateResult.AppendText(">>" + ErrorMessage1 + "\n", Color.Red);
-        }
-
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
             dt = (DataTable)dh.ExecuteSql("select pl_labelname,pl_labelcode,pl_indate,pl_labelurl from productlabel where pl_prodcode='" + pr_code.Text + "' and pl_labeltype='彩盒标' order by pl_isdefault desc", "select");

+ 4 - 61
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -209,73 +209,16 @@ namespace UAS_MES.Make
                             }
                             string sp_soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
                             string sp_prefix = dt1.Rows[RemainIndex]["sp_prefix"].ToString();
-                            string sp_ifuseregex = dt1.Rows[RemainIndex]["sp_ifuseregex"].ToString();
                             string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
                             string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
                             string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
                             string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
                             string sp_tracekind = dt1.Rows[RemainIndex]["sp_tracekind"].ToString();
                             string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
-                            switch (sp_barcoderule)
-                            {
-                                case "TSN":
-                                    dt = (DataTable)dh.ExecuteSql("select ms_id from makeserial where ms_sncode='" + code.Text + "' order by ms_id desc", "select");
-                                    if (dt.Rows.Count > 0)
-                                    {
-                                        if (sp_soncode != dt.Rows[0]["ms_prodcode"].ToString())
-                                            OperateResult.AppendText(">>序列号对应的物料不是:" + sp_soncode + "\n");
-                                        else
-                                        {
-                                            dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_soncode='" + sp_soncode + "' and cm_barcode='" + code.Text + "'", "select");
-                                            if (dt.Rows.Count > 0)
-                                                OperateResult.AppendText(">>序列号" + code.Text + "已采集过\n", Color.Red, code);
-                                            else
-                                                Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
-                                        }
-                                    }
-                                    else OperateResult.AppendText(">>序列号" + code.Text + "不存在\n");
-                                    break;
-                                case "BARCODE":
-                                    dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + code.Text + "'", "select");
-                                    if (dt.Rows.Count > 0)
-                                    {
-                                        if (sp_soncode != dt.Rows[0]["bar_prodcode"].ToString())
-                                            OperateResult.AppendText(">>用户条码号对应的物料不是:" + sp_soncode + "\n");
-                                        else
-                                        {
-                                            dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_soncode='" + sp_soncode + "' and cm_barcode='" + code.Text + "'", "select");
-                                            if (dt.Rows.Count > 0)
-                                                OperateResult.AppendText(">>条码" + code.Text + "已采集过\n", Color.Red, code);
-                                            else
-                                                Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
-                                        }
-                                    }
-                                    else OperateResult.AppendText(">>条码" + code.Text + "不存在\n", Color.Red, code);
-                                    break;
-                                case "RULE":
-                                    int sp_length = int.Parse(length != "" ? length : "0");
-                                    if (code.Text.Substring(0, sp_prefix.Length) == sp_prefix || sp_prefix == "")
-                                    {
-                                        //进行长度匹配
-                                        if (code.Text.Length == sp_length || sp_length == 0)
-                                        {
-                                            if (sp_ifuseregex != "0")
-                                            {
-                                                //进行正则表达式匹配
-                                                Regex re = new Regex(sp_regex);
-                                                if (re.IsMatch(code.Text))
-                                                    Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
-                                                else OperateResult.AppendText(">>正则表达式不匹配\n", Color.Red);
-                                            }
-                                            else Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
-                                        }
-                                        else OperateResult.AppendText(">>长度不匹配\n", Color.Red);
-                                    }
-                                    else OperateResult.AppendText(">>前缀不匹配\n", Color.Red);
-                                    break;
-                                default:
-                                    break;
-                            }
+                            if(LogicHandler.CheckSNBeforeLoad(code.Text,sp_soncode,sp_barcoderule,sp_prefix,length,out ErrorMessage))
+                                Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
+                            else
+                                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
                         }
                     }
                     //勾选了下料的时候

+ 50 - 3
UAS-MES/PublicMethod/LogicHandler.cs

@@ -1112,7 +1112,7 @@ namespace UAS_MES.PublicMethod
             sql.Clear();
             sql.Append("select nvl(cd_ifreduce,0) cd_ifreduce from craft left join craftdetail on cd_crid=cr_id ");
             sql.Append("where cr_code=(select ma_craftcode  from makeserial left join make on ma_code = ms_makecode ");
-            sql.Append("where ms_sncode = '" + iSnCode + "') and cd_stepcode='" + StepCode + "'");
+            sql.Append("where ms_sncode = '" + iSnCode + "' and ms_makecode='" + iMakeCode + "') and cd_stepcode='" + StepCode + "'");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             sql.Clear();
             if (dt.Rows.Count > 0)
@@ -1236,7 +1236,7 @@ namespace UAS_MES.PublicMethod
                 string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                 string ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                 if (ms_status == "1" && ms_stepcode != iCurrentStep)
-                    oErrorMessage = "当前工序不是" + iCurrentStep + "\n";
+                    oErrorMessage = "当前工序不是" + iCurrentStep + "";
                 else if (ms_status == "0" && ms_stepcode != iCurrentStep)
                     oErrorMessage = "当前工序不是" + iCurrentStep + "";
                 else if (ms_status == "2" && ms_nextstepcode != iCurrentStep)
@@ -1389,10 +1389,57 @@ namespace UAS_MES.PublicMethod
         /// <returns></returns>
         public static string GetOutBoxCode(string Caller, string iMakeCode, string iProdCode, string iUserCode)
         {
-            string BoxCode="";
+            string BoxCode = "";
             string[] param = new string[] { Caller, iMakeCode, iProdCode, iUserCode, BoxCode };
             dh.CallProcedure("SP_GETPACKORPALLETCODE", ref param);
             return param[4];
         }
+
+        public static bool CheckSNBeforeLoad(string iSN, string iSonCode, string iRule, string iPrefix, string iLength, out string ErrMessage)
+        {
+            DataTable dt;
+            ErrMessage = "";
+            switch (iRule)
+            {
+                case "TSN":
+                    dt = (DataTable)dh.ExecuteSql("select ms_id from makeserial where ms_sncode='" + iSN + "' order by ms_id desc", "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        if (iSonCode != dt.Rows[0]["ms_prodcode"].ToString())
+                            ErrMessage = "序列号对应的物料不是:" + iSonCode;
+                        else
+                            return true;
+                    }
+                    else ErrMessage = "序列号" + iSN + "不存在";
+                    break;
+                case "BARCODE":
+                    dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + iSN + "'", "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        if (iSonCode != dt.Rows[0]["bar_prodcode"].ToString())
+                            ErrMessage = "用户条码号对应的物料不是:" + iSonCode;
+                        else
+                            return true;
+                    }
+                    else ErrMessage = "条码" + iSN + "不存在";
+                    break;
+                case "RULE":
+                    int sp_length = int.Parse(iLength != "" ? iLength : "0");
+                    if (iSN.Substring(0, iPrefix.Length) == iPrefix || iPrefix == "")
+                    {
+                        //进行长度匹配
+                        if (iSN.Length == sp_length || sp_length == 0)
+                        {
+                            return true;
+                        }
+                        else ErrMessage = "长度不匹配";
+                    }
+                    else ErrMessage = "前缀不匹配";
+                    break;
+                default:
+                    break;
+            }
+            return false;
+        }
     }
 }