소스 검색

添加查询句柄,优化上料采集

callm 6 일 전
부모
커밋
e2aa2503a8

+ 35 - 1
UAS_MES_YDCY/FunctionCode/Make/Make_CheckRFID.Designer.cs

@@ -52,6 +52,9 @@
             this.SerialPortComBox_label = new System.Windows.Forms.Label();
             this.SerialPortComBox_label = new System.Windows.Forms.Label();
             this.ComList = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.SerialPortCombox();
             this.ComList = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.SerialPortCombox();
             this.Connect = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Connect = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.Delay = new System.Windows.Forms.NumericUpDown();
+            this.label1 = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.Delay)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // pr_detail_label
             // pr_detail_label
@@ -338,11 +341,39 @@
             this.Connect.UseVisualStyleBackColor = false;
             this.Connect.UseVisualStyleBackColor = false;
             this.Connect.Click += new System.EventHandler(this.Connect_Click);
             this.Connect.Click += new System.EventHandler(this.Connect_Click);
             // 
             // 
+            // Delay
+            // 
+            this.Delay.Location = new System.Drawing.Point(1636, 260);
+            this.Delay.Name = "Delay";
+            this.Delay.Size = new System.Drawing.Size(120, 35);
+            this.Delay.TabIndex = 215;
+            this.Delay.Value = new decimal(new int[] {
+            3,
+            0,
+            0,
+            0});
+            // 
+            // label1
+            // 
+            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            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(1473, 254);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(146, 41);
+            this.label1.TabIndex = 216;
+            this.label1.Text = "获取延迟";
+            // 
             // Make_CheckRFID
             // Make_CheckRFID
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1828, 896);
             this.ClientSize = new System.Drawing.Size(1828, 896);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.Delay);
             this.Controls.Add(this.Connect);
             this.Controls.Add(this.Connect);
             this.Controls.Add(this.BaudRate_label);
             this.Controls.Add(this.BaudRate_label);
             this.Controls.Add(this.BaudRate);
             this.Controls.Add(this.BaudRate);
@@ -374,7 +405,8 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_FuselageLabelPrint_FormClosing);
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_FuselageLabelPrint_FormClosing);
             this.Load += new System.EventHandler(this.Make_FuselageLabelPrint_Load);
             this.Load += new System.EventHandler(this.Make_FuselageLabelPrint_Load);
             this.SizeChanged += new System.EventHandler(this.Make_FuselageLabelPrint_SizeChanged);
             this.SizeChanged += new System.EventHandler(this.Make_FuselageLabelPrint_SizeChanged);
-            this.ResumeLayout(true);
+            ((System.ComponentModel.ISupportInitialize)(this.Delay)).EndInit();
+            this.ResumeLayout(false);
             this.PerformLayout();
             this.PerformLayout();
 
 
         }
         }
@@ -402,5 +434,7 @@
         private System.Windows.Forms.Label SerialPortComBox_label;
         private System.Windows.Forms.Label SerialPortComBox_label;
         private CustomControl.ComBoxWithFocus.SerialPortCombox ComList;
         private CustomControl.ComBoxWithFocus.SerialPortCombox ComList;
         private CustomControl.ButtonUtil.NormalButton Connect;
         private CustomControl.ButtonUtil.NormalButton Connect;
+        private System.Windows.Forms.NumericUpDown Delay;
+        private System.Windows.Forms.Label label1;
     }
     }
 }
 }

+ 8 - 6
UAS_MES_YDCY/FunctionCode/Make/Make_CheckRFID.cs

@@ -110,7 +110,7 @@ namespace UAS_MES_NEW.Make
             //按下enter键
             //按下enter键
             if (e.KeyCode == Keys.Enter)
             if (e.KeyCode == Keys.Enter)
             {
             {
-                CheckPass = false;
+
                 //如果输入的值为空的话,提示不能为空
                 //如果输入的值为空的话,提示不能为空
                 if (sncode.Text == "")
                 if (sncode.Text == "")
                 {
                 {
@@ -166,13 +166,15 @@ namespace UAS_MES_NEW.Make
                                 return;
                                 return;
                             }
                             }
                         }
                         }
+                        CheckPass = false;
                         //开始盘存
                         //开始盘存
                         RET_ERRNO er = n01Api.N01_StartReading();
                         RET_ERRNO er = n01Api.N01_StartReading();
-                        OperateResult.AppendText("开始盘存:" + er + "\n");
+                        OperateResult.AppendText("开始盘存:" + er + "\n", Color.Black);
+                        Thread.Sleep(int.Parse(Delay.Value.ToString()) * 1000);
                         if (!CheckPass)
                         if (!CheckPass)
                         {
                         {
                             RET_ERRNO rET_ = n01Api.N01_StopReading();
                             RET_ERRNO rET_ = n01Api.N01_StopReading();
-                            OperateResult.AppendText("未获取到数据,停止盘存:" + rET_ + "\n");
+                            OperateResult.AppendText("未获取到数据,停止盘存:" + rET_ + "\n", Color.Black);
                         }
                         }
                     }
                     }
                     else
                     else
@@ -227,7 +229,7 @@ namespace UAS_MES_NEW.Make
             ans.Add(antPwr);
             ans.Add(antPwr);
             // 调用API设置天线1的功率参数
             // 调用API设置天线1的功率参数
             RET_ERRNO eT_ERRNO = n01Api.N01_SetMultiAntPwr(ans.ToArray());
             RET_ERRNO eT_ERRNO = n01Api.N01_SetMultiAntPwr(ans.ToArray());
-            OperateResult.AppendText("设置天线功率结果:" + eT_ERRNO + "\n");
+            OperateResult.AppendText("设置天线功率结果:" + eT_ERRNO + "\n", Color.Black);
         }
         }
         public N01Api n01Api = new N01Api();
         public N01Api n01Api = new N01Api();
         private void TagReadDataResult(object sender, TagReadDataEventArgs e)
         private void TagReadDataResult(object sender, TagReadDataEventArgs e)
@@ -243,13 +245,13 @@ namespace UAS_MES_NEW.Make
                 {
                 {
                     OperateResult.AppendText("<<序列号:" + sncode.Text + "\n", Color.Black);
                     OperateResult.AppendText("<<序列号:" + sncode.Text + "\n", Color.Black);
                     RET_ERRNO rET_ = n01Api.N01_StopReading();
                     RET_ERRNO rET_ = n01Api.N01_StopReading();
-                    OperateResult.AppendText("获取数据成功,停止盘存:" + rET_ + "\n");
+                    OperateResult.AppendText("获取数据成功,停止盘存:" + rET_ + "\n", Color.Black);
+                    CheckPass = true;
                     //记录日志
                     //记录日志
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "RFID核对", "RFID核对成功", sncode.Text, "");
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "RFID核对", "RFID核对成功", sncode.Text, "");
                     //更新打印的数据
                     //更新打印的数据
                     if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, sncode.Text, "RFID核对", "RFID核对成功", User.UserCode, out oErrorMessage))
                     if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, sncode.Text, "RFID核对", "RFID核对成功", User.UserCode, out oErrorMessage))
                     {
                     {
-                        CheckPass = true;
                         //提示正确返回时传递的信息
                         //提示正确返回时传递的信息
                         if (oErrorMessage.Contains("AFTERSUCCESS"))
                         if (oErrorMessage.Contains("AFTERSUCCESS"))
                             OperateResult.AppendText(">>" + oErrorMessage + "\n");
                             OperateResult.AppendText(">>" + oErrorMessage + "\n");

+ 13 - 0
UAS_MES_YDCY/FunctionCode/Make/Make_ColorBoxLabelPrintMidBox.cs

@@ -11,6 +11,7 @@ using System.Threading;
 using UAS_MES_NEW.PublicForm;
 using UAS_MES_NEW.PublicForm;
 using System.Web.UI.WebControls;
 using System.Web.UI.WebControls;
 using Seagull.BarTender.Print;
 using Seagull.BarTender.Print;
+using System.IO;
 
 
 namespace UAS_MES_NEW.Make
 namespace UAS_MES_NEW.Make
 {
 {
@@ -69,6 +70,18 @@ namespace UAS_MES_NEW.Make
             StepCount.LineCode = User.UserLineCode;
             StepCount.LineCode = User.UserLineCode;
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
+
+            try
+            {
+                if (File.Exists("MidBox" + ".txt"))
+                {
+                    File.Delete("MidBox" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("MidBox" + ".txt");
+                sw.WriteLine(sncode.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }
 
 
         private void Ma_code_DbChange(object sender, EventArgs e)
         private void Ma_code_DbChange(object sender, EventArgs e)

+ 11 - 0
UAS_MES_YDCY/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -94,6 +94,17 @@ namespace UAS_MES_NEW.Make
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
             AutoPrint.Checked = false;
             AutoPrint.Checked = false;
+            try
+            {
+                if (File.Exists("ColorBox" + ".txt"))
+                {
+                    File.Delete("ColorBox" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("ColorBox" + ".txt");
+                sw.WriteLine(sncode.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }
 
 
         private void Ma_code_DbChange(object sender, EventArgs e)
         private void Ma_code_DbChange(object sender, EventArgs e)

+ 12 - 0
UAS_MES_YDCY/FunctionCode/Make/Make_ColorBoxWeigh_HUAGUAN.cs

@@ -83,6 +83,18 @@ namespace UAS_MES_NEW.Make
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
             AutoPrint.Checked = false;
             AutoPrint.Checked = false;
+
+            try
+            {
+                if (File.Exists("ColorBox" + ".txt"))
+                {
+                    File.Delete("ColorBox" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("ColorBox" + ".txt");
+                sw.WriteLine(sncode.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }
 
 
         private void Ma_code_DbChange(object sender, EventArgs e)
         private void Ma_code_DbChange(object sender, EventArgs e)

+ 11 - 0
UAS_MES_YDCY/FunctionCode/Make/Make_ColorBoxWeigh_LANCHEN.cs

@@ -81,6 +81,17 @@ namespace UAS_MES_NEW.Make
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
             AutoPrint.Checked = false;
             AutoPrint.Checked = false;
+            try
+            {
+                if (File.Exists("ColorBox" + ".txt"))
+                {
+                    File.Delete("ColorBox" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("ColorBox" + ".txt");
+                sw.WriteLine(sncode.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }
 
 
         private void Ma_code_DbChange(object sender, EventArgs e)
         private void Ma_code_DbChange(object sender, EventArgs e)

+ 15 - 9
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionBadOnlyNEW.cs

@@ -68,6 +68,8 @@ namespace UAS_MES_NEW.Make
 
 
         List<string> SpType = new List<string>();
         List<string> SpType = new List<string>();
 
 
+        List<string> SpSNType = new List<string>();
+
         List<string> ReturnUseRate = new List<string>();
         List<string> ReturnUseRate = new List<string>();
 
 
         List<string> ReturnSubFix = new List<string>();
         List<string> ReturnSubFix = new List<string>();
@@ -176,6 +178,7 @@ namespace UAS_MES_NEW.Make
                             string sp_subnumlength = dt1.Rows[RemainIndex]["sp_subnumlength"].ToString();
                             string sp_subnumlength = dt1.Rows[RemainIndex]["sp_subnumlength"].ToString();
                             string sp_rate = dt1.Rows[RemainIndex]["sp_rate"].ToString();
                             string sp_rate = dt1.Rows[RemainIndex]["sp_rate"].ToString();
                             string sptype = dt1.Rows[RemainIndex]["sptype"].ToString();
                             string sptype = dt1.Rows[RemainIndex]["sptype"].ToString();
+                            string sp_sntype = dt1.Rows[RemainIndex]["sp_sntype"].ToString();
                             string resultstr = "";
                             string resultstr = "";
                             string subfix = "";
                             string subfix = "";
                             string userate = "0";
                             string userate = "0";
@@ -210,7 +213,7 @@ namespace UAS_MES_NEW.Make
                                     sp_soncode = ErrorMessage;
                                     sp_soncode = ErrorMessage;
                                 }
                                 }
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上物料", sn_code.Text + "上物料" + code.Text + "料号" + sp_fsoncode, sn_code.Text, "");
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上物料", sn_code.Text + "上物料" + code.Text + "料号" + sp_fsoncode, sn_code.Text, "");
-                                Save_OtherCode(soncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sptype);
+                                Save_OtherCode(soncode, sp_soncode, make_code, sn_code.Text, sp_id, resultstr, userate, subfix, sptype, sp_sntype);
                             }
                             }
                             else
                             else
                             {
                             {
@@ -420,9 +423,9 @@ namespace UAS_MES_NEW.Make
             //单独用一个DataTable存储一个
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             dt1 = new DataTable();
             sql.Clear();
             sql.Clear();
-            sql.Append("select sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end A,SP_ID, max(sp_rate)sp_rate,replace(wm_concat(sp_fsoncode),',','?')sp_fsoncode,replace(wm_concat(sp_prefix),',','?')sp_prefix,max(pr_lightbox)pr_lightbox,replace(wm_concat(nvl(sp_subnum,0)),',','?')sp_subnum,replace(wm_concat(nvl(sp_subnumlength,0)),',','?')sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)sp_ifforsn,replace(wm_concat(sp_length),',','?')sp_length,max(sp_type)sp_type,max(sp_regex)sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from(");
+            sql.Append("select max(sptype)sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end A,SP_ID, max(sp_rate)sp_rate,replace(wm_concat(sp_fsoncode),',','?')sp_fsoncode,replace(wm_concat(sp_prefix),',','?')sp_prefix,max(pr_lightbox)pr_lightbox,replace(wm_concat(nvl(sp_subnum,0)),',','?')sp_subnum,replace(wm_concat(nvl(sp_subnumlength,0)),',','?')sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,max(sp_barcoderule)sp_barcoderule,max(sp_sntype)sp_sntype,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)sp_ifforsn,replace(wm_concat(sp_length),',','?')sp_length,max(sp_type)sp_type,max(sp_regex)sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from(");
             sql.Append("select '主料' sptype,0 spr_id,-1 spr_isreplace,max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
             sql.Append("select '主料' sptype,0 spr_id,-1 spr_isreplace,max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
-            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
+            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,max(sp_sntype)sp_sntype,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
@@ -430,14 +433,14 @@ namespace UAS_MES_NEW.Make
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
             sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
             sql.Append("select '替代' sptype,spr_id,max(spr_isreplace),max(spr_rate)spr_rate,max(pr_lightbox)pr_lightbox,spr_spid,max(nvl(spr_subnum,0))spr_subnum,max(nvl(spr_subnumlength,0))spr_subnumlength,max(spr_detno)spr_detno,min(spr_ifrepeat)spr_ifrepeat,max(spr_checkbarcode)spr_checkbarcode,min(spr_checksalecode)spr_checksalecode,");
             sql.Append("select '替代' sptype,spr_id,max(spr_isreplace),max(spr_rate)spr_rate,max(pr_lightbox)pr_lightbox,spr_spid,max(nvl(spr_subnum,0))spr_subnum,max(nvl(spr_subnumlength,0))spr_subnumlength,max(spr_detno)spr_detno,min(spr_ifrepeat)spr_ifrepeat,max(spr_checkbarcode)spr_checkbarcode,min(spr_checksalecode)spr_checksalecode,");
-            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
+            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,max(spr_sntype)spr_sntype,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
             sql.Append("spr_ifforsn,max(spr_length)spr_length,max(spr_type)spr_type,replace(wm_concat(spr_prefix),',','|')spr_prefix,max(spr_regex)");
             sql.Append("spr_ifforsn,max(spr_length)spr_length,max(spr_type)spr_type,replace(wm_concat(spr_prefix),',','|')spr_prefix,max(spr_regex)");
             sql.Append("spr_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproductrep left join product on pr_code=spr_fsoncode where ");
             sql.Append("spr_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproductrep left join product on pr_code=spr_fsoncode where ");
             sql.Append("spr_bomversion='" + ms_bomversion.Text + "' and spr_craftcode='" + ms_craftcode.Text + "' and spr_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("spr_bomversion='" + ms_bomversion.Text + "' and spr_craftcode='" + ms_craftcode.Text + "' and spr_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("And spr_mothercode ='" + ma_prodcode.Text + "' and spr_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("And spr_mothercode ='" + ma_prodcode.Text + "' and spr_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("spr_fsoncode and cm_status=0 and cm_stepcode=spr_stepcode) group by spr_fsoncode,spr_id,spr_spid ");
             sql.Append("spr_fsoncode and cm_status=0 and cm_stepcode=spr_stepcode) group by spr_fsoncode,spr_id,spr_spid ");
-            sql.Append(") group by case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sptype,sp_id order by sp_id");
+            sql.Append(") group by case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sp_id order by sp_id");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             code.Clear();
             //用于记录提醒的数据长度
             //用于记录提醒的数据长度
@@ -550,13 +553,14 @@ namespace UAS_MES_NEW.Make
         }
         }
 
 
         //此类中通用的保存逻辑
         //此类中通用的保存逻辑
-        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix,string sptype)
+        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id, string resultstr, string userate, string subfix, string sptype, string sp_sntype)
         {
         {
             LogicHandler.CheckBarcode(ma_code, ms_sncode, code.Text, resultstr, Tag.ToString());
             LogicHandler.CheckBarcode(ma_code, ms_sncode, code.Text, resultstr, Tag.ToString());
             CollectDataSonCode.Add(sp_fsoncode);
             CollectDataSonCode.Add(sp_fsoncode);
             ReturnUseRate.Add(userate);
             ReturnUseRate.Add(userate);
             ReturnSubFix.Add(subfix);
             ReturnSubFix.Add(subfix);
             SpType.Add(sptype);
             SpType.Add(sptype);
+            SpSNType.Add(sp_sntype);
             //采集成功提示
             //采集成功提示
             ResultStr.Add(resultstr);
             ResultStr.Add(resultstr);
             CollectData.Add(code.Text);
             CollectData.Add(code.Text);
@@ -580,13 +584,13 @@ namespace UAS_MES_NEW.Make
             {
             {
                 sql.Clear();
                 sql.Clear();
                 sql.Append("insert into Craftmaterial (cm_id ,cm_prodtype,cm_makecode,cm_maid,cm_maprodcode, cm_soncode, cm_mscode, cm_sncode, cm_stepcode, cm_stepname,cm_fsoncode,");
                 sql.Append("insert into Craftmaterial (cm_id ,cm_prodtype,cm_makecode,cm_maid,cm_maprodcode, cm_soncode, cm_mscode, cm_sncode, cm_stepcode, cm_stepname,cm_fsoncode,");
-                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,cm_substr,cm_subfix,cm_rate,cm_type)");
+                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,cm_substr,cm_subfix,cm_rate,cm_type,cm_sntype)");
                 sql.Append("select Craftmaterial_seq.nextval,sp_prodtype, ma_code, ma_id, ma_prodcode,:soncode,ms_code,ms_sncode,mcd_stepcode,");
                 sql.Append("select Craftmaterial_seq.nextval,sp_prodtype, ma_code, ma_id, ma_prodcode,:soncode,ms_code,ms_sncode,mcd_stepcode,");
                 sql.Append("mcd_stepname,sp_fsoncode,ms_craftcode,ms_craftname,:barcode,1,sysdate,'" + User.UserCode + "','" + User.UserLineCode + "',ma_wccode,");
                 sql.Append("mcd_stepname,sp_fsoncode,ms_craftcode,ms_craftname,:barcode,1,sysdate,'" + User.UserCode + "','" + User.UserLineCode + "',ma_wccode,");
-                sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn,:substr,:subfix,:rate,:sptype from make left join makecraftdetail on mcd_maid=ma_id  left join stepproduct on sp_stepcode=mcd_stepcode ");
+                sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn,:substr,:subfix,:rate,:sptype,:spsntype from make left join makecraftdetail on mcd_maid=ma_id  left join stepproduct on sp_stepcode=mcd_stepcode ");
                 sql.Append(" and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode ");
                 sql.Append(" and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode ");
                 sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1  and ms_sncode='" + ms_sncode + "'");
                 sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1  and ms_sncode='" + ms_sncode + "'");
-                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "sptype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(),  ReturnUseRate.ToArray() ,SpType.ToArray(), SPID.ToArray());
+                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "substr", "subfix", "rate", "sptype", "spsntype", "sp_id1", }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), ResultStr.ToArray(), ReturnSubFix.ToArray(), ReturnUseRate.ToArray(), SpType.ToArray(), SpSNType.ToArray(), SPID.ToArray());
                 try
                 try
                 {
                 {
                     string Log = "";
                     string Log = "";
@@ -621,6 +625,7 @@ namespace UAS_MES_NEW.Make
                 ReturnUseRate.Clear();
                 ReturnUseRate.Clear();
                 ReturnSubFix.Clear();
                 ReturnSubFix.Clear();
                 SpType.Clear();
                 SpType.Clear();
+                SpSNType.Clear();
                 ResultStr.Clear();
                 ResultStr.Clear();
                 CheckBarcode.Clear();
                 CheckBarcode.Clear();
                 CollectDataSonCode.Clear();
                 CollectDataSonCode.Clear();
@@ -640,6 +645,7 @@ namespace UAS_MES_NEW.Make
             ReturnUseRate.Clear();
             ReturnUseRate.Clear();
             ReturnSubFix.Clear();
             ReturnSubFix.Clear();
             SpType.Clear();
             SpType.Clear();
+            SpSNType.Clear();
             ResultStr.Clear();
             ResultStr.Clear();
             CollectData.Clear();
             CollectData.Clear();
             CollectDataSonCode.Clear();
             CollectDataSonCode.Clear();

+ 4 - 4
UAS_MES_YDCY/FunctionCode/Make/Make_FeedingCollectionNEW.cs

@@ -421,9 +421,9 @@ namespace UAS_MES_NEW.Make
             //单独用一个DataTable存储一个
             //单独用一个DataTable存储一个
             dt1 = new DataTable();
             dt1 = new DataTable();
             sql.Clear();
             sql.Clear();
-            sql.Append("select sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end A,SP_ID, max(sp_rate)sp_rate,replace(wm_concat(sp_fsoncode),',','?')sp_fsoncode,replace(wm_concat(sp_prefix),',','?')sp_prefix,max(pr_lightbox)pr_lightbox,replace(wm_concat(nvl(sp_subnum,0)),',','?')sp_subnum,replace(wm_concat(nvl(sp_subnumlength,0)),',','?')sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)sp_ifforsn,replace(wm_concat(sp_length),',','?')sp_length,max(sp_type)sp_type,max(sp_regex)sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from(");
+            sql.Append("select max(sptype)sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end A,SP_ID, max(sp_rate)sp_rate,replace(wm_concat(sp_fsoncode),',','?')sp_fsoncode,replace(wm_concat(sp_prefix),',','?')sp_prefix,max(pr_lightbox)pr_lightbox,replace(wm_concat(nvl(sp_subnum,0)),',','?')sp_subnum,replace(wm_concat(nvl(sp_subnumlength,0)),',','?')sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,max(sp_barcoderule)sp_barcoderule,max(sp_sntype),wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)sp_ifforsn,replace(wm_concat(sp_length),',','?')sp_length,max(sp_type)sp_type,max(sp_regex)sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from(");
             sql.Append("select '主料' sptype,0 spr_id,-1 spr_isreplace,max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
             sql.Append("select '主料' sptype,0 spr_id,-1 spr_isreplace,max(sp_rate)sp_rate,max(pr_lightbox)pr_lightbox,sp_id,max(nvl(sp_subnum,0))sp_subnum,max(nvl(sp_subnumlength,0))sp_subnumlength,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
-            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
+            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,max(sp_sntype)sp_sntype,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
@@ -431,14 +431,14 @@ namespace UAS_MES_NEW.Make
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
             sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) group by sp_fsoncode,sp_id union ");
             sql.Append("select '替代' sptype,spr_id,max(spr_isreplace),max(spr_rate)spr_rate,max(pr_lightbox)pr_lightbox,spr_spid,max(nvl(spr_subnum,0))spr_subnum,max(nvl(spr_subnumlength,0))spr_subnumlength,max(spr_detno)spr_detno,min(spr_ifrepeat)spr_ifrepeat,max(spr_checkbarcode)spr_checkbarcode,min(spr_checksalecode)spr_checksalecode,");
             sql.Append("select '替代' sptype,spr_id,max(spr_isreplace),max(spr_rate)spr_rate,max(pr_lightbox)pr_lightbox,spr_spid,max(nvl(spr_subnum,0))spr_subnum,max(nvl(spr_subnumlength,0))spr_subnumlength,max(spr_detno)spr_detno,min(spr_ifrepeat)spr_ifrepeat,max(spr_checkbarcode)spr_checkbarcode,min(spr_checksalecode)spr_checksalecode,");
-            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
+            sql.Append("spr_fsoncode,max(spr_barcoderule)spr_barcoderule,max(spr_sntype)spr_sntype,wm_concat(spr_soncode) spr_soncode,max(spr_ifuseregex)spr_ifuseregex,max(spr_ifforsn)");
             sql.Append("spr_ifforsn,max(spr_length)spr_length,max(spr_type)spr_type,replace(wm_concat(spr_prefix),',','|')spr_prefix,max(spr_regex)");
             sql.Append("spr_ifforsn,max(spr_length)spr_length,max(spr_type)spr_type,replace(wm_concat(spr_prefix),',','|')spr_prefix,max(spr_regex)");
             sql.Append("spr_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproductrep left join product on pr_code=spr_fsoncode where ");
             sql.Append("spr_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproductrep left join product on pr_code=spr_fsoncode where ");
             sql.Append("spr_bomversion='" + ms_bomversion.Text + "' and spr_craftcode='" + ms_craftcode.Text + "' and spr_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("spr_bomversion='" + ms_bomversion.Text + "' and spr_craftcode='" + ms_craftcode.Text + "' and spr_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("And spr_mothercode ='" + ma_prodcode.Text + "' and spr_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("And spr_mothercode ='" + ma_prodcode.Text + "' and spr_tracekind=1 and not exists(select 1 from craftmaterial where ");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
             sql.Append("spr_fsoncode and cm_status=0 and cm_stepcode=spr_stepcode) group by spr_fsoncode,spr_id,spr_spid ");
             sql.Append("spr_fsoncode and cm_status=0 and cm_stepcode=spr_stepcode) group by spr_fsoncode,spr_id,spr_spid ");
-            sql.Append(") group by sptype,case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sp_id order by sp_id");
+            sql.Append(") group by case when spr_isreplace=-1 then to_char(spr_isreplace) else sp_fsoncode end,sp_id order by sp_id");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();
             code.Clear();
             //用于记录提醒的数据长度
             //用于记录提醒的数据长度

+ 12 - 0
UAS_MES_YDCY/FunctionCode/Make/Make_SNLabelCheckMidBox.cs

@@ -107,6 +107,18 @@ namespace UAS_MES_NEW.Make
             StepCount.LineCode = User.UserLineCode;
             StepCount.LineCode = User.UserLineCode;
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
+
+            try
+            {
+                if (File.Exists("MidBoxCheck" + ".txt"))
+                {
+                    File.Delete("MidBoxCheck" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("MidBoxCheck" + ".txt");
+                sw.WriteLine(code.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }
 
 
         private void Ma_code_DBChange(object sender, EventArgs e)
         private void Ma_code_DBChange(object sender, EventArgs e)

+ 2 - 0
UAS_MES_YDCY/FunctionCode/Packing/Packing_PackageCollectionPallet.cs

@@ -99,6 +99,8 @@ namespace UAS_MES_NEW.Packing
             StepCount.LineCode = User.UserLineCode;
             StepCount.LineCode = User.UserLineCode;
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
+
+         
         }
         }
 
 
         private void PackCollection_SizeChanged(object sender, EventArgs e)
         private void PackCollection_SizeChanged(object sender, EventArgs e)

+ 12 - 0
UAS_MES_YDCY/FunctionCode/Packing/Packing_PackageCollectionWeigh.cs

@@ -120,6 +120,18 @@ namespace UAS_MES_NEW.Packing
             StepCount.LineCode = User.UserLineCode;
             StepCount.LineCode = User.UserLineCode;
             StepCount.Dh = dh;
             StepCount.Dh = dh;
             StepCount.Start();
             StepCount.Start();
+
+            try
+            {
+                if (File.Exists("CartonBoxWeigh" + ".txt"))
+                {
+                    File.Delete("CartonBoxWeigh" + ".txt");
+                }
+                StreamWriter sw = File.AppendText("CartonBoxWeigh" + ".txt");
+                sw.WriteLine(sn_code.Handle);
+                sw.Close();
+            }
+            catch (Exception) { }
         }
         }