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

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>