|
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
+//using System.Text;
|
|
|
using Microsoft.Win32;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
@@ -48,6 +48,9 @@ using System.Reflection;
|
|
|
using static MainForm.ClassFile.XiaomiAPI_MES.XiaomiMESHttp_StationOutbound.XmMES_StationOutRequest_Body;
|
|
|
using FaFrameUI;
|
|
|
using System.Security.Policy;
|
|
|
+using System.Drawing.Imaging;
|
|
|
+using System.Drawing;
|
|
|
+using ICSharpCode.SharpZipLib.Zip;
|
|
|
|
|
|
/*
|
|
|
* 注:本源码对外提供,所以有些地方使用中文命名方法及变量
|
|
@@ -2413,7 +2416,19 @@ namespace MainForm
|
|
|
isCollectingFlagRight = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ public static void CompressFolder(string folderPath, string zipFilePath)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 创建zip文件,将指定文件夹内的所有内容压缩到这个zip文件中
|
|
|
+ System.IO.Compression.ZipFile.CreateFromDirectory(folderPath, zipFilePath);
|
|
|
+ Console.WriteLine("文件夹已成功压缩!");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Console.WriteLine($"发生错误: {ex.Message}");
|
|
|
+ }
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 上传文件
|
|
|
/// </summary>
|
|
@@ -2446,8 +2461,12 @@ namespace MainForm
|
|
|
{
|
|
|
if (imageFiles.Count > 0)
|
|
|
{
|
|
|
+ CompressFolder("D:\\Temp\\VisionLog\\Pic\\Left", "D:\\Temp\\VisionLog\\Pic\\YaSuo.zip");
|
|
|
+
|
|
|
foreach (string imageFile in imageFiles)
|
|
|
{
|
|
|
+
|
|
|
+ break;
|
|
|
if (guid == "")
|
|
|
{
|
|
|
guid = Guid.NewGuid().ToString();
|
|
@@ -2523,7 +2542,7 @@ namespace MainForm
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
return (1,
|
|
|
- filename + $"图片保存失败!载具码:{BarcodeSet.strCarrierBarcode}产品码{BarcodeSet.strProductBarcode},错误原因:" +
|
|
|
+ filename + $"图片获取失败!载具码:{BarcodeSet.strCarrierBarcode}产品码{BarcodeSet.strProductBarcode},错误原因:" +
|
|
|
e.Message);
|
|
|
//AddMessage_Station(stationName, LogType.Error, filename + $"图片保存失败!载具码:{BarcodeSet.strCarrierBarcode}产品码{BarcodeSet.strProductBarcode}");
|
|
|
}
|