This commit is contained in:
孙源
2025-07-11 14:12:47 +08:00
commit 9dacccd1d5
404 changed files with 514108 additions and 0 deletions

59
BLL/BLL.csproj Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{02A200E7-551A-4DD7-B23A-AFAA9DBECF81}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BLL</RootNamespace>
<AssemblyName>BLL</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="SqlSugar, Version=5.0.3.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CheckBLL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{5A80DE64-FCD5-4D7C-8A1E-4199412D80BD}</Project>
<Name>Model</Name>
</ProjectReference>
<ProjectReference Include="..\Tool\Tool.csproj">
<Project>{cc8994b7-1312-45e6-abda-92413692feb3}</Project>
<Name>Tool</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

775
BLL/CheckBLL.cs Normal file
View File

@ -0,0 +1,775 @@
using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Tool;
namespace BLL
{
public class CheckBLL
{
private SqlHelper sql = new SqlHelper();
private ConfigHelper configHelper = new ConfigHelper();
private FileHelper file = new FileHelper();
public void SetConfig(SettingModel set)
{
configHelper.Write("Index", set.index.ToString());
}
/// <summary>
/// 读取配置文件内容
/// </summary>
/// <returns></returns>
public SettingModel LoadConfig()
{
//地址
string setPath1 = System.Environment.CurrentDirectory + "\\Setting1.config";
//夹具号
string setPath2 = System.Environment.CurrentDirectory + "\\Setting2.config";
//机型
string setPath3 = System.Environment.CurrentDirectory + "\\Setting3.config";
try
{
SettingModel set = new SettingModel();
Dictionary<string, string> dic = configHelper.ReadAll();
//地址
Dictionary<string, string> dic1 = configHelper.ReadAll(setPath1);
//夹具号
Dictionary<string, string> dic2 = configHelper.ReadAll(setPath2);
//机型
Dictionary<string, string> dic3 = configHelper.ReadAll(setPath3);
if (dic1.ContainsKey("pathini"))
{
set.pathini = dic1["pathini"];
}
if (dic1.ContainsKey("pathLoad"))
{
set.pathLoad = dic1["pathLoad"];
}
if (dic1.ContainsKey("pathch1"))
{
set.pathch1 = dic1["pathch1"];
}
if (dic1.ContainsKey("pathch2"))
{
set.pathch2 = dic1["pathch2"];
}
if (dic2.ContainsKey("devcode1"))
{
set.devcode1 = dic2["devcode1"];
}
if (dic2.ContainsKey("devcode2"))
{
set.devcode2 = dic2["devcode2"];
}
if (dic3.ContainsKey("type"))
{
set.Types = dic3["type"].Split(';');
}
if (dic.ContainsKey("Index"))
{
set.index = int.Parse(dic["Index"]);
}
return set;
}
catch (Exception ee)
{
LogHelper.WriteLog(ee.ToString());
return null;
}
}
public List<ExclModel> getReplacetest1(string path,string imei)
{
string pathen = "";
string textna = "";
List<ExclModel> topexcl = new List<ExclModel>();
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length!=1)
{
return topexcl;
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
textna = NextFolder2.Name;
if (NextFolder2.Name.Contains(imei) && NextFolder2.Name.Contains("PASS"))
{
pathen = NextFolder2.FullName+ "\\LTE_FT.csv";
}else
{
return topexcl;
}
}
using (var reader = new StreamReader(pathen))
{
string line;
// 循环读取文件中的每一行
while ((line = reader.ReadLine()) != null)
{
// 使用Split函数按逗号分隔行内容
string[] fields = line.Split(',');
// 这里可以对分隔后的字段数据进行处理或存储
// 示例:打印每一行的字段
//for (int i = 0; i < fields.Length; i++)
//{
// Console.WriteLine($"Field {i + 1}: {fields[i]}");
//}
ExclModel itme = new ExclModel();
itme.textname = textna;
itme.Band = fields[1];
itme.Channel = fields[2];
itme.Result = fields[7];
topexcl.Add(itme);
// 实际应用中,您可以在此处替换为实际的数据处理逻辑
}
}
return topexcl;
}
/// <summary>
/// 从log文件读取功率
/// </summary>
/// <param name="path"></param>
/// <param name="imei"></param>
/// <returns></returns>
public Tuple<List<ExclModel>, string> getReplacetest(string path, string imei,int num)
{
string pathen = "";
string textna = "";
string retul = "OK";
List<ExclModel> topexcl = new List<ExclModel>();
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
List<DirectoryInfo> dir13 = theFolder1.GetDirectories().ToList();
if (dir12.Length != num + 1)
{
retul = "log文件数量不为" + (num + 1);
return new Tuple<List<ExclModel>, string>(topexcl, retul);
}
//List<DirectoryInfo> onetextna1 = dir13.OrderByDescending(it => it.CreationTime).ToList();
DirectoryInfo onetextna = dir13.OrderByDescending(it => it.CreationTime).First();
textna = onetextna.Name;
pathen = onetextna.FullName + "\\LTE_FT.csv";
DateTime s = onetextna.CreationTime;
DateTime s1 = DateTime.Today;
if (s<s1)
{
retul = "log 文件的创建时间"+ s.ToString()+"不为当前日期";
return new Tuple<List<ExclModel>, string>(topexcl, retul);
}
//if (dir12.Length != num+1)
//{
// retul="log文件数量不为"+ (num+1);
// return new Tuple<List<ExclModel>, string>(topexcl, retul);
//}
foreach (DirectoryInfo NextFolder2 in dir12)
{
//textna = NextFolder2.Name;
//if (NextFolder2.Name.Contains(imei) && NextFolder2.Name.Contains("PASS"))
//{
// pathen = NextFolder2.FullName + "\\LTE_FT.csv";
//}
//else
//{
// retul = "log文件名称没有PASS或与金机号不符";
// return new Tuple<List<ExclModel>, string>(topexcl, retul);
//}
if (!NextFolder2.Name.Contains(imei) || !NextFolder2.Name.Contains("PASS"))
{
retul = "log文件名称没有PASS或与金机号不符";
return new Tuple<List<ExclModel>, string>(topexcl, retul);
}
}
using (var reader = new StreamReader(pathen))
{
string line;
// 循环读取文件中的每一行
while ((line = reader.ReadLine()) != null)
{
// 使用Split函数按逗号分隔行内容
string[] fields = line.Split(',');
// 这里可以对分隔后的字段数据进行处理或存储
// 示例:打印每一行的字段
//for (int i = 0; i < fields.Length; i++)
//{
// Console.WriteLine($"Field {i + 1}: {fields[i]}");
//}
if (fields[2].Contains("Channel"))
{
continue;
}
ExclModel itme = new ExclModel();
itme.textname = textna;
itme.Band = fields[1];
itme.Channel = fields[2];
itme.Result = fields[7];
topexcl.Add(itme);
// 实际应用中,您可以在此处替换为实际的数据处理逻辑
}
}
return new Tuple<List<ExclModel>, string>(topexcl, retul);
}
/// <summary>
/// 从软件的配置文件里读取线损
/// </summary>
/// <param name="path"></param>
/// <param name="numb"></param>
/// <returns></returns>
public List<IniModel> getinitest(string path,int numb)
{
string DateStr = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
string pathen = AppDomain.CurrentDomain.BaseDirectory + "ini备份";
//this.file.Transport(path, "D:\\xiansun", DateStr+"line.ini");
this.file.Transport(path, pathen, DateStr + "line.ini");
List < IniModel > lsit = new List<IniModel>();
for (int i = 0; i < 48; i++)
{
IniModel one = new IniModel();
one.several_line_loss = (lsit.Count + 1).ToString();
one.textname = DateStr + "Line.ini";
lsit.Add(one);
}
using (StreamReader sr = new StreamReader(pathen+"\\" + DateStr + "Line.ini", Encoding.UTF8))
//using (StreamReader sr = new StreamReader("D:\\xiansun\\" + DateStr + "Line.ini", Encoding.UTF8))
{
string line;
bool isRead = false;
List<string> lines = new List<string>();
//IniModel one = new IniModel();
int number = 0;
while ((line = sr.ReadLine()) != null)
{
lines.Add(line);
if (line.Contains("[Instrument Setting TS"+ (numb).ToString() +"]"))
{
isRead = true;
}
if (line.Contains("[Instrument Setting TS" + (numb+1).ToString() + "]"))
{
isRead = false;
}
if (line == ""|| !isRead||line.Contains("DIV")|| line.Contains("66_"))
{
continue;
}
if (!line.Contains("LTE_BAND"))
{
continue;
}
if (line.Contains("LTE_BAND") && line.Contains("TX_LOW_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2])-1;
lsit[number].LTE_BAND_TX_LOW_LOSS= line.Split('=')[1].Trim();
//one.LTE_BAND_TX_LOW_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("TX_MID_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_TX_MID_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_TX_MID_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("TX_HIGH_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_TX_HIGH_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_TX_HIGH_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_LOW_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_LOW_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_LOW_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_MID_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_MID_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_MID_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
else if (line.Contains("LTE_BAND") && line.Contains("RX_HIGH_LOSS"))
{
number = int.Parse(line.Split(new char[2] { 'D', '_' })[2]) - 1;
lsit[number].LTE_BAND_RX_HIGH_LOSS = line.Split('=')[1].Trim();
//one.LTE_BAND_RX_HIGH_LOSS = line.Split('=')[1].Trim();
//number = number + 1;
}
//if (number==6)
//{
// lsit.Add(one);
// one = new IniModel();
// number = 0;
//}
}
return lsit;
}
}
/// <summary>
/// 从软件的配置文件里读取线损
/// </summary>
/// <param name="path"></param>
/// <param name="numb"></param>
/// <returns></returns>
public string getloadtest(string path)
{
//string DateStr = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
//this.file.Transport(path, "D:\\xiansun", DateStr + "Load.ini");
//List<string> lsit = new List<string>();
//using (StreamReader sr = new StreamReader("D:\\xiansun\\" + DateStr + "Load.ini", Encoding.UTF8))
//{
// string line;
// List<string> lines = new List<string>();
// //IniModel one = new IniModel();
// while ((line = sr.ReadLine()) != null)
// {
// lines.Add(line);
// if (line.Contains("EnableScript1="))
// {
// string setingd = line.Split('=')[1].Trim();
// lsit.Add(setingd);
// }
// }
// if (lsit.Count!=2)
// {
// return "Load.ini读取的EnableScript1数量为"+ lsit.Count+"条";
// }
//if (lsit[1]!="0")
//{
// return "Load.ini未取消校准";
//}
return "OK";
//} //}
}
/// <summary>
/// 将log文件的位置清理准备点检或抓取
/// </summary>
/// <param name="set"></param>
public void Clearfile(SettingModel set)
{
DirectoryInfo theFolder1 = new DirectoryInfo(set.pathch1);
DirectoryInfo theFolder2 = new DirectoryInfo(set.pathch2);
DirectoryInfo parsent = theFolder1.Parent;
string path1 = parsent.FullName + "\\errch1";
string path2 = parsent.FullName + "\\errch2";
if (!Directory.Exists(path1))
{
Directory.CreateDirectory(path1);
}
if (!Directory.Exists(path2))
{
Directory.CreateDirectory(path2);
}
DirectoryInfo[] dir11 = theFolder1.GetDirectories();
foreach (DirectoryInfo NextFolder1 in dir11)
{
NextFolder1.MoveTo(path1 + "\\" + NextFolder1.Name);
}
DirectoryInfo[] dir12 = theFolder2.GetDirectories();
foreach (DirectoryInfo NextFolder2 in dir12)
{
NextFolder2.MoveTo(path2 + "\\" + NextFolder2.Name);
}
//theFolder1.MoveTo(path1+ "\\" + “xxx_xx_xxx”);
//theFolder2.MoveTo(path2+"\\" + “xxx_xx_xxx”);
}
/// <summary>
/// 将log文件上传共享文件夹并在本地备份
/// </summary>
/// <param name="path"></param>
/// <param name="num"></param>
/// <returns></returns>
public string coply(string path,int num,string devcode)
{
try
{
DateTime dt = sql.db3.GetDate();
string DateStr = dt.ToString("yyyy-MM-dd");
string pathup = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检\\" + DateStr + "\\" + devcode;
string pathcp = "";
DirectoryInfo theFolder1 = new DirectoryInfo(path);
pathcp = theFolder1.Parent.FullName+"\\备份\\"+ DateStr;
if (!Directory.Exists(pathcp))
{
Directory.CreateDirectory(pathcp);
}
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length != num)
{
return "文件数量错误";
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
if (!Directory.Exists(pathup+"\\"+ NextFolder2.Name))
{
Directory.CreateDirectory(pathup + "\\" + NextFolder2.Name);
}
FileInfo[] dir11 = NextFolder2.GetFiles();
foreach (FileInfo NextFolder3 in dir11)
{
if (Copy_directory(NextFolder3.FullName, pathup + "\\" + NextFolder2.Name))
{
if (File.Exists(pathcp + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name))
{
File.Delete(pathcp + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name);
}
}
else
{
return "文件上传失败"+ NextFolder2.Name;
}
}
NextFolder2.MoveTo(pathcp + "\\" + NextFolder2.Name);
}
return "OK";
}
catch (Exception ee)
{
return ee.ToString();
}
}
/// <summary>
/// 复制文件
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="destinationPath"></param>
/// <returns></returns>
public static bool Copy_directory(string sourcePath, string destinationPath)
{
Boolean fpss = true;
string dPath = destinationPath + sourcePath.Substring(sourcePath.LastIndexOf("\\"));
FileInfo old = new FileInfo(sourcePath);
File.Copy(sourcePath, dPath, true);
if (File.Exists(dPath))
{
FileInfo romote = new FileInfo(dPath);
if (old.Length != romote.Length)
{
fpss = false;
}
}
return fpss;
}
/// <summary>
/// 判断从文件读取的log功率是否读取完整。线损是否小于4
/// </summary>
/// <param name="exclModel"></param>
/// <param name="initestModel"></param>
/// <returns></returns>
public string Checktest(List<ExclModel> exclModel, List<IniModel> initestModel)
{
foreach (var item1 in exclModel)
{
if (item1.Band==""|| item1.Result == "" || item1.Channel == "" )
{
return "log数据未采集完整";
}
}
foreach (var item2 in initestModel)
{
if (item2.LTE_BAND_TX_LOW_LOSS == "" || item2.LTE_BAND_TX_MID_LOSS == ""
|| item2.LTE_BAND_TX_HIGH_LOSS == "" || item2.LTE_BAND_RX_LOW_LOSS == ""
|| item2.LTE_BAND_RX_MID_LOSS == "" || item2.LTE_BAND_RX_HIGH_LOSS == "")
{
return "ini数据未采集完整";
}
if(double.Parse(item2.LTE_BAND_TX_LOW_LOSS) >100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_LOW_LOSS的为" + item2.LTE_BAND_TX_LOW_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_TX_MID_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_MID_LOSS的为" + item2.LTE_BAND_TX_MID_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_TX_HIGH_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_TX_HIGH_LOSS的为" + item2.LTE_BAND_TX_HIGH_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_LOW_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_LOW_LOSS的为" + item2.LTE_BAND_RX_LOW_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_MID_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_MID_LOSS的为" + item2.LTE_BAND_RX_MID_LOSS + "大于100";
}
if (double.Parse(item2.LTE_BAND_RX_HIGH_LOSS) > 100)
{
return "ini的index" + item2.several_line_loss + "的LTE_BAND_RX_HIGH_LOSS的为" + item2.LTE_BAND_RX_HIGH_LOSS + "大于100";
}
}
return "OK";
}
/// <summary>
/// 对比两个log功率的差距是否大于0.3
/// </summary>
/// <param name="exclModel"></param>
/// <param name="standardExclModelModel"></param>
/// <returns></returns>
public string Checklog(List<ExclModel> exclModel, List<ExclModel> standardExclModelModel,string exc1name,string exc2name,string type)
{
try
{
if (exclModel.Count != standardExclModelModel.Count)
{
return exc1name+"的数据条数" + exclModel.Count + "与"+ exc2name+"的条数" + standardExclModelModel.Count + "不同";
}
foreach (var item in exclModel)
{
//bool chck = false;
//foreach (var item1 in standardExclModelModel)
//{
// if (item.Channel == item1.Channel)
// {
// chck = true;
// double value1 = double.Parse(item.Result.Replace("dBm", ""));
// double value2 = double.Parse(item1.Result.Replace("dBm", ""));
// double difference = Math.Abs(value1 - value2);
// if (difference >= 0.5)
// {
// return (item.Channel + "的" + item.Result + "与数据库的" + item1.Result + "差超过0.5");
// }
// if (difference >= 0.3)
// {
// return (item.Channel + "的" + item.Result + "与数据库的" + item1.Result + "差超过0.3");
// }
// }
//}
var item2 = standardExclModelModel.Find(m=>m.Band== item.Band&&m.Channel==item.Channel);
if (item2==null)
{
return exc1name + "的数据Channel:" + item.Channel + "在"+ exc2name + "未找到对应的记录";
}
double value1 = double.Parse(item.Result.Replace("dBm", ""));
double value2 = double.Parse(item2.Result.Replace("dBm", ""));
double difference = Math.Abs(value1 - value2);
if (difference >= 0.5)
{
return (exc1name + "的数据Channel:"+item.Channel + "的" + item.Result + "与"+ exc2name+"的" + item2.Result + "差超过0.5");
}
//if (type == "ML307R芯朴" && item.Band == "8")
//{
// if (difference >= 0.4)
// {
// return ("ML307R芯朴"+exc1name + "的数据Channel:" + item.Channel + "的" + item.Result + "与" + exc2name + "的" + item2.Result + "差超过0.4");
// }
//}
//else
//{
// if (difference >= 0.3)
// {
// return (exc1name + "的数据Channel:" + item.Channel + "的" + item.Result + "与" + exc2name + "的" + item2.Result + "差超过0.3");
// }
//}
}
return "OK";
}
catch (Exception ee) {
LogHelper.WriteLog(ee.ToString());
return ee.ToString();
}
}
/// <summary>
/// 对比两个线损的差距是否小于.03
/// </summary>
/// <param name="initestModel"></param>
/// <param name="standardInitestModel"></param>
/// <returns></returns>
public string Checkini(List<IniModel> initestModel, List<IniModel> standardInitestModel, string exc1name, string exc2name)
{
try
{
if (initestModel.Count != standardInitestModel.Count)
{
return exc1name+"线损的数据条数" + initestModel.Count + "与"+ exc2name + "线损的条数" + standardInitestModel.Count + "不同";
}
foreach (var item in initestModel)
{
////bool chck = false;
//foreach (var item1 in standardInitestModel)
//{
// if (item.index == item1.index)
// {
// chck = true;
// string difff ="";
// difff=matchekc(item.LTE_BAND_TX_LOW_LOSS, item1.LTE_BAND_TX_LOW_LOSS);
// if (difff!="OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_LOW_LOSS"+ difff;
// }
// difff = matchekc(item.LTE_BAND_TX_MID_LOSS, item1.LTE_BAND_TX_MID_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_MID_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_TX_HIGH_LOSS, item1.LTE_BAND_TX_HIGH_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_TX_HIGH_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_LOW_LOSS, item1.LTE_BAND_RX_LOW_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_LOW_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_MID_LOSS, item1.LTE_BAND_RX_MID_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_MID_LOSS" + difff;
// }
// difff = matchekc(item.LTE_BAND_RX_HIGH_LOSS, item1.LTE_BAND_RX_HIGH_LOSS);
// if (difff != "OK")
// {
// return "线损的数据index:" + item.index + "LTE_BAND_RX_HIGH_LOSS" + difff;
// }
// }
//}
//if (!chck)
//{
// return "线损的数据index:" + item.index + "未找到对应的记录";
//}
var item2 = standardInitestModel.Find(m=>m.several_line_loss == item.several_line_loss);
if (item2 == null)
{
return exc1name+"线损的数据index:" + item.several_line_loss + "在" +exc2name + "未找到对应的记录";
}
string difff = "";
difff = matchekc(item.LTE_BAND_TX_LOW_LOSS, item2.LTE_BAND_TX_LOW_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比"+ exc2name + "LTE_BAND_TX_LOW_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_TX_MID_LOSS, item2.LTE_BAND_TX_MID_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_TX_MID_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_TX_HIGH_LOSS, item2.LTE_BAND_TX_HIGH_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_TX_HIGH_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_LOW_LOSS, item2.LTE_BAND_RX_LOW_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_LOW_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_MID_LOSS, item2.LTE_BAND_RX_MID_LOSS);
if (difff != "OK")
{
return exc1name + "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_MID_LOSS" + difff;
}
difff = matchekc(item.LTE_BAND_RX_HIGH_LOSS, item2.LTE_BAND_RX_HIGH_LOSS);
if (difff != "OK")
{
return "线损的数据index:" + item.several_line_loss + "对比" + exc2name + "LTE_BAND_RX_HIGH_LOSS" + difff;
}
}
return "OK";
}
catch (Exception ee)
{
return ee.ToString();
}
}
/// <summary>
/// 判断两个数是否相差大于0.3
/// </summary>
/// <param name="tvalue1"></param>
/// <param name="tvalue2"></param>
/// <returns></returns>
public string matchekc(string tvalue1,string tvalue2)
{
try
{
double value1 = double.Parse(tvalue1);
double value2 = double.Parse(tvalue2);
double difference = Math.Abs(value1 - value2);
if (difference >= 0.5)
{
return ("差超过0.5");
}
//if (difference >= 0.3)
//{
// return ("差超过0.3");
//}
return "OK";
}
catch (Exception ee) {
return ee.ToString();
}
}
/// <summary>
/// 将共享文件内的文件移动到其他地方
/// </summary>
/// <param name="devcode1"></param>
/// <param name="type"></param>
/// <param name="snimei"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public string moveto(string devcode1, string type, string snimei)
{
DateTime dt = sql.db3.GetDate();
string DateStr = dt.ToString("yyyy-MM-dd");
string path = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检\\" + DateStr+"\\"+ devcode1;
string pathto = "\\\\192.168.2.149\\生产数据-2\\制造二课\\制造二课(模组车间)\\中移上传点检\\日常点检备份\\" + DateStr + "\\" + devcode1;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
DirectoryInfo theFolder1 = new DirectoryInfo(path);
DirectoryInfo[] dir12 = theFolder1.GetDirectories();
if (dir12.Length == 0)
{
return "OK";
}
if (!Directory.Exists(pathto))
{
Directory.CreateDirectory(pathto);
}
foreach (DirectoryInfo NextFolder2 in dir12)
{
//if (!Directory.Exists(pathto + "\\" + NextFolder2.Name))
//{
// Directory.CreateDirectory(pathto + "\\" + NextFolder2.Name);
//}
//FileInfo[] dir11 = NextFolder2.GetFiles();
//foreach (FileInfo NextFolder3 in dir11)
//{
// if (Copy_directory(NextFolder3.FullName, pathto + "\\" + NextFolder2.Name))
// {
// if (File.Exists(pathto + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name))
// {
// File.Delete(pathto + "\\" + NextFolder2.Name + "\\" + NextFolder3.Name);
// }
// }
// else
// {
// return "文件上传失败" + NextFolder2.Name;
// }
//}
NextFolder2.MoveTo(pathto + "\\" + NextFolder2.Name);
}
return "OK";
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("BLL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BLL")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("02a200e7-551a-4dd7-b23a-afaa9dbecf81")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

BIN
BLL/bin/Debug/BLL.dll Normal file

Binary file not shown.

BIN
BLL/bin/Debug/BLL.pdb Normal file

Binary file not shown.

BIN
BLL/bin/Debug/Model.dll Normal file

Binary file not shown.

BIN
BLL/bin/Debug/Model.pdb Normal file

Binary file not shown.

BIN
BLL/bin/Debug/SqlSugar.dll Normal file

Binary file not shown.

BIN
BLL/bin/Debug/Tool.dll Normal file

Binary file not shown.

BIN
BLL/bin/Debug/Tool.pdb Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]

Binary file not shown.

View File

@ -0,0 +1 @@
b1a84f9457003ac7d2ad72352989e29f41b8275d375cf8d680061b79df40335e

View File

@ -0,0 +1,11 @@
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\BLL.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\BLL.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\obj\Debug\BLL.csproj.AssemblyReference.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\obj\Debug\BLL.csproj.CoreCompileInputs.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\obj\Debug\BLL.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\obj\Debug\BLL.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\Model.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\Tool.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\Model.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\bin\Debug\Tool.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\BLL\obj\Debug\BLL.csproj.Up2Date

View File

BIN
BLL/obj/Debug/BLL.dll Normal file

Binary file not shown.

BIN
BLL/obj/Debug/BLL.pdb Normal file

Binary file not shown.

293
DAL/CheckDAL.cs Normal file
View File

@ -0,0 +1,293 @@
using Model;
using NPOI.HSSF.UserModel;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tool;
namespace DAL
{
public class CheckDAL
{
private SqlHelper sql = new SqlHelper();
/// <summary>
/// 抓取模式功率值取平均值
/// </summary>
/// <param name="initestModel"></param>
/// <param name="initestModel2"></param>
/// <param name="initestModel3"></param>
/// <returns></returns>
public List<IniModel> getendinitest(List<IniModel> initestModel, List<IniModel> initestModel2, List<IniModel> initestModel3)
{
List<IniModel> Ini = new List<IniModel>();
foreach (var item1 in initestModel)
{
IniModel ind = new IniModel();
var itme2 = initestModel2.Find(m => m.several_line_loss == item1.several_line_loss);
var itme3 = initestModel3.Find(m => m.several_line_loss == item1.several_line_loss);
if (itme2==null|| itme3 == null)
{
return new List<IniModel>();
}
ind.several_line_loss = item1.several_line_loss;
ind.LTE_BAND_TX_LOW_LOSS = getendini3(item1.LTE_BAND_TX_LOW_LOSS, itme2.LTE_BAND_TX_LOW_LOSS, itme3.LTE_BAND_TX_LOW_LOSS);
ind.LTE_BAND_TX_MID_LOSS = getendini3(item1.LTE_BAND_TX_MID_LOSS, itme2.LTE_BAND_TX_MID_LOSS, itme3.LTE_BAND_TX_MID_LOSS);
ind.LTE_BAND_TX_HIGH_LOSS = getendini3(item1.LTE_BAND_TX_HIGH_LOSS, itme2.LTE_BAND_TX_HIGH_LOSS, itme3.LTE_BAND_TX_HIGH_LOSS);
ind.LTE_BAND_RX_LOW_LOSS = getendini3(item1.LTE_BAND_RX_LOW_LOSS, itme2.LTE_BAND_RX_LOW_LOSS, itme3.LTE_BAND_RX_LOW_LOSS);
ind.LTE_BAND_RX_MID_LOSS = getendini3(item1.LTE_BAND_RX_MID_LOSS, itme2.LTE_BAND_RX_MID_LOSS, itme3.LTE_BAND_RX_MID_LOSS);
ind.LTE_BAND_RX_HIGH_LOSS = getendini3(item1.LTE_BAND_RX_HIGH_LOSS, itme2.LTE_BAND_RX_HIGH_LOSS, itme3.LTE_BAND_RX_HIGH_LOSS);
Ini.Add(ind);
}
return Ini;
}
/// <summary>
/// 计算三个数的平均值,保留小数点后两位
/// </summary>
/// <param name="lTE_BAND_RX_LOW_LOSS1"></param>
/// <param name="lTE_BAND_RX_LOW_LOSS2"></param>
/// <param name="lTE_BAND_RX_LOW_LOSS3"></param>
/// <returns></returns>
public string getendini3(string lTE_BAND_RX_LOW_LOSS1, string lTE_BAND_RX_LOW_LOSS2, string lTE_BAND_RX_LOW_LOSS3)
{
double value1 = double.Parse(lTE_BAND_RX_LOW_LOSS1);
double value2 = double.Parse(lTE_BAND_RX_LOW_LOSS2);
double value3 = double.Parse(lTE_BAND_RX_LOW_LOSS3);
double difference = Math.Round((value1 + value2+ value3)/3,2);
return difference.ToString();
}
/// <summary>
/// 计算抓取模式下线损的平均值
/// </summary>
/// <param name="exclModel"></param>
/// <param name="exclModel2"></param>
/// <param name="exclModel3"></param>
/// <returns></returns>
public List<ExclModel> getendtest(List<ExclModel> exclModel, List<ExclModel> exclModel2, List<ExclModel> exclModel3)
{
List<ExclModel> Excl = new List<ExclModel>();
foreach (var item in exclModel)
{
ExclModel excd = new ExclModel();
var itme2 = exclModel2.Find(m => m.Channel == item.Channel&& m.Band == item.Band);
var itme3 = exclModel3.Find(m => m.Channel == item.Channel&&m.Band == item.Band);
if (itme2 == null || itme3 == null)
{
return new List<ExclModel>();
}
excd.Band = item.Band;
excd.Channel = item.Channel;
excd.Result = getendini3(item.Result.Replace("dBm", ""), itme2.Result.Replace("dBm", ""), itme3.Result.Replace("dBm", "")) + "dBm";
Excl.Add(excd);
}
return Excl;
}
/// <summary>
/// 从数据库读取金机与机型的关系
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public string[] Getimei(string type)
{
string[] Jinjiimei;
string imei = "";
List<SqlHelper.t_CMCC_Jinji> lS = sql.db3.Queryable<SqlHelper.t_CMCC_Jinji>().
Where(it => it.type == type).ToList();
if (lS.Count>0)
{
foreach (var yj in lS)
{
if (imei == "")
{
imei = yj.snimei;
}
else {
imei = imei+";"+ yj.snimei;
}
}
}
Jinjiimei= imei.Split(';');
return Jinjiimei;
}
/// <summary>
/// 抓取作为标准的功率值
/// </summary>
/// <param name="devcode1"></param>
/// <param name="type"></param>
/// <param name="snimei"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<ExclModel> GetStandardExcl(string devcode1, string type, string snimei)
{
try
{
List<ExclModel> exciset = new List<ExclModel>();
SqlHelper.t_CMCC_JinjiPower LinExc = sql.db3.Queryable<SqlHelper.t_CMCC_JinjiPower>().
Where(it => it.Devcode == devcode1 && it.snimei == snimei && it.kind == "标准").
OrderBy(it => it.PowerTime, SqlSugar.OrderByType.Desc).First();
if (LinExc != null)
{
List<SqlHelper.t_CMCC_JinjiPower> lsitpower = sql.db3.Queryable<SqlHelper.t_CMCC_JinjiPower>().
Where(it => it.PowerTime == LinExc.PowerTime && it.Devcode == devcode1 && it.snimei == snimei && it.kind == "标准").ToList();
foreach (var item in lsitpower)
{
ExclModel excModel = new ExclModel();
excModel.Band = item.Band;
excModel.Result = item.Result;
excModel.Channel = item.Channel;
exciset.Add(excModel);
}
return exciset;
}
else
{
LogHelper.WriteLog("数据库为空");
return null;
}
}
catch (Exception ee)
{
LogHelper.WriteLog(ee.ToString());
return null;
}
}
/// <summary>
/// 抓取作为标准的线损值
/// </summary>
/// <param name="devcode1"></param>
/// <param name="type"></param>
/// <param name="snimei"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<IniModel> GetStandardIni(string devcode1, string type, string snimei)
{
try
{
List<IniModel> linliset = new List<IniModel>();
SqlHelper.t_CMCC_JinjiLine Lin = sql.db3.Queryable<SqlHelper.t_CMCC_JinjiLine>().
Where(it => it.Devcode == devcode1&&it.snimei == snimei && it.kind == "标准").
OrderBy(it => it.LineTime, SqlSugar.OrderByType.Desc).First();
if (Lin != null)
{
List<SqlHelper.t_CMCC_JinjiLine> lsitline = sql.db3.Queryable<SqlHelper.t_CMCC_JinjiLine>().
Where(it => it.LineTime== Lin.LineTime&& it.Devcode == devcode1 && it.snimei == snimei&&it.kind=="标准").ToList();
foreach (var item in lsitline)
{
IniModel lineModel = new IniModel();
lineModel.several_line_loss = item.several_line_loss;
lineModel.LTE_BAND_TX_LOW_LOSS = item.LTE_BAND_TX_LOW_LOSS;
lineModel.LTE_BAND_TX_MID_LOSS = item.LTE_BAND_TX_MID_LOSS;
lineModel.LTE_BAND_TX_HIGH_LOSS = item.LTE_BAND_TX_HIGH_LOSS;
lineModel.LTE_BAND_RX_LOW_LOSS = item.LTE_BAND_RX_LOW_LOSS;
lineModel.LTE_BAND_RX_MID_LOSS = item.LTE_BAND_RX_MID_LOSS;
lineModel.LTE_BAND_RX_HIGH_LOSS = item.LTE_BAND_RX_HIGH_LOSS;
linliset.Add(lineModel);
}
return linliset;
}
else
{
LogHelper.WriteLog("数据库为空");
return null;
}
}
catch (Exception ee)
{
LogHelper.WriteLog(ee.ToString());
return null;
}
}
/// <summary>
/// 上传合格的功率值和线损值
/// </summary>
/// <param name="initestModel"></param>
/// <param name="exclModel"></param>
/// <param name="classify"></param>
/// <returns></returns>
public string updata(List<IniModel> initestModel, List<ExclModel> exclModel,string classify,string devcode,string type,string snimei,string name)
{
try {
DateTime dt = sql.db3.GetDate();
List<SqlHelper.t_CMCC_JinjiPower> powelist = new List<SqlHelper.t_CMCC_JinjiPower>();
foreach (var item in exclModel)
{
SqlHelper.t_CMCC_JinjiPower powerone = new SqlHelper.t_CMCC_JinjiPower();
powerone.Band = item.Band;
powerone.Channel = item.Channel;
powerone.Result = item.Result;
powerone.PowerTime = dt;
powerone.Powername = name;
powerone.kind = classify;
powerone.textname = item.textname;
powerone.Devcode = devcode;
powerone.type = type;
powerone.snimei = snimei;
powelist.Add(powerone);
}
int result = sql.db3.Insertable(powelist).ExecuteCommand();
if (result != powelist.Count)
{
return "功率数据上传异常!";
}
List<SqlHelper.t_CMCC_JinjiLine> Linelist = new List<SqlHelper.t_CMCC_JinjiLine>();
foreach (var item in initestModel)
{
SqlHelper.t_CMCC_JinjiLine lineone = new SqlHelper.t_CMCC_JinjiLine();
lineone.LTE_BAND_TX_LOW_LOSS = item.LTE_BAND_TX_LOW_LOSS;
lineone.LTE_BAND_TX_MID_LOSS = item.LTE_BAND_TX_MID_LOSS;
lineone.LTE_BAND_TX_HIGH_LOSS = item.LTE_BAND_TX_HIGH_LOSS;
lineone.LTE_BAND_RX_LOW_LOSS = item.LTE_BAND_RX_LOW_LOSS;
lineone.LTE_BAND_RX_MID_LOSS = item.LTE_BAND_RX_MID_LOSS;
lineone.LTE_BAND_RX_HIGH_LOSS = item.LTE_BAND_RX_HIGH_LOSS;
lineone.several_line_loss = item.several_line_loss;
lineone.kind = classify;
lineone.LineTime = dt;
lineone.Linename = name;
lineone.textname = item.textname;
lineone.Devcode = devcode;
lineone.type = type;
lineone.snimei = snimei;
Linelist.Add(lineone);
}
result = sql.db3.Insertable(Linelist).ExecuteCommand();
if (result != Linelist.Count)
{
return "功率数据上传异常!";
}
return "OK";
}
catch (Exception ee)
{
LogHelper.WriteLog(ee.ToString());
return "MES连接异常";
}
}
public string checkdist(string devcode1, string type, string snimei, string name)
{
if(devcode1==""|| devcode1==null)
{
return "对应的夹具号为空";
}
if (type =="" || type == null)
{
return "机型为空";
}
if (snimei=="" || snimei == null)
{
return "对应的金机编号为空";
}
if (name=="" || name == null)
{
return "未登录";
}
return "OK";
}
}
}

82
DAL/DAL.csproj Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EED41D82-0ECD-49C0-B753-4DE90642BE69}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DAL</RootNamespace>
<AssemblyName>DAL</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\点检\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\点检\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\点检\packages\NPOI.2.5.6\lib\net45\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\点检\packages\NPOI.2.5.6\lib\net45\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\点检\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\点检\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\点检\packages\SqlSugar.5.0.3\lib\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CheckDAL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{5a80de64-fcd5-4d7c-8a1e-4199412d80bd}</Project>
<Name>Model</Name>
</ProjectReference>
<ProjectReference Include="..\Tool\Tool.csproj">
<Project>{CC8994B7-1312-45E6-ABDA-92413692FEB3}</Project>
<Name>Tool</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DAL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DAL")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("eed41d82-0ecd-49c0-b753-4de90642be69")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
DAL/bin/Debug/DAL.dll Normal file

Binary file not shown.

BIN
DAL/bin/Debug/DAL.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
DAL/bin/Debug/Model.dll Normal file

Binary file not shown.

BIN
DAL/bin/Debug/Model.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

11817
DAL/bin/Debug/NPOI.OOXML.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

BIN
DAL/bin/Debug/NPOI.dll Normal file

Binary file not shown.

BIN
DAL/bin/Debug/NPOI.pdb Normal file

Binary file not shown.

45803
DAL/bin/Debug/NPOI.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
DAL/bin/Debug/SqlSugar.dll Normal file

Binary file not shown.

BIN
DAL/bin/Debug/Tool.dll Normal file

Binary file not shown.

BIN
DAL/bin/Debug/Tool.pdb Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]

Binary file not shown.

View File

@ -0,0 +1 @@
fe1430da598476beb59a227e01b90eccdd1b8b854775aa7738cf602c74d6c360

View File

@ -0,0 +1,28 @@
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\DAL.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\DAL.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\obj\Debug\DAL.csproj.AssemblyReference.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\obj\Debug\DAL.csproj.CoreCompileInputs.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\obj\Debug\DAL.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\obj\Debug\DAL.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\BouncyCastle.Crypto.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\ICSharpCode.SharpZipLib.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\Model.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OOXML.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OpenXml4Net.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OpenXmlFormats.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\Model.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\BouncyCastle.Crypto.xml
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\ICSharpCode.SharpZipLib.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\ICSharpCode.SharpZipLib.xml
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.xml
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OOXML.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OOXML.xml
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OpenXml4Net.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OpenXml4Net.xml
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\NPOI.OpenXmlFormats.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\SqlSugar.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\Tool.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\bin\Debug\Tool.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\DAL\obj\Debug\DAL.csproj.Up2Date

View File

BIN
DAL/obj/Debug/DAL.dll Normal file

Binary file not shown.

BIN
DAL/obj/Debug/DAL.pdb Normal file

Binary file not shown.

7
DAL/packages.config Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NPOI" version="2.5.6" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net452" />
<package id="SharpZipLib" version="1.3.3" targetFramework="net452" />
<package id="SqlSugar" version="5.0.3" targetFramework="net452" />
</packages>

75
Model/CheckModel.cs Normal file
View File

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class ExclModel
{/// <summary>
/// Band
/// </summary>
public string Band { get; set; } = "";
/// <summary>
/// Test result
/// </summary>
public string Result { get; set; } = "";
/// <summary>
/// Channel
/// </summary>
public string Channel { get; set; } = "";
/// <summary>
/// 文件名
/// </summary>
public string textname { get; set; } = "";
}
public class IniModel
{/// <summary>
/// LTE_BAND_TX_LOW_LOSS-1
/// </summary>
public string LTE_BAND_TX_LOW_LOSS { get; set; } = "";
/// <summary>
/// LTE_BAND_TX_MID_LOSS-2
/// </summary>
public string LTE_BAND_TX_MID_LOSS { get; set; } = "";
/// <summary>
/// LTE_BAND_TX_HIGH_LOSS-3
/// </summary>
public string LTE_BAND_TX_HIGH_LOSS { get; set; } = "";
/// <summary>
/// LTE_BAND_RX_LOW_LOSS-4
/// </summary>
public string LTE_BAND_RX_LOW_LOSS { get; set; } = "";
/// <summary>
/// LTE_BAND_RX_MID_LOSS-5
/// </summary>
public string LTE_BAND_RX_MID_LOSS { get; set; } = "";
/// <summary>
/// LTE_BAND_TX_HIGH_LOSS-6
/// </summary>
public string LTE_BAND_RX_HIGH_LOSS { get; set; } = "";
/// <summary>
/// index
/// </summary>
public string several_line_loss { get; set; } = "";
/// <summary>
/// 文件名
/// </summary>
public string textname { get; set; } = "";
}
public class JinjiModel
{
/// <summary>
/// type
/// </summary>
public string type { get; set; } = "";
/// <summary>
/// snimei
/// </summary>
public string[] snimei { get; set; } = new string[] { };
}
public class CheckModel
{
}
}

49
Model/Model.csproj Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5A80DE64-FCD5-4D7C-8A1E-4199412D80BD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Model</RootNamespace>
<AssemblyName>Model</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CheckModel.cs" />
<Compile Include="SettingModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Model")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("5a80de64-fcd5-4d7c-8a1e-4199412d80bd")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

77
Model/SettingModel.cs Normal file
View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class UserModel
{
/// <summary>
/// 工号
/// </summary>
public string userName { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string nickName { get; set; }
/// <summary>
/// 部门
/// </summary>
public string bumen { get; set; }
/// <summary>
/// 职位
/// </summary>
public string zhiwei { get; set; }
}
public class SettingModel
{
/// <summary>
/// 机型
/// </summary>
public string[] Types { get; set; }
/// <summary>
/// 夹具号1
/// </summary>
public string devcode1 { get; set; }
/// <summary>
/// 夹具号2
/// </summary>
public string devcode2 { get; set; }
/// <summary>
/// 线损文件地址
/// </summary>
public string pathini { get; set; }
/// <summary>
/// 线损文件备份地址
/// </summary>
public string pathen { get; set; }
/// <summary>
/// load配置文件地址
/// </summary>
public string pathLoad { get; set; }
/// <summary>
/// log文件1地址
/// </summary>
public string pathch1 { get; set; }
/// <summary>
/// log文件2地址
/// </summary>
public string pathch2 { get; set; }
public int index { get; set; }
public SettingModel()
{
this.Types = new string[] { };
this.index = 0;
this.devcode1 = "";
this.devcode2 = "";
this.pathini = "";
this.pathen = "";
this.pathLoad = "";
this.pathch1 = "";
this.pathch1 = "";
}
}
}

BIN
Model/bin/Debug/Model.dll Normal file

Binary file not shown.

BIN
Model/bin/Debug/Model.pdb Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]

Binary file not shown.

View File

@ -0,0 +1 @@
5b0fed87316a2c0929a745c8f24737b80a561f496f6dcc58c66336c4775c7d1c

View File

@ -0,0 +1,6 @@
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\bin\Debug\Model.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\bin\Debug\Model.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\obj\Debug\Model.csproj.AssemblyReference.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\obj\Debug\Model.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Model\obj\Debug\Model.pdb

BIN
Model/obj/Debug/Model.dll Normal file

Binary file not shown.

BIN
Model/obj/Debug/Model.pdb Normal file

Binary file not shown.

121
Tool/CommonHelper.cs Normal file
View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tool
{
public class CommonHelper
{
public static bool IMEICheck(string imei)
{
int vl_Sum1 = 0, vl_Sum2 = 0, vl_Total = 0;
int vl_Temp = 0;
for (int i = 0; i < 14; i++)
{
/*(1)将奇数位数字相加(从1开始计数)*/
if ((i % 2) == 0)
{
vl_Sum1 = vl_Sum1 + int.Parse(imei[i].ToString());
}
else
{
/*(2)将偶数位数字分别乘以2,分别计算个位数和十位数之和(从1开始计数)*/
vl_Temp = (int.Parse(imei[i].ToString())) * 2;
if (vl_Temp < 10)
{
vl_Sum2 = vl_Sum2 + vl_Temp;
}
else
{
vl_Sum2 = vl_Sum2 + 1 + vl_Temp - 10;
}
}
}
/*(1)+(2)*/
vl_Total = vl_Sum1 + vl_Sum2;
/*如果得出的数个位是0则校验位为0,否则为10减去个位数 */
if ((vl_Total % 10) == 0)
{
if (imei[14] == '0')
{
return true;
}
}
else
{
if ((10 - (vl_Total % 10)).ToString() == imei[14].ToString())
{
return true;
}
}
return false;
}
public static string GetIMEI(string imei)
{
int vl_Sum1 = 0, vl_Sum2 = 0, vl_Total = 0;
int vl_Temp = 0;
for (int i = 0; i < 14; i++)
{
/*(1)将奇数位数字相加(从1开始计数)*/
if ((i % 2) == 0)
{
vl_Sum1 = vl_Sum1 + int.Parse(imei[i].ToString());
}
else
{
/*(2)将偶数位数字分别乘以2,分别计算个位数和十位数之和(从1开始计数)*/
vl_Temp = (int.Parse(imei[i].ToString())) * 2;
if (vl_Temp < 10)
{
vl_Sum2 = vl_Sum2 + vl_Temp;
}
else
{
vl_Sum2 = vl_Sum2 + 1 + vl_Temp - 10;
}
}
}
/*(1)+(2)*/
vl_Total = vl_Sum1 + vl_Sum2;
/*如果得出的数个位是0则校验位为0,否则为10减去个位数 */
if ((vl_Total % 10) == 0)
{
return imei + "0";
}
else
{
return imei + (10 - (vl_Total % 10)).ToString();
}
}
public static List<T> Clone<T>(List<T> list) where T : new()
{
List<T> items = new List<T>();
foreach (var m in list)
{
var model = new T();
var ps = model.GetType().GetProperties();
var properties = m.GetType().GetProperties();
foreach (var p in properties)
{
foreach (var pm in ps)
{
if (pm.Name == p.Name)
{
pm.SetValue(model, p.GetValue(m));
}
}
}
items.Add(model);
}
return items;
}
}
}

54
Tool/ConfigHelper.cs Normal file
View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tool
{
public class ConfigHelper
{
//向配置文件写入内容
public void Write(string key, string value)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
config.AppSettings.Settings.Add(key, value);
}
else
{
config.AppSettings.Settings[key].Value = value;
}
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");// 重新加载新的配置文件
}
//读取配置文件内容
public Dictionary<string, string> ReadAll()
{
Dictionary<string, string> dic = new Dictionary<string, string>();
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
foreach (string key in config.AppSettings.Settings.AllKeys)
{
dic[key] = config.AppSettings.Settings[key].Value;
}
return dic;
}
public Dictionary<string, string> ReadAll(string path)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
ExeConfigurationFileMap map = new ExeConfigurationFileMap
{
ExeConfigFilename = path
};
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
foreach (string key in config.AppSettings.Settings.AllKeys)
{
dic[key] = config.AppSettings.Settings[key].Value;
}
return dic;
}
}
}

46
Tool/FileHelper.cs Normal file
View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tool
{
public class FileHelper
{
public void Transport(string file, string dst, string product)
{
string src;
src = file;
FileStream inFileStream = new FileStream(src, FileMode.Open);
if (!Directory.Exists(dst))
{
Directory.CreateDirectory(dst);
}
dst = dst + "\\" + product;
FileStream outFileStream = new FileStream(dst, FileMode.OpenOrCreate);
try
{
byte[] buf = new byte[inFileStream.Length];
int byteCount;
while ((byteCount = inFileStream.Read(buf, 0, buf.Length)) > 0)
{
outFileStream.Write(buf, 0, byteCount);
}
inFileStream.Flush();
outFileStream.Flush();
}
finally
{
inFileStream.Close();
outFileStream.Close();
}
}
}
}

92
Tool/LogHelper.cs Normal file
View File

@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tool
{
public class LogHelper
{
private static readonly object LogLock = new object();
public static void WriteLog(string msg)
{
lock (LogLock)
{
string filePath = AppDomain.CurrentDomain.BaseDirectory + "Log";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string logPath = AppDomain.CurrentDomain.BaseDirectory + "Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
try
{
using (StreamWriter sw = File.AppendText(logPath))
{
sw.WriteLine("**************************************************");
sw.WriteLine("时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
sw.WriteLine(msg);
sw.WriteLine();
sw.Flush();
sw.Close();
sw.Dispose();
}
}
catch (IOException e)
{
using (StreamWriter sw = File.AppendText(logPath))
{
sw.WriteLine("**************************************************");
sw.WriteLine("时间:" + DateTime.Now.ToString("yyy-MM-dd HH:mm:ss"));
sw.WriteLine("异常:" + e.Message);
sw.WriteLine();
sw.Flush();
sw.Close();
sw.Dispose();
}
}
}
}
public static void WriteLogMater(string msg)
{
lock (LogLock)
{
string filePath = AppDomain.CurrentDomain.BaseDirectory + "Logmater";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string logPath = AppDomain.CurrentDomain.BaseDirectory + "Logmater\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
try
{
using (StreamWriter sw = File.AppendText(logPath))
{
sw.WriteLine("**************************************************");
sw.WriteLine("时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
sw.WriteLine(msg);
sw.WriteLine();
sw.Flush();
sw.Close();
sw.Dispose();
}
}
catch (IOException e)
{
using (StreamWriter sw = File.AppendText(logPath))
{
sw.WriteLine("**************************************************");
sw.WriteLine("时间:" + DateTime.Now.ToString("yyy-MM-dd HH:mm:ss"));
sw.WriteLine("异常:" + e.Message);
sw.WriteLine();
sw.Flush();
sw.Close();
sw.Dispose();
}
}
}
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Tool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tool")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("cc8994b7-1312-45e6-abda-92413692feb3")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

165
Tool/SqlHelper.cs Normal file
View File

@ -0,0 +1,165 @@
using Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tool
{
public class SqlHelper
{
private ConnectionConfig connection2 = null;
public SqlSugarClient db2 = null;
private ConnectionConfig connection3 = null;
public SqlSugarClient db3 = null;
public SqlHelper()
{
string SqlIP2 = "192.168.2.2";
string SqlIP3 = "192.168.2.3";
string database = "MESDB";
string uid = "sa";
string pwd = "8ik,9ol.";
connection2 = new ConnectionConfig()
{
ConnectionString = "server='" + SqlIP2 + "';initial catalog='" + database + "';uid='" + uid + "';pwd='" + pwd + "'",
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute
};
db2 = new SqlSugarClient(connection2);
connection3 = new ConnectionConfig()
{
ConnectionString = "server='" + SqlIP3 + "';initial catalog='" + database + "';uid='" + uid + "';pwd='" + pwd + "'",
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute
};
db3 = new SqlSugarClient(connection3);
}
#region t_CMCC_Jinji
[SugarTable("t_CMCC_Jinji")]
public class t_CMCC_Jinji
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int id { get; set; }
public string type { get; set; }
public string snimei { get; set; }
public string inname { get; set; }
public DateTime? inTime { get; set; }
public string endname { get; set; }
public DateTime? endTime { get; set; }
}
#endregion
#region t_CMCC_JinjiPower
[SugarTable("t_CMCC_JinjiPower")]
public class t_CMCC_JinjiPower
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int id { get; set; }
public string type { get; set; }
public string snimei { get; set; }
public string Devcode { get; set; }
public string Band { get; set; }
public string Channel { get; set; }
public string Result { get; set; }
public string kind { get; set; }
public string textname { get; set; }
public string Powername { get; set; }
public DateTime? PowerTime { get; set; }
}
#endregion
#region t_CMCC_JinjiLine
[SugarTable("t_CMCC_JinjiLine")]
public class t_CMCC_JinjiLine
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int id { get; set; }
/// <summary>
/// 机型
/// </summary>
public string type { get; set; }
/// <summary>
/// 金机编码
/// </summary>
public string snimei { get; set; }
/// <summary>
/// 夹具号
/// </summary>
public string Devcode { get; set; }
/// <summary>
/// 类别
/// </summary>
public string kind { get; set; }
/// <summary>
/// 第几项线损
/// </summary>
public string several_line_loss { get; set; }
public string LTE_BAND_TX_LOW_LOSS { get; set; }
public string LTE_BAND_TX_MID_LOSS { get; set; }
public string LTE_BAND_TX_HIGH_LOSS { get; set; }
public string LTE_BAND_RX_LOW_LOSS { get; set; }
public string LTE_BAND_RX_MID_LOSS { get; set; }
public string LTE_BAND_RX_HIGH_LOSS { get; set; }
/// <summary>
/// 线损文件名称
/// </summary>
public string textname { get; set; }
/// <summary>
/// 录入人员名称
/// </summary>
public string Linename { get; set; }
/// <summary>
/// 录入时间
/// </summary>
public DateTime? LineTime { get; set; }
}
#endregion
#region t_DD_UserDetail
[SugarTable("t_DD_UserDetail")]
public class t_DD_UserDetail
{
/// <summary>
/// 姓名
/// </summary>
public string username { get; set; }
/// <summary>
/// 工号
/// </summary>
public string jobnumber { get; set; }
/// <summary>
/// 公司
/// </summary>
public string companyName { get; set; }
/// <summary>
/// 部门
/// </summary>
public string workPlace { get; set; }
/// <summary>
/// 职位
/// </summary>
public string position { get; set; }
}
#endregion
public UserModel GetUser(string jobnumber)
{
try
{
var userModel = db2.Queryable<t_DD_UserDetail>().Where(it => it.jobnumber == jobnumber && it.companyName == "重庆盟讯电子科技有限公司").First();
if (userModel == null)
{
return null;
}
return new UserModel() { userName = jobnumber, nickName = userModel.username, bumen = userModel.workPlace, zhiwei = userModel.position };
}
// return db.Queryable<t_DD_UserDetail>().Where(it => it.jobnumber == jobnumber && it.companyName == "重庆盟讯电子科技有限公司").First().username;
//}
catch (System.Exception ee)
{
LogHelper.WriteLog(ee.ToString());
throw ee;
}
}
}
}

65
Tool/Tool.csproj Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CC8994B7-1312-45E6-ABDA-92413692FEB3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Tool</RootNamespace>
<AssemblyName>Tool</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="SqlSugar, Version=5.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\点检\packages\SqlSugar.5.0.3\lib\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CommonHelper.cs" />
<Compile Include="ConfigHelper.cs" />
<Compile Include="FileHelper.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="SqlHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{5A80DE64-FCD5-4D7C-8A1E-4199412D80BD}</Project>
<Name>Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

BIN
Tool/bin/Debug/Model.dll Normal file

Binary file not shown.

BIN
Tool/bin/Debug/Model.pdb Normal file

Binary file not shown.

BIN
Tool/bin/Debug/SqlSugar.dll Normal file

Binary file not shown.

BIN
Tool/bin/Debug/Tool.dll Normal file

Binary file not shown.

BIN
Tool/bin/Debug/Tool.pdb Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]

Binary file not shown.

View File

@ -0,0 +1 @@
f94c390bd35cd2c22da9892b123575027c89d50c705b1483972981c73fe32bc2

View File

@ -0,0 +1,10 @@
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\bin\Debug\Tool.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\bin\Debug\Tool.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\obj\Debug\Tool.csproj.AssemblyReference.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\obj\Debug\Tool.csproj.CoreCompileInputs.cache
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\obj\Debug\Tool.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\obj\Debug\Tool.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\bin\Debug\Model.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\bin\Debug\SqlSugar.dll
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\bin\Debug\Model.pdb
D:\桌面文件夹\Desktop\中移版本库\金机点检\Tool\obj\Debug\Tool.csproj.Up2Date

View File

BIN
Tool/obj/Debug/Tool.dll Normal file

Binary file not shown.

BIN
Tool/obj/Debug/Tool.pdb Normal file

Binary file not shown.

4
Tool/packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SqlSugar" version="5.0.3" targetFramework="net452" />
</packages>

6
View/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

9
View/App.xaml Normal file
View File

@ -0,0 +1,9 @@
<Application x:Class="View.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:View"
StartupUri="MesLoginView.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
View/App.xaml.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace View
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

98
View/MesLoginView.xaml Normal file
View File

@ -0,0 +1,98 @@
<Window x:Class="View.MesLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:View"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="登录" Height="331.675" Width="420" WindowStyle="None" Background="{x:Null}"
ResizeMode="NoResize" x:Name="main"
AllowsTransparency="True" WindowStartupLocation="CenterScreen" Loaded="main_Loaded">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded" >
<BeginStoryboard>
<Storyboard Name="sbOpShow">
<DoubleAnimation
Storyboard.TargetName="main"
Storyboard.TargetProperty="Opacity"
From="0" To="0.95" Duration="0:0:0.15"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml"/>
</ResourceDictionary.MergedDictionaries>
<ControlTemplate x:Key="CloseButtonTemplate" TargetType="Button">
<!-- 外观 -->
<Border Name="Border" Background="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<!-- 绘制关闭按钮图形 -->
<Canvas RenderOptions.EdgeMode="Aliased">
<Line Stroke="White" Opacity="0.90" x:Name="doi"
X1="0"
X2="{TemplateBinding ActualWidth}"
Y1="0"
Y2="{TemplateBinding ActualHeight }" StrokeThickness="2" />
<Line Stroke="White" Opacity="0.90" x:Name="twoy"
X1="0"
X2="{TemplateBinding ActualWidth }"
Y1="{TemplateBinding ActualHeight}"
Y2="0" StrokeThickness="2" />
</Canvas>
</Border>
<!-- 触发器 -->
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="doi" Property="Stroke" Value="#FF1982FF" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="doi" Property="Stroke" Value="#FFFF9898" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="twoy" Property="Stroke" Value="#FF1982FF" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="twoy" Property="Stroke" Value="#FFFF9898" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
</Window.Resources>
<Border Opacity="1" CornerRadius="3">
<Canvas Background="AliceBlue">
<Border Canvas.Top="0" Height="30" Width="{Binding ElementName=main, Path=Width,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0,0,0,1" Background="{StaticResource PrimaryHueMidBrush}">
<TextBlock x:Name="lblTitle" TextAlignment="Center"
Foreground="AliceBlue" FontSize="20" Margin="40,2"/>
</Border>
<materialDesign:PackIcon Kind="Account" Width="30" Height="30"
Canvas.Top="73" Canvas.Left="80" Foreground= "Black" />
<materialDesign:PackIcon Kind="Password" Width="30" Height="30"
Canvas.Top="131" Canvas.Left="80" Foreground= "Black" />
<materialDesign:PackIcon Kind="StarBox" Width="30" Height="30"
Canvas.Top="196" Canvas.Left="80" Foreground= "Black" />
<TextBox x:Name="Account"
Foreground="Black" FontSize="20"
TextAlignment="Left"
VerticalContentAlignment="Center"
Canvas.Top="69" Height="33" Width="200" Canvas.Left="133" />
<PasswordBox x:Name="Password"
Foreground="Black" FontSize="20"
HorizontalAlignment="Center"
VerticalContentAlignment="Center"
Canvas.Top="129" Height="33" Width="200" Canvas.Left="133" />
<ComboBox x:Name="ComboBoxProd" Canvas.Left="133" Canvas.Top="196" Width="200" Height="30" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Top" >
</ComboBox>
<Button Content="登录" Canvas.Top="267" Height="33" Width="240" Canvas.Left="93" Click="btnLogin_Click"/>
<Button x:Name="btnCancel" Template="{StaticResource CloseButtonTemplate}" Canvas.Left="395" Canvas.Top="7" Height="13" Width="13" BorderThickness="2" Click="btnCancel_Click" FontWeight="Bold" ></Button>
</Canvas>
</Border>
</Window>

169
View/MesLoginView.xaml.cs Normal file
View File

@ -0,0 +1,169 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tool;
namespace View
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
///
public class LoginModel
{
public string name { get; set; }
public string pro { get; set; }
/// <summary>
/// 部门
/// </summary>
public string bumen { get; set; }
}
public partial class MesLoginView : Window
{
private List<string> Users = new List<string>();
private Dictionary<string, string> dic = new Dictionary<string, string>();
private LoginModel _model;
public MesLoginView()
{
InitializeComponent();
}
public MesLoginView(string title, Dictionary<string, string> dic1, List<string> Item, LoginModel model)
{
InitializeComponent();
try
{
Users = new List<string>();
int num = int.Parse(dic1["账号数量"]);
for (int i = 0; i < num; i++)
{
string nam = "账号" + (i + 1).ToString();
Users.Add(dic1[nam]);
}
}
catch (Exception ex)
{
new MessageBoxView("提示!", ex.ToString() + "账号数量可能不是数值").ShowDialog();
return;
}
dic = dic1;
lblTitle.Text = title;
ComboBoxProd.ItemsSource = Item;
ComboBoxProd.SelectedIndex = 0;
_model = model;
}
public string userName = "";
private UserModel UserModel = new UserModel();
private SqlHelper mesHelper = new SqlHelper();
private SqlHelper sqlHelper = new SqlHelper();
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
try
{
if (Account.Text == "")
{
new MessageBoxView("提示!", "请输入账号!").ShowDialog();
return;
}
IntPtr p = Marshal.SecureStringToBSTR(this.Password.SecurePassword); // 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串
string password = Marshal.PtrToStringBSTR(p); // 顺便校验一下
if (password == "")
{
new MessageBoxView("提示!", "请输入密码!").ShowDialog();
return;
}
//try
//{
// if (mesHelper.Login(Account.Text.ToLower(), password))
// {
// string user = mesHelper.GetName(Account.Text.ToLower());
// if (user == "")
// {
// new MessageBoxView("提示!", "获取姓名失败!").ShowDialog();
// return;
// }
// _model.name = user;
// _model.pro = ComboBoxProd.Text;
// this.DialogResult = true;
// this.Close();
// }
// else
// {
// new MessageBoxView("提示!", "账号或密码错误!").ShowDialog();
// }
//}
//catch (Exception)
//{
//}
try
{
UserModel user = sqlHelper.GetUser(Account.Text.ToLower());
if (user.nickName == "")
{
new MessageBoxView("提示!", "获取姓名失败!").ShowDialog();
return;
}
string nume = user.nickName + ";" + password;
if (!Users.Contains(nume))
{
new MessageBoxView("提示!", "密码错误").ShowDialog();
return;
}
_model.name = user.nickName;
_model.pro = ComboBoxProd.Text;
_model.bumen = user.bumen;
this.DialogResult = true;
this.Close();
}
catch (Exception ee)
{
new MessageBoxView("错误!", ee.Message.ToString()).ShowDialog();
LogHelper.WriteLog(ee.ToString());
}
//}
}
catch (Exception ee)
{
new MessageBoxView("错误!", ee.Message.ToString()).ShowDialog();
LogHelper.WriteLog(ee.ToString());
}
}
//private void main_PreviewKeyDown(object sender, KeyEventArgs e)
//{
// //if (e.Key == Key.Enter)
// //{
// // btnLogin_Click(null, null);
// //}
// //else if (e.Key == Key.Escape)
// //{
// // this.Close();
// //}
//}
private void main_Loaded(object sender, RoutedEventArgs e)
{
Account.Focus();
Account.SelectAll();
}
}
}

62
View/MessageBoxView.xaml Normal file
View File

@ -0,0 +1,62 @@
<Window x:Class="View.MessageBoxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:View"
mc:Ignorable="d"
Title="提示" Height="270" Width="400" WindowStyle="None" Background="{x:Null}"
ResizeMode="NoResize" x:Name="main"
AllowsTransparency="True" WindowStartupLocation="CenterScreen">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded" >
<BeginStoryboard>
<Storyboard Name="sbOpShow">
<DoubleAnimation
Storyboard.TargetName="main"
Storyboard.TargetProperty="Opacity"
From="0" To="0.95" Duration="0:0:0.15"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Border Background="AliceBlue" Opacity="1" CornerRadius="3">
<Canvas>
<Border Canvas.Top="0" Height="25" Width="{Binding ElementName=main, Path=Width,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0,0,0,1" Background="{StaticResource PrimaryHueMidBrush}">
<TextBlock x:Name="lblTitle" Text="test" HorizontalAlignment="Left"
Foreground="AliceBlue" FontSize="14"
VerticalAlignment="Center" Margin="5"/>
</Border>
<TextBox x:Name="lblMsg"
Foreground="Brown" FontSize="18"
TextWrapping="Wrap" Text="test"
ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Auto"
VerticalContentAlignment="Center"
Canvas.Top="43" Height="173" Width="358" Canvas.Left="22"
/>
<Border BorderBrush="{StaticResource PrimaryHueMidBrush}" BorderThickness="0.5" Height="28"
Canvas.Bottom="10" Canvas.Right="85" MouseLeftButtonDown="Yes_MouseLeftButtonDown"
Name="border1" Width="52" Background="{StaticResource PrimaryHueMidBrush}" CornerRadius="2" Canvas.Left="258" Canvas.Top="224">
<TextBlock Text="确认" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<Border BorderBrush="{StaticResource PrimaryHueMidBrush}" BorderThickness="0.5" Height="28"
Canvas.Bottom="10" Canvas.Right="30" MouseLeftButtonDown="No_MouseLeftButtonDown"
Name="border2" Width="52" CornerRadius="2" Background="{StaticResource PrimaryHueMidBrush}" Canvas.Left="328" Canvas.Top="224">
<TextBlock Text="取消" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Canvas>
</Border>
</Window>

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace View
{
/// <summary>
/// MessageBoxView.xaml 的交互逻辑
/// </summary>
public partial class MessageBoxView : Window
{
public MessageBoxView(string title, string msg)
{
InitializeComponent();
Title = title;
Message = msg;
}
public new string Title
{
get { return this.lblTitle.Text; }
set { this.lblTitle.Text = value; }
}
public string Message
{
get { return this.lblMsg.Text; }
set { this.lblMsg.Text = value; }
}
private void Yes_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DialogResult = true;
this.Close();
}
private void No_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}

View File

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("View")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("View")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//在 <PropertyGroup> 中。例如,如果你使用的是美国英语。
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

71
View/Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace View.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[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
{
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()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("View.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

30
View/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace View.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
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Some files were not shown because too many files have changed in this diff Show More