Browse Source

5060修改

WIN-GH9CEESPLTB\Administrator 4 months ago
parent
commit
99b89368b5

+ 3 - 0
MainForm/ClassFile/Inovance_EIP.cs

@@ -286,6 +286,9 @@ namespace EIP_Protocol
 
 
         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 101)]    //工位零部件条码
         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 101)]    //工位零部件条码
         public string strPartBarcode;
         public string strPartBarcode;
+
+        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 101)]    //工位零部件条码
+        public string strPCBBarcode;
     }
     }
 
 
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
     [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]

+ 33 - 0
MainForm/ClassFile/ProjectClass/SQLHelper.cs

@@ -687,6 +687,38 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
             #endregion
             #endregion
         }
         }
 
 
+        //载具码和产品码绑定关系
+        public static ResponseMessage PCBCarrierBind(string carrierCode, string pcbBarcode)
+        {
+            // 检查记录是否已经存在
+            var CarrierBind_exists = Db.Queryable<CarrierBind>()
+                                        .Where(x => x.CarrierCode == carrierCode)
+                                        .OrderByDescending(x => x.CreateTime)
+                                        .Take(1)
+                                        .First();
+            try
+            {
+                if (CarrierBind_exists != null)
+                {
+                    Db.Updateable<CarrierBind>()
+                        .SetColumns(x=>x.PCBBarcode== pcbBarcode)
+                        .Where(x => x.ID == CarrierBind_exists.ID)
+                        .ExecuteCommand();
+                    logNet.WriteInfo($"载具码与PCB码绑定成功");
+                }
+                else { 
+                    return new ResponseMessage { result = true, text = "载具码与PCB码绑定失败!载具码["+ carrierCode + "]没有绑定记录"};
+                }
+                // 插入数据
+                return new ResponseMessage { result = true, text = "载具码与PCB码绑定成功" };
+            }
+            catch (Exception ex)
+            {
+                logNet.WriteError($"载具码与产品码绑定失败,错误" + ex.Message);
+                return new ResponseMessage { result = false, text = "载具码与产品码绑定失败,错误" + ex.Message };
+            }
+        }
+
         public static ResponseMessage InsertOp10Data(string carrierCode, string productBarcode, int bindOrder,
         public static ResponseMessage InsertOp10Data(string carrierCode, string productBarcode, int bindOrder,
                                           int throwingAmount, float cleaningPressure, float cleaningSpeed,
                                           int throwingAmount, float cleaningPressure, float cleaningSpeed,
                                           float airKnifeHeight, float cleaningTime, int cleaningCount, int remainCount)
                                           float airKnifeHeight, float cleaningTime, int cleaningCount, int remainCount)
@@ -1422,6 +1454,7 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
             // 其他列
             // 其他列
             public string CarrierCode { get; set; } = "";           // 载具码
             public string CarrierCode { get; set; } = "";           // 载具码
             public string ProductBarcode { get; set; } = "";  // 产品码
             public string ProductBarcode { get; set; } = "";  // 产品码
+            public string PCBBarcode { get; set; } = "";  // 产品码
             public DateTime CreateTime { get; set; } = DateTime.Now;    // 创建时间
             public DateTime CreateTime { get; set; } = DateTime.Now;    // 创建时间
         }
         }
 
 

+ 126 - 0
MainForm/FaForm/BandBarodeDialog.Designer.cs

@@ -0,0 +1,126 @@
+namespace MainForm.FaForm
+{
+    partial class BandBarodeDialog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(536, 278);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 0;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(230, 108);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(280, 28);
+            this.textBox1.TabIndex = 1;
+            // 
+            // textBox2
+            // 
+            this.textBox2.Location = new System.Drawing.Point(230, 47);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(280, 28);
+            this.textBox2.TabIndex = 2;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(124, 50);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(62, 18);
+            this.label1.TabIndex = 3;
+            this.label1.Text = "载具码";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(124, 111);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(62, 18);
+            this.label2.TabIndex = 4;
+            this.label2.Text = "产品码";
+            // 
+            // textBox3
+            // 
+            this.textBox3.Location = new System.Drawing.Point(230, 172);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(280, 28);
+            this.textBox3.TabIndex = 5;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(124, 182);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(62, 18);
+            this.label3.TabIndex = 6;
+            this.label3.Text = "产品码";
+            // 
+            // BandBarodeDialog
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.textBox3);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.textBox2);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.button1);
+            this.Name = "BandBarodeDialog";
+            this.Text = "BandBarodeDialog";
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox textBox3;
+        private System.Windows.Forms.Label label3;
+    }
+}

+ 21 - 0
MainForm/FaForm/BandBarodeDialog.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace MainForm.FaForm
+{
+    public partial class BandBarodeDialog : Form
+    {
+        public BandBarodeDialog()
+        {
+            InitializeComponent();
+        }
+
+    }
+}

+ 120 - 0
MainForm/FaForm/BandBarodeDialog.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 14 - 8
MainForm/FaForm/Form_Home.cs

@@ -1829,7 +1829,7 @@ namespace MainForm
 
 
                 //测试先用9码,正式直接用PLC得到的SN码,截取成9位码
                 //测试先用9码,正式直接用PLC得到的SN码,截取成9位码
                 sn = sn.Substring(sn.Length - 11, 4) + sn.Substring(sn.Length - 5, 5);
                 sn = sn.Substring(sn.Length - 11, 4) + sn.Substring(sn.Length - 5, 5);
-               
+
                 AddMessage(LogType.Info, $"载具码:{CarrierBarcode};产品码:{sn}");
                 AddMessage(LogType.Info, $"载具码:{CarrierBarcode};产品码:{sn}");
                 //绑定载具和产品
                 //绑定载具和产品
                 ResponseMessage message = new ResponseMessage();
                 ResponseMessage message = new ResponseMessage();
@@ -3098,20 +3098,26 @@ namespace MainForm
 
 
                 string MachineId = GlobalContext.S5_MachineId;  // 装备ID(可配置)
                 string MachineId = GlobalContext.S5_MachineId;  // 装备ID(可配置)
                 string StationId = GlobalContext.S5_StationId;  // 工位ID(可配置)
                 string StationId = GlobalContext.S5_StationId;  // 工位ID(可配置)
-                string strCarrierBarcode = (string)stPLC_MesData.BarcodeSet.strCarrierBarcode;  // 产品SN(物料码)
+                string strCarrierBarcode = (string)stPLC_MesData.BarcodeSet.strCarrierBarcode;  // 载具条码
+                string pcbBarcode = (string)stPLC_MesData.BarcodeSet.strPCBBarcode;
+
+                //绑定载具和产品
+                ResponseMessage message = new ResponseMessage();
+                message = SQLHelper.PCBCarrierBind(strCarrierBarcode, pcbBarcode);
+                if (message.result == false)
+                {
+                    AddMessage(LogType.Error, stationNameStr + "_载具码与产品码绑定失败,错误:" + message.text);
+                }
                 //载具码验证产品码                                                                              //载具码验证产品码 
                 //载具码验证产品码                                                                              //载具码验证产品码 
                 string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
                 string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(strCarrierBarcode);
+
                 if (string.IsNullOrEmpty(strProductBarcode))
                 if (string.IsNullOrEmpty(strProductBarcode))
                 {
                 {
                     AddMessage(LogType.Error, $"{stationNameStr}_未能查到已绑定的载具信息,无法进行载具绑定产品验证");
                     AddMessage(LogType.Error, $"{stationNameStr}_未能查到已绑定的载具信息,无法进行载具绑定产品验证");
                 }
                 }
-                //这个地方之后PLC可能会返回SN码,到时用返回的和数据库中的比较下对错,结果faalse怎么办现在不知道
-                //if (sn != strProductBarcode)
-                //{
-                //    AddMessage(LogType.Info, $"进站产品码错误!与载具绑定的产品码不匹配,进站产品码:{sn};载具绑定产品码:{strProductBarcode}");
-                //}
+
                 sn = strProductBarcode;
                 sn = strProductBarcode;
-                AddMessage(LogType.Info, $"载具码:{strCarrierBarcode};产品码:{sn}");
+                AddMessage(LogType.Info, $"载具码:{strCarrierBarcode};产品码:{sn};PCB码:{pcbBarcode}");
 
 
                 // 产品SN(物料码)校验
                 // 产品SN(物料码)校验
                 List<TestItem> item = new List<TestItem>();
                 List<TestItem> item = new List<TestItem>();