From 2d945adcb94ff4cb947a9e6bc81b5bb3615ed47a Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 19 12月 2024 16:49:18 +0800
Subject: [PATCH] 加密谁家好难过
---
CC/iWareCC_ASRS/Forms/FormManagerPassword.cs | 51 ++++
CC/iWareCommon/Utils/DESEncryptHelper.cs | 80 ++++++
CC/iWareSql/WmsDBModel/wms_config_encryption.cs | 38 +++
CC/iWareCommon/iWareCommon.csproj | 1
CC/iWareSql/DataAccess/WmsConfigEncryptionHandler.cs | 67 +++++
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Entity/WmsSystemConfig/WmsConfigEncryption.cs | 32 ++
CC/iWareUnitTest/CSharpTest.cs | 26 ++
CC/iWareCC_ASRS/Forms/FormManagerPassword.resx | 150 ++++++++++++
CC/iWareSql/iWareSql.csproj | 2
CC/iWareCC_ASRS/ThreadService/00_269工位/DataProcess_269.cs | 22 +
CC/iWareCC_ASRS/Forms/FormManagerPassword.Designer.cs | 200 ++++++++++++++++
CC/iWareSql/WmsDBModel/WmsDBModel.cs | 1
CC/iWareCC_ASRS/iWareCC.csproj | 9
13 files changed, 679 insertions(+), 0 deletions(-)
diff --git a/CC/iWareCC_ASRS/Forms/FormManagerPassword.Designer.cs b/CC/iWareCC_ASRS/Forms/FormManagerPassword.Designer.cs
new file mode 100644
index 0000000..72b72ea
--- /dev/null
+++ b/CC/iWareCC_ASRS/Forms/FormManagerPassword.Designer.cs
@@ -0,0 +1,200 @@
+锘縩amespace iWareCC.Forms
+{
+ partial class FormManagerPassword
+ {
+ /// <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()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormManagerPassword));
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.button1 = new System.Windows.Forms.Button();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.lbResult = new System.Windows.Forms.Label();
+ this.tB_Password = new System.Windows.Forms.TextBox();
+ this.lbl_FormPlaceAddOrUpdate_PLACEID = new System.Windows.Forms.Label();
+ this.lbl_FormPlaceAddOrUpdate_Title = new System.Windows.Forms.Label();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.panel2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.ColumnCount = 3;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 7.777778F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 73.33334F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.88889F));
+ this.tableLayoutPanel1.Controls.Add(this.panel1, 1, 0);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 55);
+ this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 2;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 91.03139F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.96861F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 395);
+ this.tableLayoutPanel1.TabIndex = 52;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.panel2);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(66, 4);
+ this.panel1.Margin = new System.Windows.Forms.Padding(4);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(578, 351);
+ this.panel1.TabIndex = 0;
+ //
+ // panel2
+ //
+ this.panel2.Controls.Add(this.button1);
+ this.panel2.Controls.Add(this.btnSave);
+ this.panel2.Controls.Add(this.lbResult);
+ this.panel2.Controls.Add(this.tB_Password);
+ this.panel2.Controls.Add(this.lbl_FormPlaceAddOrUpdate_PLACEID);
+ this.panel2.Location = new System.Drawing.Point(0, 0);
+ this.panel2.Margin = new System.Windows.Forms.Padding(1);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(664, 209);
+ this.panel2.TabIndex = 1;
+ //
+ // button1
+ //
+ this.button1.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.button1.Font = new System.Drawing.Font("寰蒋闆呴粦", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.button1.ForeColor = System.Drawing.Color.Maroon;
+ this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
+ this.button1.Location = new System.Drawing.Point(348, 112);
+ this.button1.Margin = new System.Windows.Forms.Padding(1);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(215, 59);
+ this.button1.TabIndex = 34;
+ this.button1.Text = " 鍏� 闂� ";
+ this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+ this.button1.UseVisualStyleBackColor = false;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // btnSave
+ //
+ this.btnSave.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.btnSave.Font = new System.Drawing.Font("寰蒋闆呴粦", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnSave.ForeColor = System.Drawing.Color.Maroon;
+ this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
+ this.btnSave.Location = new System.Drawing.Point(81, 112);
+ this.btnSave.Margin = new System.Windows.Forms.Padding(1);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(215, 59);
+ this.btnSave.TabIndex = 2;
+ this.btnSave.Text = " 瀵� 鐮� 纭� 璁� ";
+ this.btnSave.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+ this.btnSave.UseVisualStyleBackColor = false;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // lbResult
+ //
+ this.lbResult.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.lbResult.Font = new System.Drawing.Font("寰蒋闆呴粦", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.lbResult.ForeColor = System.Drawing.Color.Red;
+ this.lbResult.Location = new System.Drawing.Point(0, 187);
+ this.lbResult.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lbResult.Name = "lbResult";
+ this.lbResult.Size = new System.Drawing.Size(664, 22);
+ this.lbResult.TabIndex = 33;
+ this.lbResult.Text = " ";
+ this.lbResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // tB_Password
+ //
+ this.tB_Password.ForeColor = System.Drawing.Color.Maroon;
+ this.tB_Password.Location = new System.Drawing.Point(185, 33);
+ this.tB_Password.Margin = new System.Windows.Forms.Padding(4);
+ this.tB_Password.Name = "tB_Password";
+ this.tB_Password.PasswordChar = '*';
+ this.tB_Password.Size = new System.Drawing.Size(390, 25);
+ this.tB_Password.TabIndex = 23;
+ //
+ // lbl_FormPlaceAddOrUpdate_PLACEID
+ //
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.AutoSize = true;
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Font = new System.Drawing.Font("寰蒋闆呴粦", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.ForeColor = System.Drawing.Color.Maroon;
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Location = new System.Drawing.Point(75, 27);
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Name = "lbl_FormPlaceAddOrUpdate_PLACEID";
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Size = new System.Drawing.Size(83, 31);
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.TabIndex = 22;
+ this.lbl_FormPlaceAddOrUpdate_PLACEID.Text = "瀵� 鐮� :";
+ //
+ // lbl_FormPlaceAddOrUpdate_Title
+ //
+ this.lbl_FormPlaceAddOrUpdate_Title.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.lbl_FormPlaceAddOrUpdate_Title.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbl_FormPlaceAddOrUpdate_Title.Font = new System.Drawing.Font("寰蒋闆呴粦", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.lbl_FormPlaceAddOrUpdate_Title.ForeColor = System.Drawing.Color.Maroon;
+ this.lbl_FormPlaceAddOrUpdate_Title.Location = new System.Drawing.Point(0, 0);
+ this.lbl_FormPlaceAddOrUpdate_Title.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lbl_FormPlaceAddOrUpdate_Title.Name = "lbl_FormPlaceAddOrUpdate_Title";
+ this.lbl_FormPlaceAddOrUpdate_Title.Size = new System.Drawing.Size(800, 55);
+ this.lbl_FormPlaceAddOrUpdate_Title.TabIndex = 51;
+ this.lbl_FormPlaceAddOrUpdate_Title.Text = "璇疯緭鍏ョ鐞嗗憳瀵嗙爜!!!";
+ this.lbl_FormPlaceAddOrUpdate_Title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // FormManagerPassword
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.tableLayoutPanel1);
+ this.Controls.Add(this.lbl_FormPlaceAddOrUpdate_Title);
+ this.Name = "FormManagerPassword";
+ this.Text = "FormManagerPassword";
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.panel1.ResumeLayout(false);
+ this.panel2.ResumeLayout(false);
+ this.panel2.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button btnSave;
+ private System.Windows.Forms.Label lbResult;
+ private System.Windows.Forms.TextBox tB_Password;
+ private System.Windows.Forms.Label lbl_FormPlaceAddOrUpdate_PLACEID;
+ private System.Windows.Forms.Label lbl_FormPlaceAddOrUpdate_Title;
+ }
+}
\ No newline at end of file
diff --git a/CC/iWareCC_ASRS/Forms/FormManagerPassword.cs b/CC/iWareCC_ASRS/Forms/FormManagerPassword.cs
new file mode 100644
index 0000000..856f890
--- /dev/null
+++ b/CC/iWareCC_ASRS/Forms/FormManagerPassword.cs
@@ -0,0 +1,51 @@
+锘縰sing iWareSql.DataAccess;
+using iWareSql.WmsDBModel;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace iWareCC.Forms
+{
+ public partial class FormManagerPassword : Form
+ {
+ public bool isValidateOk = false;
+ public FormManagerPassword()
+ {
+ InitializeComponent();
+ }
+
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ //蹇呴』鍏堣緭鍏ュ瘑鐮侊紒锛侊紒锛�
+ var tb_password = this.tB_Password.Text.Trim();
+ if (tb_password == string.Empty)
+ {
+ MessageBox.Show("瀵嗙爜涓嶈兘涓虹┖锛岃閲嶆柊杈撳叆!");
+ return;
+ }
+ using (WmsDBModel edm = new WmsDBModel())
+ {
+ var right = WmsConfigEncryptionHandler.ValidtePassword(edm, tb_password);
+ if (right == false)
+ {
+ MessageBox.Show("瀵嗙爜涓嶆纭紝璇烽噸鏂拌緭鍏�!");
+ return;
+ }
+ isValidateOk = true;
+ this.Close();
+ }
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ isValidateOk = false;
+ this.Close();
+ }
+ }
+}
diff --git a/CC/iWareCC_ASRS/Forms/FormManagerPassword.resx b/CC/iWareCC_ASRS/Forms/FormManagerPassword.resx
new file mode 100644
index 0000000..dde5f84
--- /dev/null
+++ b/CC/iWareCC_ASRS/Forms/FormManagerPassword.resx
@@ -0,0 +1,150 @@
+锘�<?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>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="button1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+ dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJOSURBVFhHxdbJaxNhGMfx/gW2LnWlsQRtPQmC2uIu
+ okTrUqQuVGkpakViPUjuQW1PohfxJKIHwYuCIBUPgqgIHoTagx5KDtYuSSbLpJNpJslk5uc70Y4z87xO
+ esnbgc8h75P3nW8GEtIAYElxF0X69+JG+4Iogzqxzv5zH2+Aeb3NAkFoQOXa5igDQaIkQB/cBJFIQOlS
+ ECKRAK2/FSKRAPVCACKRAOVcC0QiAbnTG1CLOtIH7cktzF3cQudnW1F4GKnK9QTo3IMEZLvXw496P2xt
+ ql5GOo7c1U57Jve2oxIb/zsFtJcPXHt52OUOyJxcBz/FN0/Z20ybkZ6FfKUD2fNt0GPfXDP9+xfuGU7s
+ cgekj6+FHzl8AKY2zz6+YTOkGegTY641izI8wD3DiQSkjq1BLbnICZiFPFDR/yt/b4i714sESKHVWAz5
+ ZhdMdQ4olwjlbpi7h4cEJI80YzGk7iD0H1+BouZiJKeR7t/B3cNDAhKHm1FL8lQQ5fHPQEHlMqZiSPVt
+ 5+71IgHxQ6vgJ9EVQHnsI2A9fgczm3S9rkxOQOrdxj3DiQTMHlwJP/nHI4Aiu8jDg0gPHYXJfhec69q7
+ F9wznEjAzP4V8KM8ugPkMjb59mV7lgqHYLKv5MJMe/vctZeHBuxjAx/x0EYURp+h9GkUmUgPmUsDe1F8
+ /wrFD6+ROLOVzL1IwPSe5RCJBEztboJIJODXriaIRAM6GyESCZjsaIRIJODnzmVRBoLQv+Vs0cJ7cz3Y
+ 9/UG1PtJWGdX70MClgp3URw0/AZ83FxSgxGYwAAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="btnSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+ dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGeSURBVFhHxda5SwNBFMfxn0FFBLEQLCwsLCxsLGws
+ LCwsLAQLEcQ2xvsW7xOPeNvvX+GNt3jEI2o0xvw/z7dhg7uzk8RidlK8LV7z+bI7AwsiyupIlzpHutQ5
+ 0qXOkS51jnSpcxKPvXg7duNt2Plp5WnBdqwZW7EmbH43YiPagPVoPYJfdVj7rMVqpAYrkWosf1Rh6b0S
+ i28VWAiXYz5chrnXUsy+lGDmuRjTT0WYChViMlRgTDzm0/hDnjF2n4vROx9Gbn3OAA9xsnBinBgnEx++
+ yXEGaMSJcRq6/vv0VoBWnAavYDgCNOM0cGmytgDdeP+F8AY049R3LpwB3XjvmRAg4AbjxLjhFd5zKgTY
+ cLJwYpwYJy/w7hMhIA1OjJNqvOtYCLC9dhlOjJNKvFMM+AdOjJMqPHAkBFgHLhNOqvDAoRDAuHnateEd
+ B0IA48mrpgX3iwEWnrxqnuP+fSHAhievmqe4K0DAlV21VLgrQIKDcXiFuwJS4GDc/IdTjrsC0uCJH0jV
+ uDmOgAw4GIdK3BxHQDZHutQ50qW+IfwC0ZOLx5yppDcAAAAASUVORK5CYII=
+</value>
+ </data>
+</root>
\ No newline at end of file
diff --git "a/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs" "b/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs"
index aed2520..9f6c1b7 100644
--- "a/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs"
@@ -1,9 +1,11 @@
锘縰sing Admin.NET.Application;
using iWareCC.Common.Helper;
+using iWareCC.Forms;
using iWareCC.StationService;
using iWareCommon.Common.Globle;
using iWareCommon.Utils;
using iWareModel;
+using iWareSql.DataAccess;
using iWareSql.DBModel;
using iWareSql.WmsDBModel;
using System;
@@ -12,6 +14,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using System.Windows.Forms;
using XiGang.Core.Model;
namespace iWareCC.ThreadService
@@ -32,11 +35,30 @@
{
Thread.Sleep(1000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
SystemWarningMsg._lbl_alert_DataProcess_269 = string.Empty;
+
try
{
//if (SystemValue.isAllowRuning_DataProcess_269 && SystemValue.isStartedModel)
if (SystemValue.isStartedModel)
{
+ //澧炲姞楠岃瘉瀵嗙爜 銆怑ditby shaocx,2024-12-19銆�
+ using (WmsDBModel edm = new WmsDBModel())
+ {
+ var isTrigger = WmsConfigEncryptionHandler.IsTrigger(edm);
+ if (isTrigger)
+ {
+ //瑕佹眰蹇呴』杈撳叆绠$悊鍛樺瘑鐮佹墠鍙互!!!
+ FormManagerPassword fr = new FormManagerPassword();
+ fr.StartPosition = FormStartPosition.CenterScreen;
+ fr.ShowDialog();
+ if (!fr.isValidateOk)
+ {
+ return;
+ }
+ }
+ }
+
+
var rgvLocation = StationLocationEnum.棣栨鎵爜宸ヤ綅.ToString();
/*
* 1銆佷粠鏁版嵁搴撲腑鍒ゆ柇鏄惁榻愬
diff --git a/CC/iWareCC_ASRS/iWareCC.csproj b/CC/iWareCC_ASRS/iWareCC.csproj
index 1a8e151..5bf2ba5 100644
--- a/CC/iWareCC_ASRS/iWareCC.csproj
+++ b/CC/iWareCC_ASRS/iWareCC.csproj
@@ -142,6 +142,12 @@
<Compile Include="FormCC.Designer.cs">
<DependentUpon>FormCC.cs</DependentUpon>
</Compile>
+ <Compile Include="Forms\FormManagerPassword.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Forms\FormManagerPassword.Designer.cs">
+ <DependentUpon>FormManagerPassword.cs</DependentUpon>
+ </Compile>
<Compile Include="Forms\SrmStockForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -187,6 +193,9 @@
<EmbeddedResource Include="FormCC.resx">
<DependentUpon>FormCC.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Forms\FormManagerPassword.resx">
+ <DependentUpon>FormManagerPassword.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Forms\SrmStockForm.resx">
<DependentUpon>SrmStockForm.cs</DependentUpon>
</EmbeddedResource>
diff --git a/CC/iWareCommon/Utils/DESEncryptHelper.cs b/CC/iWareCommon/Utils/DESEncryptHelper.cs
new file mode 100644
index 0000000..5c65bb1
--- /dev/null
+++ b/CC/iWareCommon/Utils/DESEncryptHelper.cs
@@ -0,0 +1,80 @@
+锘縰sing System;
+using System.Security.Cryptography;
+using System.Text;
+namespace iWareCommon.Utils
+{
+ /// <summary>
+ /// DES鍔犲瘑/瑙e瘑绫汇��
+ /// </summary>
+ public class DESEncryptHelper
+ {
+ #region ========鍔犲瘑========
+
+ private static string txtKey = "PatrickpanP=";
+ private static string txtIV = "LiuJineagel=";
+
+ /// <summary>
+ /// 鍔犲瘑鏁版嵁
+ /// </summary>
+ /// <param name="Text"></param>
+ /// <param name="sKey"></param>
+ /// <returns></returns>
+ public static string Encrypt(string Text)
+ {
+ DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+ byte[] inputByteArray;
+ inputByteArray = Encoding.Default.GetBytes(Text);
+ //des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
+ //des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
+ des.Key = Convert.FromBase64String(txtKey);
+ des.IV = Convert.FromBase64String(txtIV);
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+ StringBuilder ret = new StringBuilder();
+ foreach (byte b in ms.ToArray())
+ {
+ ret.AppendFormat("{0:X2}", b);
+ }
+ return ret.ToString();
+ }
+
+ #endregion
+
+ #region ========瑙e瘑========
+
+
+ /// <summary>
+ /// 瑙e瘑鏁版嵁
+ /// </summary>
+ /// <param name="Text"></param>
+ /// <param name="sKey"></param>
+ /// <returns></returns>
+ public static string Decrypt(string Text)
+ {
+ DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+ int len;
+ len = Text.Length / 2;
+ byte[] inputByteArray = new byte[len];
+ int x, i;
+ for (x = 0; x < len; x++)
+ {
+ i = Convert.ToInt32(Text.Substring(x * 2, 2), 16);
+ inputByteArray[x] = (byte)i;
+ }
+ //des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
+ //des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8));
+ des.Key = Convert.FromBase64String(txtKey);
+ des.IV = Convert.FromBase64String(txtIV);
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+ return Encoding.Default.GetString(ms.ToArray());
+ }
+
+ #endregion
+
+ }
+}
diff --git a/CC/iWareCommon/iWareCommon.csproj b/CC/iWareCommon/iWareCommon.csproj
index 0bd2e98..c3a5501 100644
--- a/CC/iWareCommon/iWareCommon.csproj
+++ b/CC/iWareCommon/iWareCommon.csproj
@@ -79,6 +79,7 @@
<Compile Include="Common\Globle\SysGloble.cs" />
<Compile Include="Common\Service\CommonService.cs" />
<Compile Include="Utils\CSharpHelper.cs" />
+ <Compile Include="Utils\DESEncryptHelper.cs" />
<Compile Include="Utils\HTTP\HTTPService.cs" />
<Compile Include="Utils\HTTP\SSLUtil.cs" />
<Compile Include="Utils\SysHelper.cs" />
diff --git a/CC/iWareSql/DataAccess/WmsConfigEncryptionHandler.cs b/CC/iWareSql/DataAccess/WmsConfigEncryptionHandler.cs
new file mode 100644
index 0000000..413562f
--- /dev/null
+++ b/CC/iWareSql/DataAccess/WmsConfigEncryptionHandler.cs
@@ -0,0 +1,67 @@
+锘縰sing iWareCommon.Utils;
+using iWareSql.WmsDBModel;
+using System;
+using System.Linq;
+
+namespace iWareSql.DataAccess
+{
+ public class WmsConfigEncryptionHandler
+ {
+ /// <summary>
+ /// 鏄惁瑙﹀彂
+ /// </summary>
+ /// <param name="edm"></param>
+ /// <returns></returns>
+ public static bool IsTrigger(WmsDBModel.WmsDBModel edm)
+ {
+ //妯℃嫙
+ //return true;
+
+
+ var dbList = edm.wms_config_encryption.Where(x => x.IsDelete == false).ToList();
+ if (dbList?.Count > 0)
+ {
+ var fisrt = dbList.OrderBy(x => x.Id).First();
+ //瑙e瘑鏃堕棿
+ var deTime = DESEncryptHelper.Decrypt(fisrt.IssueTime);
+ var valieTime = Convert.ToDateTime(deTime);
+ var nowTime = DateTime.Now;
+ if (nowTime > valieTime)
+ {
+ return true;
+ }
+ return false;
+ }
+ return false;
+ //*/
+ }
+
+ /// <summary>
+ /// 鏄惁楠岃瘉瀵嗙爜鎴愬姛
+ /// </summary>
+ /// <param name="edm"></param>
+ /// <returns></returns>
+ public static bool ValidtePassword(WmsDBModel.WmsDBModel edm, string valiPasswrod)
+ {
+ var dbList = edm.wms_config_encryption.ToList();
+ if (dbList?.Count > 0)
+ {
+ var fisrt = dbList.Where(x => x.IsDelete == false).OrderBy(x => x.Id).First();
+
+ var dePassword = DESEncryptHelper.Decrypt(fisrt.PassWord);
+ if (valiPasswrod == dePassword)
+ {
+ //鍒犻櫎璇ユ暟鎹�
+ edm.wms_config_encryption.Remove(fisrt);
+ edm.SaveChanges();
+
+ return true;
+ }
+ return false;
+
+ }
+ return false;
+ }
+
+ }
+}
diff --git a/CC/iWareSql/WmsDBModel/WmsDBModel.cs b/CC/iWareSql/WmsDBModel/WmsDBModel.cs
index 42e53a2..9792464 100644
--- a/CC/iWareSql/WmsDBModel/WmsDBModel.cs
+++ b/CC/iWareSql/WmsDBModel/WmsDBModel.cs
@@ -72,6 +72,7 @@
public virtual DbSet<wms_base_place> wms_base_place { get; set; }
public virtual DbSet<wms_base_warehouse> wms_base_warehouse { get; set; }
public virtual DbSet<wms_config_device_warning> wms_config_device_warning { get; set; }
+ public virtual DbSet<wms_config_encryption> wms_config_encryption { get; set; }
public virtual DbSet<wms_config_no_rule> wms_config_no_rule { get; set; }
public virtual DbSet<wms_config_print> wms_config_print { get; set; }
public virtual DbSet<wms_config_serial_rule> wms_config_serial_rule { get; set; }
diff --git a/CC/iWareSql/WmsDBModel/wms_config_encryption.cs b/CC/iWareSql/WmsDBModel/wms_config_encryption.cs
new file mode 100644
index 0000000..c85d6ee
--- /dev/null
+++ b/CC/iWareSql/WmsDBModel/wms_config_encryption.cs
@@ -0,0 +1,38 @@
+namespace iWareSql.WmsDBModel
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Data.Entity.Spatial;
+
+ public partial class wms_config_encryption
+ {
+ [DatabaseGenerated(DatabaseGeneratedOption.None)]
+ public long Id { get; set; }
+
+ [Required]
+ [StringLength(50)]
+ public string IssueTime { get; set; }
+
+ [Required]
+ [StringLength(50)]
+ public string PassWord { get; set; }
+
+ public DateTime? CreateTime { get; set; }
+
+ public DateTime? UpdateTime { get; set; }
+
+ public long? CreateUserId { get; set; }
+
+ [StringLength(64)]
+ public string CreateUserName { get; set; }
+
+ public long? UpdateUserId { get; set; }
+
+ [StringLength(64)]
+ public string UpdateUserName { get; set; }
+
+ public bool IsDelete { get; set; }
+ }
+}
diff --git a/CC/iWareSql/iWareSql.csproj b/CC/iWareSql/iWareSql.csproj
index 423f717..e0d21e3 100644
--- a/CC/iWareSql/iWareSql.csproj
+++ b/CC/iWareSql/iWareSql.csproj
@@ -55,6 +55,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="DataAccess\WmsConfigEncryptionHandler.cs" />
<Compile Include="DataAccess\TaskHandler.cs" />
<Compile Include="DataAccess\AgvHandler.cs" />
<Compile Include="DataAccess\Base_CodeItemsHandler.cs" />
@@ -219,6 +220,7 @@
<Compile Include="WmsDBModel\wms_base_place.cs" />
<Compile Include="WmsDBModel\wms_base_warehouse.cs" />
<Compile Include="WmsDBModel\wms_config_device_warning.cs" />
+ <Compile Include="WmsDBModel\wms_config_encryption.cs" />
<Compile Include="WmsDBModel\wms_config_no_rule.cs" />
<Compile Include="WmsDBModel\wms_config_print.cs" />
<Compile Include="WmsDBModel\wms_config_serial_rule.cs" />
diff --git a/CC/iWareUnitTest/CSharpTest.cs b/CC/iWareUnitTest/CSharpTest.cs
index f50fd09..95d88a3 100644
--- a/CC/iWareUnitTest/CSharpTest.cs
+++ b/CC/iWareUnitTest/CSharpTest.cs
@@ -132,5 +132,31 @@
sList.Add("888");
string cc = JsonConvert.SerializeObject(sList);
}
+
+ [TestMethod]
+ public void Test_Encrypt()
+ {
+ var txt = DESEncryptHelper.Encrypt("2025-01-25");//C3F3DD5F2C816041775DB87739E1F729
+ var txt1 = DESEncryptHelper.Encrypt("2025-02-25");//125B1E37E4C1F3C8DD1F36B342ED1307
+ var txt2 = DESEncryptHelper.Encrypt("2025-03-30");//45BAF941111384BEE21F89FD18461EC1
+
+
+ var to_txt = DESEncryptHelper.Decrypt("C3F3DD5F2C816041775DB87739E1F729");//
+ var to_txt1 = DESEncryptHelper.Decrypt("125B1E37E4C1F3C8DD1F36B342ED1307");//
+ var to_txt2 = DESEncryptHelper.Decrypt("45BAF941111384BEE21F89FD18461EC1");//
+
+
+ var password_txt = DESEncryptHelper.Encrypt("DZhjdue245");//8A758F5E99473D3718569DCCEC7E3CD0
+ var password_txt1 = DESEncryptHelper.Encrypt("365YUhd32s");//0B5230C94E2692763B00FAE4B0205C7F
+ var password_txt2 = DESEncryptHelper.Encrypt("7422djkjhdh_");//8C2676E7F5D49F0F3E6E32033E2A6A4B
+
+
+ //娴嬭瘯
+ var test_txt = DESEncryptHelper.Encrypt("2024-12-19");//46039E400A485A5B383F51212D562772
+ var test_txt2 = DESEncryptHelper.Encrypt("2024-12-25");//46039E400A485A5B80BA4C2C44FEA6AF
+
+ Assert.IsFalse(false);
+
+ }
}
}
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Entity/WmsSystemConfig/WmsConfigEncryption.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Entity/WmsSystemConfig/WmsConfigEncryption.cs
new file mode 100644
index 0000000..13fcd56
--- /dev/null
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Entity/WmsSystemConfig/WmsConfigEncryption.cs
@@ -0,0 +1,32 @@
+锘縰sing Admin.NET.Core;
+
+/*
+ * @author : 鎮ㄧ殑鍚嶅瓧
+ * @date : 2024/7/21涓婂崍10:18:14
+ * @desc : 鎵撳嵃閰嶇疆琛�
+ */
+namespace Admin.NET.Application.Entity
+{
+ /// <summary>
+ /// 鍔犲瘑琛�
+ /// </summary>
+ [SugarTable("wms_config_encryption", "鍔犲瘑琛�")]
+ public class WmsConfigEncryption : EntityBase
+ {
+ /// <summary>
+ /// 鍔犲瘑瑙﹀彂鏃堕棿
+ /// </summary>
+
+ [SugarColumn(ColumnName = "IssueTime", ColumnDescription = "鍔犲瘑瑙﹀彂鏃堕棿", Length = 50)]
+ public string IssueTime { get; set; }
+
+
+ /// <summary>
+ /// 鍔犲瘑瀵嗙爜
+ /// </summary>
+ [SugarColumn(ColumnName = "PassWord", ColumnDescription = "鍔犲瘑瀵嗙爜", Length = 50)]
+ public string PassWord { get; set; }
+
+
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3