新供应商 数据恢复 升级exe优化

This commit is contained in:
wule committed 2026-08-17 16:43:35 +08:00
1 parent 456b0534e3
commit dcb82684f4
13 files changed
+419 -21

No files matched your search

+49 -4
View File
@@ -33,15 +33,18 @@ namespace Publish
this.btnPack = new System.Windows.Forms.Button();
this.lstFile = new System.Windows.Forms.ListBox();
this.btnSelect = new System.Windows.Forms.Button();
this.btnSelectOrder = new System.Windows.Forms.Button();
this.lstOrderFile = new System.Windows.Forms.ListBox();
this.btnPackOrder = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnPack
//
this.btnPack.Location = new System.Drawing.Point(466, 415);
this.btnPack.Location = new System.Drawing.Point(283, 415);
this.btnPack.Name = "btnPack";
this.btnPack.Size = new System.Drawing.Size(75, 23);
this.btnPack.TabIndex = 0;
this.btnPack.Text = "打包";
this.btnPack.Text = "打包上货";
this.btnPack.UseVisualStyleBackColor = true;
this.btnPack.Click += new System.EventHandler(this.btnPack_Click);
//
@@ -55,7 +58,7 @@ namespace Publish
"29供应链.exe"});
this.lstFile.Location = new System.Drawing.Point(12, 12);
this.lstFile.Name = "lstFile";
this.lstFile.Size = new System.Drawing.Size(529, 388);
this.lstFile.Size = new System.Drawing.Size(346, 388);
this.lstFile.TabIndex = 1;
//
// btnSelect
@@ -69,11 +72,50 @@ namespace Publish
this.btnSelect.Visible = false;
this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
//
// btnSelectOrder
//
this.btnSelectOrder.Location = new System.Drawing.Point(379, 415);
this.btnSelectOrder.Name = "btnSelectOrder";
this.btnSelectOrder.Size = new System.Drawing.Size(75, 23);
this.btnSelectOrder.TabIndex = 5;
this.btnSelectOrder.Text = "选择文件";
this.btnSelectOrder.UseVisualStyleBackColor = true;
this.btnSelectOrder.Visible = false;
this.btnSelectOrder.Click += new System.EventHandler(this.btnSelectOrder_Click);
//
// lstOrderFile
//
this.lstOrderFile.FormattingEnabled = true;
this.lstOrderFile.ItemHeight = 12;
this.lstOrderFile.Items.AddRange(new object[] {
"WxOrder.Framework.dll",
"WPFCommon.dll",
"29WxOrderWork.dll",
"29WxOrderAllBase.dll",
"29WxFindOrder.exe"});
this.lstOrderFile.Location = new System.Drawing.Point(379, 12);
this.lstOrderFile.Name = "lstOrderFile";
this.lstOrderFile.Size = new System.Drawing.Size(346, 388);
this.lstOrderFile.TabIndex = 4;
//
// btnPackOrder
//
this.btnPackOrder.Location = new System.Drawing.Point(650, 415);
this.btnPackOrder.Name = "btnPackOrder";
this.btnPackOrder.Size = new System.Drawing.Size(75, 23);
this.btnPackOrder.TabIndex = 3;
this.btnPackOrder.Text = "打包拍单";
this.btnPackOrder.UseVisualStyleBackColor = true;
this.btnPackOrder.Click += new System.EventHandler(this.btnPackOrder_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(553, 450);
this.ClientSize = new System.Drawing.Size(739, 450);
this.Controls.Add(this.btnSelectOrder);
this.Controls.Add(this.lstOrderFile);
this.Controls.Add(this.btnPackOrder);
this.Controls.Add(this.btnSelect);
this.Controls.Add(this.lstFile);
this.Controls.Add(this.btnPack);
@@ -89,6 +131,9 @@ namespace Publish
private System.Windows.Forms.Button btnPack;
private System.Windows.Forms.ListBox lstFile;
private System.Windows.Forms.Button btnSelect;
private System.Windows.Forms.Button btnSelectOrder;
private System.Windows.Forms.ListBox lstOrderFile;
private System.Windows.Forms.Button btnPackOrder;
}
}
+66 -1
View File
@@ -19,6 +19,11 @@ namespace Publish
InitializeComponent();
}
private void btnSelect_Click(object sender, EventArgs e)
{
}
private void btnPack_Click(object sender, EventArgs e)
{
try
@@ -54,9 +59,69 @@ namespace Publish
}
}
private void btnSelect_Click(object sender, EventArgs e)
private void btnSelectOrder_Click(object sender, EventArgs e)
{
}
private void btnPackOrder_Click(object sender, EventArgs e)
{
try
{
var mainPath = "";
////var dir = "..\\AllBase\\BaseClass.cs";
//var dir = "BaseClass.cs";
//string baseClassStr = File.ReadAllText(dir);
////var mainPath = baseClassStr.Substring(baseClassStr.IndexOf("MainPath = \"") + "MainPath = \"".Length);
////mainPath = mainPath.Split('\"')[0];
//var versionCount = baseClassStr.Substring(baseClassStr.IndexOf("VersionCount = ") + "VersionCount = ".Length);
//versionCount = versionCount.Split(';')[0];
//int version = Convert.ToInt32(versionCount);
var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
int version = 100;
foreach (var file in files)
{
var fileName = file.Split('\\').LastOrDefault();
if (fileName.StartsWith("WxFindOrderUpdate"))
{
var versionTmp = fileName.Replace(".zip", "").Replace("WxFindOrderUpdate", "");
try
{
if (Convert.ToInt32(versionTmp) > version)
version = Convert.ToInt32(versionTmp);
}
catch
{
}
}
}
version += 1;
while (version.ToString().Contains("4"))
{
version++;
}
List<string> filePathLst = new List<string>();
string destinationZip = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "WxFindOrderUpdate" + mainPath + version + ".zip";
foreach (var item in this.lstOrderFile.Items)
{
filePathLst.Add(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + item.ToString());
}
using (ZipArchive zip = ZipFile.Open(destinationZip, ZipArchiveMode.Create))
{
foreach (string filePath in filePathLst)
{
zip.CreateEntryFromFile(filePath, Path.GetFileName(filePath), CompressionLevel.Optimal);
}
}
MessageBox.Show("打包成功!");
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}