baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+157
@@ -0,0 +1,157 @@
|
||||
using ODK.WPF.Helper;
|
||||
using System;
|
||||
using APServerClient.APServiceReference;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Services.CommonFunction
|
||||
{
|
||||
public class APClient
|
||||
{
|
||||
public APClient()
|
||||
{
|
||||
this.Url = this.GetURL(this.Url);
|
||||
BasicHttpBinding binding = new BasicHttpBinding()
|
||||
{
|
||||
MaxBufferSize = 20000000,
|
||||
MaxBufferPoolSize = 20000000,
|
||||
MaxReceivedMessageSize = 20000000,
|
||||
AllowCookies = true
|
||||
};
|
||||
EndpointAddress address = new EndpointAddress(this.Url);
|
||||
this._Service = new APServiceSoapClient(binding, address);
|
||||
}
|
||||
|
||||
public APClient(string URL)
|
||||
{
|
||||
string text;
|
||||
if (string.IsNullOrEmpty(URL))
|
||||
{
|
||||
text = this.GetURL(this.Url);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (URL.LastIndexOf('/') == URL.Length - 1)
|
||||
{
|
||||
text = URL.Left(URL.Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = URL;
|
||||
}
|
||||
if (string.IsNullOrEmpty(ODKContext.APPath))
|
||||
{
|
||||
text += "/ODKV60/AP/APService.asmx";
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text + "/" + ODKContext.APPath + "/AP/APService.asmx";
|
||||
}
|
||||
}
|
||||
this.Url = text;
|
||||
BasicHttpBinding binding = new BasicHttpBinding()
|
||||
{
|
||||
MaxBufferSize = 20000000,
|
||||
MaxBufferPoolSize = 20000000,
|
||||
MaxReceivedMessageSize = 20000000,
|
||||
AllowCookies = true
|
||||
};
|
||||
EndpointAddress address = new EndpointAddress(text);
|
||||
this._Service = new APServiceSoapClient(binding, address);
|
||||
}
|
||||
|
||||
// Token: 0x06000464 RID: 1124 RVA: 0x0001C82C File Offset: 0x0001AA2C
|
||||
protected virtual string GetURL(string WebServiceURL)
|
||||
{
|
||||
Uri uri = new Uri(WebServiceURL);
|
||||
if (this.IsRunTime)
|
||||
{
|
||||
string result;
|
||||
if (string.IsNullOrEmpty(ODKContext.APPath))
|
||||
{
|
||||
result = this.APServerURL + "/ODKV60/AP/" + uri.Segments[uri.Segments.GetLength(0) - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.APServerURL + ODKContext.APPath + "/AP/" + uri.Segments[uri.Segments.GetLength(0) - 1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return WebServiceURL;
|
||||
}
|
||||
|
||||
// Token: 0x17000126 RID: 294
|
||||
// (get) Token: 0x06000465 RID: 1125 RVA: 0x0001C8B0 File Offset: 0x0001AAB0
|
||||
protected virtual string APServerURL
|
||||
{
|
||||
get
|
||||
{
|
||||
string text;
|
||||
if (ODKContext.APServer.LastIndexOf('/') == ODKContext.APServer.Length - 1)
|
||||
{
|
||||
text = "http://" + ODKContext.APServer.Right(ODKContext.APServer.Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "http://" + ODKContext.APServer;
|
||||
}
|
||||
if (ODKContext.APPPort != 80)
|
||||
{
|
||||
text = text + ":" + ODKContext.APPPort.ToStringEx() + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "/";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000124 RID: 292
|
||||
private APServiceSoapClient _Service;
|
||||
public APServiceSoapClient Service
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Service == null)
|
||||
{
|
||||
this.Url = this.GetURL(this.Url);
|
||||
BasicHttpBinding binding = new BasicHttpBinding();
|
||||
EndpointAddress address = new EndpointAddress(this.Url);
|
||||
this._Service = new APServiceSoapClient(binding, address);
|
||||
}
|
||||
return this._Service;
|
||||
}
|
||||
}
|
||||
|
||||
private Uri uri;
|
||||
public string Url
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(this.uri == null))
|
||||
{
|
||||
return this.uri.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.uri = new Uri(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000127 RID: 295
|
||||
// (get) Token: 0x0600047C RID: 1148 RVA: 0x000051B3 File Offset: 0x000033B3
|
||||
public virtual bool IsRunTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1198
File diff suppressed because it is too large.
Load diff
Executable
+423
@@ -0,0 +1,423 @@
|
||||
using APServerClient.APServiceReference;
|
||||
using ODK.WPF.Helper;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Services.CommonFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件操作静态类
|
||||
/// </summary>
|
||||
public static class FileHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 下载服务器文件
|
||||
/// </summary>
|
||||
/// <param name="upFileInfo"></param>
|
||||
public static void WebDownLoadFile(FileUpDownInfo upFileInfo)
|
||||
{
|
||||
APClient apclient;
|
||||
if (!string.IsNullOrEmpty(upFileInfo.ServerIP))
|
||||
{
|
||||
apclient = new APClient(upFileInfo.ServerIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
apclient = new APClient();
|
||||
}
|
||||
|
||||
long blockAmount = 512000L;
|
||||
bool flag = false;
|
||||
string sourceFilePath = upFileInfo.SourceFilePath;
|
||||
string sourceFileName = upFileInfo.SourceFileName;
|
||||
string targetFilePath = upFileInfo.TargetFilePath;
|
||||
string targetFileName = upFileInfo.TargetFileName;
|
||||
string text = Path.Combine(targetFilePath, targetFileName);
|
||||
try
|
||||
{
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(targetFilePath);
|
||||
if (!directoryInfo.Exists)
|
||||
{
|
||||
directoryInfo.Create();
|
||||
}
|
||||
string fileInfo = apclient.Service.GetFileInfo(sourceFilePath, sourceFileName);
|
||||
if (fileInfo.Contains("失败:") || fileInfo.Contains("Error:"))
|
||||
{ }
|
||||
else
|
||||
{
|
||||
long num = 0L;
|
||||
foreach (string text2 in fileInfo.Split(new char[]
|
||||
{
|
||||
';'
|
||||
}))
|
||||
{
|
||||
if (text2.Length > 0)
|
||||
{
|
||||
string[] array2 = text2.Trim(new char[]
|
||||
{
|
||||
'\r'
|
||||
}).Split(new char[]
|
||||
{
|
||||
'='
|
||||
});
|
||||
if (array2.Length == 2 && array2[0].ToLower() == "filelength")
|
||||
{
|
||||
num = array2[1].ToInt64();
|
||||
}
|
||||
}
|
||||
}
|
||||
long num2 = num / blockAmount + 1L;
|
||||
string path = targetFileName + ".temp";
|
||||
string text3 = Path.Combine(targetFilePath, path);
|
||||
using (FileStream fileStream = File.Open(text3, FileMode.Create))
|
||||
{
|
||||
long num3 = 0L;
|
||||
while (num3 < num2 && !flag)
|
||||
{
|
||||
long pOffset = num3 * blockAmount;
|
||||
FileUpDownInfo fileUpDownInfo = PublicFunction.DeserializeObject<FileUpDownInfo>(apclient.Service.DownloadBtye(sourceFilePath, sourceFileName, pOffset, blockAmount.ToInt()));
|
||||
if (fileUpDownInfo.HasErr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
byte[] fileContent = fileUpDownInfo.FileContent;
|
||||
fileStream.Write(fileContent, 0, fileContent.Length);
|
||||
int num4;
|
||||
if (num2 > 0L)
|
||||
{
|
||||
num4 = (int)decimal.Floor(num3 / (num2 * 1m) * 100m);
|
||||
}
|
||||
else
|
||||
{
|
||||
num4 = 100;
|
||||
}
|
||||
if (num4 > 100)
|
||||
{
|
||||
num4 = 100;
|
||||
}
|
||||
num3 += 1L;
|
||||
}
|
||||
fileStream.Flush();
|
||||
fileStream.Close();
|
||||
if (File.Exists(text))
|
||||
{
|
||||
File.Delete(text);
|
||||
}
|
||||
File.Move(text3, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public static DownloadErr WebUpLoadFile(FileUpDownInfo upFileInfo)
|
||||
{
|
||||
DownloadErr UploadFileErr = new DownloadErr();
|
||||
|
||||
bool flag = false;
|
||||
string sourceFilePath = upFileInfo.SourceFilePath;
|
||||
string sourceFileName = upFileInfo.SourceFileName;
|
||||
string text = Path.Combine(sourceFilePath, sourceFileName);
|
||||
try
|
||||
{
|
||||
long blockAmount = 512000L;
|
||||
|
||||
UploadFileErr.UpFilePath = upFileInfo.TargetFullPath;
|
||||
UploadFileErr.SourceFilePath = upFileInfo.SourceFullPath;
|
||||
FileInfo fileInfo = new FileInfo(text);
|
||||
if (fileInfo == null)
|
||||
{
|
||||
UploadFileErr.HasErr = true;
|
||||
UploadFileErr.Err = string.Format("文件{0}不存在!!!", text);
|
||||
}
|
||||
else
|
||||
{
|
||||
APClient apclient;
|
||||
if (!string.IsNullOrEmpty(upFileInfo.ServerIP))
|
||||
{
|
||||
apclient = new APClient(upFileInfo.ServerIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
apclient = new APClient();
|
||||
}
|
||||
using (FileStream fileStream = fileInfo.OpenRead())
|
||||
{
|
||||
bool flag2 = false;
|
||||
bool isFirst = true;
|
||||
fileStream.Position = 0L;
|
||||
while (!flag)
|
||||
{
|
||||
int num = (int)(fileStream.Length - fileStream.Position);
|
||||
if ((long)num > blockAmount)
|
||||
{
|
||||
byte[] array = new byte[blockAmount];
|
||||
upFileInfo.IsFirst = isFirst;
|
||||
upFileInfo.IsLast = false;
|
||||
fileStream.Read(array, 0, (int)blockAmount);
|
||||
upFileInfo.FileContent = array;
|
||||
upFileInfo.Offset = fileStream.Position;
|
||||
string text2 = apclient.Service.UploadFileByte(PublicFunction.SerializeObject(upFileInfo));
|
||||
if (!string.IsNullOrEmpty(text2))
|
||||
{
|
||||
UploadFileErr.HasErr = true;
|
||||
UploadFileErr.Err = text2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] array = new byte[num];
|
||||
upFileInfo.IsFirst = isFirst;
|
||||
upFileInfo.IsLast = true;
|
||||
fileStream.Read(array, 0, num);
|
||||
upFileInfo.FileContent = array;
|
||||
upFileInfo.Offset = fileStream.Position;
|
||||
string text3 = apclient.Service.UploadFileByte(PublicFunction.SerializeObject(upFileInfo));
|
||||
if (!string.IsNullOrEmpty(text3))
|
||||
{
|
||||
UploadFileErr.HasErr = true;
|
||||
UploadFileErr.Err = text3;
|
||||
break;
|
||||
}
|
||||
flag2 = true;
|
||||
}
|
||||
int num2;
|
||||
if (fileStream.Length > 0L)
|
||||
{
|
||||
num2 = (int)decimal.Floor(fileStream.Position / (fileStream.Length * 1m) * 100m);
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = 100;
|
||||
}
|
||||
if (num2 > 100)
|
||||
{
|
||||
num2 = 100;
|
||||
}
|
||||
isFirst = false;
|
||||
if (flag2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
return UploadFileErr;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 上传下载文件传输时通用类
|
||||
public class FileUpDownInfo
|
||||
{
|
||||
//
|
||||
// 摘要:
|
||||
// 目标文件名
|
||||
public string TargetFileName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 目标文件路径
|
||||
public string TargetFilePath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 源文件路径
|
||||
public string SourceFilePath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 源文件名称
|
||||
public string SourceFileName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 源全路径
|
||||
public string SourceFullPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(SourceFilePath, SourceFileName);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
SourceFilePath = Path.GetDirectoryName(value);
|
||||
SourceFileName = Path.GetFileName(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 目标全路径
|
||||
public string TargetFullPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(TargetFilePath, TargetFileName);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
TargetFilePath = Path.GetDirectoryName(value);
|
||||
TargetFileName = Path.GetFileName(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 首次上传(断点续传)
|
||||
public bool IsFirst
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 最后一次上传(断点续传)
|
||||
public bool IsLast
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 文件块实体
|
||||
public byte[] FileContent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 文件块位置
|
||||
public long Offset
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 是否存在错误
|
||||
public bool HasErr
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 错误信息
|
||||
public string Err
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 文件下传下载协议
|
||||
public UpOrDownType UpType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 服务器IP
|
||||
public string ServerIP
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 登录服务器用户帐号
|
||||
public string UserID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 登录服务器密码
|
||||
public string Password
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 是否启用身份验证
|
||||
public bool Credentials
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public FileUpDownInfo()
|
||||
{
|
||||
UpType = UpOrDownType.WebService;
|
||||
Credentials = true;
|
||||
TargetFileName = "";
|
||||
TargetFilePath = "";
|
||||
SourceFilePath = "";
|
||||
SourceFileName = "";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 文件下传下载协议
|
||||
public enum UpOrDownType
|
||||
{
|
||||
//
|
||||
// 摘要:
|
||||
// WebService的方式
|
||||
WebService,
|
||||
//
|
||||
// 摘要:
|
||||
// FTP方式
|
||||
FTP
|
||||
}
|
||||
}
|
||||
Executable
+145
@@ -0,0 +1,145 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using MySqlX.XDevAPI.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Services.CommonFunction
|
||||
{
|
||||
|
||||
public class MySqlUtils : IDisposable
|
||||
{
|
||||
#region 构造函数
|
||||
public MySqlUtils()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 连接字符串
|
||||
private string _connectionString;
|
||||
public string ConnectionString
|
||||
{
|
||||
get { return _connectionString; }
|
||||
set { _connectionString = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据库连接
|
||||
/// <summary>
|
||||
/// 数据库连接
|
||||
/// </summary>
|
||||
public MySqlConnection Connection
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取连接
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MySqlConnection GetConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Connection == null)
|
||||
{
|
||||
Connection = new MySqlConnection();
|
||||
Connection.ConnectionString = _connectionString;
|
||||
}
|
||||
if (Connection.State == ConnectionState.Broken)
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
if (Connection.State == ConnectionState.Closed)
|
||||
{
|
||||
Connection.ConnectionString = _connectionString;
|
||||
Connection.Open();
|
||||
}
|
||||
return Connection;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("获取连接失败.\r\n" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 销毁对象
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (Connection != null)
|
||||
{
|
||||
if (Connection.State != ConnectionState.Closed)
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
Connection.Dispose();
|
||||
Connection = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 执行查询
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strSQL"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable ExecQuery(string strSQL)
|
||||
{
|
||||
DataSet dsTemp = new DataSet();
|
||||
try
|
||||
{
|
||||
using (MySqlDataAdapter daExcute = new MySqlDataAdapter(strSQL, GetConnection()))
|
||||
{
|
||||
daExcute.Fill(dsTemp);
|
||||
|
||||
if (DBNull.Value.Equals(dsTemp) || dsTemp.Tables.Count < 1 || DBNull.Value.Equals(dsTemp.Tables[0]))
|
||||
{
|
||||
throw new Exception("查询结果为空.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return dsTemp.Tables[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 执行增删改
|
||||
public int ExecuteNonQuery(string strSQL)
|
||||
|
||||
{
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
using (var command = new MySqlCommand(strSQL, GetConnection()))
|
||||
{
|
||||
result = command.ExecuteNonQuery(); // 执行命令并返回受影响的行数
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user