From 8fdbbc40906d564aee0d23445a2b64ba34c01ce0 Mon Sep 17 00:00:00 2001
From: tangxu <tangxu76880903>
Date: 星期三, 19 六月 2024 09:15:56 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 HStation.DeskTop.Xhs.Core/Program.cs                       |   78 +++++++++
 HStation.BLL.Xhs.Core/HStation.BLL.Xhs.Core.csproj         |    2 
 HStation.DeskTop.Xhs.Core/MainFrm.cs                       |   27 +++
 HStation.Service.Xhs.Core/HStation.Service.Xhs.Core.csproj |    2 
 HStation.DeskTop.Xhs.Core/MainFrm.resx                     |  120 +++++++++++++++
 HStation.DeskTop.Xhs.Core/HStation.DeskTop.Xhs.Core.csproj |   34 ++++
 HStation.DeskTop.Xhs.Core/MainFrm.Designer.cs              |   49 ++++++
 HStation.DeskTop.Xhs.Core/Login/LoginFrm.cs                |  147 ++++++++++++++++++
 8 files changed, 457 insertions(+), 2 deletions(-)

diff --git a/HStation.BLL.Xhs.Core/HStation.BLL.Xhs.Core.csproj b/HStation.BLL.Xhs.Core/HStation.BLL.Xhs.Core.csproj
index d1502b2..16c415f 100644
--- a/HStation.BLL.Xhs.Core/HStation.BLL.Xhs.Core.csproj
+++ b/HStation.BLL.Xhs.Core/HStation.BLL.Xhs.Core.csproj
@@ -8,7 +8,7 @@
 	</PropertyGroup>
 
 	<ItemGroup>
-	  <PackageReference Include="Yw.CAL.HttpClient.Core" Version="3.0.5" />
+	  <PackageReference Include="Yw.CAL.HttpClient.Core" Version="3.0.6" />
 	  <PackageReference Include="Yw.CALFactory.Core" Version="3.0.0" />
 	  <PackageReference Include="Yw.Mapster.Core" Version="3.0.0" />
 	</ItemGroup>
diff --git a/HStation.DeskTop.Xhs.Core/HStation.DeskTop.Xhs.Core.csproj b/HStation.DeskTop.Xhs.Core/HStation.DeskTop.Xhs.Core.csproj
new file mode 100644
index 0000000..d5918dc
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/HStation.DeskTop.Xhs.Core.csproj
@@ -0,0 +1,34 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net6.0-windows</TargetFramework>
+    <UseWindowsForms>true</UseWindowsForms>
+    <RootNamespace>HStation.DeskTop</RootNamespace>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="DevExpress.Win.Design" Version="22.2.4" />
+    <PackageReference Include="Yw.BLL.Auth.Core" Version="3.0.5" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\HStation.WinFrmUI.Xhs.Core\HStation.WinFrmUI.Xhs.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Properties\Settings.Designer.cs">
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+
+</Project>
\ No newline at end of file
diff --git a/HStation.DeskTop.Xhs.Core/Login/LoginFrm.cs b/HStation.DeskTop.Xhs.Core/Login/LoginFrm.cs
new file mode 100644
index 0000000..630297c
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/Login/LoginFrm.cs
@@ -0,0 +1,147 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Configuration;
+using DevExpress.XtraEditors;
+
+namespace HStation.Desktop
+{
+    public partial class LoginFrm : DevExpress.XtraEditors.XtraForm
+    {
+        public LoginFrm()
+        {
+            InitializeComponent();
+            //this.IconOptions.Icon = Properties.Resources.App;
+            //this.layoutControl1.SetupLayoutControl();
+            //this.layoutControl2.SetupLayoutControl();
+            this.Load += LoginBigFrm_Load;
+        }
+
+        private void LoginBigFrm_Load(object sender, EventArgs e)
+        {
+            try
+            {
+                var settings = new UserLoginSettings();
+                this.txtLoginName.EditValue = settings.LoginName;
+                if (settings.ExpireTime != null && settings.ExpireTime.Value > DateTime.Now)
+                {
+                    this.txtPwd.EditValue = settings.Password;
+                    this.ckRemember.Checked = true;
+                }
+            }
+            catch
+            {
+            }
+        }
+
+        private void labSysTitle_MouseDown(object sender, MouseEventArgs e)
+        {
+            //this.DragMove();
+        }
+
+        private void btnLogin_Click(object sender, EventArgs e)
+        {
+            Login();
+        }
+
+        /// <summary>
+        /// 鏂板缁樺埗杈规
+        /// </summary>
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            base.OnPaint(e);
+            using (var pen = new Pen(Color.FromArgb(0, 122, 204), 1f))
+            {
+                e.Graphics.DrawRectangle(pen, 0.5f, 0.5f, this.Width - 1, this.Height - 1);
+            }
+        }
+
+        //楠岃瘉
+        private bool Valid()
+        {
+            this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+            if (string.IsNullOrEmpty(this.txtLoginName.Text.Trim()))
+            {
+                XtraMessageBox.Show("璇疯緭鍏ョ敤鎴峰悕锛�");
+                this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                return default;
+            }
+            if (string.IsNullOrEmpty(this.txtPwd.Text.Trim()))
+            {
+                XtraMessageBox.Show("璇疯緭鍏ュ瘑鐮侊紒");
+                this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                return default;
+            }
+            return true;
+        }
+
+        //鍙栨秷
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+            this.Close();
+        }
+
+        //鐢ㄦ埛鍚岴nter
+        private void txtLoginName_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if (e.KeyChar == 13)
+            {
+                this.txtPwd.Focus();
+            }
+        }
+
+        //瀵嗙爜 Enter
+        private void txtPwd_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if (e.KeyChar == 13)
+            {
+                Login();
+            }
+        }
+
+        //鐧诲綍
+        private async void Login()
+        {
+            if (!Valid())
+                return;
+
+            // 鐢ㄦ埛鐧诲綍
+            var loginModel = new Yw.Dto.UserLoginSoftwareBySystemAccountStandardInput();
+            loginModel.Software = "HStation_XHS_DESKTOP";
+            loginModel.LoginName = this.txtLoginName.Text.Trim();
+            loginModel.LoginPwd = this.txtPwd.Text.Trim();
+            var bll = new Yw.BLL.UserLogin();
+            var result = await bll.LoginSoftwareStandardBySystemAccount(loginModel);
+            if (result.Status != Yw.Auth.eLoginStatus.Success)
+            {
+                XtraMessageBox.Show($"鐧诲綍澶辫触,淇℃伅锛歿(int)result.Status}");
+                this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                return;
+            }
+
+            Yw.JwtToken2Helper.Set(result.AccessToken, result.RefreshToken);
+            var settings = new UserLoginSettings();
+            settings.LoginName = this.txtLoginName.Text.Trim();
+            settings.Password = null;
+            settings.ExpireTime = DateTime.Now;
+            if (this.ckRemember.Checked)
+            {
+                settings.Password = this.txtPwd.Text.Trim();
+                settings.ExpireTime = DateTime.Now.AddMonths(1);
+            }
+            settings.Save();
+
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+        }
+
+
+    }
+}
\ No newline at end of file
diff --git a/HStation.DeskTop.Xhs.Core/MainFrm.Designer.cs b/HStation.DeskTop.Xhs.Core/MainFrm.Designer.cs
new file mode 100644
index 0000000..21cca06
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/MainFrm.Designer.cs
@@ -0,0 +1,49 @@
+锘縩amespace HStation.DeskTop
+{
+    partial class MainFrm
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            SuspendLayout();
+            // 
+            // MainFrm
+            // 
+            AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
+            AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            ClientSize = new System.Drawing.Size(737, 364);
+            Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            Name = "MainFrm";
+            Text = "Form1";
+            Load += MainFrm_Load;
+            ResumeLayout(false);
+        }
+
+        #endregion
+
+    }
+}
+
diff --git a/HStation.DeskTop.Xhs.Core/MainFrm.cs b/HStation.DeskTop.Xhs.Core/MainFrm.cs
new file mode 100644
index 0000000..b5b52d4
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/MainFrm.cs
@@ -0,0 +1,27 @@
+锘縰sing 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 HStation.DeskTop
+{
+    public partial class MainFrm : Form
+    {
+        public MainFrm()
+        {
+            InitializeComponent();
+        }
+
+        private async void MainFrm_Load(object sender, EventArgs e)
+        {
+            var all = await new BLL.XhsProject().GetAll();
+            var count = all.Count();
+        }
+
+
+    }
+}
diff --git a/HStation.DeskTop.Xhs.Core/MainFrm.resx b/HStation.DeskTop.Xhs.Core/MainFrm.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/MainFrm.resx
@@ -0,0 +1,120 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!--
+    Microsoft ResX Schema 
+
+    Version 2.0
+
+    The primary goals of this format is to allow a simple XML format
+    that is mostly human readable. The generation and parsing of the
+    various data types are done through the TypeConverter classes
+    associated with the data types.
+
+    Example:
+
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+
+    There are any number of "resheader" rows that contain simple
+    name/value pairs.
+
+    Each data row contains a name, and value. The row also contains a
+    type or mimetype. Type corresponds to a .NET class that support
+    text/value conversion through the TypeConverter architecture.
+    Classes that don't support this are serialized and stored with the
+    mimetype set.
+
+    The mimetype is used for serialized objects, and tells the
+    ResXResourceReader how to depersist the object. This is currently not
+    extensible. For a given mimetype the value must be set accordingly:
+
+    Note - application/x-microsoft.net.object.binary.base64 is the format
+    that the ResXResourceWriter will generate, however the reader can
+    read any of the formats listed below.
+
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file
diff --git a/HStation.DeskTop.Xhs.Core/Program.cs b/HStation.DeskTop.Xhs.Core/Program.cs
new file mode 100644
index 0000000..8861a1f
--- /dev/null
+++ b/HStation.DeskTop.Xhs.Core/Program.cs
@@ -0,0 +1,78 @@
+锘縰sing DevExpress.LookAndFeel;
+using HStation.DeskTop;
+using Mapster;
+using System;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace HStation.Desktop
+{
+    static class Program
+    {
+        /// <summary>
+        /// 搴旂敤绋嬪簭鐨勪富鍏ュ彛鐐广��
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            using (var mutex = new System.Threading.Mutex(true, Application.ProductName, out bool createNew))
+            {
+                if (!createNew)
+                {
+                    MessageBox.Show("绋嬪簭姝e湪杩愯涓�...");
+                    Application.Exit();
+                    return;
+                }
+
+                //DevExpress.UserSkins.BonusSkins.Register();
+                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Bezier");//Visual Studio 2013 Light
+                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinSvgPalette.Bezier.OfficeColorful);
+                DevExpress.Skins.SkinManager.EnableFormSkins();
+                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
+                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans");
+
+                //澶勭悊鏈崟鑾风殑寮傚父   
+                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
+                //澶勭悊UI绾跨▼寮傚父
+                Application.ThreadException += Application_ThreadException;
+                //澶勭悊闈濽I绾跨▼寮傚父   
+                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+
+
+                Application.EnableVisualStyles();
+                Application.SetCompatibleTextRenderingDefault(false);
+
+                //鎵弿鍏ㄥ眬DTO鏄犲皠
+                TypeAdapterConfig.GlobalSettings.Scan(Assembly.Load("Yw.BLL.Auth.Core"), Assembly.Load("HStation.BLL.Xhs.Core"));
+
+                var loginHelper = new LoginHelper();
+                if (!loginHelper.Login())
+                    return;
+                Application.Run(new MainFrm());
+            }
+        }
+
+
+        ///<summary>
+        ///  杩欏氨鏄垜浠鍦ㄥ彂鐢熸湭澶勭悊寮傚父鏃跺鐞嗙殑鏂规硶锛屾垜杩欐槸鍐欏嚭閿欒缁嗕俊鎭埌鏂囨湰锛屽鍑洪敊鍚庡脊鍑轰竴涓紓浜殑鍑洪敊鎻愮ず绐椾綋锛岀粰澶у鍋氫釜鍙傝��
+        ///  鍋氭硶寰堝锛屽彲浠ユ槸鎶婂嚭閿欒缁嗕俊鎭褰曞埌鏂囨湰銆佹暟鎹簱锛屽彂閫佸嚭閿欓偖浠跺埌浣滆�呬俊绠辨垨鍑洪敊鍚庨噸鏂板垵濮嬪寲绛夌瓑
+        ///  杩欏氨鏄粊鑰呰浠佹櫤鑰呰鏅猴紝澶у鑷繁鍋氫簡銆�
+        ///</summary>
+        ///<param name="sender"> </param>
+        ///<param name="e"> </param>
+        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
+        {
+            var ex = e.Exception;
+            Yw.LogHelper.Error("绯荤粺鍑虹幇鏈煡寮傚父,ERROR:249", ex);
+            MessageBox.Show($"绯荤粺鍑虹幇鏈煡寮傚父锛岃閲嶅惎绯荤粺锛乗r\n{ex.Message}");
+        }
+
+        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+        {
+            var ex = e.ExceptionObject as Exception;
+            Yw.LogHelper.Error("绯荤粺鍑虹幇鏈煡寮傚父,ERROR:255", ex);
+            MessageBox.Show($"绯荤粺鍑虹幇鏈煡寮傚父锛岃閲嶅惎绯荤粺锛乗r\n{ex.Message}");
+        }
+
+    }
+}
diff --git a/HStation.Service.Xhs.Core/HStation.Service.Xhs.Core.csproj b/HStation.Service.Xhs.Core/HStation.Service.Xhs.Core.csproj
index 4460658..86b01d3 100644
--- a/HStation.Service.Xhs.Core/HStation.Service.Xhs.Core.csproj
+++ b/HStation.Service.Xhs.Core/HStation.Service.Xhs.Core.csproj
@@ -12,7 +12,7 @@
 
   <ItemGroup>
     <Content Include="paras_xhs_settings.json">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
 

--
Gitblit v1.9.3