diff --git a/PEIS.sln b/PEIS.sln
index e83cf14..61c0062 100644
--- a/PEIS.sln
+++ b/PEIS.sln
@@ -1,13 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.33529.398
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.36324.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEIS", "PEIS\PEIS.csproj", "{8980800E-6620-4B2E-A7DD-8C4651E1A344}"
+ ProjectSection(ProjectDependencies) = postProject
+ {12FE71E3-1E39-424C-8685-64EC743A248F} = {12FE71E3-1E39-424C-8685-64EC743A248F}
+ EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{AB0394FA-735E-4213-9ACE-31C02F698FA7}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{12FE71E3-1E39-424C-8685-64EC743A248F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,26 +22,26 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|x86.Build.0 = Debug|Any CPU
+ {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|x86.ActiveCfg = Debug|x86
+ {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Debug|x86.Build.0 = Debug|x86
{8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|Any CPU.Build.0 = Release|Any CPU
- {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|x86.ActiveCfg = Release|Any CPU
- {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|x86.Build.0 = Release|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Debug|x86.Build.0 = Debug|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Release|Any CPU.Build.0 = Release|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Release|x86.ActiveCfg = Release|Any CPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}.Release|x86.Build.0 = Release|Any CPU
+ {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|x86.ActiveCfg = Release|x86
+ {8980800E-6620-4B2E-A7DD-8C4651E1A344}.Release|x86.Build.0 = Release|x86
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Debug|x86.ActiveCfg = Debug|x86
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Debug|x86.Build.0 = Debug|x86
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Release|x86.ActiveCfg = Release|x86
+ {12FE71E3-1E39-424C-8685-64EC743A248F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5} = {AB0394FA-735E-4213-9ACE-31C02F698FA7}
+ {12FE71E3-1E39-424C-8685-64EC743A248F} = {AB0394FA-735E-4213-9ACE-31C02F698FA7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {56DA78F6-DED1-4B17-AE1F-7DCF4A666388}
diff --git a/PEIS/App.config b/PEIS/App.config
index d8a4f3a..c275d0b 100644
--- a/PEIS/App.config
+++ b/PEIS/App.config
@@ -4,42 +4,26 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/PEIS/Model/Enrollment/EnrollmentPatientModel.cs b/PEIS/Model/Enrollment/EnrollmentPatientModel.cs
index 700ec10..42bc3f9 100644
--- a/PEIS/Model/Enrollment/EnrollmentPatientModel.cs
+++ b/PEIS/Model/Enrollment/EnrollmentPatientModel.cs
@@ -210,7 +210,7 @@ namespace PEIS.Model.Enrollment
// 撤回发送到科室
public bool RecallDept(Int64 EId, String Name)
{
- var checkCost = $@"UPDATE Enrollment_CheckCost SET SendTime = null, SenderCode = null, Sender = null WHERE EID = {EId} AND SendTime is not null AND DeleteTime is null AND WeChatCostTime is null";
+ var checkCost = $@"UPDATE Enrollment_CheckCost SET SendTime = null, SenderCode = null, Sender = null WHERE EID = {EId} AND SendTime is not null AND DeleteTime is null";
var enrollmentPatient = $@"UPDATE Enrollment_Patient SET SignTime = null, SignerCode = null, Signer = null WHERE ID = {EId} AND SignTime is not null";
var enrollmentFeeItem = $@"UPDATE a SET a.IsSend = 0 FROM Enrollment_FeeItem a LEFT JOIN Enrollment_CheckCost b ON a.OrderNO = b.ID AND a.EID = b.EID WHERE b.SendTime IS NULL AND a.EID = {EId}";
diff --git a/PEIS/Model/Exam/PartModel.cs b/PEIS/Model/Exam/PartModel.cs
index 63c4eab..360dbda 100644
--- a/PEIS/Model/Exam/PartModel.cs
+++ b/PEIS/Model/Exam/PartModel.cs
@@ -110,7 +110,7 @@ SELECT
END AS STATUS
FROM StatusData
WHERE rn = 1 -- 每个eid只取最新的一行";
-
+
var data = DAOHelp.GetDataBySQL(sql).OrderByDescending(o => o.SignTime).ToList();
return data;
@@ -307,6 +307,9 @@ FROM StatusData;";
};*/
#endregion
+ //先清除旧的结论
+ DAOHelp.ExecuteSql($@" DELETE FROM Exam_Conclusion WHERE PID ={part.ID} AND EID={eid};");
+
var index = 1;
results.GroupBy(g => g.FeeItemName).ToList().ForEach(items =>
{
diff --git a/PEIS/PEIS.csproj b/PEIS/PEIS.csproj
index 49417e0..f48ef9c 100644
--- a/PEIS/PEIS.csproj
+++ b/PEIS/PEIS.csproj
@@ -61,6 +61,24 @@
PEIS.Program
+
+ true
+ bin\x86\Debug\
+ DEBUG;TRACE
+ full
+ x86
+ 7.3
+ prompt
+
+
+ bin\x86\Release\
+ TRACE
+ true
+ pdbonly
+ x86
+ 7.3
+ prompt
+
@@ -310,20 +328,20 @@
+
+
-
-
-
-
-
+
+
+
+
-
@@ -368,6 +386,12 @@
SelectPatientForm.cs
+
+ Form
+
+
+ CountdownMessageBox.cs
+
Form
@@ -807,8 +831,6 @@
PreserveNewest
-
-
@@ -834,14 +856,6 @@
PreserveNewest
-
-
-
-
-
-
-
-
PreserveNewest
@@ -929,6 +943,17 @@
- xcopy $(SolutionDir)Third\DevExpress\ $(TargetDir) /e /y
+
+
+
+
+ :: Update目录
+xcopy "$(SolutionDir)Update\bin\$(ConfigurationName)\" "$(TargetDir)Update\" /e /y
+:: 汉化目录
+xcopy "$(SolutionDir)Third\DevExpress\" "$(TargetDir)" /e /y
+xcopy "$(SolutionDir)Third\FastReport\" "$(TargetDir)" /e /y
+:: 设备目录
+xcopy "$(SolutionDir)Third\SW100\" "$(TargetDir)SW100\" /e /y
+xcopy "$(SolutionDir)Third\SS860\" "$(TargetDir)SS860\" /e /y
\ No newline at end of file
diff --git a/PEIS/Program.cs b/PEIS/Program.cs
index c4012c6..52da5a1 100644
--- a/PEIS/Program.cs
+++ b/PEIS/Program.cs
@@ -14,7 +14,7 @@ namespace PEIS
/// 应用程序的主入口点。
///
[STAThread]
- static void Main()
+ static void Main(string[] args)
{
//var test = new TestView();
//test.ShowDialog();
@@ -35,14 +35,16 @@ namespace PEIS
//汉化Dev组件
ForceLoadDevExpressLocalization();
+ //汉化FastReport组件
+ ForceLoadFastReportLocalization();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CacheDataModel.GetConfig();
- VersionHelper.CheckUpdate();
+ VersionHelper.CheckUpdate(args.Length > 0 ? args[0] : null);
+
var login = new LoginForm();
login.ShowDialog();
-
if (login.DialogResult == DialogResult.OK)
{
//ThreadPool.QueueUserWorkItem(state => CacheDataModel.GetConfig());
@@ -56,6 +58,13 @@ namespace PEIS
}
}
+ private static void ForceLoadFastReportLocalization()
+ {
+ string chineseSimpleFrl = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "zh-CHS", "FastReport", "Chinese (Simplified).frl");
+ FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
+
+ }
+
private static void ForceLoadDevExpressLocalization()
{
diff --git a/PEIS/Utils/Global.cs b/PEIS/Utils/Global.cs
index bd1942f..d7cfd22 100644
--- a/PEIS/Utils/Global.cs
+++ b/PEIS/Utils/Global.cs
@@ -56,6 +56,16 @@ namespace PEIS.Utils
return Global._lstConfig.FirstOrDefault(x => x.Key == "UseGroupFeeItemsInTeamReport")?.Value ?? "0";
}
}
+ ///
+ /// 身份证阅读器
+ ///
+ public static string IDReader
+ {
+ get
+ {
+ return Global._lstConfig.FirstOrDefault(x => x.Key == "IDReader")?.Value ?? "";
+ }
+ }
///
/// 配置信息
diff --git a/PEIS/Utils/IDCard/IDCardHelper.cs b/PEIS/Utils/IDCard/IDCardHelper.cs
new file mode 100644
index 0000000..b2e59a0
--- /dev/null
+++ b/PEIS/Utils/IDCard/IDCardHelper.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+
+namespace PEIS.Utils.IDCard
+{
+ public static class IDCardHelper
+ {
+ public static IDCardInfo Read()
+ {
+ IDCardInfo info = null;
+ switch (Global.IDReader)
+ {
+ case "SW100":
+ info = SW100.SW100.ReadIDCard();
+ break;
+ default:
+ info = SS860.ReadCardInfo.Get();
+ break;
+ }
+ return info;
+ }
+ }
+
+ public class IDCardInfo
+ {
+ ///
+ /// 姓名
+ ///
+ public string NAME { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public string SEX { get; set; }
+
+ ///
+ /// 民族
+ ///
+ public string NATION { get; set; }
+
+ ///
+ /// 住址
+ ///
+ public string ADDRESS { get; set; }
+
+ ///
+ /// 签发机关
+ ///
+ public string ISSUE_AUTH { get; set; }
+
+ ///
+ /// 有效期开始日期
+ ///
+ public DateTime BEGIN_DATE { get; set; }
+
+ ///
+ /// 有效期结束日期
+ ///
+ public DateTime END_DATE { get; set; }
+
+ ///
+ /// 身份证号码
+ ///
+ public string IDNO { get; set; }
+
+ ///
+ /// 生日
+ ///
+ public DateTime BIRTH { get; set; }
+
+ ///
+ /// 头像
+ ///
+ public Bitmap HEADPORTRAIT { get; set; }
+ }
+}
diff --git a/PEIS/Utils/SS860/IMAGE.cs b/PEIS/Utils/IDCard/SS860/IMAGE.cs
similarity index 99%
rename from PEIS/Utils/SS860/IMAGE.cs
rename to PEIS/Utils/IDCard/SS860/IMAGE.cs
index f1d32f3..0864194 100644
--- a/PEIS/Utils/SS860/IMAGE.cs
+++ b/PEIS/Utils/IDCard/SS860/IMAGE.cs
@@ -3,7 +3,7 @@ using System.Drawing;
using System.IO;
using System.Windows.Forms;
-namespace PEIS.Utils.SS860
+namespace PEIS.Utils.IDCard.SS860
{
class IMAGE
{
diff --git a/PEIS/Utils/SS860/ReadCardAPI64.cs b/PEIS/Utils/IDCard/SS860/ReadCardAPI64.cs
similarity index 75%
rename from PEIS/Utils/SS860/ReadCardAPI64.cs
rename to PEIS/Utils/IDCard/SS860/ReadCardAPI64.cs
index 5163094..96064d2 100644
--- a/PEIS/Utils/SS860/ReadCardAPI64.cs
+++ b/PEIS/Utils/IDCard/SS860/ReadCardAPI64.cs
@@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
-namespace PEIS.Utils.SS860
+namespace PEIS.Utils.IDCard.SS860
{
///
/// 神思二代读卡器API函数
///
public class ReadCardApi64
{
- [DllImport("./RDCard64/RdCard.DLL")]
+ [DllImport("./SS860/RDCard64/RdCard.DLL")]
public static extern int UCommand1(string pcmd, ref int arg0, ref int arg1, byte[] arg3);
}
}
diff --git a/PEIS/Utils/SS860/ReadCardAPI86.cs b/PEIS/Utils/IDCard/SS860/ReadCardAPI86.cs
similarity index 77%
rename from PEIS/Utils/SS860/ReadCardAPI86.cs
rename to PEIS/Utils/IDCard/SS860/ReadCardAPI86.cs
index 425f120..6317368 100644
--- a/PEIS/Utils/SS860/ReadCardAPI86.cs
+++ b/PEIS/Utils/IDCard/SS860/ReadCardAPI86.cs
@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
-namespace PEIS.Utils.SS860
+namespace PEIS.Utils.IDCard.SS860
{
///
/// 神思二代读卡器API函数
@@ -8,7 +8,7 @@ namespace PEIS.Utils.SS860
public class ReadCardApi86
{
- [DllImport("./RDCard86/RdCard.DLL")]
+ [DllImport("./SS860/RDCard86/RdCard.DLL")]
public static extern int UCommand1(string pcmd, ref int arg0, ref int arg1, byte[] arg3);
}
diff --git a/PEIS/Utils/SS860/ReadCardInfo.cs b/PEIS/Utils/IDCard/SS860/ReadCardInfo.cs
similarity index 93%
rename from PEIS/Utils/SS860/ReadCardInfo.cs
rename to PEIS/Utils/IDCard/SS860/ReadCardInfo.cs
index 6574b34..483d411 100644
--- a/PEIS/Utils/SS860/ReadCardInfo.cs
+++ b/PEIS/Utils/IDCard/SS860/ReadCardInfo.cs
@@ -6,14 +6,14 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
-namespace PEIS.Utils.SS860
+namespace PEIS.Utils.IDCard.SS860
{
///
/// 读卡相关类
///
public class ReadCardInfo
{
- public static RdCardModel Get()
+ public static IDCardInfo Get()
{
//Win64/Win32
return Environment.Is64BitOperatingSystem ? ReadCard() : ReadCard86();
@@ -22,9 +22,9 @@ namespace PEIS.Utils.SS860
/// 读取卡内容--表示层应用
///
///
- private static RdCardModel ReadCard()
+ private static IDCardInfo ReadCard()
{
- RdCardModel model = null;
+ IDCardInfo model = null;
var pcmd = Char.ConvertFromUtf32(0x41);
var result = Application.StartupPath + "\\";
@@ -55,9 +55,9 @@ namespace PEIS.Utils.SS860
///
/// 错误信息
///
- private static RdCardModel ReadCard86()
+ private static IDCardInfo ReadCard86()
{
- RdCardModel model = null;
+ IDCardInfo model = null;
var pcmd = Char.ConvertFromUtf32(0x41);
var result = Application.StartupPath + "\\";
@@ -87,9 +87,9 @@ namespace PEIS.Utils.SS860
/// 读取生成文件内容
///
///
- private static RdCardModel GetCardInfo()
+ private static IDCardInfo GetCardInfo()
{
- var model = new RdCardModel();
+ IDCardInfo model = new IDCardInfo();
var infoPath = Application.StartupPath + "\\wz.txt";
//string NewAddressPath = Application.StartupPath + "\\NewAdd.txt";
var binPath = Application.StartupPath + "\\fp.bin";
@@ -118,7 +118,7 @@ namespace PEIS.Utils.SS860
if (list.Count == 9)
{
model.NAME = list[0];//姓名
- model.SEX = list[1] == "女" ? 2 : 1; //性别
+ model.SEX = list[1];//性别
model.NATION = list[2];//民族
model.BIRTH = DateTime.ParseExact(list[3], "yyyyMMdd", CultureInfo.InvariantCulture);
model.ADDRESS = list[4];//住址
diff --git a/PEIS/Utils/IDCard/SW100/SW100.cs b/PEIS/Utils/IDCard/SW100/SW100.cs
new file mode 100644
index 0000000..418d04d
--- /dev/null
+++ b/PEIS/Utils/IDCard/SW100/SW100.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace PEIS.Utils.IDCard.SW100
+{
+ public static class SW100
+ {
+ #region DLL导入声明
+
+ [DllImport("./SW100/SSCARDInterface.dll", EntryPoint = "iOpenPort")]
+ public static extern int iOpenPort(StringBuilder errMsg);
+
+ [DllImport("./SW100/SSCARDInterface.dll", EntryPoint = "iClosePort")]
+ public static extern int iClosePort();
+
+ [DllImport("./SW100/SSCARDInterface.dll", EntryPoint = "iReaderIDCard_CS")]
+ public static extern int iReaderIDCard_CS(StringBuilder bmpFilePath, StringBuilder cardInfo, StringBuilder base64Info, StringBuilder errMsg);
+
+ [DllImport("./SW100/SSCARDInterface.dll", EntryPoint = "iPosBeep")]
+ public static extern int iPosBeep();
+
+ #endregion
+
+ private const int BUFFER_SIZE = 1024;
+
+ ///
+ /// 打开设备
+ ///
+ /// 打开结果
+ private static bool OpenDevice()
+ {
+ try
+ {
+ StringBuilder errMsg = new StringBuilder(BUFFER_SIZE);
+ int result = iOpenPort(errMsg);
+
+ if (result == 0)
+ {
+ return true;
+ }
+ else
+ {
+ Global.MsgErr($"设备打开失败:{errMsg}");
+ return false;
+ }
+ }
+ catch (Exception ex)
+ {
+ Global.MsgErr($"设备打开失败:{ex.Message}");
+ return false;
+ }
+ }
+
+ ///
+ /// 关闭设备
+ ///
+ /// 关闭结果
+ private static bool CloseDevice()
+ {
+ try
+ {
+ int result = iClosePort();
+
+ if (result == 0)
+ {
+ return true;
+ }
+ else
+ {
+ Global.MsgErr($"设备关闭失败");
+ return false;
+ }
+ }
+ catch (Exception ex)
+ {
+ Global.MsgErr($"设备关闭失败:{ex.Message}");
+ return false;
+ }
+ }
+
+ ///
+ /// 读取身份证信息
+ ///
+ /// 照片保存路径,例如:D:\zp.bmp
+ /// 身份证信息
+ public static IDCardInfo ReadIDCard()
+ {
+
+ IDCardInfo idCardInfo = null;
+ if (OpenDevice())
+ {
+ try
+ {
+
+ // 设置默认照片路径
+ StringBuilder photoSavePath = new StringBuilder(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "idcard_photo.bmp"));
+
+ // 准备缓冲区
+ StringBuilder cardInfoBuffer = new StringBuilder(BUFFER_SIZE);
+ StringBuilder dspBuffer = new StringBuilder(BUFFER_SIZE * 10);
+ StringBuilder errMsgBuffer = new StringBuilder(BUFFER_SIZE);
+
+ // 调用读取方法
+ long result = iReaderIDCard_CS(photoSavePath, cardInfoBuffer, dspBuffer, errMsgBuffer);
+
+ if (result == 0)
+ {
+ // 解析返回的数据
+ string cardInfoStr = cardInfoBuffer.ToString();
+ string[] infoArray = cardInfoStr.Split('|');
+
+ if (infoArray.Length >= 10)
+ {
+ idCardInfo = new IDCardInfo();
+ idCardInfo.NAME = infoArray[0];
+ idCardInfo.SEX = infoArray[1];
+ idCardInfo.NATION = infoArray[2];
+ idCardInfo.BIRTH = DateTime.ParseExact(infoArray[3], "yyyyMMdd", CultureInfo.InvariantCulture);
+ idCardInfo.ADDRESS = infoArray[4];
+ idCardInfo.IDNO = infoArray[5];
+ idCardInfo.ISSUE_AUTH = infoArray[6];
+ idCardInfo.BEGIN_DATE = DateTime.ParseExact(infoArray[7], "yyyyMMdd", CultureInfo.InvariantCulture);
+ idCardInfo.END_DATE = DateTime.ParseExact(infoArray[8], "yyyyMMdd", CultureInfo.InvariantCulture);
+ using (var fs = new FileStream(photoSavePath.ToString(), FileMode.Open, FileAccess.Read))
+ {
+ idCardInfo.HEADPORTRAIT = new Bitmap(fs);
+ }
+ }
+ else
+ {
+ Global.MsgErr($"返回的数据格式不正确");
+ }
+ }
+ else
+ {
+ Global.MsgErr($"读取身份证失败:{ errMsgBuffer}");
+ }
+ }
+ catch (Exception ex)
+ {
+ Global.MsgErr($"读取身份证时发生异常:{ex.Message}");
+ }
+ finally
+ {
+ iPosBeep();
+ CloseDevice();
+ }
+ }
+ return idCardInfo;
+ }
+ }
+}
diff --git a/PEIS/Utils/SS860/RdCardModel.cs b/PEIS/Utils/SS860/RdCardModel.cs
deleted file mode 100644
index f709092..0000000
--- a/PEIS/Utils/SS860/RdCardModel.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Drawing;
-
-namespace PEIS.Utils.SS860
-{
- public class RdCardModel
- {
- private string nAME;
- ///
- /// 姓名
- ///
- public string NAME
- {
- get { return nAME; }
- set { nAME = value; }
- }
- private int sEX;
- ///
- /// 性别
- ///
- public int SEX
- {
- get { return sEX; }
- set { sEX = value; }
- }
- private string nATION;
- ///
- /// 民族
- ///
- public string NATION
- {
- get { return nATION; }
- set { nATION = value; }
- }
- private string aDDRESS;
- ///
- /// 住址
- ///
- public string ADDRESS
- {
- get { return aDDRESS; }
- set { aDDRESS = value; }
- }
- private string iSSUE_AUTH;
- ///
- /// 签发机关
- ///
- public string ISSUE_AUTH
- {
- get { return iSSUE_AUTH; }
- set { iSSUE_AUTH = value; }
- }
- private DateTime bEGIN_DATE;
- ///
- /// 有效期开始日期
- ///
- public DateTime BEGIN_DATE
- {
- get { return bEGIN_DATE; }
- set { bEGIN_DATE = value; }
- }
- private DateTime eND_DATE;
- ///
- /// 有效期结束日期
- ///
- public DateTime END_DATE
- {
- get { return eND_DATE; }
- set { eND_DATE = value; }
- }
- private string iDNO;
- ///
- /// 身份证号码
- ///
- public string IDNO
- {
- get { return iDNO; }
- set { iDNO = value; }
- }
- private string nEW_ADDR;
- ///
- /// 最新住址
- ///
- public string NEW_ADDR
- {
- get { return nEW_ADDR; }
- set { nEW_ADDR = value; }
- }
- private DateTime bIRTH;
- ///
- /// 生日
- ///
- public DateTime BIRTH
- {
- get { return bIRTH; }
- set { bIRTH = value; }
- }
- private Bitmap hEADPORTRAIT;
- ///
- /// 头像
- ///
- public Bitmap HEADPORTRAIT
- {
- get { return hEADPORTRAIT; }
- set { hEADPORTRAIT = value; }
- }
-
-
- }
-
-}
diff --git a/PEIS/Utils/SS860/ReadSs628.cs b/PEIS/Utils/SS860/ReadSs628.cs
deleted file mode 100644
index 2bd30a9..0000000
--- a/PEIS/Utils/SS860/ReadSs628.cs
+++ /dev/null
@@ -1,283 +0,0 @@
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace PEIS.Utils.SS860
-{
- public class WltRead
- {
- [DllImport("RdCard.dll", EntryPoint = "UCommand1", CharSet = CharSet.Ansi)]
- private static extern int UCommand1(ref byte pCmd, ref int parg0, ref int parg1, byte[] parg2);
-
-
- //
- //初始化设备(串口:1-16, USB:1001-1016),为零自动找接口
- //
- // (串口: 1 - 16, USB: 1001 - 1016) param >
- //< returns > returns >
- public static bool InitCom(int nPort=0)
- {
-
- string sMsg = string.Empty;
- try
- {
- Byte cmd = 0x41;
- int para0 = nPort;
- int para1 = 8811;
- byte[] para2 = { 0x02, 0x27, 0x00, 0x00 }; //9986
- int nRet = UCommand1(ref cmd, ref para0, ref para1, para2);
-
- if (nRet == 62171)
- {
- sMsg = "身份证读卡器连接成功";
- return true;
- }
- else
- sMsg = "身份证读卡器连接失败!";
- }
- catch (Exception ex)
- {
- sMsg = "身份证读卡器连接失败,原因是:" + ex.Message;
- }
- Console.WriteLine(sMsg);
- return false;
-
- }
-
- //
- // 关闭设备
- //
- //
- public static bool CloseCom(int nPort)
- {
- string sMsg = string.Empty;
- try
- {
- Byte cmd = 0x42;
- int para0 = nPort;
- int para1 = 8811;
- byte[] para2 = { 0x02, 0x27, 0x00, 0x00 }; //9986
- IntPtr ptrRet = Marshal.StringToHGlobalAnsi(UCommand1(ref cmd, ref para0, ref para1, para2).ToString());
- string retlust = Marshal.PtrToStringAnsi(ptrRet);
- int nRet = int.Parse(retlust);
-
- if (nRet == 62171)
- {
- sMsg = "端口关闭成功";
- return true;
- }
- else
- sMsg = "端口关闭失败!";
- }
- catch (Exception ex)
- {
- sMsg = "端口关闭失败,原因是:" + ex.Message;
- }
-
- return false;
- }
-
- //
- // 获取身份证信息
- //
- //
- // nInfoType=1,读基本信息;nInfoType=3,读追加地址
- //
- public static CardInfo ReadCardInfo(int nPort)//,
- {
- string sMsg = string.Empty;
- CardInfo objCardInfo = null;
- string savePath =Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "IDCard");
- if (!Directory.Exists(savePath))
- {
- Directory.CreateDirectory(savePath);
- }
- Random rd = new Random();
- int i = rd.Next() * 10;
- savePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "IDCard") + i;
- try
- {
-
- byte bCmd = 0x43;//验证信息
- int nPara0 = nPort;
- int nPara1 = 8811;
- byte[] nPara2 = { 0x02, 0x27, 0x00, 0x00 }; //9986
- int nRet = UCommand1(ref bCmd, ref nPara0, ref nPara1, nPara2);// 验证卡
-
- if (nRet == 62171)//身份证验证成功
- {
- bCmd = 68;// "0x44 读卡内信息
- nPara0 = nPort;
- nPara1 = 8811;
-
- //如果要用sSavePath,请将sSavePath转换为ANSI编码格式。因为.net中的字符串是unicode格式,所以这里使用byte类型,内部逐字节进行赋值,最后一个是0
- //如,C:\a 调用后会生成a.txt a1.txt,a.bmp a1.wlt
- // byte[] ctr = { (byte)"C", (byte)":", (byte)"\\", (byte)"a", (byte)"\0" };
-
- byte[] ctr = Encoding.ASCII.GetBytes(savePath);
- nRet = UCommand1(ref bCmd, ref nPara0, ref nPara1, ctr);//读取卡内信息
-
- if (nRet == 62171)
- {
-
- objCardInfo = new CardInfo();
-
- System.IO.StreamReader objStreamReader = new System.IO.StreamReader(savePath + @"wx.txt", System.Text.Encoding.Default);
-
- objCardInfo.Name = objStreamReader.ReadLine();
- objCardInfo.Sex = objStreamReader.ReadLine();
- objCardInfo.Nation = objStreamReader.ReadLine();
- objCardInfo.Birthday = objStreamReader.ReadLine();
- objCardInfo.Address = objStreamReader.ReadLine();
- objCardInfo.CardNo = objStreamReader.ReadLine();
- objCardInfo.Department = objStreamReader.ReadLine();
- objCardInfo.StartDate = objStreamReader.ReadLine();
- //objCardInfo.EndDate = objStreamReader.ReadLine(); //身份证有效期"长期"
- objCardInfo.AddressEx = objStreamReader.ReadLine();
- objCardInfo.PhotoPath = savePath + @"zp.bmp";
-
- string sPhotoPath = objCardInfo.PhotoPath;
- objCardInfo.ArrPhotoByte = ImageToByteArray(sPhotoPath);
-
- objStreamReader.Close();
- objStreamReader.Dispose();
-
- return objCardInfo;
- }
- else if (nRet == -5)
- sMsg = "返回值:" + nRet + "软件未授权!";
- else
- {
- sMsg = "返回值:" + nRet + "读身份证不成功";
- }
- }
- else
- sMsg = "请将身份证放置感应区,谢谢合作!";
- }
- catch (Exception ex)
- {
- sMsg = "读身份证失败,原因是:" + ex.Message;
- Console.WriteLine(sMsg);
- return null;
- }
- Console.WriteLine(sMsg);
- return objCardInfo;
- }
-
- //
- // 将图片转换成字节
- //
- //
- //
- private static Byte[] ImageToByteArray(string selectPictureFile)
- {
- //Image photo = new Bitmap(selectPictureFile);
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- //photo.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
- byte[] imagedata = ms.GetBuffer();
-
- //ms.Close();
- //ms.Dispose();
- //photo.Dispose();
- return imagedata;
-
- }
- }
-
- //
- // 身份证的信息
- //
- public class CardInfo
- {
- ///
- /// 订单编号
- ///
- public string OrderNo;
- public int Id;
- ///
- /// 身份证号码
- ///
- public string CardNo;
- ///
- /// 姓名
- ///
- public string Name;
- ///
- /// 性别
- ///
- public string Sex;
- ///
- /// 出生日期
- ///
- public string Birthday;
- ///
- /// 地址
- ///
- public string Address;
- ///
- /// 追加地址
- ///
- public string AddressEx;
- ///
- /// 发卡机关
- ///
- public string Department;
- ///
- /// 证件开始日期
- ///
- public string StartDate;
- ///
- /// 证件结束日期
- ///
- public string EndDate;
- ///
- /// 民族
- ///
- public string Nation;
- ///
- /// 分店编号
- ///
- public int ChainID;
- ///
- /// 相片路径
- ///
- public string PhotoPath;
- ///
- /// 相片的字节信息
- ///
- public byte[] ArrPhotoByte;
- ///
- /// 时时图片字节信息
- ///
- public byte[] PhoTimeByte;
- ///
- /// 操作时间
- ///
- public DateTime OpeTime;
- ///
- /// 操作人
- ///
- public int UserID;
- ///
- /// 操作人
- ///
- public string UserName;
- ///
- /// 入住人数
- ///
- public int nMebCount;
- ///
- /// 提交状态,1:插入成功;0:插入失败
- ///
- public string nState;
- ///
- /// 备注信息
- ///
- public string sRemark;
- ///
- /// 客户端名称
- ///
- public string ClientName;
- }
-}
diff --git a/PEIS/Utils/VersionHelper.cs b/PEIS/Utils/VersionHelper.cs
index 80ec809..96163cf 100644
--- a/PEIS/Utils/VersionHelper.cs
+++ b/PEIS/Utils/VersionHelper.cs
@@ -4,7 +4,9 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
+using System.Windows.Forms;
using PEIS.Entity;
+using PEIS.View;
namespace PEIS.Utils
{
@@ -15,117 +17,60 @@ namespace PEIS.Utils
///
/// 检查更新
///
- public static void CheckUpdate()
+ public static void CheckUpdate(string updateVersion)
{
- var version = Global._lstConfig.FirstOrDefault(x => x.Key == "Version")?.Value ?? "";
- var currentVersion = ConfigurationManager.AppSettings["Version"];
- if (string.IsNullOrEmpty(currentVersion) || string.IsNullOrEmpty(version) || currentVersion == version)
- return;
-
- Download(version, currentVersion);
- }
-
- private static void Download(string version, string currentVersion)
- {
- Global.MsgInfo($@"发现新版本:{version},启动更新");
- // var versionUrl = ConfigurationManager.AppSettings["VersionUrl"];
- var downloadUrl = ConfigurationManager.AppSettings["DownloadUrl"];
- //return;
- try
+ if (string.IsNullOrEmpty(updateVersion))
{
- if ((string.IsNullOrEmpty(version)) || (string.IsNullOrEmpty(currentVersion)) || currentVersion == version) return;
- // 保存路径
- var savePath = Path.Combine(BasePath, "Update");
- if (!Directory.Exists(savePath))
- {
- Directory.CreateDirectory(savePath);
- }
- //保存文件
- var zipFilePath = Path.Combine(savePath, version + ".zip");
- //解压路径
- var unZipPath = Path.Combine(BasePath, "Update", "UnZip");
- if (!Directory.Exists(unZipPath))
- {
- Directory.CreateDirectory(unZipPath);
- }
- // 创建HttpWebRequest对象
- var request2 = (HttpWebRequest)WebRequest.Create(downloadUrl + $"?fileName={version}.zip");
- // 获取响应
- using (var response2 = (HttpWebResponse)request2.GetResponse())
- {
- // 读取响应流
- using (var stream = response2.GetResponseStream())
- {
- // 将响应保存到本地文件
- using (var fileStream = File.Create(zipFilePath))
- {
- var buffer = new byte[4096];
- int bytesRead;
- // 循环读取和写入,直到读取完整个响应流
- while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
- {
- // 写入文件流
- fileStream.Write(buffer, 0, bytesRead);
- }
- }
- }
- // Global.MsgInfo(@"更新文件下载完成!");
- }
- // 解压文件
- UnZipAndReplace(zipFilePath, unZipPath);
- // Global.MsgInfo(@"解压完成!");
- var path = Path.Combine(BasePath, "Update", "Update.exe");
- if (File.Exists(path))
- {
- Process.Start(path);
- }
- else
- {
- Global.MsgErr(@"未找到更新程序!");
- }
- Process.GetCurrentProcess().Kill();
+ var remoteVersion = Global._lstConfig.FirstOrDefault(x => x.Key == "Version")?.Value ?? "";
+ var localVersion = ConfigurationManager.AppSettings["Version"];
+ if (string.IsNullOrEmpty(localVersion) || string.IsNullOrEmpty(remoteVersion) || localVersion == remoteVersion)
+ return;
+
+ StartUpdate(remoteVersion);
}
- catch (Exception ex)
+ else
{
- Global.MsgErr($@"下载更新程序出错,{ex.Message}");
- Process.GetCurrentProcess().Kill();
+ CopyUpdate(updateVersion);
}
}
- ///
- /// 解压文件到Update
- ///
- private static void UnZipAndReplace(string zipFilePath, string unZipPath)
+ private static void StartUpdate(string remoteVersion)
+ {
+ var messageBox = new CountdownMessageBox($"检测到新版本{remoteVersion}\r\n正在启动更新程序...");
+ messageBox.ShowDialog();
+ Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update", "Update.exe"), remoteVersion);
+ Environment.Exit(0);
+ }
+
+ private static void CopyUpdate(string updateVersion)
{
- if (Directory.Exists(unZipPath)) Directory.Delete(unZipPath, true);
- Directory.CreateDirectory(unZipPath);
- if (!File.Exists(zipFilePath))
+ string sourceDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update", "Update", "UnZip", updateVersion, "Update");
+ string destDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update");
+ if (Directory.Exists(sourceDir))
{
- Global.MsgErr(@"更新文件下载失败,请重试!");
- return;
+ CopyFiles(sourceDir, destDir);
}
- //保存文件路径检查
- if (Directory.Exists(unZipPath))
- {
- var di = new DirectoryInfo(unZipPath);
+ }
- foreach (var file in di.EnumerateFiles())
- {
- file.Delete();
- }
- foreach (var dir in di.EnumerateDirectories())
- {
- dir.Delete(true);
- }
- }
- //解压
- using (var zipFile = new Ionic.Zip.ZipFile(zipFilePath))
+ private static void CopyFiles(string sourceDir, string destDir)
+ {
+ // 复制当前目录的文件
+ foreach (string sourceFile in Directory.GetFiles(sourceDir))
{
- zipFile.ExtractAll(unZipPath);
+ string destFile = Path.Combine(destDir, Path.GetFileName(sourceFile));
+ File.Copy(sourceFile, destFile, overwrite: true);
}
- //Directory.Delete(unZipPath, true);//删除压缩目录
- //File.Delete(zipFilePath);//删除压缩文件
+ // 递归处理子目录
+ foreach (string subDir in Directory.GetDirectories(sourceDir))
+ {
+
+ string destSubDir = Path.Combine(destDir, Path.GetFileName(subDir));
+ Directory.CreateDirectory(destSubDir);
+
+ CopyFiles(subDir, destSubDir);
+ }
}
+
}
}
\ No newline at end of file
diff --git a/PEIS/View/Base/NewPersonForm.cs b/PEIS/View/Base/NewPersonForm.cs
index 8aa9a83..c37f501 100644
--- a/PEIS/View/Base/NewPersonForm.cs
+++ b/PEIS/View/Base/NewPersonForm.cs
@@ -8,9 +8,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
-using PEIS.Utils.SS860;
using System.Windows.Forms;
using System.Dynamic;
+using PEIS.Utils.IDCard;
namespace PEIS.View.Base
{
@@ -57,7 +57,7 @@ namespace PEIS.View.Base
private void NameTextBox_TextChanged(object sender, EventArgs e)
{
- Contactor1.Text = NameTextBox.Text;
+ Contactor1.Text = NameTextBox.Text;
}
private void IDCard_Leave(object sender, EventArgs e)
@@ -100,7 +100,7 @@ namespace PEIS.View.Base
return;
}
-
+
// 提取出生日期
string year = IDCard.Text.Substring(6, 4);
string month = IDCard.Text.Substring(10, 2);
@@ -128,7 +128,8 @@ namespace PEIS.View.Base
IDCard.ForeColor = System.Drawing.Color.Black;
BirthdayDateTimePicker.Value = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));
- }catch(Exception)
+ }
+ catch (Exception)
{
Global.Msg("err", "身份证出生日期错误!");
return;
@@ -155,12 +156,12 @@ namespace PEIS.View.Base
{
try
{
- var idCard = ReadCardInfo.Get();
+ var idCard = IDCardHelper.Read();
if (idCard == null) return;
NameTextBox.Text = idCard.NAME;
- Male.Checked = idCard.SEX == 1 ? true : false;
- Female.Checked = idCard.SEX == 2 ? true : false;
+ Male.Checked = idCard.SEX == "男" ? true : false;
+ Female.Checked = !Male.Checked;
CardTypeComboBox.SelectedIndex = 0;
IDCard.Text = idCard.IDNO;
BirthdayDateTimePicker.Value = idCard.BIRTH;
@@ -174,7 +175,7 @@ namespace PEIS.View.Base
Global.MsgErr(a.Message);
return;
}
-
+
}
private void ConfirmBtn_Click(object sender, EventArgs e)
@@ -250,7 +251,7 @@ namespace PEIS.View.Base
Female.Checked = genderDigit % 2 == 0;
}
}
-
+
if (BirthdayDateTimePicker.Value.Date == DateTime.Now.Date)
{
@@ -323,7 +324,7 @@ namespace PEIS.View.Base
{
OnIsExitBaseInfo();
Global.Msg("info", "添加成功!");
- _action(_patient);
+ _action(_patient);
}
else
{
@@ -380,14 +381,14 @@ namespace PEIS.View.Base
public event EventHandler> IsExitBaseInfo;
public void ShowIsExitBaseInfo(BasePatient item)
{
- Invoke(new Action(() => _patient = item ));
+ Invoke(new Action(() => _patient = item));
}
protected virtual void OnIsExitBaseInfo()
{
IsExitBaseInfo?.Invoke(this, new Args
{
- Name = CardTypeComboBox.SelectedValue.ToString(),
- Code = IDCard.Text.Trim()
+ Name = CardTypeComboBox.SelectedValue.ToString(),
+ Code = IDCard.Text.Trim()
});
}
diff --git a/PEIS/View/CountdownMessageBox.Designer.cs b/PEIS/View/CountdownMessageBox.Designer.cs
new file mode 100644
index 0000000..886ea1e
--- /dev/null
+++ b/PEIS/View/CountdownMessageBox.Designer.cs
@@ -0,0 +1,40 @@
+
+namespace PEIS.View
+{
+ partial class CountdownMessageBox
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "CountdownMessageBox";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/PEIS/View/CountdownMessageBox.cs b/PEIS/View/CountdownMessageBox.cs
new file mode 100644
index 0000000..8a3050c
--- /dev/null
+++ b/PEIS/View/CountdownMessageBox.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace PEIS.View
+{
+ public partial class CountdownMessageBox : Form
+ {
+ private int _countdownSeconds = 3;
+ private System.Windows.Forms.Timer _countdownTimer;
+
+ public CountdownMessageBox(string message, int seconds = 3)
+ {
+ // 设置窗体属性
+ this.Text = "提示";
+ this.StartPosition = FormStartPosition.CenterScreen;
+ this.FormBorderStyle = FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.ControlBox = false;
+ this.TopMost = true;
+ this.ShowInTaskbar = false;
+ this.Size = new Size(350, 150);
+
+ // 消息文本
+ Label lblMessage = new Label
+ {
+ Text = message,
+ Font = new Font("Microsoft YaHei", 10),
+ TextAlign = ContentAlignment.MiddleCenter,
+ Location = new Point(20, 40),
+ Size = new Size(310, 50),
+ AutoSize = false
+ };
+
+ // 倒计时文本
+ Label lblCountdown = new Label
+ {
+ Text = $"({seconds}秒后自动关闭)",
+ Font = new Font("Microsoft YaHei", 9),
+ ForeColor = Color.Blue,
+ TextAlign = ContentAlignment.MiddleCenter,
+ Location = new Point(20, 100),
+ Size = new Size(310, 20),
+ AutoSize = false
+ };
+
+ // 将控件添加到窗体
+ this.Controls.Add(lblMessage);
+ this.Controls.Add(lblCountdown);
+
+ // 初始化计时器
+ _countdownSeconds = seconds;
+ _countdownTimer = new System.Windows.Forms.Timer
+ {
+ Interval = 1000
+ };
+ _countdownTimer.Tick += (s, e) =>
+ {
+ _countdownSeconds--;
+ lblCountdown.Text = $"({_countdownSeconds}秒后自动关闭)";
+
+ if (_countdownSeconds <= 0)
+ {
+ _countdownTimer.Stop();
+ this.Close();
+ }
+ };
+
+ // 窗体显示时开始倒计时
+ this.Shown += (s, e) => _countdownTimer.Start();
+ }
+ }
+}
diff --git a/PEIS/View/Enrollment/EnrollmentOrgForm.cs b/PEIS/View/Enrollment/EnrollmentOrgForm.cs
index ecc8c00..b6eba61 100644
--- a/PEIS/View/Enrollment/EnrollmentOrgForm.cs
+++ b/PEIS/View/Enrollment/EnrollmentOrgForm.cs
@@ -980,7 +980,7 @@ namespace PEIS.View.Enrollment
var eid = _chooseRegItem.ID;
- if (_lstCheckCost?.Concat(_lstCheckCost2).Where(w => w.ChargeTime == null && w.EID == eid).ToList().Count != 0)
+ if (_lstCheckCost?.Concat(_lstCheckCost2).Where(w => w.ChargeTime == null && w.CostTime == null && w.EID == eid).ToList().Count != 0)
{
Global.Msg("info", "订单还未收费或未记账,不能操作,请核对后重试!");
return;
diff --git a/PEIS/View/Enrollment/EnrollmentPersonForm.Designer.cs b/PEIS/View/Enrollment/EnrollmentPersonForm.Designer.cs
index 1768f74..4614857 100644
--- a/PEIS/View/Enrollment/EnrollmentPersonForm.Designer.cs
+++ b/PEIS/View/Enrollment/EnrollmentPersonForm.Designer.cs
@@ -235,6 +235,7 @@
this.TsmiCopyFeeItem = new System.Windows.Forms.ToolStripMenuItem();
this.DgcCheckCost = new DevExpress.XtraGrid.GridControl();
this.DgvCheckCost = new DevExpress.XtraGrid.Views.Grid.GridView();
+ this.gridColumn55 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn53 = new DevExpress.XtraGrid.Columns.GridColumn();
this.repositoryItemMemoEdit3 = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
this.RegListPanel.SuspendLayout();
@@ -316,7 +317,7 @@
this.gridColumn52.OptionsColumn.ReadOnly = true;
this.gridColumn52.OptionsFilter.AllowFilter = false;
this.gridColumn52.Visible = true;
- this.gridColumn52.VisibleIndex = 15;
+ this.gridColumn52.VisibleIndex = 16;
//
// gridColumn118
//
@@ -2767,6 +2768,7 @@
this.gridColumn36,
this.gridColumn37,
this.gridColumn38,
+ this.gridColumn55,
this.gridColumn53,
this.gridColumn52});
this.DgvCheckCost.FixedLineWidth = 1;
@@ -2792,6 +2794,24 @@
this.DgvCheckCost.OptionsView.ShowIndicator = false;
this.DgvCheckCost.RowHeight = 35;
//
+ // gridColumn55
+ //
+ this.gridColumn55.Caption = "微信预约缴费时间";
+ this.gridColumn55.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
+ this.gridColumn55.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
+ this.gridColumn55.FieldName = "WeChatCostTime";
+ this.gridColumn55.Name = "gridColumn55";
+ this.gridColumn55.OptionsColumn.AllowEdit = false;
+ this.gridColumn55.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False;
+ this.gridColumn55.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False;
+ this.gridColumn55.OptionsColumn.AllowMove = false;
+ this.gridColumn55.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
+ this.gridColumn55.OptionsColumn.Printable = DevExpress.Utils.DefaultBoolean.False;
+ this.gridColumn55.OptionsColumn.ReadOnly = true;
+ this.gridColumn55.OptionsFilter.AllowFilter = false;
+ this.gridColumn55.Visible = true;
+ this.gridColumn55.VisibleIndex = 14;
+ //
// gridColumn53
//
this.gridColumn53.Caption = "退费人";
@@ -2806,7 +2826,7 @@
this.gridColumn53.OptionsColumn.ReadOnly = true;
this.gridColumn53.OptionsFilter.AllowFilter = false;
this.gridColumn53.Visible = true;
- this.gridColumn53.VisibleIndex = 14;
+ this.gridColumn53.VisibleIndex = 15;
//
// repositoryItemMemoEdit3
//
@@ -3112,5 +3132,6 @@
private DevExpress.XtraGrid.Columns.GridColumn gridColumn54;
private System.Windows.Forms.ContextMenuStrip FeeFastMenu;
private System.Windows.Forms.ToolStripMenuItem PartOption;
+ private DevExpress.XtraGrid.Columns.GridColumn gridColumn55;
}
}
\ No newline at end of file
diff --git a/PEIS/View/Enrollment/EnrollmentPersonForm.cs b/PEIS/View/Enrollment/EnrollmentPersonForm.cs
index df8a325..bb60cfc 100644
--- a/PEIS/View/Enrollment/EnrollmentPersonForm.cs
+++ b/PEIS/View/Enrollment/EnrollmentPersonForm.cs
@@ -218,7 +218,7 @@ namespace PEIS.View.Enrollment
{
e.Appearance.ForeColor = Color.FromArgb(234, 149, 24);
}
- if (_order.CostTime != null)
+ if (_order.CostTime != null || _order.WeChatCostTime != null)
{
e.Appearance.ForeColor = Color.ForestGreen;
}
@@ -707,7 +707,7 @@ namespace PEIS.View.Enrollment
return;
}
- if (_lstCheckCost.Where(w => w.ChargeTime == null).ToList().Count != 0)
+ if (_lstCheckCost.Where(w => w.ChargeTime == null && w.CostTime == null && w.WeChatCostTime == null).ToList().Count != 0)
{
Global.Msg("info", "订单还未收费或未记账,不能操作,请核对后重试!");
return;
diff --git a/PEIS/View/Enrollment/NewEnrollmentPersonForm.cs b/PEIS/View/Enrollment/NewEnrollmentPersonForm.cs
index c003520..843564a 100644
--- a/PEIS/View/Enrollment/NewEnrollmentPersonForm.cs
+++ b/PEIS/View/Enrollment/NewEnrollmentPersonForm.cs
@@ -5,7 +5,7 @@ using PEIS.Entity;
using PEIS.Event;
using PEIS.Presenter;
using PEIS.Utils;
-using PEIS.Utils.SS860;
+using PEIS.Utils.IDCard;
using PEIS.View.Base;
using System;
using System.Collections.Generic;
@@ -340,7 +340,7 @@ namespace PEIS.View.Enrollment
try
{
- RdCardModel idCard = ReadCardInfo.Get();
+ IDCardInfo idCard = IDCardHelper.Read();
if (idCard == null) return;
NameTextBox.Text = idCard.IDNO;
diff --git a/Third/FastReport/zh-CHS/FastReport/Chinese (Simplified).frl b/Third/FastReport/zh-CHS/FastReport/Chinese (Simplified).frl
new file mode 100644
index 0000000..369f099
--- /dev/null
+++ b/Third/FastReport/zh-CHS/FastReport/Chinese (Simplified).frl
@@ -0,0 +1,1510 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PEIS/Utils/SS860/RDCard64/RdCard.dll b/Third/SS860/RDCard64/RdCard.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/RdCard.dll
rename to Third/SS860/RDCard64/RdCard.dll
diff --git a/PEIS/Utils/SS860/RDCard64/WltRS.dll b/Third/SS860/RDCard64/WltRS.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/WltRS.dll
rename to Third/SS860/RDCard64/WltRS.dll
diff --git a/PEIS/Utils/SS860/RDCard64/license.dat b/Third/SS860/RDCard64/license.dat
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/license.dat
rename to Third/SS860/RDCard64/license.dat
diff --git a/PEIS/Utils/SS860/RDCard64/msvcr100.dll b/Third/SS860/RDCard64/msvcr100.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/msvcr100.dll
rename to Third/SS860/RDCard64/msvcr100.dll
diff --git a/PEIS/Utils/SS860/RDCard64/sdtapi.dll b/Third/SS860/RDCard64/sdtapi.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/sdtapi.dll
rename to Third/SS860/RDCard64/sdtapi.dll
diff --git a/PEIS/Utils/SS860/RDCard64/unpack.dll b/Third/SS860/RDCard64/unpack.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard64/unpack.dll
rename to Third/SS860/RDCard64/unpack.dll
diff --git a/PEIS/Utils/SS860/RDCard86/RdCard.dll b/Third/SS860/RDCard86/RdCard.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard86/RdCard.dll
rename to Third/SS860/RDCard86/RdCard.dll
diff --git a/PEIS/Utils/SS860/RDCard86/WltRS.dll b/Third/SS860/RDCard86/WltRS.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard86/WltRS.dll
rename to Third/SS860/RDCard86/WltRS.dll
diff --git a/PEIS/Utils/SS860/RDCard86/license.dat b/Third/SS860/RDCard86/license.dat
similarity index 100%
rename from PEIS/Utils/SS860/RDCard86/license.dat
rename to Third/SS860/RDCard86/license.dat
diff --git a/PEIS/Utils/SS860/RDCard86/sdtapi.dll b/Third/SS860/RDCard86/sdtapi.dll
similarity index 100%
rename from PEIS/Utils/SS860/RDCard86/sdtapi.dll
rename to Third/SS860/RDCard86/sdtapi.dll
diff --git a/Third/SW100/BmpToJpg.dll b/Third/SW100/BmpToJpg.dll
new file mode 100644
index 0000000..af0645f
Binary files /dev/null and b/Third/SW100/BmpToJpg.dll differ
diff --git a/Third/SW100/Device.dll b/Third/SW100/Device.dll
new file mode 100644
index 0000000..8d678bc
Binary files /dev/null and b/Third/SW100/Device.dll differ
diff --git a/Third/SW100/SSCARDInterface.dll b/Third/SW100/SSCARDInterface.dll
new file mode 100644
index 0000000..c9eb6c3
Binary files /dev/null and b/Third/SW100/SSCARDInterface.dll differ
diff --git a/Third/SW100/SSSE32.dll b/Third/SW100/SSSE32.dll
new file mode 100644
index 0000000..7c8c4bd
Binary files /dev/null and b/Third/SW100/SSSE32.dll differ
diff --git a/Third/SW100/SW100.dll b/Third/SW100/SW100.dll
new file mode 100644
index 0000000..7c8c4bd
Binary files /dev/null and b/Third/SW100/SW100.dll differ
diff --git a/Third/SW100/TestCard.exe b/Third/SW100/TestCard.exe
new file mode 100644
index 0000000..0c04415
Binary files /dev/null and b/Third/SW100/TestCard.exe differ
diff --git a/Third/SW100/UnPack.dll b/Third/SW100/UnPack.dll
new file mode 100644
index 0000000..2dc0943
Binary files /dev/null and b/Third/SW100/UnPack.dll differ
diff --git a/Third/SW100/zpp.bmp b/Third/SW100/zpp.bmp
new file mode 100644
index 0000000..3268e1b
Binary files /dev/null and b/Third/SW100/zpp.bmp differ
diff --git a/Third/SW100/接口说明.doc b/Third/SW100/接口说明.doc
new file mode 100644
index 0000000..3e96bbf
--- /dev/null
+++ b/Third/SW100/接口说明.doc
@@ -0,0 +1,334 @@
+
+
+
+
+
+
+ 多合一读写器接口规范
+
+
+
+ 动态库名:SSCARDInterface.dll
+
+
+
+
+
+
+
+一、外部方法
+
+
+1.1打开设备
+
+long WINAPI iOpenPort(char* ErrMsg);
+参数:ErrMsg:[OUT]返回错误信息,下同
+
+返回值:非0表示失败
+
+
+1.2关闭设备
+
+
+long WINAPI iClosePort();
+返回值:非0表示失败
+
+
+蜂鸣器
+
+long WINAPI iPosBeep ();
+返回值:非0表示失败
+
+
+1.3读取身份证/港澳台居住证信息
+
+
+函数原型:
+long WINAPI iReaderIDCard_CS(char* pPicFilePath, char* cardinfo, char* dsp,
+char* ErrMsg);
+
+功能:读取身份证信息
+
+参数:pPicFilePath:[IN]照片路径,例:D:\\zp.bmp
+ Cardinfo:[OUT] 读卡成功时返回
+"姓名|性别|民族|出生日期|地址|身份证号|发卡机关|发卡日期|卡有效期|证件类型|"
+。
+证件类型:I:外国人 J:港澳台居住证,居民身份证为空格
+ dsp[OUT] 预留
+返回值:非0表示失败
+
+
+
+读取身份证UID
+
+long WINAPI iReadCertID_CS(char* cardinfo, char* ErrMsg);
+功能:读取社保卡信息
+
+参数:
+ Cardinfo:[OUT] 成功返回身份证16位UID字符串。
+
+返回值:非0表示失败
+
+
+1.4读取社保卡信息
+
+函数原型:
+long WINAPI iReadSicard_CS(int slot,char* cardinfo, char* ErrMsg);
+功能:读取社保卡信息
+
+参数:slot:[IN]PSAM卡槽,SAM1~SAM4(值:17~20)
+ Cardinfo:[OUT]
+成功返回:"卡识别码|社保卡卡号|社会保障号码|姓名|性别|民族|出生日期|发卡日期
+|卡有效期|"。
+
+返回值:非0表示失败
+
+
+
+
+1.5 M1卡读写
+
+
+1.5.1 M1卡读操作
+
+1)函数原型:
+long WINAPI MifareOnCardRead_CS(int addr, int keyType, char* passWord,
+char* OutData, char* ErrMsg)
+功能:读取M1卡某一块的数据,ASCii格式
+
+参数:
+ addr:[IN]块地址(0~63)
+ keyType:[IN]认证KeyA时传0x60, KeyB:0x61
+ passWord:[IN]6字节十六进制字符串密码,例如 "ffffffffffff"
+ OutData:[OUT]读取的数据
+
+返回值:非0表示失败。
+
+
+2)函数原型:
+long WINAPI MifareOnCardReadHEX_CS(int addr, int keyType, char* passWord,
+char* OutData, char* ErrMsg)
+
+功能:读取M1卡某一块的数据,十六进制字符串格式
+
+参数:
+ addr:[IN]块地址(0~63)
+ keyType:[IN]认证KeyA时传0x60, KeyB:0x61
+ passWord:[IN]6字节十六进制字符串密码,例如 "ffffffffffff"
+ OutData:[OUT]读取的数据
+
+
+返回值:非0表示失败。
+
+
+
+1.5.2 M1卡写操作
+
+
+1)函数原型:
+long WINAPI MifareOnCardWrite_CS(int addr, int keyType, char* passWord,
+char* Data, char* ErrMsg)
+
+功能:写入M1卡某一块的数据,ASCii格式
+
+参数:
+ addr:[IN]块地址(0~63)
+ keyType:[IN]认证KeyA时传0x60, KeyB:0x61
+ passWord:[IN]6字节十六进制字符串密码,例如 "ffffffffffff"
+ Data:[IN]待写入的数据 16个字符
+
+返回值:非0表示失败。
+
+
+2)函数原型:
+long WINAPI MifareOnCardWriteHEX_CS(int addr, int keyType, char* passWord,
+char* Data, char* ErrMsg)
+
+功能:写入M1卡某一块的数据,十六进制字符串格式
+
+参数:
+ addr:[IN]块地址(0~63)
+ keyType:[IN]认证KeyA时传0x60, KeyB:0x61
+ passWord:[IN]6字节十六进制字符串密码,例如 "ffffffffffff"
+ Data:[IN]待写入的数据 32个字符
+
+返回值:非0表示失败。
+
+
+1.6读取磁条卡信息
+
+函数原型:
+long WINAPI iReadMagCard(int timeOut, int nTrack, char* trackData, char*
+ErrMsg);
+功能:读取磁条卡信息
+
+参数:timeOut:[IN]刷卡超时值,单位为秒
+ nTrack:[IN] 磁道值1-3
+ Cardinfo:[OUT] 成功返回磁道信息。
+
+返回值:小于等于0表示失败,大于0表示成功
+
+
+1.7扫码二维码信息
+
+函数原型:
+long WINAPI ScanQRcode(int nTimeOut, char* pCodeInfo, char* ErrMsg);
+
+功能:扫码信息
+
+参数:nTimeOut:[IN]扫码超时值,单位为秒
+ pCodeInfo:[OUT] 成功返回扫码信息。
+
+返回值:非0表示失败,等于0表示成功
+
+相关函数:
+设置主动扫码:
+long WINAPI SetAutoQRcode(char* ErrMsg);
+关闭主动扫码:
+long WINAPI CloseAutoQRcode(char* ErrMsg);
+
+
+ 加密机部分
+
+
+1 1“读基本信息”函数
+
+
+1 1.1 SI_ReadCardBas “读基本信息”
+
+
+1.1.1函数定义
+
+ 读基本信息接口函数定义见表1。在进行任何社保卡操作前,应先调用此函数。
+ 表1读基本信息接口函数定义
+|函数名称 |读基本信息 |
+|语法 |long SI_ReadCardBas (int iType, char* pOutInfo) |
+|功能描述 |选择社保卡社会保障系统环境后,通过PSAM卡对社保卡进行内部认证,|
+| |通过后将卡内的基本信息读出返回。 |
+|参数说明 |序号 |参数 |输入/输 |类型 |长度(十进 |含义 |
+| | | |出 | |制) | |
+| |1 |iType |IN |整数 |4 |操作卡的类型 |
+| |2 |pOutInfo |OUT |字符串|1024 |读出数据或返回错误 |
+| | | | | | |信息 |
+|返回值 |0表示成功;非0表示失败。 |
+
+
+1.1.2参数说明
+
+ 1. 输入参数iType
+ 表示执行本函数时操作卡的类型,定义如下:1-接触式操作卡;2-
+非接触式操作卡;3-自动寻卡,接触式操作卡优先;4-
+自动寻卡,非接触式操作卡优先。
+ 2. 输出参数pOutInfo
+ 当函数执行成功时,该输出参数为读出的社保卡基本信息各数据项,依次为:发卡地
+区行政区划代码(卡识别码前6位)、社会保障号码、卡号、卡识别码、姓名、卡复位信
+息(仅取历史字节)、规范版本、发卡日期、卡有效期、终端机编号、终端设备号。各
+数据项之间以“|”分割,且最后一个数据项以“|”结尾。例如:639900|111111198101011
+110|X00000019|639900D15600000500BF7C7A48FB4966|张三|00814E43238697159900BF7C
+7A|1.00|20101001|20201001|410100813475|终端设备号|。
+ 当函数执行失败时,该输出参数为错误信息描述。
+ 注:当没有终端设备号时,终端设备号返回空字符串。
+
+
+
+2 1.2 SI_ReadCardHSM_Step1 “基于加密机的读基本信息(步骤一)”
+
+
+1.2.1函数定义
+
+ 基于加密机的读基本信息(步骤一)接口函数定义见表2。
+ 表2基于加密机的读基本信息(步骤一)接口函数定义
+|函数名称 |基于加密机的读基本信息(步骤一) |
+|语法 |long SI_ReadCardHSM_Step1 (int iType, char* pOutInfo) |
+|功能描述 |选择社会保障系统环境后,返回内部认证和外部认证所需信息。 |
+|参数说明 |序号 |参数 |输入/输 |类型 |长度(十进 |含义 |
+| | | |出 | |制) | |
+| |1 |iType |IN |整数 |4 |操作卡的类型 |
+| |2 |pOutInfo |OUT |字符串|1024 |返回认证信息或错误 |
+| | | | | | |信息 |
+|返回值 |0表示成功;非0表示失败。 |
+
+
+1.2.2参数说明
+
+ 1. 输入参数iType
+ 定义同1.1.2(1)。
+ 2. 输出参数pOutInfo
+ 当函数执行成功时,该输出参数为读出的社保卡内部认证和外部认证的计算数据,依
+次为:发卡地区行政区划代码(卡识别码前6位)、卡复位信息(仅取历史字节)、算法
+标识、卡识别码、内部认证过程因子、内部认证鉴别所需的原始信息、外部认证过程因
+子、外部认证鉴别所需的原始信息,其中外部认证相关数据项全部不为空或全部为空。
+各数据项之间以“|”分割,且最后一个数据项以“|”结尾。
+ 当函数执行失败时,该输出参数为错误信息描述。
+ 注:当外部认证相关数据项为空时,表示不做外部认证。
+
+
+
+3 1.3 SI_ReadCardHSM_Step2 “基于加密机的读基本信息(步骤二)”
+
+
+1.3.1函数定义
+
+ 基于加密机的读基本信息(步骤二)接口函数定义见表3。
+ 表3基于加密机的读基本信息(步骤二)接口函数定义
+|函数名称 |基于加密机的读基本信息(步骤二) |
+|语法 |long SI_ReadCardHSM_Step2 (char *pKey, char* pOutInfo) |
+|功能描述 |根据加密机返回的内部认证和外部认证结果数据对社保卡进行内部认证|
+| |和外部认证,通过后将卡内的基本信息读出返回。 |
+|参数说明 |序号 |参数 |输入/输 |类型 |长度(十进 |含义 |
+| | | |出 | |制) | |
+| |1 |pKey |IN |字符串|128 |加密机返回的内部认 |
+| | | | | | |证和外部认证结果数 |
+| | | | | | |据 |
+| |2 |pOutInfo |OUT |字符串|1024 |读出数据或返回错误 |
+| | | | | | |信息 |
+|返回值 |0表示成功;非0表示失败。 |
+
+
+1.3.2参数说明
+
+ 1. 输入参数pKey
+ 加密机返回的内部认证和外部认证结果数据,依次为:内部认证结果数据(即内部认
+证鉴别数据(16位)和内部认证鉴别所需的原始信息(16位)拼接组成)、外部认证结
+果数据(即外部认证鉴别数据(16位)和外部认证鉴别所需的原始信息(16位)拼接组
+成)。各数据项之间以“|”分割,且最后一个数据项以“|”结尾。
+ 注:如果不做外部认证,则后面一个参数都为空字符串。
+ 2. 输出参数pOutInfo
+ 定义同1.1.2(2)。
+ 注:当没有PSAM卡时,终端机编号返回12个0,即6个0x00对应的字符。
+ 当没有终端设备号时,终端设备号返回空字符串。
+
+
+
+
+
+ 2 2 读社保基本信息流程
+
+ 读基本信息流程如图C.1所示。
+
+ [pic]
+
+ 图C.1读基本信息流程
+ 具体流程如下:
+ (1)调用SI_ReadCardBas函数,判断函数执行结果,若执行成功,则返回基本信息
+,调用持卡库的卡鉴权服务接口,完成卡鉴权操作;若执行失败,返回错误代码并进行
+判断,当判断到五种情况的错误代码(详见10.5)后,则调用基于加密机的SI_ReadCar
+dBas_HSM_Step1函数,否则报错退出;
+ (2)若SI_ReadCardBas_HSM_Step1函数执行成功,则分析返回数据内容,组织持卡
+库报文,调用持卡库的卡内部认证服务接口,否则报错退出;
+ (3)若卡内部认证服务接口调用成功,则调用基于加密机的SI_ReadCardBas_HSM_S
+tep2函数,否则报错退出;
+ (4)若SI_ReadCardBas_HSM_Step2函数执行成功,则返回基本信息,调用持卡库的
+卡鉴权服务接口,完成卡鉴权操作,否则报错退出。
+
+
+附录
+
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
+| | |
diff --git a/Update/App.config b/Update/App.config
new file mode 100644
index 0000000..e563517
--- /dev/null
+++ b/Update/App.config
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Update/CountdownMessageBox.Designer.cs b/Update/CountdownMessageBox.Designer.cs
new file mode 100644
index 0000000..a83baec
--- /dev/null
+++ b/Update/CountdownMessageBox.Designer.cs
@@ -0,0 +1,40 @@
+
+namespace Update
+{
+ partial class CountdownMessageBox
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "CountdownMessageBox";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Update/CountdownMessageBox.cs b/Update/CountdownMessageBox.cs
new file mode 100644
index 0000000..456db5b
--- /dev/null
+++ b/Update/CountdownMessageBox.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Update
+{
+ public partial class CountdownMessageBox : Form
+ {
+ private int _countdownSeconds = 3;
+ private Label _lblMessage;
+ private Label _lblCountdown;
+
+ public CountdownMessageBox(string message, int seconds = 3)
+ {
+ _countdownSeconds = seconds;
+
+ // 窗体设置
+ this.Text = "提示";
+ this.StartPosition = FormStartPosition.CenterScreen;
+ this.FormBorderStyle = FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.ControlBox = false;
+ this.TopMost = true;
+ this.ShowInTaskbar = false;
+
+ // 设置窗体大小
+ this.Size = new Size(400, 200);
+
+ // 创建消息标签 - 关键设置
+ _lblMessage = new Label();
+ _lblMessage.Text = message; // 先设置文本
+ _lblMessage.Font = new Font("Microsoft YaHei", 10);
+ _lblMessage.TextAlign = ContentAlignment.MiddleCenter;
+ _lblMessage.AutoSize = false; // 设置为false
+ _lblMessage.Size = new Size(360, 120); // 明确设置大小
+ _lblMessage.Location = new Point(20, 20);
+
+ // 创建倒计时标签
+ _lblCountdown = new Label();
+ _lblCountdown.Text = $"({_countdownSeconds}秒后自动关闭)";
+ _lblCountdown.Font = new Font("Microsoft YaHei", 9);
+ _lblCountdown.ForeColor = Color.Blue;
+ _lblCountdown.TextAlign = ContentAlignment.MiddleCenter;
+ _lblCountdown.AutoSize = false;
+ _lblCountdown.Size = new Size(360, 25);
+ _lblCountdown.Location = new Point(20, 150);
+
+ // 添加控件
+ this.Controls.Add(_lblMessage);
+ this.Controls.Add(_lblCountdown);
+
+ // 初始化计时器
+ System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer
+ {
+ Interval = 1000
+ };
+ timer.Tick += (s, e) =>
+ {
+ _countdownSeconds--;
+ _lblCountdown.Text = $"({_countdownSeconds}秒后自动关闭)";
+
+ if (_countdownSeconds <= 0)
+ {
+ timer.Stop();
+ this.Close();
+ }
+ };
+
+ this.Shown += (s, e) => timer.Start();
+
+ // 确保控件可见
+ _lblMessage.Visible = true;
+ _lblCountdown.Visible = true;
+
+ // 强制刷新显示
+ this.Refresh();
+ }
+ }
+}
diff --git a/Update/Form1.Designer.cs b/Update/Form1.Designer.cs
deleted file mode 100644
index 58abf3e..0000000
--- a/Update/Form1.Designer.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-namespace Update
-{
- partial class Form1
- {
- ///
- /// 必需的设计器变量。
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// 清理所有正在使用的资源。
- ///
- /// 如果应释放托管资源,为 true;否则为 false。
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows 窗体设计器生成的代码
-
- ///
- /// 设计器支持所需的方法 - 不要修改
- /// 使用代码编辑器修改此方法的内容。
- ///
- private void InitializeComponent()
- {
- this.lblTips = new System.Windows.Forms.Label();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.SuspendLayout();
- //
- // lblTips
- //
- this.lblTips.AutoSize = true;
- this.lblTips.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.lblTips.Location = new System.Drawing.Point(93, 55);
- this.lblTips.Name = "lblTips";
- this.lblTips.Size = new System.Drawing.Size(74, 20);
- this.lblTips.TabIndex = 4;
- this.lblTips.Text = "正在更新···";
- this.lblTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // pictureBox1
- //
- this.pictureBox1.Image = global::Update.Properties.Resources.update;
- this.pictureBox1.InitialImage = null;
- this.pictureBox1.Location = new System.Drawing.Point(12, 40);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(50, 50);
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
- this.pictureBox1.TabIndex = 5;
- this.pictureBox1.TabStop = false;
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(304, 141);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.lblTips);
- this.Name = "Form1";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "体检系统更新";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
- private System.Windows.Forms.Label lblTips;
- private System.Windows.Forms.PictureBox pictureBox1;
- }
-}
-
diff --git a/Update/Form1.cs b/Update/Form1.cs
deleted file mode 100644
index 14cd307..0000000
--- a/Update/Form1.cs
+++ /dev/null
@@ -1,168 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Windows.Forms;
-
-namespace Update
-{
- public partial class Form1 : Form
- {
- // 当前程序目录 **/Update/
- private static string CurrentPath = Application.StartupPath;
-
- public Form1()
- {
- InitializeComponent();
- TopMost = true;
- MaximizeBox = false;
- ControlBox = true;
- ControlBox = false;
-
- try
- {
- // 体检系统
- var program = "PEIS.exe";
- // 解压文件目录 **/Update/Unzip/
- var unZipPath = Path.Combine(CurrentPath, "UnZip");
- // 检查程序是否正在运行
- var processes = Process.GetProcessesByName(program);
- if (processes.Length > 0)
- {
- // 关闭程序
- foreach (var process in processes)
- {
- process.Kill();
- process.WaitForExit(); // 等待程序退出
- Console.WriteLine($@"Closed existing instance of {program}");
- }
- // 等待1秒
- Thread.Sleep(1000);
- }
- lblTips.Text = @"正在更新……";
- // 删除文件夹
- DelDirectory();
- // 解压路径是否存在
- if (Directory.Exists(unZipPath))
- {
- // 获取解压文件下的第一个文件夹,避免 **/Update/UnZip/PEIS.exe || **/Update/UnZip/XxDirectory/PEIS.exe
- var temp = Directory.GetDirectories(unZipPath, "*", SearchOption.AllDirectories).ToList()
- ?.FirstOrDefault();
- if (File.Exists(Path.Combine(unZipPath, program)))
- {
- CopyFilesRecursively(unZipPath, Path.GetDirectoryName(CurrentPath));
- var sourceFilePath = Path.Combine(unZipPath, "PEIS.exe.config");
- var targetFilePath = Path.Combine(Path.GetDirectoryName(CurrentPath), "PEIS.exe.config");
- // 复制并替换指定文件 PEIS.exe.config
- File.Copy(sourceFilePath, targetFilePath, true);
- //删除压缩目录
- //Directory.Delete(unZipPath, true);
- lblTips.Text = (@"更新完成,请重新启动!");
- //Process.Start(programPath);
- }
- else if (File.Exists(Path.Combine(temp, program)))
- {
- CopyFilesRecursively(temp, Path.GetDirectoryName(CurrentPath));
- var sourceFilePath = Path.Combine(temp, "PEIS.exe.config");
- var targetFilePath = Path.Combine(Path.GetDirectoryName(CurrentPath), "PEIS.exe.config");
- // 复制并替换指定文件
- File.Copy(sourceFilePath, targetFilePath, true);
- lblTips.Text = (@"更新完成,请重新启动!");
- }
- else
- {
- lblTips.Text = (@"未找到更新程序!");
- }
- }
- else
- {
- lblTips.Text = (@"未找到更新文件!");
- }
- //Process.GetCurrentProcess().Kill();
- }
- catch (Exception e)
- {
- lblTips.Text = (e.Message);
- //Process.GetCurrentProcess().Kill();
- }
- finally
- {
- ControlBox = true;
- }
- }
-
- ///
- /// 文件复制替换
- ///
- /// 原位置
- /// 目标位置
- private static void CopyFilesRecursively(string sourcePath, string targetPath)
- {
- //现在创建所有目录
- foreach (var dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
- {
- if (dirPath == CurrentPath) continue;
- if (dirPath.Contains("Update")) continue;
- var dir = dirPath.Replace(sourcePath, targetPath);
- Directory.CreateDirectory(dir);
- }
- //复制所有文件并替换所有同名文件
- foreach (var newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
- {
- //File.Copy(newPath, newPath.Replace(sourcePath, targetPath), true);
- var newFilePath = newPath.Replace(sourcePath, targetPath);
- var targetDirectory = Path.GetDirectoryName(newFilePath);
-
- if (newPath.Contains("Update.exe")) continue;
- if (newFilePath.Contains("Update.exe")) continue;
- // 如果目标文件夹不存在,则创建
- if (!Directory.Exists(targetDirectory))
- {
- Directory.CreateDirectory(targetDirectory);
- }
-
- File.Copy(newPath, newFilePath, true);
- }
- }
-
-
- private static void DelDirectory()
- {
- var list = new List()
- {
- "de",
- "es",
- "ja",
- "ru",
- "nl",
- "x64",
- "x86",
- };
- list.ForEach(item =>
- {
- var path = Path.Combine( Path.GetDirectoryName(CurrentPath), item);
- DeleteDirectory(path);
- });
- }
-
- static void DeleteDirectory(string targetDir)
- {
- if (Directory.Exists(targetDir))
- {
- string[] files = Directory.GetFiles(targetDir);
- foreach (string file in files)
- {
- File.Delete(file);
- }
- string[] subDirs = Directory.GetDirectories(targetDir);
- foreach (string subDir in subDirs)
- {
- DeleteDirectory(subDir);
- }
- Directory.Delete(targetDir);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Update/MainFrom.Designer.cs b/Update/MainFrom.Designer.cs
new file mode 100644
index 0000000..535c7b7
--- /dev/null
+++ b/Update/MainFrom.Designer.cs
@@ -0,0 +1,95 @@
+
+namespace Update
+{
+ partial class MainFrom
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows 窗体设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.MainBackgroundWorker = new System.ComponentModel.BackgroundWorker();
+ this.MainProgressBar = new System.Windows.Forms.ProgressBar();
+ this.label1 = new System.Windows.Forms.Label();
+ this.MainProcessLabel = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // MainBackgroundWorker
+ //
+ this.MainBackgroundWorker.WorkerReportsProgress = true;
+ //
+ // MainProgressBar
+ //
+ this.MainProgressBar.Location = new System.Drawing.Point(16, 48);
+ this.MainProgressBar.Name = "MainProgressBar";
+ this.MainProgressBar.Size = new System.Drawing.Size(365, 33);
+ this.MainProgressBar.TabIndex = 0;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(286, 19);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "更新程序运行中, 请勿操作电脑!";
+ //
+ // MainProcessLabel
+ //
+ this.MainProcessLabel.AutoSize = true;
+ this.MainProcessLabel.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.MainProcessLabel.Location = new System.Drawing.Point(392, 55);
+ this.MainProcessLabel.Name = "MainProcessLabel";
+ this.MainProcessLabel.Size = new System.Drawing.Size(21, 14);
+ this.MainProcessLabel.TabIndex = 2;
+ this.MainProcessLabel.Text = "0%";
+ //
+ // MainFrom
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(442, 102);
+ this.ControlBox = false;
+ this.Controls.Add(this.MainProcessLabel);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.MainProgressBar);
+ this.Name = "MainFrom";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "更新程序";
+ this.TopMost = true;
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.ComponentModel.BackgroundWorker MainBackgroundWorker;
+ private System.Windows.Forms.ProgressBar MainProgressBar;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label MainProcessLabel;
+ }
+}
+
diff --git a/Update/MainFrom.cs b/Update/MainFrom.cs
new file mode 100644
index 0000000..61e5641
--- /dev/null
+++ b/Update/MainFrom.cs
@@ -0,0 +1,241 @@
+using Ionic.Zip;
+using System;
+using System.ComponentModel;
+using System.Configuration;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Update
+{
+ public partial class MainFrom : Form
+ {
+ readonly string programName = ConfigurationManager.AppSettings["ProgramName"];
+ readonly string downloadUrl = ConfigurationManager.AppSettings["DownloadUrl"];
+ string version;
+ public MainFrom(string[] args)
+ {
+ InitializeComponent();
+
+ // 参数验证
+ if (args.Length < 1)
+ {
+ MessageBox.Show("未接收到启动参数!程序即将关闭!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Close();
+ }
+ else
+ {
+ version = args[0];
+ }
+
+ // 杀死业务系统进程
+ Process[] processes = Process.GetProcessesByName(programName);
+ foreach (Process process in processes)
+ {
+ process.Kill();
+ process.WaitForExit(); // 可选:等待进程完全退出
+ process.Close(); // 释放资源
+ }
+
+
+ MainBackgroundWorker.DoWork += BackgroundWorker_DoWork;
+ MainBackgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged;
+ MainBackgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
+
+ MainBackgroundWorker.RunWorkerAsync();
+ }
+
+ private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
+ {
+ //下载 80%
+ Download();
+ //解压 10%
+ UnZip();
+ //复制 10%
+ Copy();
+ }
+
+ private void Download()
+ {
+ //保存路径
+ var savePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update");
+ if (Directory.Exists(savePath))
+ {
+ Directory.Delete(savePath, true);
+ }
+ Directory.CreateDirectory(savePath);
+ //保存文件
+ var zipFilePath = Path.Combine(savePath, version + ".zip");
+
+ // 创建HttpWebRequest对象
+ var request = (HttpWebRequest)WebRequest.Create(downloadUrl + $"?fileName={version}.zip");
+ // 获取响应
+ using (var response = (HttpWebResponse)request.GetResponse())
+ {
+ long totalBytes = response.ContentLength;
+ long downloadedBytes = 0;
+
+ // 读取响应流
+ using (var stream = response.GetResponseStream())
+ {
+ // 将响应保存到本地文件
+ using (var fileStream = File.Create(zipFilePath))
+ {
+ var buffer = new byte[4096];
+ int bytesRead;
+ // 循环读取和写入,直到读取完整个响应流
+ while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ // 写入文件流
+ fileStream.Write(buffer, 0, bytesRead);
+ downloadedBytes += bytesRead;
+ MainBackgroundWorker.ReportProgress((int)((double)downloadedBytes / totalBytes * 80), "正在下载");
+ }
+ }
+ }
+ }
+ }
+
+ private void UnZip()
+ {
+ //保存路径
+ var savePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update");
+ //保存文件
+ var zipFilePath = Path.Combine(savePath, version + ".zip");
+ //解压路径
+ var unZipPath = Path.Combine(savePath, "UnZip");
+
+ if (Directory.Exists(unZipPath))
+ Directory.Delete(unZipPath, true);
+ Directory.CreateDirectory(unZipPath);
+
+
+ int totalFiles = 0;
+ int processedFiles = 0;
+
+ using (ZipFile zip = ZipFile.Read(zipFilePath, new ReadOptions { Encoding = Encoding.GetEncoding("GB2312") }))
+ {
+ totalFiles = zip.Count;
+
+ foreach (ZipEntry entry in zip)
+ {
+ entry.Extract(unZipPath, ExtractExistingFileAction.OverwriteSilently);
+ processedFiles++;
+
+ // 报告进度
+ MainBackgroundWorker.ReportProgress((int)((double)processedFiles / totalFiles * 10) + 80, "正在解压");
+ }
+ }
+ }
+
+ private void OnExtractProgress(object sender, ExtractProgressEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ ///
+ /// 在 BackgroundWorker 中递归复制文件(简单进度报告)
+ ///
+ private void Copy()
+ {
+ string sourceDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Update", "UnZip", version);
+ string destDir = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName;
+
+ int totalFiles = CountAllFiles(sourceDir);
+ int copiedFiles = 0;
+
+ // 执行复制
+ CopyFiles(sourceDir, destDir, ref copiedFiles, totalFiles);
+ MainBackgroundWorker.ReportProgress(100, $"复制完成,共复制 {copiedFiles} 个文件");
+ }
+
+ ///
+ /// 统计目录下所有文件数量
+ ///
+ private int CountAllFiles(string directory)
+ {
+ int count = 0;
+
+ try
+ {
+ // 当前目录的文件数
+ count += Directory.GetFiles(directory).Length;
+
+ // 递归统计子目录
+ foreach (string subDir in Directory.GetDirectories(directory))
+ {
+ count += CountAllFiles(subDir);
+ }
+ }
+ catch (UnauthorizedAccessException)
+ {
+ // 无权限访问,跳过该目录
+ }
+
+ return count;
+ }
+
+ private void CopyFiles(string sourceDir, string destDir, ref int copiedFiles, int totalFiles)
+ {
+ if (sourceDir.EndsWith("Update"))
+ {
+ return;
+ }
+
+ // 复制当前目录的文件
+ foreach (string sourceFile in Directory.GetFiles(sourceDir))
+ {
+ string destFile = Path.Combine(destDir, Path.GetFileName(sourceFile));
+ File.Copy(sourceFile, destFile, overwrite: true);
+ copiedFiles++;
+
+ // 报告进度
+ MainBackgroundWorker.ReportProgress((int)((double)copiedFiles / totalFiles * 10) + 90, "正在复制");
+ }
+
+ // 递归处理子目录
+ foreach (string subDir in Directory.GetDirectories(sourceDir))
+ {
+
+ string destSubDir = Path.Combine(destDir, Path.GetFileName(subDir));
+ Directory.CreateDirectory(destSubDir);
+
+ CopyFiles(subDir, destSubDir, ref copiedFiles, totalFiles);
+ }
+ }
+
+ private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
+ {
+ // 更新进度条
+ MainProgressBar.Value = e.ProgressPercentage;
+
+ // 更新百分比标签
+ MainProcessLabel.Text = $"{e.ProgressPercentage}%";
+
+ // 如果需要显示具体信息
+ //if (e.UserState != null)
+ //{
+ // lblProgress.Text = $"{e.ProgressPercentage}% - {e.UserState}";
+ //}
+ }
+
+ private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ if (e.Error != null)
+ {
+ var box = new CountdownMessageBox($"更新出错, 请联系系统管理员:\r\n{e.Error.Message}", 15);
+ box.ShowDialog();
+ }
+ else
+ {
+ var box = new CountdownMessageBox("更新完成!即将启动系统...");
+ box.ShowDialog();
+ Process.Start(Path.Combine(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName, programName + ".exe"), version);
+ }
+ Close();
+ }
+ }
+}
diff --git a/Update/Form1.resx b/Update/MainFrom.resx
similarity index 96%
rename from Update/Form1.resx
rename to Update/MainFrom.resx
index 1af7de1..bd58d62 100644
--- a/Update/Form1.resx
+++ b/Update/MainFrom.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/Update/Program.cs b/Update/Program.cs
index a64f644..20179fd 100644
--- a/Update/Program.cs
+++ b/Update/Program.cs
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
-using System.Threading;
using System.Windows.Forms;
namespace Update
@@ -13,29 +11,11 @@ namespace Update
/// 应用程序的主入口点。
///
[STAThread]
- static void Main()
+ static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- var program = "PEIS.exe";
-
- // 检查程序是否正在运行
- Process[] processes = Process.GetProcessesByName(program);
-
- if (processes.Length > 0)
- {
- // 关闭程序
- foreach (var process in processes)
- {
- process.Kill();
- process.WaitForExit(); // 等待程序退出
- Console.WriteLine($@"Closed existing instance of {program}");
- }
-
- // 等待2秒
- Thread.Sleep(1000);
- }
- Application.Run(new Form1());
+ Application.Run(new MainFrom(args));
}
}
}
diff --git a/Update/Properties/AssemblyInfo.cs b/Update/Properties/AssemblyInfo.cs
index 9d2771d..1382e30 100644
--- a/Update/Properties/AssemblyInfo.cs
+++ b/Update/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Update")]
-[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("8894c92c-210d-459c-b5cd-7a6d2ab4cbe5")]
+[assembly: Guid("12fe71e3-1e39-424c-8685-64ec743a248f")]
// 程序集的版本信息由下列四个值组成:
//
@@ -29,8 +29,8 @@ using System.Runtime.InteropServices;
// 生成号
// 修订号
//
-// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
-// 方法是按如下所示使用“*”: :
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Update/Properties/Resources.Designer.cs b/Update/Properties/Resources.Designer.cs
index 9156364..1a47275 100644
--- a/Update/Properties/Resources.Designer.cs
+++ b/Update/Properties/Resources.Designer.cs
@@ -1,73 +1,70 @@
//------------------------------------------------------------------------------
//
// 此代码由工具生成。
-// 运行时版本:4.0.30319.42000
+// 运行时版本: 4.0.30319.42000
//
-// 对此文件的更改可能会导致不正确的行为,并且如果
-// 重新生成代码,这些更改将会丢失。
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
//
//------------------------------------------------------------------------------
-namespace Update.Properties {
- using System;
-
-
+
+namespace Update.Properties
+{
///
- /// 一个强类型的资源类,用于查找本地化的字符串等。
+ /// 强类型资源类,用于查找本地化字符串等。
///
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
- // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
+ internal class Resources
+ {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
+ internal Resources()
+ {
}
-
+
///
- /// 返回此类使用的缓存的 ResourceManager 实例。
+ /// 返回此类使用的缓存 ResourceManager 实例。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Update.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
- /// 重写当前线程的 CurrentUICulture 属性
- /// 重写当前线程的 CurrentUICulture 属性。
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
return resourceCulture;
}
- set {
+ set
+ {
resourceCulture = value;
}
}
-
- ///
- /// 查找 System.Drawing.Bitmap 类型的本地化资源。
- ///
- internal static System.Drawing.Bitmap update {
- get {
- object obj = ResourceManager.GetObject("update", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
}
}
diff --git a/Update/Properties/Resources.resx b/Update/Properties/Resources.resx
index 3aa7d5a..af7dbeb 100644
--- a/Update/Properties/Resources.resx
+++ b/Update/Properties/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,7 +60,6 @@
: and then encoded with base64 encoding.
-->
-
@@ -69,10 +68,9 @@
-
+
-
@@ -87,10 +85,9 @@
-
+
-
@@ -112,13 +109,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
\ No newline at end of file
diff --git a/Update/Properties/Settings.Designer.cs b/Update/Properties/Settings.Designer.cs
index 37ea7c8..0f5d5e9 100644
--- a/Update/Properties/Settings.Designer.cs
+++ b/Update/Properties/Settings.Designer.cs
@@ -8,10 +8,9 @@
//
//------------------------------------------------------------------------------
+
namespace Update.Properties
{
-
-
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
diff --git a/Update/Update.csproj b/Update/Update.csproj
index 7726f31..e85e9a1 100644
--- a/Update/Update.csproj
+++ b/Update/Update.csproj
@@ -4,28 +4,13 @@
Debug
AnyCPU
- {8894C92C-210D-459C-B5CD-7A6D2AB4CBE5}
+ {12FE71E3-1E39-424C-8685-64EC743A248F}
WinExe
Update
Update
v4.0
512
true
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
AnyCPU
@@ -46,22 +31,54 @@
prompt
4
+
+ true
+ bin\x86\Debug\
+ DEBUG;TRACE
+ full
+ x86
+ 7.3
+ prompt
+
+
+ bin\x86\Release\
+ TRACE
+ true
+ pdbonly
+ x86
+ 7.3
+ prompt
+
+
+
+
+
+
+
+
+
-
+
Form
-
- Form1.cs
+
+ CountdownMessageBox.cs
+
+
+ Form
+
+
+ MainFrom.cs
-
- Form1.cs
+
+ MainFrom.cs
ResXFileCodeGenerator
@@ -71,9 +88,8 @@
True
Resources.resx
- True
-
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -85,16 +101,9 @@
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
- Always
-
+
+ 1.16.0
+
\ No newline at end of file
diff --git a/Update/packages.config b/Update/packages.config
deleted file mode 100644
index 362fa35..0000000
--- a/Update/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Update/update.png b/Update/update.png
deleted file mode 100644
index 96948ce..0000000
Binary files a/Update/update.png and /dev/null differ