1
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.Orm.Metadata.DataEntity;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Renci.SshNet;
|
||||
using Spire.Doc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Kingdee.K3.SCM.App.Stock.Report;
|
||||
using HandleUtils;
|
||||
using System.Data.SqlClient;
|
||||
using Kingdee.BOS.Util;
|
||||
using E_ZKEcc.Service;
|
||||
using E_ZKEcc.Domian;
|
||||
|
||||
namespace UnitTestProject2
|
||||
{
|
||||
[TestClass]
|
||||
@@ -57,157 +61,98 @@ namespace UnitTestProject2
|
||||
[TestMethod]
|
||||
public void TestMethod2()
|
||||
{
|
||||
// HUIWE_SFTP_TST@sftp.betagrid.gxs.com 22
|
||||
string ip = "sftp.betagrid.gxs.com";
|
||||
string port = "22";
|
||||
string user = "HUIWE_SFTP_TST";
|
||||
string pwd = "@m+n|9+v^.R}1[^";
|
||||
string localPath = "D:\\Work\\GateDge\\SFTP\\aatat.docx";
|
||||
string remotePath = "/aatat.docx";
|
||||
string remotePath = "/././POLLABLE";
|
||||
SFTPHelper SFTPHelper = new SFTPHelper(ip, user, pwd, port);
|
||||
var flag = SFTPHelper.Put(localPath, remotePath);
|
||||
var result = SFTPHelper.GetFileList(remotePath, "*BIN");
|
||||
SFTPHelper.Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
public class SFTPHelper
|
||||
[TestMethod]
|
||||
public void TestMethod4()
|
||||
{
|
||||
//var list = new List<EmployeeUpdateDomain>();
|
||||
|
||||
//list.Add(new EmployeeUpdateDomain()
|
||||
//{
|
||||
// pin = "AAA",
|
||||
// name = ""
|
||||
//});
|
||||
|
||||
//var str = JsonUtil.SerializeWithOutNull(list);
|
||||
var apiInfo = new ApiInfoDomian();
|
||||
apiInfo.appKey = "3391hexqe5h0wv4z4veju_dvn7gntnr5oiv_dxjabqtt";
|
||||
apiInfo.apiVersion = "v2";
|
||||
apiInfo.serverUrl = "http://14.21.32.187:8088";
|
||||
var service = new EmployeeService(apiInfo);
|
||||
|
||||
var data = service.GetEmployee(null);
|
||||
return;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class EmployeeUpdateDomain
|
||||
{
|
||||
#region 字段或属性
|
||||
private SftpClient _sftp;
|
||||
/// <summary>
|
||||
/// SFTP连接状态
|
||||
/// 人员编号 长度为1~24个字符 必填
|
||||
/// </summary>
|
||||
public bool Connected => _sftp.IsConnected;
|
||||
#endregion
|
||||
public string pin { get; set; }
|
||||
|
||||
#region 构造
|
||||
/// <summary>
|
||||
/// 构造
|
||||
/// 名称。长度为1~20个字符
|
||||
/// </summary>
|
||||
/// <param name="ip">IP</param>
|
||||
/// <param name="port">端口</param>
|
||||
/// <param name="user">用户名</param>
|
||||
/// <param name="pwd">密码</param>
|
||||
public SFTPHelper(string ip, string user, string pwd, string port = "22")
|
||||
{
|
||||
_sftp = new SftpClient(ip, int.Parse(port), user, pwd);
|
||||
Connect();
|
||||
}
|
||||
public string name { get; set; }
|
||||
|
||||
~SFTPHelper()
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 连接SFTP
|
||||
/// <summary>
|
||||
/// 连接SFTP
|
||||
/// 人员所属部门编号(更新可以不填,新增必填)
|
||||
/// </summary>
|
||||
/// <returns>true成功</returns>
|
||||
public bool Connect()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Connected)
|
||||
{
|
||||
_sftp.Connect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("连接SFTP失败,原因:{0}", ex.Message));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public string deptnumber { get; set; }
|
||||
|
||||
#region 断开SFTP
|
||||
/// <summary>
|
||||
/// 断开SFTP
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_sftp != null && Connected)
|
||||
{
|
||||
_sftp.Disconnect();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("断开SFTP失败,原因:{0}", ex.Message));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SFTP上传文件
|
||||
/// <summary>
|
||||
/// SFTP上传文件
|
||||
/// 性别 。'M'表示男,'F'表示女 允许值: 'M', 'F'
|
||||
/// </summary>
|
||||
/// <param name="localPath">本地文件全路径 例:G:\\Project\\logo.png</param>
|
||||
/// <param name="remotePath">远程路径 例:/logo.png</param>
|
||||
public bool Put(string localPath, string remotePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var file = File.OpenRead(localPath))
|
||||
{
|
||||
Connect();
|
||||
_sftp.UploadFile(file, remotePath);
|
||||
Disconnect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public string gender { get; set; }
|
||||
|
||||
#region SFTP获取文件
|
||||
/// <summary>
|
||||
/// SFTP获取文件
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
/// <param name="remotePath">远程路径</param>
|
||||
/// <param name="localPath">本地路径</param>
|
||||
public void Get(string remotePath, string localPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
Connect();
|
||||
var byt = _sftp.ReadAllBytes(remotePath);
|
||||
Disconnect();
|
||||
File.WriteAllBytes(localPath, byt);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("SFTP文件获取失败,原因:{0}", ex.Message));
|
||||
}
|
||||
public string identitycard { get; set; }
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除SFTP文件
|
||||
/// <summary>
|
||||
/// 删除SFTP文件
|
||||
/// 人员自助密码
|
||||
/// </summary>
|
||||
/// <param name="remoteFile">远程路径</param>
|
||||
public void Delete(string remoteFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
Connect();
|
||||
_sftp.Delete(remoteFile);
|
||||
Disconnect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("SFTP文件删除失败,原因:{0}", ex.Message));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public string selfpassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员是否考勤
|
||||
/// </summary>
|
||||
public int? att { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证方式
|
||||
/// </summary>
|
||||
public int? comverifys { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 比对照片信息,BASE64格式
|
||||
/// </summary>
|
||||
public string enrollpic { get; set; }
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethod3()
|
||||
{
|
||||
string sqlConn = "Data Source=ASSDB;User ID=ooa;Password=123qwe123";
|
||||
|
||||
SqlConnection con = new SqlConnection(sqlConn);
|
||||
//SqlConnection con = new SqlConnection("Server=.;Database=ASSDB;uid=ooa;pwd=123qwe123;Trusted_Connection=False;");
|
||||
con.Open();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GDHNJN.BusinessForm.BusinessPlugIn">
|
||||
<HintPath>C:\Users\Fareoh\Desktop\对比\dll\GDHNJN.BusinessForm.BusinessPlugIn.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -78,6 +81,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -89,6 +93,16 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\00.SDK\E_ZKEccSDK\E_ZKEccSDK.csproj">
|
||||
<Project>{9a0273e4-d584-4418-951c-020d4eff1732}</Project>
|
||||
<Name>E_ZKEccSDK</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\01.扩展\HandleUtils\HandleUtils.csproj">
|
||||
<Project>{d6a5e5a0-7529-4ffa-9f9d-b2c610919bf6}</Project>
|
||||
<Name>HandleUtils</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
28
00.未分类/公式.sql
Normal file
28
00.未分类/公式.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
SELECT *
|
||||
INTO #T1
|
||||
FROM (
|
||||
SELECT 1 ID,'A+B' 公式
|
||||
union ALL
|
||||
SELECT 2 ID,'A+B+C' 公式
|
||||
) tt
|
||||
declare @tttt varchar(MAX),@ttt varchar(MAX)
|
||||
SELECT @tttt = ISNULL(STUFF((select ' WHEN '+ CONVERT(nvarchar(100), tt.ID) + 'THEN '+ tt.公式 from #T1 tt for xml path('')),1,1,''),'')
|
||||
SET @ttt = N'
|
||||
SELECT tt.A,CASE tt.ID '+@tttt+' ELSE 0 END
|
||||
FROM(
|
||||
SELECT 1 A,2 B,3 C,1 ID
|
||||
union ALL
|
||||
SELECT 2 A,3 B,3 C,2 ID
|
||||
union ALL
|
||||
SELECT 1 A,3 B,3 C,1 ID
|
||||
union ALL
|
||||
SELECT 1 A,1 B,3 C,1 ID
|
||||
) tt
|
||||
'
|
||||
--SELECT @ttt
|
||||
exec(@ttt)
|
||||
|
||||
DROP TABLE #T1
|
||||
--DROP TABLE #T2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user