WIN-GH9CEESPLTB\Administrator преди 5 месеца
родител
ревизия
0ff5a8919a

+ 6 - 0
MainForm/ClassFile/ProjectClass/GlobalContext.cs

@@ -141,6 +141,8 @@ namespace MainForm
         public static bool IsSendAlarmData;      // 启用上传报警
         public static bool IsUseMESRoute;   // 启用边线MES软件
         public static bool MESIsConnect;  // MES是否正常连接
+        public static string UpFileUrl;  // 文档库地址
+        public static string UpFilePath;  // 本地文件路径
 
         // IOT - MQTT
         public static bool IsUseIot;  // 是否 启用IOT
@@ -349,6 +351,10 @@ namespace MainForm
                 StationInMESUrl = string.Format(StationInMESUrl, ServerHost);
                 StationOutMESUrl = IniFile.INIGetStringValue(FilePath, "MES", "StationOutMESUrl", "");
                 StationOutMESUrl = string.Format(StationOutMESUrl, ServerHost);
+
+                UpFileUrl = IniFile.INIGetStringValue(FilePath, "MES", "UpFileUrl", "");
+                UpFilePath = IniFile.INIGetStringValue(FilePath, "MES", "UpFilePath", "");
+
                 if (ServerHost.Contains(":"))
                 {
                     string[] mesServers = ServerHost.Split(':');

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

@@ -577,6 +577,10 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
                 {
                     CreateTables<CarrierBind>(Db);
                 }
+                if (!CheckTableExists(Db, "DataFiles"))
+                {
+                    CreateTables<DataFiles>(Db);
+                }
 
                 if (!CheckTableExists(Db, "productbind"))
                 {
@@ -1425,6 +1429,29 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
             public DateTime CreateTime { get; set; } = DateTime.Now;    // 创建时间
         }
 
+        public class DataFiles
+        {
+            // 主键ID,设置为自增且非空
+            [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+            public int ID { get; set; }                                 // 主键ID
+
+            // 其他列
+            public string stationCode { get; set; } = "";           // 站点编号
+            public string stationName { get; set; } = "";  // 站点名称
+            public string CarrierBarcode { get; set; } = "";  // 载具条码
+            public string ProductBarcode { get; set; } = "";  // 产品条码
+            public string bucket { get; set; } = "";  // ⽂件所属包  格式为:/A/B,如/home/work/app
+            public string fileName { get; set; } = "";  // 文件名
+            public string fileContext { get; set; } = "";  // 文件内容
+            public string uuid { get; set; } = "";  // 产品码
+            public string fileUrl { get; set; } = "";  // 产品码
+            public string status { get; set; } = "";  // 状态  0未推送、1已推送、2推送失败
+
+            public DateTime createTime { get; set; } = DateTime.Now;    // 创建时间
+            public DateTime submitTime { get; set; }    // 推送时间
+            
+        }
+
         // 定义ProductBind实体类,表示表格结构
         public class ProductBind
         {

+ 91 - 133
MainForm/FaForm/Form_Home.Designer.cs

@@ -77,6 +77,7 @@
             this.colTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.imageListState = new System.Windows.Forms.ImageList(this.components);
+            this.button1 = new System.Windows.Forms.Button();
             this.panel1.SuspendLayout();
             this.groupBox3.SuspendLayout();
             this.panel2.SuspendLayout();
@@ -115,14 +116,14 @@
             this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.panel1.Controls.Add(this.groupBox3);
-            this.panel1.Location = new System.Drawing.Point(9, 10);
-            this.panel1.Margin = new System.Windows.Forms.Padding(2);
+            this.panel1.Location = new System.Drawing.Point(14, 15);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(1026, 122);
+            this.panel1.Size = new System.Drawing.Size(1539, 183);
             this.panel1.TabIndex = 0;
             // 
             // groupBox3
             // 
+            this.groupBox3.Controls.Add(this.button1);
             this.groupBox3.Controls.Add(this.txt_CurSupplierCode);
             this.groupBox3.Controls.Add(this.label20);
             this.groupBox3.Controls.Add(this.currentMtltmrk);
@@ -134,10 +135,8 @@
             this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBox3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.groupBox3.Location = new System.Drawing.Point(0, 0);
-            this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox3.Name = "groupBox3";
-            this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox3.Size = new System.Drawing.Size(1026, 122);
+            this.groupBox3.Size = new System.Drawing.Size(1539, 183);
             this.groupBox3.TabIndex = 2;
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "当前加工订单信息";
@@ -145,20 +144,18 @@
             // txt_CurSupplierCode
             // 
             this.txt_CurSupplierCode.Enabled = false;
-            this.txt_CurSupplierCode.Location = new System.Drawing.Point(433, 80);
-            this.txt_CurSupplierCode.Margin = new System.Windows.Forms.Padding(2);
+            this.txt_CurSupplierCode.Location = new System.Drawing.Point(650, 120);
             this.txt_CurSupplierCode.Name = "txt_CurSupplierCode";
-            this.txt_CurSupplierCode.Size = new System.Drawing.Size(176, 27);
+            this.txt_CurSupplierCode.Size = new System.Drawing.Size(262, 36);
             this.txt_CurSupplierCode.TabIndex = 95;
             this.txt_CurSupplierCode.Visible = false;
             // 
             // label20
             // 
             this.label20.AutoSize = true;
-            this.label20.Location = new System.Drawing.Point(338, 83);
-            this.label20.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label20.Location = new System.Drawing.Point(507, 124);
             this.label20.Name = "label20";
-            this.label20.Size = new System.Drawing.Size(88, 20);
+            this.label20.Size = new System.Drawing.Size(128, 30);
             this.label20.TabIndex = 94;
             this.label20.Text = "供应商代码:";
             this.label20.Visible = false;
@@ -166,48 +163,43 @@
             // currentMtltmrk
             // 
             this.currentMtltmrk.Enabled = false;
-            this.currentMtltmrk.Location = new System.Drawing.Point(433, 39);
-            this.currentMtltmrk.Margin = new System.Windows.Forms.Padding(2);
+            this.currentMtltmrk.Location = new System.Drawing.Point(650, 58);
             this.currentMtltmrk.Name = "currentMtltmrk";
-            this.currentMtltmrk.Size = new System.Drawing.Size(176, 27);
+            this.currentMtltmrk.Size = new System.Drawing.Size(262, 36);
             this.currentMtltmrk.TabIndex = 10;
             // 
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(353, 42);
-            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label3.Location = new System.Drawing.Point(530, 63);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(73, 20);
+            this.label3.Size = new System.Drawing.Size(106, 30);
             this.label3.TabIndex = 7;
             this.label3.Text = "产品型号:";
             // 
             // currentBN
             // 
             this.currentBN.Enabled = false;
-            this.currentBN.Location = new System.Drawing.Point(119, 80);
-            this.currentBN.Margin = new System.Windows.Forms.Padding(2);
+            this.currentBN.Location = new System.Drawing.Point(178, 120);
             this.currentBN.Name = "currentBN";
-            this.currentBN.Size = new System.Drawing.Size(176, 27);
+            this.currentBN.Size = new System.Drawing.Size(262, 36);
             this.currentBN.TabIndex = 3;
             this.currentBN.Visible = false;
             // 
             // currentWC
             // 
             this.currentWC.Enabled = false;
-            this.currentWC.Location = new System.Drawing.Point(119, 39);
-            this.currentWC.Margin = new System.Windows.Forms.Padding(2);
+            this.currentWC.Location = new System.Drawing.Point(178, 58);
             this.currentWC.Name = "currentWC";
-            this.currentWC.Size = new System.Drawing.Size(176, 27);
+            this.currentWC.Size = new System.Drawing.Size(262, 36);
             this.currentWC.TabIndex = 2;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(46, 83);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(69, 124);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(69, 20);
+            this.label2.Size = new System.Drawing.Size(101, 30);
             this.label2.TabIndex = 1;
             this.label2.Text = "批次号:";
             this.label2.Visible = false;
@@ -215,10 +207,9 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(19, 42);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(28, 63);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(88, 20);
+            this.label1.Size = new System.Drawing.Size(128, 30);
             this.label1.TabIndex = 0;
             this.label1.Text = "车间订单号:";
             // 
@@ -227,10 +218,9 @@
             this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.panel2.Controls.Add(this.groupBox2);
-            this.panel2.Location = new System.Drawing.Point(9, 455);
-            this.panel2.Margin = new System.Windows.Forms.Padding(2);
+            this.panel2.Location = new System.Drawing.Point(14, 682);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(1026, 100);
+            this.panel2.Size = new System.Drawing.Size(1539, 150);
             this.panel2.TabIndex = 1;
             // 
             // groupBox2
@@ -248,11 +238,9 @@
             this.groupBox2.Controls.Add(this.groupBox13);
             this.groupBox2.Controls.Add(this.groupBox11);
             this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.groupBox2.Location = new System.Drawing.Point(2, 2);
-            this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox2.Location = new System.Drawing.Point(3, 3);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox2.Size = new System.Drawing.Size(902, 94);
+            this.groupBox2.Size = new System.Drawing.Size(1353, 141);
             this.groupBox2.TabIndex = 1;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "设备状态";
@@ -261,12 +249,10 @@
             // 
             this.groupBox15.Controls.Add(this.picAgvMqtt);
             this.groupBox15.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox15.Location = new System.Drawing.Point(245, 24);
-            this.groupBox15.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox15.Location = new System.Drawing.Point(368, 36);
             this.groupBox15.Name = "groupBox15";
-            this.groupBox15.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox15.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox15.Size = new System.Drawing.Size(90, 60);
+            this.groupBox15.Size = new System.Drawing.Size(135, 90);
             this.groupBox15.TabIndex = 14;
             this.groupBox15.TabStop = false;
             this.groupBox15.Text = "AGV Mqtt";
@@ -276,10 +262,9 @@
             this.picAgvMqtt.ErrorImage = ((System.Drawing.Image)(resources.GetObject("picAgvMqtt.ErrorImage")));
             this.picAgvMqtt.Image = ((System.Drawing.Image)(resources.GetObject("picAgvMqtt.Image")));
             this.picAgvMqtt.InitialImage = ((System.Drawing.Image)(resources.GetObject("picAgvMqtt.InitialImage")));
-            this.picAgvMqtt.Location = new System.Drawing.Point(32, 24);
-            this.picAgvMqtt.Margin = new System.Windows.Forms.Padding(2);
+            this.picAgvMqtt.Location = new System.Drawing.Point(48, 36);
             this.picAgvMqtt.Name = "picAgvMqtt";
-            this.picAgvMqtt.Size = new System.Drawing.Size(26, 28);
+            this.picAgvMqtt.Size = new System.Drawing.Size(39, 42);
             this.picAgvMqtt.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picAgvMqtt.TabIndex = 10;
             this.picAgvMqtt.TabStop = false;
@@ -288,12 +273,10 @@
             // 
             this.groupBox14.Controls.Add(this.picAgvHttp);
             this.groupBox14.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox14.Location = new System.Drawing.Point(156, 24);
-            this.groupBox14.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox14.Location = new System.Drawing.Point(234, 36);
             this.groupBox14.Name = "groupBox14";
-            this.groupBox14.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox14.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox14.Size = new System.Drawing.Size(85, 60);
+            this.groupBox14.Size = new System.Drawing.Size(128, 90);
             this.groupBox14.TabIndex = 13;
             this.groupBox14.TabStop = false;
             this.groupBox14.Text = "AGV Http";
@@ -303,10 +286,9 @@
             this.picAgvHttp.ErrorImage = ((System.Drawing.Image)(resources.GetObject("picAgvHttp.ErrorImage")));
             this.picAgvHttp.Image = ((System.Drawing.Image)(resources.GetObject("picAgvHttp.Image")));
             this.picAgvHttp.InitialImage = ((System.Drawing.Image)(resources.GetObject("picAgvHttp.InitialImage")));
-            this.picAgvHttp.Location = new System.Drawing.Point(28, 24);
-            this.picAgvHttp.Margin = new System.Windows.Forms.Padding(2);
+            this.picAgvHttp.Location = new System.Drawing.Point(42, 36);
             this.picAgvHttp.Name = "picAgvHttp";
-            this.picAgvHttp.Size = new System.Drawing.Size(26, 28);
+            this.picAgvHttp.Size = new System.Drawing.Size(39, 42);
             this.picAgvHttp.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picAgvHttp.TabIndex = 10;
             this.picAgvHttp.TabStop = false;
@@ -315,12 +297,10 @@
             // 
             this.groupBox1.Controls.Add(this.picIot);
             this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox1.Location = new System.Drawing.Point(88, 24);
-            this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox1.Location = new System.Drawing.Point(132, 36);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox1.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox1.Size = new System.Drawing.Size(64, 60);
+            this.groupBox1.Size = new System.Drawing.Size(96, 90);
             this.groupBox1.TabIndex = 12;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "IOT";
@@ -330,10 +310,9 @@
             this.picIot.ErrorImage = ((System.Drawing.Image)(resources.GetObject("picIot.ErrorImage")));
             this.picIot.Image = ((System.Drawing.Image)(resources.GetObject("picIot.Image")));
             this.picIot.InitialImage = ((System.Drawing.Image)(resources.GetObject("picIot.InitialImage")));
-            this.picIot.Location = new System.Drawing.Point(18, 24);
-            this.picIot.Margin = new System.Windows.Forms.Padding(2);
+            this.picIot.Location = new System.Drawing.Point(27, 36);
             this.picIot.Name = "picIot";
-            this.picIot.Size = new System.Drawing.Size(26, 28);
+            this.picIot.Size = new System.Drawing.Size(39, 42);
             this.picIot.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picIot.TabIndex = 10;
             this.picIot.TabStop = false;
@@ -342,12 +321,10 @@
             // 
             this.groupBox5.Controls.Add(this.picMESStatus);
             this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox5.Location = new System.Drawing.Point(20, 24);
-            this.groupBox5.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox5.Location = new System.Drawing.Point(30, 36);
             this.groupBox5.Name = "groupBox5";
-            this.groupBox5.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox5.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox5.Size = new System.Drawing.Size(64, 60);
+            this.groupBox5.Size = new System.Drawing.Size(96, 90);
             this.groupBox5.TabIndex = 0;
             this.groupBox5.TabStop = false;
             this.groupBox5.Text = "MES";
@@ -357,10 +334,9 @@
             this.picMESStatus.ErrorImage = ((System.Drawing.Image)(resources.GetObject("picMESStatus.ErrorImage")));
             this.picMESStatus.Image = ((System.Drawing.Image)(resources.GetObject("picMESStatus.Image")));
             this.picMESStatus.InitialImage = ((System.Drawing.Image)(resources.GetObject("picMESStatus.InitialImage")));
-            this.picMESStatus.Location = new System.Drawing.Point(18, 24);
-            this.picMESStatus.Margin = new System.Windows.Forms.Padding(2);
+            this.picMESStatus.Location = new System.Drawing.Point(27, 36);
             this.picMESStatus.Name = "picMESStatus";
-            this.picMESStatus.Size = new System.Drawing.Size(26, 28);
+            this.picMESStatus.Size = new System.Drawing.Size(39, 42);
             this.picMESStatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picMESStatus.TabIndex = 10;
             this.picMESStatus.TabStop = false;
@@ -369,12 +345,10 @@
             // 
             this.groupBox7.Controls.Add(this.pictureBox6);
             this.groupBox7.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox7.Location = new System.Drawing.Point(680, 24);
-            this.groupBox7.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox7.Location = new System.Drawing.Point(1020, 36);
             this.groupBox7.Name = "groupBox7";
-            this.groupBox7.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox7.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox7.Size = new System.Drawing.Size(64, 60);
+            this.groupBox7.Size = new System.Drawing.Size(96, 90);
             this.groupBox7.TabIndex = 1;
             this.groupBox7.TabStop = false;
             this.groupBox7.Text = "PLC6";
@@ -385,10 +359,9 @@
             this.pictureBox6.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox6.ErrorImage")));
             this.pictureBox6.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox6.Image")));
             this.pictureBox6.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox6.InitialImage")));
-            this.pictureBox6.Location = new System.Drawing.Point(18, 24);
-            this.pictureBox6.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox6.Location = new System.Drawing.Point(27, 36);
             this.pictureBox6.Name = "pictureBox6";
-            this.pictureBox6.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox6.Size = new System.Drawing.Size(39, 42);
             this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox6.TabIndex = 16;
             this.pictureBox6.TabStop = false;
@@ -397,12 +370,10 @@
             // 
             this.groupBox12.Controls.Add(this.pictureBox8);
             this.groupBox12.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox12.Location = new System.Drawing.Point(816, 24);
-            this.groupBox12.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox12.Location = new System.Drawing.Point(1224, 36);
             this.groupBox12.Name = "groupBox12";
-            this.groupBox12.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox12.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox12.Size = new System.Drawing.Size(64, 60);
+            this.groupBox12.Size = new System.Drawing.Size(96, 90);
             this.groupBox12.TabIndex = 1;
             this.groupBox12.TabStop = false;
             this.groupBox12.Text = "PLC8";
@@ -413,10 +384,9 @@
             this.pictureBox8.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox8.ErrorImage")));
             this.pictureBox8.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox8.Image")));
             this.pictureBox8.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox8.InitialImage")));
-            this.pictureBox8.Location = new System.Drawing.Point(19, 24);
-            this.pictureBox8.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox8.Location = new System.Drawing.Point(28, 36);
             this.pictureBox8.Name = "pictureBox8";
-            this.pictureBox8.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox8.Size = new System.Drawing.Size(39, 42);
             this.pictureBox8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox8.TabIndex = 18;
             this.pictureBox8.TabStop = false;
@@ -425,12 +395,10 @@
             // 
             this.groupBox9.Controls.Add(this.pictureBox7);
             this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox9.Location = new System.Drawing.Point(748, 24);
-            this.groupBox9.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox9.Location = new System.Drawing.Point(1122, 36);
             this.groupBox9.Name = "groupBox9";
-            this.groupBox9.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox9.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox9.Size = new System.Drawing.Size(64, 60);
+            this.groupBox9.Size = new System.Drawing.Size(96, 90);
             this.groupBox9.TabIndex = 1;
             this.groupBox9.TabStop = false;
             this.groupBox9.Text = "PLC7";
@@ -441,10 +409,9 @@
             this.pictureBox7.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox7.ErrorImage")));
             this.pictureBox7.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox7.Image")));
             this.pictureBox7.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox7.InitialImage")));
-            this.pictureBox7.Location = new System.Drawing.Point(20, 24);
-            this.pictureBox7.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox7.Location = new System.Drawing.Point(30, 36);
             this.pictureBox7.Name = "pictureBox7";
-            this.pictureBox7.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox7.Size = new System.Drawing.Size(39, 42);
             this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox7.TabIndex = 17;
             this.pictureBox7.TabStop = false;
@@ -453,12 +420,10 @@
             // 
             this.groupBox8.Controls.Add(this.picPLC);
             this.groupBox8.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox8.Location = new System.Drawing.Point(339, 24);
-            this.groupBox8.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox8.Location = new System.Drawing.Point(508, 36);
             this.groupBox8.Name = "groupBox8";
-            this.groupBox8.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox8.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox8.Size = new System.Drawing.Size(64, 60);
+            this.groupBox8.Size = new System.Drawing.Size(96, 90);
             this.groupBox8.TabIndex = 1;
             this.groupBox8.TabStop = false;
             this.groupBox8.Text = "PLC";
@@ -468,10 +433,9 @@
             this.picPLC.ErrorImage = ((System.Drawing.Image)(resources.GetObject("picPLC.ErrorImage")));
             this.picPLC.Image = ((System.Drawing.Image)(resources.GetObject("picPLC.Image")));
             this.picPLC.InitialImage = ((System.Drawing.Image)(resources.GetObject("picPLC.InitialImage")));
-            this.picPLC.Location = new System.Drawing.Point(20, 24);
-            this.picPLC.Margin = new System.Windows.Forms.Padding(2);
+            this.picPLC.Location = new System.Drawing.Point(30, 36);
             this.picPLC.Name = "picPLC";
-            this.picPLC.Size = new System.Drawing.Size(26, 28);
+            this.picPLC.Size = new System.Drawing.Size(39, 42);
             this.picPLC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.picPLC.TabIndex = 0;
             this.picPLC.TabStop = false;
@@ -480,12 +444,10 @@
             // 
             this.groupBox6.Controls.Add(this.pictureBox2);
             this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox6.Location = new System.Drawing.Point(407, 24);
-            this.groupBox6.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox6.Location = new System.Drawing.Point(610, 36);
             this.groupBox6.Name = "groupBox6";
-            this.groupBox6.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox6.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox6.Size = new System.Drawing.Size(64, 60);
+            this.groupBox6.Size = new System.Drawing.Size(96, 90);
             this.groupBox6.TabIndex = 11;
             this.groupBox6.TabStop = false;
             this.groupBox6.Text = "PLC2";
@@ -496,10 +458,9 @@
             this.pictureBox2.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox2.ErrorImage")));
             this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
             this.pictureBox2.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox2.InitialImage")));
-            this.pictureBox2.Location = new System.Drawing.Point(20, 24);
-            this.pictureBox2.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox2.Location = new System.Drawing.Point(30, 36);
             this.pictureBox2.Name = "pictureBox2";
-            this.pictureBox2.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox2.Size = new System.Drawing.Size(39, 42);
             this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox2.TabIndex = 12;
             this.pictureBox2.TabStop = false;
@@ -508,12 +469,10 @@
             // 
             this.groupBox10.Controls.Add(this.pictureBox3);
             this.groupBox10.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox10.Location = new System.Drawing.Point(475, 24);
-            this.groupBox10.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox10.Location = new System.Drawing.Point(712, 36);
             this.groupBox10.Name = "groupBox10";
-            this.groupBox10.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox10.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox10.Size = new System.Drawing.Size(64, 60);
+            this.groupBox10.Size = new System.Drawing.Size(96, 90);
             this.groupBox10.TabIndex = 1;
             this.groupBox10.TabStop = false;
             this.groupBox10.Text = "PLC3";
@@ -524,10 +483,9 @@
             this.pictureBox3.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox3.ErrorImage")));
             this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
             this.pictureBox3.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox3.InitialImage")));
-            this.pictureBox3.Location = new System.Drawing.Point(18, 24);
-            this.pictureBox3.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox3.Location = new System.Drawing.Point(27, 36);
             this.pictureBox3.Name = "pictureBox3";
-            this.pictureBox3.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox3.Size = new System.Drawing.Size(39, 42);
             this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox3.TabIndex = 13;
             this.pictureBox3.TabStop = false;
@@ -536,12 +494,10 @@
             // 
             this.groupBox13.Controls.Add(this.pictureBox5);
             this.groupBox13.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox13.Location = new System.Drawing.Point(611, 24);
-            this.groupBox13.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox13.Location = new System.Drawing.Point(916, 36);
             this.groupBox13.Name = "groupBox13";
-            this.groupBox13.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox13.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox13.Size = new System.Drawing.Size(64, 60);
+            this.groupBox13.Size = new System.Drawing.Size(96, 90);
             this.groupBox13.TabIndex = 1;
             this.groupBox13.TabStop = false;
             this.groupBox13.Text = "PLC5";
@@ -552,10 +508,9 @@
             this.pictureBox5.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox5.ErrorImage")));
             this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image")));
             this.pictureBox5.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox5.InitialImage")));
-            this.pictureBox5.Location = new System.Drawing.Point(20, 24);
-            this.pictureBox5.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox5.Location = new System.Drawing.Point(30, 36);
             this.pictureBox5.Name = "pictureBox5";
-            this.pictureBox5.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox5.Size = new System.Drawing.Size(39, 42);
             this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox5.TabIndex = 15;
             this.pictureBox5.TabStop = false;
@@ -564,12 +519,10 @@
             // 
             this.groupBox11.Controls.Add(this.pictureBox4);
             this.groupBox11.Font = new System.Drawing.Font("微软雅黑", 9.6F);
-            this.groupBox11.Location = new System.Drawing.Point(543, 24);
-            this.groupBox11.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox11.Location = new System.Drawing.Point(814, 36);
             this.groupBox11.Name = "groupBox11";
-            this.groupBox11.Padding = new System.Windows.Forms.Padding(2);
             this.groupBox11.RightToLeft = System.Windows.Forms.RightToLeft.No;
-            this.groupBox11.Size = new System.Drawing.Size(64, 60);
+            this.groupBox11.Size = new System.Drawing.Size(96, 90);
             this.groupBox11.TabIndex = 1;
             this.groupBox11.TabStop = false;
             this.groupBox11.Text = "PLC4";
@@ -580,10 +533,9 @@
             this.pictureBox4.ErrorImage = ((System.Drawing.Image)(resources.GetObject("pictureBox4.ErrorImage")));
             this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
             this.pictureBox4.InitialImage = ((System.Drawing.Image)(resources.GetObject("pictureBox4.InitialImage")));
-            this.pictureBox4.Location = new System.Drawing.Point(20, 24);
-            this.pictureBox4.Margin = new System.Windows.Forms.Padding(2);
+            this.pictureBox4.Location = new System.Drawing.Point(30, 36);
             this.pictureBox4.Name = "pictureBox4";
-            this.pictureBox4.Size = new System.Drawing.Size(26, 28);
+            this.pictureBox4.Size = new System.Drawing.Size(39, 42);
             this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBox4.TabIndex = 14;
             this.pictureBox4.TabStop = false;
@@ -594,10 +546,9 @@
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.panel3.Controls.Add(this.groupBox4);
-            this.panel3.Location = new System.Drawing.Point(9, 137);
-            this.panel3.Margin = new System.Windows.Forms.Padding(2);
+            this.panel3.Location = new System.Drawing.Point(14, 206);
             this.panel3.Name = "panel3";
-            this.panel3.Size = new System.Drawing.Size(1026, 313);
+            this.panel3.Size = new System.Drawing.Size(1539, 470);
             this.panel3.TabIndex = 2;
             // 
             // groupBox4
@@ -606,10 +557,8 @@
             this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.groupBox4.Location = new System.Drawing.Point(0, 0);
-            this.groupBox4.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox4.Name = "groupBox4";
-            this.groupBox4.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox4.Size = new System.Drawing.Size(1026, 313);
+            this.groupBox4.Size = new System.Drawing.Size(1539, 470);
             this.groupBox4.TabIndex = 1;
             this.groupBox4.TabStop = false;
             this.groupBox4.Text = "数据采集";
@@ -638,8 +587,7 @@
             this.systemLog.Dock = System.Windows.Forms.DockStyle.Fill;
             this.systemLog.EnableHeadersVisualStyles = false;
             this.systemLog.GridColor = System.Drawing.Color.Gainsboro;
-            this.systemLog.Location = new System.Drawing.Point(2, 22);
-            this.systemLog.Margin = new System.Windows.Forms.Padding(2);
+            this.systemLog.Location = new System.Drawing.Point(3, 32);
             this.systemLog.Name = "systemLog";
             this.systemLog.ReadOnly = true;
             dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
@@ -657,7 +605,7 @@
             this.systemLog.RowsDefaultCellStyle = dataGridViewCellStyle4;
             this.systemLog.RowTemplate.Height = 27;
             this.systemLog.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
-            this.systemLog.Size = new System.Drawing.Size(1022, 289);
+            this.systemLog.Size = new System.Drawing.Size(1533, 435);
             this.systemLog.TabIndex = 0;
             // 
             // colDate
@@ -697,16 +645,25 @@
             this.imageListState.Images.SetKeyName(1, "light_green.png");
             this.imageListState.Images.SetKeyName(2, "light_red.png");
             // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(1108, 70);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(159, 47);
+            this.button1.TabIndex = 96;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
             // Form_Home
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.White;
-            this.ClientSize = new System.Drawing.Size(1044, 561);
+            this.ClientSize = new System.Drawing.Size(1566, 842);
             this.Controls.Add(this.panel3);
             this.Controls.Add(this.panel2);
             this.Controls.Add(this.panel1);
-            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "Form_Home";
             this.Text = "Form_Home";
             this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form_Home_FormClosed);
@@ -792,5 +749,6 @@
         private System.Windows.Forms.PictureBox picAgvHttp;
         private System.Windows.Forms.GroupBox groupBox15;
         private System.Windows.Forms.PictureBox picAgvMqtt;
+        private System.Windows.Forms.Button button1;
     }
 }

+ 123 - 0
MainForm/FaForm/Form_Home.cs

@@ -36,6 +36,7 @@ using Org.BouncyCastle.Asn1.IsisMtt;
 using System.Web.Services.Description;
 using System.Numerics;
 using MathNet.Numerics.RootFinding;
+using System.Net.Http;
 
 /*
  * 注:本源码对外提供,所以有些地方使用中文命名方法及变量
@@ -1319,6 +1320,117 @@ namespace MainForm
             return result;
         }
 
+        /// <summary>
+        /// 图片存入数据库
+        /// </summary>
+        /// <param name="stPLC_MesData"></param>
+        /// <param name="stationCode"></param>
+        /// <param name="stationName"></param>
+        private void SaveDBbyFileInfo(OP40_MesData_t stPLC_MesData, string stationCode, string stationName)
+        {
+            string path = GlobalContext.UpFilePath;
+            string leftPath = path + "\\Left";
+            string rightPath = path + "\\Right";
+            string sql = "";
+            var formData = new MultipartFormDataContent();
+
+            // 获取所有图片文件
+            List<string> imageFiles_L = GetAllImageFiles(leftPath);
+            List<string> imageFiles_R = GetAllImageFiles(rightPath);
+            try
+            {
+                foreach (string imageFile in imageFiles_L)
+                {
+                    //formData = MultipartbyFile(imageFile);
+                    sql = string.Format("INSERT INTO [dbo].[DataFiles](stationCode,stationName,CarrierBarcode,ProductBarcode,bucket,fileName,fileContext,uuid,fileUrl,status,submitTime,createTime) " +
+                        "VALUES('{0}','{1}','{2}' ,'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')"
+                        , stationCode
+                        , stationName
+                        , stPLC_MesData.BarcodeSet.strCarrierBarcode
+                        , stPLC_MesData.BarcodeSet.strProductBarcode
+                        , "/mesCommToPC/pic/left"
+                        , Path.GetFileName(imageFile)
+                        , ""
+                        , ""
+                        , ""
+                        , 0
+                        , ""
+                        , DateTime.Now
+                        );
+                    string ret = SQLHelper_New.ExecuteNonQuery(sql, null);
+                }
+                foreach (string imageFile in imageFiles_R)
+                {
+                    //formData = MultipartbyFile(imageFile);
+                    sql = string.Format("INSERT INTO [dbo].[DataFiles](stationCode,stationName,CarrierBarcode,ProductBarcode,bucket,fileName,fileContext,uuid,fileUrl,status,submitTime,createTime) " +
+                        "VALUES('{0}','{1}','{2}' ,'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')"
+                        , stationCode
+                        , stationName
+                        , stPLC_MesData.BarcodeSet.strCarrierBarcode
+                        , stPLC_MesData.BarcodeSet.strProductBarcode
+                        , "/mesCommToPC/pic/right"
+                        , Path.GetFileName(imageFile)
+                        , ""
+                        , ""
+                        , ""
+                        , 0
+                        , ""
+                        , DateTime.Now
+                        );
+                    string ret = SQLHelper_New.ExecuteNonQuery(sql, null);
+                }
+            }
+            catch (Exception)
+            {
+                AddMessage_Station(stationName, LogType.Error, $"图片保存失败!载具码:{stPLC_MesData.BarcodeSet.strCarrierBarcode}产品码{stPLC_MesData.BarcodeSet.strProductBarcode}");
+
+            }
+        }
+
+        /// <summary>
+        /// 获取路径下的所有图片
+        /// </summary>
+        /// <param name="directoryPath"></param>
+        /// <returns></returns>
+        private List<string> GetAllImageFiles(string directoryPath)
+        {
+            var imageExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".jpg", ".jpeg", ".png", ".bmp", ".gif", ".tiff" };
+            var imageFiles = new List<string>();
+
+            try
+            {
+                // 遍历目录及子目录中的所有文件
+                foreach (string file in Directory.EnumerateFiles(directoryPath, "*.*", SearchOption.AllDirectories))
+                {
+                    // 获取文件扩展名并检查是否为图片格式
+                    string extension = Path.GetExtension(file);
+                    if (imageExtensions.Contains(extension))
+                    {
+                        imageFiles.Add(file);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                OnMessage(LogType.Error, $"图片查询发生错误: {ex.Message}");
+            }
+            return imageFiles;
+        }
+
+        public MultipartFormDataContent MultipartbyFile(string filePath)
+        {
+            using (var formData = new MultipartFormDataContent())
+            {
+                // 读取文件并转换为ByteArrayContent
+                byte[] fileBytes = File.ReadAllBytes(filePath);
+                var fileContent = new ByteArrayContent(fileBytes);
+
+                // 将ByteArrayContent添加到MultipartFormDataContent,并指定名称
+                formData.Add(fileContent, "file", Path.GetFileName(filePath));
+
+                return formData;
+            }
+        }
 
         //private void CollectAndProcessDataLeft(string sn, string direction, string ip, string port, int connectTimeOut, int sendDataTimeOut)
         //{
@@ -10905,5 +11017,16 @@ namespace MainForm
             //DicAlarms.Add(2, keyValues);
             #endregion 第二个工站-原来的写法(废弃)
         }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            string stationCode = "[OP40]";
+            string stationName = "胶线检测";
+            OP40_MesData_t OP40_MesData_t = new OP40_MesData_t();
+            OP40_MesData_t.BarcodeSet.strCarrierBarcode = "AAA111";
+            OP40_MesData_t.BarcodeSet.strProductBarcode = "CP20250217001";
+
+            SaveDBbyFileInfo(OP40_MesData_t, stationCode, stationName);
+        }
     }
 }

+ 1 - 1
MainForm/FaForm/Form_Home.resx

@@ -8367,7 +8367,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACQ
-        PgAAAk1TRnQBSQFMAgEBAwEAAbgBCAG4AQgBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA
+        PgAAAk1TRnQBSQFMAgEBAwEAAcABCAHAAQgBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA
         AwABIAMAAQEBAAEgBgABQP8A/wA8AAP5Af8DzgH/A6gB/wOLAf8DeAH/A3EB/wNxAf8DeAH/A4sB/wOo
         Af8DzwH/A/kB/1AAAfcB+wH3Af8BuwHgAbYB/wGGAcgBfAH/AV0BtQFQAf8BQgGpATMB/wE5AaUBKQH/
         ATkBpQEpAf8BQwGqATQB/wFdAbYBUAH/AYUByAF7Af8BvAHhAbcB/wH3AfsB9wH/UAAB9gH1AfsB/wGw