This commit is contained in:
clovejunti 2024-05-30 23:52:57 +08:00
parent 2ae755baa7
commit fff9a50650
49 changed files with 1188 additions and 559 deletions

View File

@ -46,6 +46,8 @@ namespace DeviceRepair.Api
// 使应用程序可以使用不记名令牌来验证用户身份
app.UseOAuthBearerTokens(OAuthOptions);
// 取消注释以下行可允许使用第三方登录提供程序登录
//app.UseMicrosoftAccountAuthentication(
// clientId: "",

View File

@ -123,5 +123,25 @@ namespace DeviceRepair.Api.Controllers
return response;
}
/// <summary>
/// 获取邮箱配置
/// </summary>
/// <param name="ModuleCode"></param>
/// <returns></returns>
[HttpGet, Route("sysEmailConfigByModuleCode"), HttpAuthorize]
public APIResponseData sysEmailConfigByModuleCode(string ModuleCode)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "未能获取到数据" };
try
{
apiResponseData = SystemUtil.Instance.sysEmailConfigByModuleCode(ModuleCode);
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
}
}

View File

@ -2,17 +2,8 @@
using DeviceRepair.Api.CustomAttribute;
using DeviceRepair.DataAccess;
using DeviceRepair.Models;
using DeviceRepair.Models.Common;
using DeviceRepair.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Data;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using System.Xml;
using System.Linq;
using System.Collections.Generic;
namespace DeviceRepair.Api.Controllers
{
@ -183,245 +174,38 @@ namespace DeviceRepair.Api.Controllers
/// </summary>
/// <param name="Batch"></param>
/// <returns></returns>
[HttpPost, HttpAuthorize, Route("GetBatchInfoToStaff")]
public APIResponseData GetBatchInfoToStaff(SfcParams Params)
[HttpGet, HttpAuthorize, Route("GetBatchInfoToStaff")]
public APIResponseData GetBatchInfoToStaff(string Batch)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "获取失败!" };
try
{
string SFCWebServiceUrl = Utils.Config.Configurations.Properties.SFCWebServiceUrl;
bool isSuccess = false;
byte[] password = Encoding.Unicode.GetBytes(Params.LoginCode);
Array.Reverse(password);
string pass64 = Convert.ToBase64String(password);
if (pass64.Length < 10)
pass64 += "YeT+=fue";
StringBuilder builder = new StringBuilder();
builder.AppendLine($"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
builder.AppendLine($"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
builder.AppendLine($" <soap:Header>");
builder.AppendLine($" <SvcAuthentication xmlns=\"http://www.TechScan.cn/\">");
builder.AppendLine($" <Password>{pass64}</Password>");
builder.AppendLine($" <Username>{Params.LoginCode}</Username>");
builder.AppendLine($" </SvcAuthentication>");
builder.AppendLine($" </soap:Header>");
builder.AppendLine($" <soap:Body>");
builder.AppendLine($" <GetBatchInfoToStaff xmlns=\"http://www.TechScan.cn/\">");
builder.AppendLine($" <inParams>{Params.inParams}</inParams>");
builder.AppendLine($" </GetBatchInfoToStaff>");
builder.AppendLine($" </soap:Body>");
builder.AppendLine($"</soap:Envelope>");
using (var client = new HttpClient())
{
var content = new StringContent(builder.ToString(), Encoding.UTF8, "text/xml");
var request = new HttpRequestMessage(HttpMethod.Post, $"{SFCWebServiceUrl}/SfcService.asmx");
request.Content = content;
var response = client.SendAsync(request).Result;
if (response.IsSuccessStatusCode)
{
string stringRtn = response.Content.ReadAsStringAsync().Result;
XmlDocument doc = new XmlDocument();
doc.LoadXml(stringRtn);
XmlNode Node = doc.DocumentElement["soap:Body"]["GetBatchInfoToStaffResponse"]["GetBatchInfoToStaffResult"]["Code"].LastChild;
if (Node.Value == "0")
{
Node = doc.DocumentElement["soap:Body"]["GetBatchInfoToStaffResponse"]["btResults"].LastChild;
byte[] bytes = Convert.FromBase64String(Node.Value);
DataSet ds = bytes.ExactDataSet();
isSuccess = ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0;
if (isSuccess)
return new APIResponseData { Code = 1, Data = ds.Tables[0] };
}
else
{
Node = doc.DocumentElement["soap:Body"]["GetBatchInfoToStaffResponse"]["GetBatchInfoToStaffResult"]["Msg"].LastChild;
return new APIResponseData { Code = -1, Message = Node.Value };
}
}
}
return TsSFCAccess.Instance.GetBatchInfoToStaff(Batch);
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
///// <summary>
///// 获取PE QE 信息
///// </summary>
///// <param name="Batch"></param>
///// <returns></returns>
//[HttpPost, HttpAuthorize, Route("ProductResourceAllocationsGet")]
//public APIResponseData ProductResourceAllocationsGet(SfcParams Params)
//{
// APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "获取失败!" };
// try
// {
// string SFCWebServiceUrl = Utils.Config.Configurations.Properties.SFCWebServiceUrl;
// bool isSuccess = false;
// byte[] password = Encoding.Unicode.GetBytes(Params.LoginCode);
// Array.Reverse(password);
// string pass64 = Convert.ToBase64String(password);
// if (pass64.Length < 10)
// pass64 += "YeT+=fue";
// StringBuilder builder = new StringBuilder();
// builder.AppendLine($"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
// builder.AppendLine($"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
// builder.AppendLine($" <soap:Header>");
// builder.AppendLine($" <SvcAuthentication xmlns=\"http://www.TechScan.cn/\">");
// builder.AppendLine($" <Password>{pass64}</Password>");
// builder.AppendLine($" <Username>{Params.LoginCode}</Username>");
// builder.AppendLine($" </SvcAuthentication>");
// builder.AppendLine($" </soap:Header>");
// builder.AppendLine($" <soap:Body>");
// builder.AppendLine($" <ProductResourceAllocationsGet xmlns=\"http://www.TechScan.cn/\">");
// builder.AppendLine($" <inParams>{Params.inParams}</inParams>");
// builder.AppendLine($" </ProductResourceAllocationsGet>");
// builder.AppendLine($" </soap:Body>");
// builder.AppendLine($"</soap:Envelope>");
// using (var client = new HttpClient())
// {
// var content = new StringContent(builder.ToString(), Encoding.UTF8, "text/xml");
// var request = new HttpRequestMessage(HttpMethod.Post, $"{SFCWebServiceUrl}/SfcAddon.asmx");
// request.Content = content;
// var response = client.SendAsync(request).Result;
// if (response.IsSuccessStatusCode)
// {
// string stringRtn = response.Content.ReadAsStringAsync().Result;
// XmlDocument doc = new XmlDocument();
// doc.LoadXml(stringRtn);
// XmlNode Node = doc.DocumentElement["soap:Body"]["ProductResourceAllocationsGetResponse"]["ProductResourceAllocationsGetResult"]["Code"].LastChild;
// if (Node.Value == "0")
// {
// Node = doc.DocumentElement["soap:Body"]["ProductResourceAllocationsGetResponse"]["btResults"].LastChild;
// byte[] bytes = Convert.FromBase64String(Node.Value);
// DataSet ds = bytes.ExactDataSet();
// isSuccess = ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0;
// if (isSuccess)
// {
// APIResponseData s = StaffsDatasGet(Params);
// if (s.IsSuccess)
// {
// DataTable t2 = s.Data as DataTable;
// Guid[] staffs = ds.Tables[0].AsEnumerable().Select(x => x.Field<Guid>("Staff")).ToArray();
// var query = from row in t2.AsEnumerable()
// where staffs.Contains(row.Field<Guid>("GUID"))
// select row.Field<string>("EMail");
// //t2.AsEnumerable().Where(x=>x.Field<"">)
// return new APIResponseData { Code = 1, Data = ds };
// }
// else
// {
// return new APIResponseData { Code = -1, Message = s.Message };
// }
// }
// }
// else
// {
// Node = doc.DocumentElement["soap:Body"]["ProductResourceAllocationsGetResponse"]["ProductResourceAllocationsGetResult"]["Msg"].LastChild;
// return new APIResponseData { Code = -1, Message = Node.Value };
// }
// }
// }
// }
// catch (Exception ex)
// {
// apiResponseData.Message = ex.Message;
// }
// return apiResponseData;
//}
/// <summary>
/// 获取PE QE 信息
/// 获取当前批次的QE PE邮箱
/// </summary>
/// <param name="Batch"></param>
/// <returns></returns>
[HttpPost, HttpAuthorize, Route("ProductResourceAllocationsGet")]
public APIResponseData ProductResourceAllocationsGet(SfcParams Params)
[HttpGet, HttpAuthorize, Route("CurrentBatchManagerEmail")]
public APIResponseData CurrentBatchManagerEmail(string Batch)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "获取失败!" };
try
{
JObject js = JObject.Parse(Params.inParams);
js.Add("UserCode", "");
js.Add("UserName", "");
js.Add("Post", "");
string SFCWebServiceUrl = Utils.Config.Configurations.Properties.SFCWebServiceUrl;
bool isSuccess = false;
byte[] password = Encoding.Unicode.GetBytes(Params.LoginCode);
Array.Reverse(password);
string pass64 = Convert.ToBase64String(password);
if (pass64.Length < 10)
pass64 += "YeT+=fue";
StringBuilder builder = new StringBuilder();
builder.AppendLine($"<?xml version=\"1.0\" encoding=\"utf-8\"?>");
builder.AppendLine($"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
builder.AppendLine($" <soap:Header>");
builder.AppendLine($" <SvcAuthentication xmlns=\"http://www.TechScan.cn/\">");
builder.AppendLine($" <Password>{pass64}</Password>");
builder.AppendLine($" <Username>{Params.LoginCode}</Username>");
builder.AppendLine($" </SvcAuthentication>");
builder.AppendLine($" </soap:Header>");
builder.AppendLine($" <soap:Body>");
builder.AppendLine($" <StaffsDatasGet xmlns=\"http://www.TechScan.cn/\">");
builder.AppendLine($" <inParams>{js.ToString()}</inParams>");
builder.AppendLine($" </StaffsDatasGet>");
builder.AppendLine($" </soap:Body>");
builder.AppendLine($"</soap:Envelope>");
using (var client = new HttpClient())
{
var content = new StringContent(builder.ToString(), Encoding.UTF8, "text/xml");
var request = new HttpRequestMessage(HttpMethod.Post, $"{SFCWebServiceUrl}/SfcAddon.asmx");
request.Content = content;
var response = client.SendAsync(request).Result;
if (response.IsSuccessStatusCode)
{
string stringRtn = response.Content.ReadAsStringAsync().Result;
XmlDocument doc = new XmlDocument();
doc.LoadXml(stringRtn);
XmlNode Node = doc.DocumentElement["soap:Body"]["StaffsDatasGetResponse"]["StaffsDatasGetResult"]["Code"].LastChild;
if (Node.Value == "0")
{
Node = doc.DocumentElement["soap:Body"]["StaffsDatasGetResponse"]["btResults"].LastChild;
byte[] bytes = Convert.FromBase64String(Node.Value);
DataSet ds = bytes.ExactDataSet();
isSuccess = ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0;
if (isSuccess)
return new APIResponseData { Code = 1, Data = ds.Tables[0] };
}
else
{
Node = doc.DocumentElement["soap:Body"]["StaffsDatasGetResponse"]["StaffsDatasGetResult"]["Msg"].LastChild;
return new APIResponseData { Code = -1, Message = Node.Value };
}
}
}
return TsSFCAccess.Instance.CurrentBatchManagerEmail(Batch);
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
@ -447,5 +231,26 @@ namespace DeviceRepair.Api.Controllers
}
return apiResponseData;
}
/// <summary>
/// 判断当前账户是否PE QE
/// </summary>
/// <param name="UserCode"></param>
/// <returns></returns>
[HttpGet, HttpAuthorize, Route("CurrentIsManager")]
public APIResponseData CurrentIsManager(string UserCode)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "查询失败!" };
try
{
return TsSFCAccess.Instance.CurrentIsManager(UserCode);
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Caching;
using System.Web.Http;
using System.Xml;
@ -53,8 +54,10 @@ namespace DeviceRepair.Api.CustomAttribute
!string.IsNullOrWhiteSpace(model.LoginCode) && !string.IsNullOrWhiteSpace(model.Password)
)
{
if (SfcUserValidate(model.LoginCode, model.Password, model.inParams))
string @Value = Runtime.Cachce[model.LoginCode]?.ToString();
if (desToken.Equals(Value) || SfcUserValidate(model.LoginCode, model.Password, model.inParams))
{
Runtime.Cachce.Add(model.LoginCode, desToken, null, DateTime.Now.AddMinutes(15), TimeSpan.Zero, CacheItemPriority.Normal, null);
return;
}
}
@ -66,85 +69,6 @@ namespace DeviceRepair.Api.CustomAttribute
}
}
//IEnumerable<string> token;
//if (actionContext.Request.Headers.TryGetValues("auth", out token))
//{
// if (token != null && token.Count() > 0)
// {
// try
// {
// TokenModel userInfo = null;
// foreach (string item in token)
// {
// userInfo = DecodeToObject(item);
// if (userInfo != null)
// break;
// }
// if (userInfo != null)
// return;
// }
// catch (Exception ex)
// {
// throw ex;
// }
// }
// return;
//}
//else if (actionContext.Request.Headers.TryGetValues("inParams", out token))
//{
// if (token != null && token.Count() > 0)
// {
// try
// {
// IEnumerable<string> LoginCode;
// IEnumerable<string> Password;
// if (actionContext.Request.Headers.TryGetValues("LoginCode", out LoginCode) &&
// actionContext.Request.Headers.TryGetValues("Password", out Password) &&
// LoginCode != null && LoginCode.Count() > 0
// && Password != null && Password.Count() > 0)
// {
// string inParams = string.Empty;
// string lc = string.Empty;
// string pwd = string.Empty;
// foreach (string item in token)
// {
// if (!string.IsNullOrWhiteSpace(item))
// {
// inParams = item;
// }
// }
// foreach (string item in LoginCode)
// {
// if (!string.IsNullOrWhiteSpace(item))
// {
// lc = item;
// }
// }
// foreach (string item in Password)
// {
// if (!string.IsNullOrWhiteSpace(item))
// {
// pwd = item;
// }
// }
// bool isSuccess = SfcUserValidate(lc, pwd, inParams);
// if (isSuccess)
// return;
// }
// }
// catch (Exception ex)
// {
// throw ex;
// }
// }
// return;
//}
actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized) { Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(Rtn), Encoding.UTF8, "application/json") };
return;
}
@ -226,7 +150,6 @@ namespace DeviceRepair.Api.CustomAttribute
}
}
/// <summary>
/// 通过token反序列化到对象
/// </summary>

View File

@ -54,13 +54,23 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.1.0.0\lib\netstandard1.0\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Primitives.1.0.0\lib\netstandard1.0\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.0\lib\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.Entity" />
@ -235,6 +245,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Providers\ApplicationOAuthProvider.cs" />
<Compile Include="Results\ChallengeResult.cs" />
<Compile Include="Runtime.cs" />
<Compile Include="Startup.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -7,10 +7,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\Users\Clove\Desktop\WebSite</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup>
</Project>

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>C:\Users\Clove\Desktop\WebSite</_PublishTargetUrl>
<History>True|2024-05-29T05:43:17.4797209Z;</History>
<History>True|2024-05-30T09:42:28.4008960Z;True|2024-05-30T17:35:13.0117556+08:00;True|2024-05-30T17:28:00.7834102+08:00;True|2024-05-30T17:10:05.9943745+08:00;True|2024-05-29T13:43:17.4797209+08:00;</History>
</PropertyGroup>
<ItemGroup>
<File Include="Areas/HelpPage/HelpPage.css">
@ -78,37 +78,37 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>05/28/2024 22:39:54</publishTime>
</File>
<File Include="bin/DeviceRepair.Api.dll">
<publishTime>05/30/2024 09:50:08</publishTime>
<publishTime>05/30/2024 17:35:12</publishTime>
</File>
<File Include="bin/DeviceRepair.Api.pdb">
<publishTime>05/30/2024 09:50:08</publishTime>
<publishTime>05/30/2024 17:35:12</publishTime>
</File>
<File Include="bin/DeviceRepair.DataAccess.dll">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/DeviceRepair.DataAccess.dll.config">
<publishTime>05/21/2024 00:58:04</publishTime>
<publishTime>05/30/2024 11:42:20</publishTime>
</File>
<File Include="bin/DeviceRepair.DataAccess.pdb">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/DeviceRepair.Models.dll">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/DeviceRepair.Models.dll.config">
<publishTime>04/16/2024 11:52:33</publishTime>
<publishTime>05/30/2024 11:42:20</publishTime>
</File>
<File Include="bin/DeviceRepair.Models.pdb">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/DeviceRepair.Utils.dll">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/DeviceRepair.Utils.dll.config">
<publishTime>05/21/2024 00:58:03</publishTime>
<publishTime>05/30/2024 11:42:20</publishTime>
</File>
<File Include="bin/DeviceRepair.Utils.pdb">
<publishTime>05/30/2024 09:50:07</publishTime>
<publishTime>05/30/2024 17:06:52</publishTime>
</File>
<File Include="bin/EntityFramework.dll">
<publishTime>05/28/2024 22:39:54</publishTime>
@ -137,6 +137,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<File Include="bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll">
<publishTime>05/28/2024 22:39:56</publishTime>
</File>
<File Include="bin/Microsoft.Extensions.DependencyInjection.Abstractions.dll">
<publishTime>06/22/2016 17:14:56</publishTime>
</File>
<File Include="bin/Microsoft.Extensions.Options.dll">
<publishTime>06/22/2016 17:14:56</publishTime>
</File>
<File Include="bin/Microsoft.Extensions.Primitives.dll">
<publishTime>06/22/2016 17:14:56</publishTime>
</File>
<File Include="bin/Microsoft.Owin.dll">
<publishTime>05/28/2024 22:39:56</publishTime>
</File>
@ -168,7 +177,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>05/28/2024 22:39:57</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.dll">
<publishTime>05/28/2024 22:39:54</publishTime>
<publishTime>11/28/2018 02:07:34</publishTime>
</File>
<File Include="bin/Newtonsoft.Json.pdb">
<publishTime>11/28/2018 01:59:08</publishTime>
</File>
<File Include="bin/Owin.dll">
<publishTime>05/28/2024 22:39:58</publishTime>
@ -345,7 +357,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>04/16/2024 09:58:38</publishTime>
</File>
<File Include="packages.config">
<publishTime>04/16/2024 10:35:55</publishTime>
<publishTime>05/30/2024 11:41:56</publishTime>
</File>
<File Include="Scripts/bootstrap.js">
<publishTime>04/16/2024 09:58:39</publishTime>
@ -402,7 +414,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>04/16/2024 09:58:38</publishTime>
</File>
<File Include="Web.config">
<publishTime>05/29/2024 13:43:16</publishTime>
<publishTime>05/30/2024 17:35:12</publishTime>
</File>
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
using System.Web.Caching;
namespace DeviceRepair.Api
{
public static class Runtime
{
public static Cache @Cachce = new Cache();
}
}

View File

@ -16,9 +16,10 @@
<!--<add key="LogConnection" value="BDE8F7885304F971652793A26A78C05A5037D6280601C6774ABFD7F44C1B873A2A79F9D088CF6FD89C227AE0B44A5226A45982935AAA969DD2083D0C4490A626EF86FF5F3AADCC8AA52F594871B5ECE9280C276380BF31EA4C41A3AFF6AB004294F4CE90472421ADEBC6A8DA326A81AF2C73F29625645A8F0FA12CC730F693B6CD892ED6CA2D5BA4" />-->
<add key="DbConnection" value="BDE8F7885304F971652793A26A78C05A5037D6280601C6774ABFD7F44C1B873A2A79F9D088CF6FD89C227AE0B44A5226DF3BE8D7136A5584B9EF82EF17111DCEFC50467AA2016C983E4A2C388348CD579F2B752522430413AEFDD1725A61A7BE042E02FA82F17FB1F0DC3CC9534BD3625DC8F12EC361EAE5074C4DE21294D7D3" />
<add key="LogConnection" value="BDE8F7885304F971652793A26A78C05A5037D6280601C6774ABFD7F44C1B873A2A79F9D088CF6FD89C227AE0B44A5226A45982935AAA969DD2083D0C4490A626EF86FF5F3AADCC8AA52F594871B5ECE9280C276380BF31EA4C41A3AFF6AB004294F4CE90472421ADEBC6A8DA326A81AF2C73F29625645A8F0FA12CC730F693B6CD892ED6CA2D5BA4" />
<add key="SfcConnection" value="BDE8F7885304F971652793A26A78C05A5037D6280601C6774ABFD7F44C1B873A2A79F9D088CF6FD89C227AE0B44A5226D5B497F9ACC46DF5CB372C6C25F5BE442DF2DACACF468AA62FEA2FB6DD2504E4FAF7BAA6AE05779838552E1B53273F6ABC0800E9B2C271BB5BAF76BC065E1D3DED598497A642BB90" />
<add key="SecureKey" value="A4E3uxwPTQ8Jpi7Sp4" />
<add key="AttachmentDirectory" value="D:\WorkStation\设备维护管理软件\DeviceRepairAPI\Attachment" />
<add key="SFCWebServiceUrl" value="http://localhost/MedtronicSFC5"/>
<add key="SFCWebServiceUrl" value="http://localhost/MedtronicSFC5" />
</appSettings>
<system.web>
<authentication mode="None" />
@ -56,7 +57,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />

View File

@ -32,6 +32,9 @@
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Options" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Extensions.Primitives" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
@ -52,8 +55,20 @@
<package id="Microsoft.Owin.zh-Hans" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Modernizr" version="2.6.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="Respond" version="1.2.0" targetFramework="net452" />
<package id="System.Collections" version="4.0.11" targetFramework="net452" />
<package id="System.ComponentModel" version="4.0.1" targetFramework="net452" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net452" />
<package id="System.Globalization" version="4.0.11" targetFramework="net452" />
<package id="System.Linq" version="4.1.0" targetFramework="net452" />
<package id="System.Linq.Expressions" version="4.1.0" targetFramework="net452" />
<package id="System.Reflection" version="4.1.0" targetFramework="net452" />
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="net452" />
<package id="System.Runtime" version="4.1.0" targetFramework="net452" />
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net452" />
<package id="System.Threading" version="4.0.11" targetFramework="net452" />
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="net452" />
<package id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages>

View File

@ -1,6 +1,7 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
@ -12,6 +13,8 @@ namespace DeviceRepair.DataAccess
private static readonly string logConn = Utils.Config.Configurations.Properties.logConn;
private static readonly string sfc = Utils.Config.Configurations.Properties.SfcConn;
public SqlSugarClient db;
//{
// get
@ -21,16 +24,16 @@ namespace DeviceRepair.DataAccess
// {
// ConnectionString = connectionString,
// DbType = DbType.SqlServer,
// InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
// IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true,
// ConfigId = "main"
// },
// new ConnectionConfig()
// {
// ConnectionString = logConn,
// DbType = DbType.SqlServer,
// InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
// IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true,
// ConfigId = "log"
// }
// });
@ -49,22 +52,44 @@ namespace DeviceRepair.DataAccess
public DbContext()
{
SqlConnectionStringBuilder TsSFCdb = new SqlConnectionStringBuilder(sfc);
TsSFCdb.InitialCatalog = "SFCData";
string SFCData = TsSFCdb.ConnectionString;
TsSFCdb.InitialCatalog = "SFCAddOn";
string SFCAddOn = TsSFCdb.ConnectionString;
db = new SqlSugarClient(new List<ConnectionConfig> {
new ConnectionConfig()
{
ConnectionString = connectionString,
DbType = DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConfigId = "main"
},
new ConnectionConfig()
{
ConnectionString = logConn,
DbType = DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConfigId = "log"
},
new ConnectionConfig()
{
ConnectionString = SFCData,
DbType = DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConfigId = "data"
},
new ConnectionConfig()
{
ConnectionString = SFCAddOn,
DbType = DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConfigId = "addon"
}
});

View File

@ -54,6 +54,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RoleAccess.cs" />
<Compile Include="SystemUtil.cs" />
<Compile Include="TsSFCAccess.cs" />
<Compile Include="UserAccess.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -1,4 +1,5 @@
using DeviceRepair.Models;
using DeviceRepair.Models.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
@ -152,6 +153,40 @@ namespace DeviceRepair.DataAccess
}
return apiResponseData;
}
/// <summary>
/// 获取邮箱配置
/// </summary>
/// <param name="ModuleCode"></param>
/// <returns></returns>
public APIResponseData sysEmailConfigByModuleCode(string ModuleCode)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = $"获取数据失败!" };
try
{
if (string.IsNullOrWhiteSpace(ModuleCode))
{
throw new Exception($"邮件模块编码不能为空!");
}
base.db.ChangeDatabase("main");
SysEmailConfigInfo config = db.Queryable<SysEmailConfigInfo>().First(x => x.MuduleCode == ModuleCode);
apiResponseData.Code = 1;
apiResponseData.Message = "";
apiResponseData.Data = config;
}
catch (SqlSugarException ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
}
}

View File

@ -0,0 +1,133 @@
using DeviceRepair.Models;
using DeviceRepair.Models.SFC;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
namespace DeviceRepair.DataAccess
{
public class TsSFCAccess : DbContext<InspBatchInfo>
{
private static TsSFCAccess manager;
public static TsSFCAccess Instance
{
get
{
if (manager == null)
manager = new TsSFCAccess();
return manager;
}
}
/// <summary>
/// 判断批次是否存在
/// </summary>
/// <param name="Batch"></param>
/// <returns></returns>
public APIResponseData GetBatchInfoToStaff(string Batch)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = $"获取数据失败!" };
try
{
db.ChangeDatabase("data");
int Count = db.Queryable<InspBatchInfo>().Count(x => x.Batch.ToUpper().Equals(Batch.ToUpper()));
apiResponseData.Code = 1;
apiResponseData.Message = "";
apiResponseData.Data = Count;
}
catch (SqlSugarException ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
/// <summary>
/// 判断当前账户是否PE QE
/// </summary>
/// <param name="UserCode"></param>
/// <param name="UserName"></param>
/// <param name="Post"></param>
/// <returns></returns>
public APIResponseData CurrentIsManager(string UserCode)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = $"获取数据失败!" };
try
{
db.ChangeDatabase("addon");
int Count = db.Queryable<UserPostsInfo>().Count(x => x.UserCode == UserCode);
apiResponseData.Code = 1;
apiResponseData.Message = "";
apiResponseData.Data = Count;
}
catch (SqlSugarException ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
/// <summary>
/// 获取当前批次的QE PE邮箱
/// </summary>
/// <param name="Batch"></param>
/// <returns></returns>
public APIResponseData CurrentBatchManagerEmail(string Batch)
{
APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = $"获取数据失败!" };
List<string> emailLst = new List<string>();
try
{
db.ChangeDatabase("data");
InspBatchInfo BatchInfo = db.Queryable<InspBatchInfo>().First(x => x.Batch.ToUpper().Equals(Batch.ToUpper()));
if (BatchInfo != null)
{
db.ChangeDatabase("addon");
List<ResourceAllocationsInfo> allocationsInfos = db.Queryable<ResourceAllocationsInfo>().Where(x => x.Product.Trim().Equals(BatchInfo.Product.ToUpper()) &&
x.Technology.Trim().ToUpper() == BatchInfo.Technology.Trim().ToUpper()).ToList();
if (allocationsInfos != null)
{
Guid[] guids = allocationsInfos.Select(x => x.Staff).ToArray();
List<StaffsInfo> staffs = db.Queryable<StaffsInfo>().Where(x => SqlFunc.ContainsArray(guids, x.Guid) && (x.Post == "0" || x.Post == "1")).ToList();
if (staffs != null && staffs.Count > 0)
{
emailLst.AddRange(staffs.Select(x => x.EMail).ToArray());
}
}
}
apiResponseData.Code = 1;
apiResponseData.Message = "";
apiResponseData.Data = emailLst;
}
catch (SqlSugarException ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
catch (Exception ex)
{
apiResponseData.Code = -1;
apiResponseData.Message = ex.Message;
}
return apiResponseData;
}
}
}

View File

@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -0,0 +1,77 @@
using SqlSugar;
using System;
namespace DeviceRepair.Models.Common
{
/// <summary>
/// 邮件配置表
///</summary>
[SugarTable("sysEmailConfig")]
public class SysEmailConfigInfo
{
/// <summary>
/// 主键编号
///</summary>
[SugarColumn(ColumnName = "AutoID", IsPrimaryKey = true, IsIdentity = true)]
public int AutoID { get; set; }
/// <summary>
/// 唯一编号
/// 默认值: (newid())
///</summary>
[SugarColumn(ColumnName = "GUID")]
public Guid Guid { get; set; }
/// <summary>
/// 模块编码
///</summary>
[SugarColumn(ColumnName = "MuduleCode")]
public string MuduleCode { get; set; }
/// <summary>
/// 邮箱账户
///</summary>
[SugarColumn(ColumnName = "EmailAddress")]
public string EmailAddress { get; set; }
/// <summary>
/// 邮箱密码Des加密
///</summary>
[SugarColumn(ColumnName = "EmailPassWord")]
public string EmailPassWord { get; set; }
/// <summary>
/// 邮箱是否为无密码模式
///</summary>
[SugarColumn(ColumnName = "EmailNoPass")]
public bool EmailNoPass { get; set; }
/// <summary>
/// 邮箱发件url
///</summary>
[SugarColumn(ColumnName = "SmtpServer")]
public string SmtpServer { get; set; }
/// <summary>
/// 邮箱发件端口
///</summary>
[SugarColumn(ColumnName = "SmtpPort")]
public int SmtpPort { get; set; }
/// <summary>
/// 是否SSL加密
///</summary>
[SugarColumn(ColumnName = "SmtpSSL")]
public bool SmtpSSL { get; set; }
/// <summary>
/// 状态
/// C 创建
/// A 激活
/// L 锁定
/// D 删除
///</summary>
[SugarColumn(ColumnName = "Status")]
public string Status { get; set; }
}
}

View File

@ -30,8 +30,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.0\lib\SqlSugar.dll</HintPath>
@ -59,6 +59,7 @@
<Compile Include="Common\SFCTokenModel.cs" />
<Compile Include="Common\SheetDataItem.cs" />
<Compile Include="Common\SysConfigInfo.cs" />
<Compile Include="Common\SysEmailConfigInfo.cs" />
<Compile Include="DeviceRepair\DeviceRunningStatus.cs" />
<Compile Include="DeviceRepair\DeviceWarrantyEvaluatorInfo.cs" />
<Compile Include="DeviceRepair\DeviceWarrantyRequestAccessoriesInfo.cs" />
@ -120,6 +121,10 @@
<Compile Include="Role\RoleAuthModel.cs" />
<Compile Include="Role\RoleEditSubmitModel.cs" />
<Compile Include="Role\RoleModel.cs" />
<Compile Include="SFC\Addon\ResourceAllocationsInfo.cs" />
<Compile Include="SFC\Addon\StaffsInfo.cs" />
<Compile Include="SFC\Addon\UserPostsInfo.cs" />
<Compile Include="SFC\Data\InspBatchInfo.cs" />
<Compile Include="User\TokenModel.cs" />
<Compile Include="User\UserInfoModel.cs" />
<Compile Include="Plan\View\View_CurrentMonthPlanTips.cs" />

View File

@ -0,0 +1,49 @@
using SqlSugar;
using System;
namespace DeviceRepair.Models.SFC
{
/// <summary>
///
///</summary>
[SugarTable("ResourceAllocations")]
public class ResourceAllocationsInfo
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
public Guid Guid { get; set; }
/// <summary>
/// 产品号
///</summary>
[SugarColumn(ColumnName = "Product")]
public string Product { get; set; }
/// <summary>
/// 工艺版本
///</summary>
[SugarColumn(ColumnName = "Technology")]
public string Technology { get; set; }
/// <summary>
/// 岗位
///</summary>
[SugarColumn(ColumnName = "Staff")]
public Guid Staff { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateBy")]
public string CreateBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateOn")]
public DateTime? CreateOn { get; set; }
}
}

View File

@ -0,0 +1,85 @@
using SqlSugar;
using System;
namespace DeviceRepair.Models.SFC
{
/// <summary>
///
///</summary>
[SugarTable("Staffs")]
public class StaffsInfo
{
/// <summary>
/// 0:QE 1:PE 2:ME
///</summary>
[SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
public Guid Guid { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Post")]
public string Post { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Image")]
public string Image { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Code")]
public string Code { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Name")]
public string Name { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Telephone")]
public string Telephone { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "EMail")]
public string EMail { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Status")]
public string Status { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateBy")]
public string CreateBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateOn")]
public DateTime CreateOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyBy")]
public string ModifyBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyOn")]
public DateTime? ModifyOn { get; set; }
}
}

View File

@ -0,0 +1,49 @@
using SqlSugar;
using System;
namespace DeviceRepair.Models.SFC
{
/// <summary>
///
///</summary>
[SugarTable("UserPosts")]
public class UserPostsInfo
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
public Guid Guid { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "UserCode")]
public string UserCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Post")]
public Guid Post { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateBy")]
public string CreateBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateOn")]
public DateTime CreateOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateClient")]
public string CreateClient { get; set; }
}
}

View File

@ -0,0 +1,261 @@
using SqlSugar;
using System;
namespace DeviceRepair.Models.SFC
{
/// <summary>
///
///</summary>
[SugarTable("InspBatch")]
public class InspBatchInfo
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Id", IsIdentity = true)]
public int Id { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
public Guid Guid { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Batch", IsPrimaryKey = true)]
public string Batch { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Product")]
public string Product { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MoCode")]
public string MoCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MoQty")]
public decimal? MoQty { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ufts")]
public byte[] Ufts { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateBy")]
public string CreateBy { get; set; }
/// <summary>
///
/// 默认值: (getdate())
///</summary>
[SugarColumn(ColumnName = "CreateOn")]
public DateTime CreateOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyBy")]
public string ModifyBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyOn")]
public DateTime? ModifyOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "bComplete")]
public bool? BComplete { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CompleteQty")]
public decimal? CompleteQty { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ScrapQty")]
public decimal? ScrapQty { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CompleteBy")]
public string CompleteBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CompleteOn")]
public DateTime? CompleteOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "bClosed")]
public bool? BClosed { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ClosedBy")]
public string ClosedBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ClosedOn")]
public DateTime? ClosedOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ClosedDesc")]
public string ClosedDesc { get; set; }
/// <summary>
///
/// 默认值: ('A')
///</summary>
[SugarColumn(ColumnName = "Status")]
public string Status { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "bLocked")]
public bool? BLocked { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedBy")]
public string LockedBy { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedOn")]
public DateTime? LockedOn { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedType")]
public string LockedType { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedDesc")]
public string LockedDesc { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedIP")]
public string LockedIP { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedMAC")]
public string LockedMAC { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "LockedName")]
public string LockedName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Note")]
public string Note { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CompleteBanCi")]
public string CompleteBanCi { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateBanCi")]
public string CreateBanCi { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyBanCi")]
public string ModifyBanCi { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateClient")]
public string CreateClient { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ModifyClient")]
public string ModifyClient { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CompleteClient")]
public string CompleteClient { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CloseClient")]
public string CloseClient { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ProductName")]
public string ProductName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "SapNo")]
public string SapNo { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "IsFA")]
public bool? IsFA { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Technology")]
public string Technology { get; set; }
}
}

View File

@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="sqlSugar" version="5.0.0" targetFramework="net452" />
</packages>

View File

@ -13,6 +13,10 @@
[Config("LogConnection")]
public string logConn { get; set; }
[DESEncrypted(true)]
[Config("SfcConnection")]
public string SfcConn { get; set; }
/// <summary>
/// 加密Key
/// </summary>

View File

@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

BIN
DeviceRepairAndOptimization.sln (Stored with Git LFS)

Binary file not shown.

View File

@ -64,7 +64,7 @@
<!--<probing privatePath="libs;devs;" />-->
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -221,9 +221,8 @@
<HintPath>..\packages\Microsoft.IdentityModel.Tokens.6.32.3\lib\net45\Microsoft.IdentityModel.Tokens.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.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>

View File

@ -18,7 +18,7 @@
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.32.3" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Logging" version="6.32.3" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Tokens" version="6.32.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="NPOI" version="2.5.6" targetFramework="net452" />
<package id="PDFsharp" version="1.50.5147" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net452" />

View File

@ -7,7 +7,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -41,8 +41,8 @@
<Reference Include="DevExpress.XtraGrid.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraPrinting.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.0\lib\SqlSugar.dll</HintPath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="sqlSugar" version="5.0.0" targetFramework="net452" />
</packages>

View File

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
@ -13,4 +13,12 @@
<add key="SecureKey" value="A4E3uxwPTQ8Jpi7Sp4" />
<add key="AttachmentDirectory" value="D:\WorkStation\设备维护管理软件\DeviceRepairAPI\Attachment" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -64,8 +64,8 @@
<Reference Include="HttpHelper">
<HintPath>..\DeviceRepairAndOptimization\DLLs\HttpHelper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.0\lib\SqlSugar.dll</HintPath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="sqlSugar" version="5.0.0" targetFramework="net452" />
</packages>

View File

@ -1,9 +1,9 @@
using Newtonsoft.Json;
using DeviceRepair.Models;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Text;
using TsSFCDeivceClient.Common;
using TsSFCDeivceClient.Model;
namespace TsSFCDeivceClient.Biz
{

View File

@ -40,6 +40,16 @@
/// <summary>
/// 获取PE QE 信息
/// </summary>
public const string ProductResourceAllocationsGet = "/Api/Maintenance/ProductResourceAllocationsGet";
public const string CurrentBatchManagerEmail = "/Api/Maintenance/CurrentBatchManagerEmail";
/// <summary>
/// 判断当前账户是否PE QE
/// </summary>
public const string CurrentIsManager = "/Api/Maintenance/CurrentIsManager";
/// <summary>
/// 邮箱发送配置
/// </summary>
public const string SysEmailConfig = "/Api/Common/sysEmailConfigByModuleCode";
}
}

View File

@ -1,6 +1,8 @@
using DevExpress.XtraBars.ToolbarForm;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.DXErrorProvider;
using DeviceRepair.Models;
using DeviceRepair.Models.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@ -10,9 +12,6 @@ using System.Text.RegularExpressions;
using System.Windows.Forms;
using TsSFCDeivceClient.Common;
using TsSFCDeivceClient.Email;
using TsSFCDeivceClient.Model;
using TsSFCDeivceClient.Model.Common;
using TsSFCDeivceClient.Model.DeviceWarrantyRequest;
namespace TsSFCDeivceClient
{
@ -20,7 +19,7 @@ namespace TsSFCDeivceClient
{
MailKitHelp mail = new MailKitHelp();
string emailPattern = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
public DeviceInfo CurrentDeviceInfo = null;
public DeviceInformationInfo CurrentDeviceInfo = null;
System.Configuration.Configuration m_Config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
string ServiceUrl
{
@ -86,25 +85,44 @@ namespace TsSFCDeivceClient
mail = new MailKitHelp();
}
//发件服务器设置
APIResponseData apiRtn = Biz.HttpHelper.Instance.Get($"{ServiceUrl}{DeviceApiUrlConstValue.SysEmailConfig}?ModuleCode=DeviceWarranty");
if (!apiRtn.IsSuccess)
throw new Exception(apiRtn.Message);
// mail.medtronic.com
mail.SmtpAddress = m_Config.AppSettings.Settings["SmtpServer"].Value.Trim();
SysEmailConfigInfo config = apiRtn.ToDeserializeObject<SysEmailConfigInfo>();
// false
mail.IsSSL = bool.Parse(m_Config.AppSettings.Settings["SmtpSSL"].Value.Trim());
// 25
mail.SmtpPort = int.Parse(m_Config.AppSettings.Settings["SmtpPort"].Value.Trim());
//是否启用无密码模式
if (bool.Parse(m_Config.AppSettings.Settings["EmailNoPass"].Value.Trim()))
mail.FromMailAddress = config.EmailAddress;
mail.SmtpAddress = config.SmtpServer;
mail.IsSSL = config.SmtpSSL;
mail.SmtpPort = config.SmtpPort;
if (!config.EmailNoPass)
{
mail.PassWord = DESEncrypt.Decrypt(config.EmailPassWord);
}
else
{
mail.IsUseDefaultCredentials = true;
}
else
mail.PassWord = m_Config.AppSettings.Settings["EmailPassWord"].Value.Trim();
mail.FromMailAddress = m_Config.AppSettings.Settings["EmailAddress"].Value.Trim();
//// mail.medtronic.com
//mail.SmtpAddress = m_Config.AppSettings.Settings["SmtpServer"].Value.Trim();
//// false
//mail.IsSSL = bool.Parse(m_Config.AppSettings.Settings["SmtpSSL"].Value.Trim());
//// 25
//mail.SmtpPort = int.Parse(m_Config.AppSettings.Settings["SmtpPort"].Value.Trim());
////是否启用无密码模式
//if (bool.Parse(m_Config.AppSettings.Settings["EmailNoPass"].Value.Trim()))
//{
// mail.IsUseDefaultCredentials = true;
//}
//else
// mail.PassWord = m_Config.AppSettings.Settings["EmailPassWord"].Value.Trim();
//mail.FromMailAddress = m_Config.AppSettings.Settings["EmailAddress"].Value.Trim();
return true;
}
@ -210,22 +228,24 @@ namespace TsSFCDeivceClient
if (dxValidationProvider1.Validate())
{
string cBatch = txtBatch.EditValue + "";
List<string> emailLst = new List<string>();
// 有在生产的批次
DataTable dtRtn = null;
if (InProduction)
{
JObject js = JObject.Parse(Runtime.inParams);
js.Add("Batch", cBatch);
APIResponseData apiRtn = Biz.HttpHelper.Instance.Get($"{ServiceUrl}{DeviceApiUrlConstValue.GetBatchInfoToStaff}?Batch={cBatch}");
if (!apiRtn.IsSuccess)
throw new Exception(apiRtn.Message);
APIResponseData apiResponseData2 = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.GetBatchInfoToStaff}", JsonConvert.SerializeObject(new { LoginCode = Runtime.CurrentUser.UserCode, Password = Runtime.CurrentUser.Password, inParams = js.ToString() }));
if (!apiResponseData2.IsSuccess)
throw new Exception(apiResponseData2.Message);
if (apiRtn.ToInt() == 0)
throw new Exception("当前批次不存在!");
dtRtn = apiResponseData2.ToDeserializeObject<DataTable>();
apiRtn = Biz.HttpHelper.Instance.Get($"{ServiceUrl}{DeviceApiUrlConstValue.CurrentBatchManagerEmail}?Batch={cBatch}");
if (!apiRtn.IsSuccess)
throw new Exception(apiRtn.Message);
emailLst.AddRange(apiRtn.ToDeserializeObject<List<string>>());
}
DeviceWarrantyRequestForm deviceWarrantyRequestForm = new DeviceWarrantyRequestForm
DeviceWarrantyRequestFormView deviceWarrantyRequestForm = new DeviceWarrantyRequestFormView
{
EquipmentPK = CurrentDeviceInfo.AutoID,
EquipmentID = CurrentDeviceInfo.EquipmentID,
@ -239,46 +259,14 @@ namespace TsSFCDeivceClient
ReceivingDep = "设备设施部"
};
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.DeviceDownFormAdd}", deviceWarrantyRequestForm.toJson());
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.DeviceDownFormAdd}", JsonConvert.SerializeObject(deviceWarrantyRequestForm));
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
int MaintenanceAutoID = Convert.ToInt32(apiResponseData.Data);
try
{
List<string> EmailList = new List<string>();
if (dtRtn != null && dtRtn.Rows.Count > 0 && dtRtn.Columns.Contains("Product") && dtRtn.Columns.Contains("Technology"))
{
string Product = dtRtn.Rows[0]["Product"] + "";
string Technology = dtRtn.Rows[0]["Technology"] + "";
JObject js = JObject.Parse(Runtime.inParams);
js.Add("Product", Product);
js.Add("Technology", Technology);
apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.ProductResourceAllocationsGet}", JsonConvert.SerializeObject(new { LoginCode = Runtime.CurrentUser.UserCode, Password = Runtime.CurrentUser.Password, inParams = js.ToString() }));
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
DataTable staffResourceAllocations = apiResponseData.ToDeserializeObject<DataTable>();
//IList<StaffResourceAllocations> staffResourceAllocations = p_InspRespos.ProductResourceAllocationsGet(Product, Technology);
if (staffResourceAllocations != null && (staffResourceAllocations.Rows?.Count ?? 0) > 0)
{
foreach (DataRow item in staffResourceAllocations.Rows)
{
if ((item["Post"]?.ToString() ?? "-1") == "0" || (item["Post"]?.ToString() ?? "-1") == "1")
{
string eml = item["EMail"]?.ToString() ?? "";
if (!string.IsNullOrWhiteSpace(eml) && Regex.IsMatch(eml, emailPattern))
{
EmailList.Add(eml);
}
}
}
}
}
if (EmailList.Count > 0 && InitializeMail())
if (emailLst.Count > 0 && InitializeMail())
{
mail.Title = $"有在生产的设备出现故障,请您尽快评估故障状态!";
mail.IsBodyHtml = true;
@ -288,7 +276,7 @@ namespace TsSFCDeivceClient
mail.Body = builder.ToString();
string msgResult = "";
//收件人
mail.ToMailAddress = EmailList.ToArray();
mail.ToMailAddress = emailLst.ToArray();
MailKitHelp.SendStatus ss = mail.Send(out msgResult);
}
}
@ -297,8 +285,6 @@ namespace TsSFCDeivceClient
XtraMessageBoxHelper.Warn($"新增数据成功,邮件发送失败,失败原因:{ex.Message}");
}
DialogResult = DialogResult.OK;
}
}

View File

@ -547,6 +547,7 @@ namespace TsSFCDeivceClient
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11.25F);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.IconOptions.Image = global::TsSFCDeivceClient.Properties.Resources.Maintenance;
this.IconOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("DowntimeFormAdd.IconOptions.LargeImage")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "DowntimeFormAdd";

View File

@ -13,7 +13,5 @@ namespace TsSFCDeivceClient.Model
public string UserName { get; set; }
public string Password { get; set; }
public bool HasPost { get; set; }
}
}

View File

@ -1,48 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace TsSFCDeivceClient.Properties {
using System;
namespace TsSFCDeivceClient.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TsSFCDeivceClient.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
@ -55,16 +51,23 @@ namespace TsSFCDeivceClient.Properties
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Maintenance {
get {
object obj = ResourceManager.GetObject("Maintenance", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<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="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<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>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Maintenance" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Maintenance.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
TsSFCDeivceClient/Resources/Maintenance.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -38,16 +38,35 @@
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.Data.Desktop.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.Data.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.Printing.v20.2.Core, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.Utils.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.XtraBars.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.XtraEditors.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.XtraGrid.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.XtraLayout.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.XtraPrinting.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
<Private>False</Private>
</Reference>
<Reference Include="DevExpress.Data.Desktop.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v20.2.Core, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraBars.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v20.2, Version=20.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="HttpHelper">
<HintPath>..\DeviceRepairAndOptimization\DLLs\HttpHelper.dll</HintPath>
</Reference>
@ -56,16 +75,20 @@
</Reference>
<Reference Include="MailKit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
<HintPath>..\packages\MailKit.3.0.0\lib\net452\MailKit.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MimeKit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKit.3.0.0\lib\net452\MimeKit.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
@ -103,18 +126,7 @@
<Compile Include="frmWaiting.Designer.cs">
<DependentUpon>frmWaiting.cs</DependentUpon>
</Compile>
<Compile Include="Model\APIResponseData.cs" />
<Compile Include="Model\Common\FieldsInfo.cs" />
<Compile Include="Model\Common\LookUpItemModel.cs" />
<Compile Include="Model\DeviceApiUrlConstValue.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceInfo.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceRunningStatus.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyEvaluatorInfo.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyRequestAccessoriesInfo.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyRequestForm.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyRequestFormFilter.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyRequestFormStatus.cs" />
<Compile Include="Model\DeviceWarrantyRequest\DeviceWarrantyRequestMaintaionInfo.cs" />
<Compile Include="Model\UserInfo.cs" />
<Compile Include="pageDeivceView.cs">
<SubType>Form</SubType>
@ -152,6 +164,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
@ -167,10 +180,24 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\DeviceRepair.DataAccess\DeviceRepair.DataAccess.csproj">
<Project>{4e787bc1-b925-4829-a81f-b0075d8d6790}</Project>
<Name>DeviceRepair.DataAccess</Name>
</ProjectReference>
<ProjectReference Include="..\DeviceRepair.Models\DeviceRepair.Models.csproj">
<Project>{2a1ffb12-b20f-4f9b-905e-1f928f17b4ee}</Project>
<Name>DeviceRepair.Models</Name>
</ProjectReference>
<ProjectReference Include="..\DeviceRepair.Utils\DeviceRepair.Utils.csproj">
<Project>{2ae8089a-c70a-47be-921b-de6a502f8d04}</Project>
<Name>DeviceRepair.Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Email\MailFailed.html" />
<Content Include="Email\MailSuccess.html" />
<None Include="Resources\Maintenance.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,10 +1,9 @@
using DevExpress.XtraBars.ToolbarForm;
using DeviceRepair.Models;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TsSFCDeivceClient.Common;
using TsSFCDeivceClient.Model;
using TsSFCDeivceClient.Model.DeviceWarrantyRequest;
namespace TsSFCDeivceClient
{
@ -12,7 +11,7 @@ namespace TsSFCDeivceClient
{
int m_SelectedCurrentRowIndex = 0;
public DeviceInfo CurrentDeviceInfo = null;
public DeviceInformationInfo CurrentDeviceInfo = null;
System.Configuration.Configuration m_Config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
string ServiceUrl
{
@ -55,7 +54,7 @@ namespace TsSFCDeivceClient
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
List<DeviceInfo> lst = apiResponseData.ToDeserializeObject<List<DeviceInfo>>();
List<DeviceInformationInfo> lst = apiResponseData.ToDeserializeObject<List<DeviceInformationInfo>>();
CloseWaitForm();
gridControl1.DataSource = lst;
@ -117,7 +116,7 @@ namespace TsSFCDeivceClient
if (e.FocusedRowHandle >= 0)
{
m_SelectedCurrentRowIndex = e.FocusedRowHandle;
CurrentDeviceInfo = gridView1.GetRow(e.FocusedRowHandle) as DeviceInfo;
CurrentDeviceInfo = gridView1.GetRow(e.FocusedRowHandle) as DeviceInformationInfo;
#region
if (gridView1.SelectedRowsCount > 0)

View File

@ -39,8 +39,8 @@ namespace TsSFCDeivceClient
this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
this.gcEquipmentID = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcEquipmentName = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcRemarks = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcSpecification = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcRemarks = new DevExpress.XtraGrid.Columns.GridColumn();
this.stackPanel1 = new DevExpress.Utils.Layout.StackPanel();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.txt_Filter = new DevExpress.XtraEditors.TextEdit();
@ -102,7 +102,7 @@ namespace TsSFCDeivceClient
//
// gridControl1
//
this.gridControl1.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(2);
this.gridControl1.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.gridControl1.Location = new System.Drawing.Point(12, 60);
this.gridControl1.MainView = this.gridView1;
this.gridControl1.Name = "gridControl1";
@ -138,6 +138,14 @@ namespace TsSFCDeivceClient
this.gcEquipmentName.Visible = true;
this.gcEquipmentName.VisibleIndex = 1;
//
// gcSpecification
//
this.gcSpecification.Caption = "规格型号";
this.gcSpecification.FieldName = "Specification";
this.gcSpecification.Name = "gcSpecification";
this.gcSpecification.Visible = true;
this.gcSpecification.VisibleIndex = 3;
//
// gcRemarks
//
this.gcRemarks.Caption = "说明";
@ -147,14 +155,6 @@ namespace TsSFCDeivceClient
this.gcRemarks.Visible = true;
this.gcRemarks.VisibleIndex = 2;
//
// gcSpecification
//
this.gcSpecification.Caption = "规格型号";
this.gcSpecification.FieldName = "Specification";
this.gcSpecification.Name = "gcSpecification";
this.gcSpecification.Visible = true;
this.gcSpecification.VisibleIndex = 3;
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.labelControl1);
@ -420,6 +420,7 @@ namespace TsSFCDeivceClient
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11.25F);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.IconOptions.Image = global::TsSFCDeivceClient.Properties.Resources.Maintenance;
this.IconOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("pageDeivceView.IconOptions.LargeImage")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "pageDeivceView";

View File

@ -1,5 +1,7 @@
using DevExpress.XtraBars.ToolbarForm;
using DevExpress.XtraEditors;
using DeviceRepair.Models;
using DeviceRepair.Models.Common;
using Newtonsoft.Json;
using System;
using System.Collections;
@ -9,11 +11,8 @@ using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using TsSFC.Base.Model.Device;
using TsSFCDeivceClient.Common;
using TsSFCDeivceClient.Model;
using TsSFCDeivceClient.Model.Common;
using TsSFCDeivceClient.Model.DeviceWarrantyRequest;
namespace TsSFCDeivceClient
{
@ -32,6 +31,9 @@ namespace TsSFCDeivceClient
}
List<LookUpItemModel> lookupMaintenanceStatus;
#region
DeviceWarrantyRequestFormFilter _filter;
DeviceWarrantyRequestFormFilter FilterInfo
{
@ -86,68 +88,95 @@ namespace TsSFCDeivceClient
{
get { return Convert.ToDateTime(de_EndDate.EditValue); }
}
#endregion
bool HasAuth = false;
public pageDeviceMaintenanceFormView(UserInfo user, string APPVERSION)
public pageDeviceMaintenanceFormView(UserInfo user, string APPVERSION = "5.0.0.0")
{
InitializeComponent();
Runtime.CurrentUser = user;
Runtime.inParams = JsonConvert.SerializeObject(new { OPERATORGUID = user.GUID, OPERATOR = user.UserCode, CLIENTIP = ComputerHelper.Instance().IpAddress, CLIENTMAC = ComputerHelper.Instance().MacAddress, CLIENTNAME = ComputerHelper.Instance().ComputerName , APPVERSION = APPVERSION });
HasAuth = user.HasPost;
Runtime.inParams = JsonConvert.SerializeObject(new { OPERATORGUID = user.GUID, OPERATOR = user.UserCode, CLIENTIP = ComputerHelper.Instance().IpAddress, CLIENTMAC = ComputerHelper.Instance().MacAddress, CLIENTNAME = ComputerHelper.Instance().ComputerName, APPVERSION = APPVERSION });
//HasAuth = user.HasPost;
this.Load += PageDeviceMaintenanceFormView_Load;
}
private void PageDeviceMaintenanceFormView_Load(object sender, EventArgs e)
{
if (Runtime.CurrentUser == null)
try
{
XtraMessageBoxHelper.Error($"非法的调用,请重试。");
this.Close();
}
splashScreenManager1.ShowWaitForm();
if (string.IsNullOrWhiteSpace(ServiceUrl))
{
XtraMessageBoxHelper.Error($"缺少配置字段设备管理软件接口地址【ServiceApiUrl】。");
this.Close();
}
if (lookupMaintenanceStatus == null)
lookupMaintenanceStatus = new List<LookUpItemModel>();
foreach (DeviceWarrantyRequestFormStatus item in Enum.GetValues(typeof(DeviceWarrantyRequestFormStatus)))
{
lookupMaintenanceStatus.Add(new LookUpItemModel
if (Runtime.CurrentUser == null)
{
ValueMember = (int)item,
DisplayMember = item.ToDescription()
});
XtraMessageBoxHelper.Error($"非法的调用,请重试。");
this.Close();
}
if (string.IsNullOrWhiteSpace(ServiceUrl))
{
XtraMessageBoxHelper.Error($"缺少配置字段设备管理软件接口地址【ServiceApiUrl】。");
this.Close();
}
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Get($"{ServiceUrl}{DeviceApiUrlConstValue.CurrentIsManager}?UserCode={Runtime.CurrentUser.UserCode}");
if (!apiResponseData.IsSuccess)
{
XtraMessageBoxHelper.Error(apiResponseData.Message);
this.Close();
}
HasAuth = apiResponseData.ToInt() > 0;
if (lookupMaintenanceStatus == null)
lookupMaintenanceStatus = new List<LookUpItemModel>();
foreach (DeviceWarrantyRequestFormStatus item in Enum.GetValues(typeof(DeviceWarrantyRequestFormStatus)))
{
lookupMaintenanceStatus.Add(new LookUpItemModel
{
ValueMember = (int)item,
DisplayMember = item.ToDescription()
});
}
cb_Status.Properties.DataSource = lookupMaintenanceStatus;
cb_Status.Properties.DisplayMember = "DisplayMember";
cb_Status.Properties.ValueMember = "ValueMember";
cb_Status.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
cb_Status.EditValue = (int)DeviceWarrantyRequestFormStatus.All;
cbbIsDown.Properties.Items.BeginUpdate();
foreach (DeviceRunningStatus item in Enum.GetValues(typeof(DeviceRunningStatus)))
{
cbbIsDown.Properties.Items.Add(item.ToDescription());
}
cbbIsDown.Properties.Items.EndUpdate();
cbbIsDown.SelectedIndex = 0;
de_StartDate.EditValue = DateTime.Today.AddMonths(-1);
de_EndDate.EditValue = DateTime.Today;
InitializeGridViewStyle();
splashScreenManager1.CloseWaitForm();
}
cb_Status.Properties.DataSource = lookupMaintenanceStatus;
cb_Status.Properties.DisplayMember = "DisplayMember";
cb_Status.Properties.ValueMember = "ValueMember";
cb_Status.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
cb_Status.EditValue = (int)DeviceWarrantyRequestFormStatus.All;
cbbIsDown.Properties.Items.BeginUpdate();
foreach (DeviceRunningStatus item in Enum.GetValues(typeof(DeviceRunningStatus)))
catch (Exception ex)
{
cbbIsDown.Properties.Items.Add(item.ToDescription());
XtraMessageBoxHelper.Error(ex.Message);
splashScreenManager1.CloseWaitForm();
this.Close();
}
cbbIsDown.Properties.Items.EndUpdate();
cbbIsDown.SelectedIndex = 0;
de_StartDate.EditValue = DateTime.Today.AddMonths(-1);
de_EndDate.EditValue = DateTime.Today;
InitializeGridViewStyle();
}
List<DeviceWarrantyRequestForm> GridDatas = null;
Dictionary<int, DeviceWarrantyRequestFormView> CurrentGridDatas;
//List<DeviceWarrantyRequestFormView> GridDatas = null;
DataTable ToDataTable(IList list)
{
@ -184,15 +213,43 @@ namespace TsSFCDeivceClient
try
{
splashScreenManager1.ShowWaitForm();
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.GetMaintenance}", FilterInfo.ToJson());
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.GetMaintenance}", JsonConvert.SerializeObject(FilterInfo));
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
GridDatas = apiResponseData.ToDeserializeObject<List<DeviceWarrantyRequestForm>>();
List<DeviceWarrantyRequestFormView> GridDatas = apiResponseData.ToDeserializeObject<List<DeviceWarrantyRequestFormView>>();
if (GridDatas != null && GridDatas.Count > 0)
CurrentGridDatas = GridDatas.ToDictionary(x => x.AutoID, x => x);
DataTable table = ToDataTable(GridDatas);
table.Columns.Add("InProductionText");
table.Columns.Add("EvaluatorPE");
table.Columns.Add("EvaluatorTimePE");
table.Columns.Add("EvaluatorQE");
table.Columns.Add("EvaluatorTimeQE");
string[] ManagerCodes = new string[] { "QE", "PE" };
foreach (DataRow item in table.Rows)
{
int AutoID = Convert.ToInt32(item["AutoID"]);
if (CurrentGridDatas.ContainsKey(AutoID) && CurrentGridDatas[AutoID] != null)
{
item["InProductionText"] = CurrentGridDatas[AutoID].InProduction ? "是" : "否";
foreach (string Code in ManagerCodes)
{
DeviceWarrantyEvaluatorInfo deviceWarrantyEvaluatorInfo = CurrentGridDatas[AutoID].EvaluatorItems.FirstOrDefault(x => x.EvaluatorCode == Code);
if (deviceWarrantyEvaluatorInfo == null)
continue;
item[$"Evaluator{Code}"] = deviceWarrantyEvaluatorInfo.CreatorName;
item[$"EvaluatorTime{Code}"] = deviceWarrantyEvaluatorInfo.CreatOn;
}
}
}
gridControl1.DataSource = null;
gridControl1.DataSource = table;
gridView1.BestFitColumns();
@ -293,7 +350,7 @@ namespace TsSFCDeivceClient
bool RestorationConfirmation = false;
int AutoID = Convert.ToInt32(CurrentRequestForm["AutoID"]);
DeviceWarrantyRequestForm Item = GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
if (Item != null && HasAuth && Item.FormStatus != DeviceWarrantyRequestFormStatus.BeComplate && Item.InProduction)
{
@ -378,11 +435,6 @@ namespace TsSFCDeivceClient
}
}
private void btn_Filter_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 新增设备维修单
/// </summary>
@ -397,8 +449,8 @@ namespace TsSFCDeivceClient
if (view.ShowDialog() == DialogResult.OK)
{
XtraMessageBoxHelper.Info("操作成功!");
InitializeGridDatas();
}
InitializeGridDatas();
}
}
catch (Exception ex)
@ -423,7 +475,7 @@ namespace TsSFCDeivceClient
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
DeviceWarrantyRequestForm Item = GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];//GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
@ -455,17 +507,18 @@ namespace TsSFCDeivceClient
FormID = Item.AutoID,
};
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", info.ToJson());
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", JsonConvert.SerializeObject(info));
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
InitializeGridDatas();
}
}
else
{
throw new Exception($"获取维修单数据出错,请重试!");
}
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
}
catch (Exception ex)
{
@ -484,7 +537,7 @@ namespace TsSFCDeivceClient
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
DeviceWarrantyRequestForm Item = GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
@ -516,7 +569,7 @@ namespace TsSFCDeivceClient
FormID = Item.AutoID,
};
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", info.ToJson());
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{ServiceUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", JsonConvert.SerializeObject(info));
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
}
@ -527,6 +580,7 @@ namespace TsSFCDeivceClient
}
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
InitializeGridDatas();
}
catch (Exception ex)
{
@ -555,7 +609,7 @@ namespace TsSFCDeivceClient
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
DeviceWarrantyRequestForm Item = GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
@ -577,6 +631,7 @@ namespace TsSFCDeivceClient
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
InitializeGridDatas();
}
}
else

View File

@ -268,7 +268,7 @@ namespace TsSFCDeivceClient
// gridControl1
//
this.gridControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridControl1.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(2);
this.gridControl1.EmbeddedNavigator.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.gridControl1.Location = new System.Drawing.Point(4, 72);
this.gridControl1.MainView = this.gridView1;
this.gridControl1.Margin = new System.Windows.Forms.Padding(4);
@ -671,6 +671,7 @@ namespace TsSFCDeivceClient
this.Controls.Add(this.toolbarFormControl1);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 11.25F);
this.IconOptions.Image = global::TsSFCDeivceClient.Properties.Resources.Maintenance;
this.IconOptions.LargeImage = ((System.Drawing.Image)(resources.GetObject("pageDeviceMaintenanceFormView.IconOptions.LargeImage")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "pageDeviceMaintenanceFormView";