This commit is contained in:
jackchenyang 2024-05-17 15:28:32 +08:00
parent 904833ad7e
commit e8c8ac8d23
28 changed files with 211 additions and 929 deletions

Binary file not shown.

View File

@ -120,6 +120,7 @@
<Compile Include="Common\Const.cs" />
<Compile Include="NPOIHelper.cs" />
<Compile Include="PublicInfo\BaseInfo\Base_PIPClassService.cs" />
<Compile Include="Schedule\TaskScheduleService.cs" />
<Compile Include="SendEmail\Email_ParamsService.cs" />
<Compile Include="SendEmail\Email_PopService.cs" />
<Compile Include="SendEmail\Email_SendLogService.cs" />

View File

@ -1,6 +1,8 @@
using Model;
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
namespace FineUIPro.Web.common
{
@ -170,12 +172,13 @@ namespace FineUIPro.Web.common
}
public static Email_Pop getEmailPop(string EmailID)
public static Email_Pop getEmailPop()
{
Email_Pop pp = new Email_Pop();
pp = BLL.Email_Send.Email_PopService.GetEmail_Pop(EmailID);
var pp = Funs.DB.Email_Pop.FirstOrDefault();
return pp;
}
}

View File

@ -0,0 +1,78 @@
using FineUIPro.Web.common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class TaskScheduleService
{
//NDE点口未审核统计
public static int NDEWeldPointNotAuditStatusTotal(int type)
{
if (type == 0)
return 0;
StringBuilder strSql = new StringBuilder();
strSql.Append(@"SELECT count(1) FROM dbo.View_Batch_PointBatchItem WHERE PointState IS NOT NULL ");
switch (type)
{
case 1:
strSql.Append(" AND JLAudit='未审核'");
break;
case 2:
strSql.Append(" AND GLGSAudit='未审核' ");
break;
}
int totalCount= SQLHelper.getIntValue(strSql.ToString());
return totalCount;
}
public static void GetNDEAuditEmailTemplate(int type)
{
var pop = MailHelper.getEmailPop();
if (pop == null)
{
BLL.ErrLogInfo.WriteLog($"未配置邮件服务器");
return;
}
string templateContent = string.Empty;
List<string> emailSend = new List<string>(); //发送人
List<string> emailCC = new List<string>(); //抄送给
string mailSubject = string.Empty;
string typeStr = string.Empty;
if (type == 1)
typeStr = "监理";
if (type == 2)
typeStr = "管理公司";
var emailTemplate = BLL.Email_Send.Email_SendTemplateService.GetEmailNotifier(typeStr);
if (emailTemplate == null)
{
BLL.ErrLogInfo.WriteLog($"不存在此邮件模版");
return;
}
emailSend = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "0");
emailCC = BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(emailTemplate.EmailId, "1");
if (emailSend.Count == 0)
{
BLL.ErrLogInfo.WriteLog($"未检测到发送人邮箱,请先配置邮箱地址");
return;
}
mailSubject = $"{typeStr}—{emailTemplate.EailTiaoJian}"; //发送主题
templateContent = emailTemplate.EmailContext;
int totalCount = BLL.TaskScheduleService.NDEWeldPointNotAuditStatusTotal(type);
templateContent = templateContent.Replace("{{totalCount}}", totalCount.ToString());
string resultMessage = "";
MailHelper.SendNetMail(pop, pop.EmailYx, emailSend.ToArray(), mailSubject, templateContent, string.Empty, string.Empty, string.Empty, emailCC.ToArray(), out resultMessage);
}
}
}

View File

@ -1,4 +1,5 @@
using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data.Common;
@ -79,7 +80,7 @@ namespace BLL.Email_Send
}
#endregion
#region EProject
#region
/// <summary>
/// 根据主键删除EProject
/// </summary>
@ -95,7 +96,7 @@ namespace BLL.Email_Send
}
#endregion
#region EmailNotifier查询EProject
#region EmailNotifier查询
/// <summary>
/// 根据EmailNotifier查询EProject
/// </summary>
@ -106,7 +107,7 @@ namespace BLL.Email_Send
}
#endregion
#region EmailNotifier查询EProject
#region EmailNotifier查询
/// <summary>
/// 根据EmailNotifier查询EProject
/// </summary>
@ -117,6 +118,19 @@ namespace BLL.Email_Send
}
#endregion
#region ID获取发送人列表
public static List<string> GetEmailByTemplateId(string templateId,string isCc)
{
var result = (from a in Funs.DB.Email_ToPeople
join b in Funs.DB.Sys_User on a.EmuserID equals b.UserId
where b.IsPost.Value && b.Email!=""
&& a.EMPeopleType==isCc && a.EmtempID==templateId
select b.Email
).ToList();
return result;
}
#endregion
#region
/// <summary>

View File

@ -8,7 +8,7 @@
<html>
<head runat="server">
<title></title>
<title>编辑</title>
</head>
<body>
<form id="form1" runat="server">
@ -17,7 +17,7 @@
<Rows>
<f:FormRow>
<Items>
<f:DropDownList runat="server" ID="ddlEmailParamsID" LabelWidth="150px" Label="邮件类型">
<f:DropDownList runat="server" ID="ddlEmailParamsID" Required="true" ShowRedStar="true" LabelWidth="150px" Label="邮件类型">
</f:DropDownList>
</Items>
</f:FormRow>
@ -25,7 +25,7 @@
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtTemplateCondition" ShowLabel="true" Required="true" LabelWidth="150px" LabelAlign="Right"
<f:TextBox ID="txtTemplateCondition" ShowLabel="true" ShowRedStar="true" Required="true" LabelWidth="150px" LabelAlign="Right"
BoxFlex="2" runat="server" Label="模版条件">
</f:TextBox>
</Items>
@ -34,7 +34,7 @@
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtTemplateName" ShowLabel="true" Required="true" LabelWidth="150px" LabelAlign="Right"
<f:TextBox ID="txtTemplateName" ShowLabel="true" ShowRedStar="true" Required="true" LabelWidth="150px" LabelAlign="Right"
BoxFlex="2" runat="server" Label="模版名称">
</f:TextBox>
</Items>
@ -53,8 +53,8 @@
<Items>
<f:RadioButtonList ID="rblAutoPostBack" AutoPostBack="true" OnSelectedIndexChanged="rblAutoPostBack_SelectedIndexChanged" LabelWidth="150px" LabelAlign="Right"
Label="选择人员" ColumnNumber="3" runat="server" Required="true">
<f:RadioItem Text="不选择" Value="0" Selected="true" />
<f:RadioItem Text="选择用户" Value="1" />
<f:RadioItem Text="不选择" Value="0" />
<f:RadioItem Text="选择用户" Value="1" Selected="true" />
<f:RadioItem Text="选择角色" Value="2" />
</f:RadioButtonList>
</Items>
@ -63,7 +63,7 @@
<Rows>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" Label="接收人" ID="ddlSendUserName" LabelWidth="150px" EmptyText="请选择" DataControlID="Grid1"
<f:DropDownBox runat="server" Label="接收人" Required="true" ShowRedStar="true" ID="ddlSendUserName" LabelWidth="150px" EmptyText="请选择" DataControlID="Grid1"
EnableMultiSelect="true" MatchFieldWidth="false" EnableEdit="true">
<PopPanel>
<f:UserControlConnector runat="server">

View File

@ -107,6 +107,7 @@ namespace FineUIPro.Web.Email_Send
ddlEmailParamsID.DataValueField = "MailClassID";
ddlEmailParamsID.DataSource = email_Params;
ddlEmailParamsID.DataBind();
ddlEmailParamsID.Items.Insert(0,new ListItem("",""));
}
#endregion

View File

@ -97,7 +97,7 @@
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="SendEmailTemplate Editor" Hidden="true" EnableIFrame="true" EnableMaximize="false"
<f:Window ID="Window1" Title="新增/编辑" Hidden="true" EnableIFrame="true" EnableMaximize="false"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1000px" Height="650px">
</f:Window>

View File

@ -107,9 +107,12 @@ namespace FineUIPro.Web.Email_Send
protected void btnSave_Click(object sender, EventArgs e)
{
//string mailFrom = MailHelper.MailServerFrom;
Email_Pop pop = new Email_Pop();
pop = MailHelper.getEmailPop("7EC5E991-B7A0-495A-90ED-2BE15370C959");
var pop = MailHelper.getEmailPop();
if (pop == null)
{
ShowNotify("未配置邮件服务器", MessageBoxIcon.Error);
return;
}
string mailFrom = pop.EmailYx;

View File

@ -94,7 +94,7 @@ namespace FineUIPro.Web.Email_Send
string sortField = Grid1.SortField;
string sortDirection = Grid1.SortDirection;
string strSql = @"select a.UserId,b.UnitId,b.UserName,c.UnitName from Project_User as a inner join Sys_User as b on a.UserId=b.UserId
string strSql = @"select a.UserId,b.UnitId,b.UserName,c.UnitName,b.Email from Project_User as a inner join Sys_User as b on a.UserId=b.UserId
inner join Base_Unit as c on b.UnitId=c.UnitId where b.IsPost=1 order by c.UnitName ";
List<SqlParameter> listStr = new List<SqlParameter>();
SqlParameter[] parameter = listStr.ToArray();

View File

@ -14,6 +14,8 @@
using System.Data;
using System.Data.SqlClient;
using BLL;
using FineUIPro.Web.common;
using System.Threading.Tasks;
public class Global : System.Web.HttpApplication
{
@ -47,6 +49,8 @@
// 开启线程
System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(ExpirePoint));
LoadServiceData.Start();
}
private void ExpirePoint()
@ -60,6 +64,7 @@
ExpirePoint.Elapsed += new System.Timers.ElapsedEventHandler(ExpirePoint_Elapsed);
}
void ExpirePoint_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
@ -142,6 +147,7 @@
}
protected void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 36000;

View File

@ -69,7 +69,8 @@ namespace FineUIPro.Web.common.SysManage
this.txtUserName.Text = user.UserName;
this.txtAccount.Text = user.Account;
this.txtDepart.Text = user.Depart;
this.txtEmail.Text = user.Email;
this.txtEmailPassword.Text = user.EmailPassword;
if (user.IsPost.HasValue)
{
this.cbIsPost.Checked = user.IsPost.Value;

View File

@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using WebAPI.Filter;
namespace WebApi
{
public static class WebApiConfig
@ -14,8 +12,6 @@ namespace WebApi
GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
// Web API 路由
config.MapHttpAttributeRoutes();
//
config.Filters.Add(new PermissionAttribute());
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",

View File

@ -1,156 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BLL;
using System.Web.Http;
namespace WebApi.Controllers
{
public class BaseInfoController : ApiController
{
#region ID获取项目列表()
/// <summary>
/// 根据登陆的用户ID获取项目列表
/// </summary>
/// <param name="userId">登陆的用户ID</param>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData getProjectList(string userId, string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getProjectList(userId, projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 根据项目区域获取项目列表
/// </summary>
/// <param name="userId">登陆的用户ID</param>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData getProjectListByArea(string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getProjectListByArea(projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID和施工单位获取区域列表
/// <summary>
/// 根据项目ID和施工单位获取区域列表
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitId">施工单位ID</param>
/// <returns></returns>
public Model.ResponeData getWorkAreaList(string projectId, string unitId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getWorkAreaList(projectId, unitId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID和施工区域获取管线列表信息
/// <summary>
/// 根据项目ID和施工区域获取管线列表信息
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="wordAreaId">施工区域ID</param>
/// <returns></returns>
public Model.ResponeData getPipeLineList(string projectId, string wordAreaId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getPipeLineList(projectId, wordAreaId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region 线ID获取焊口列表信息
/// <summary>
/// 根据管线ID获取焊口列表信息
/// </summary>
/// <param name="pipelineId">管线ID</param>
/// <returns></returns>
public Model.ResponeData getWeldJointList(string pipelineId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getWeldJointList(pipelineId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID获取装置列表信息
/// <summary>
/// 根据管线ID获取焊口列表信息
/// </summary>
/// <param name="pipelineId">管线ID</param>
/// <returns></returns>
public Model.ResponeData getInstallationList(string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getInstallationList(projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using BLL;
namespace WebApi.Controllers
{
public class CheckController : ApiController
{
#region
/// <summary>
/// 保存检查(巡检)信息
/// </summary>
/// <param name="newItem">检查信息</param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveCheckInfo([FromBody] Model.CheckItem newItem)
{
var responeData = new Model.ResponeData();
try
{
APICheckService.SaveCheckInfo(newItem);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 保存检查(巡检)信息
/// </summary>
/// <param name="newItem">检查信息</param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateReCheckInfo([FromBody] Model.CheckItem newItem)
{
var responeData = new Model.ResponeData();
try
{
APICheckService.UpdateReCheckInfo(newItem);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 获取项目区域的检查列表
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData GetCheckList(string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APICheckService.GetCheckList(projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 根据主建获取检查信息
/// </summary>
/// <param name="checkId">主建</param>
/// <returns></returns>
public Model.ResponeData GetCheckInfo(string checkId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APICheckService.GetCheckInfo(checkId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -1,117 +0,0 @@
using BLL;
using System;
using System.Configuration;
using System.Drawing;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Http;
namespace WebApi.Controllers
{
public class FileUploadController : ApiController
{
#region
/// <summary>
/// 附件上传
/// </summary>
/// <returns></returns>
public IHttpActionResult Post()
{
HttpFileCollection files = HttpContext.Current.Request.Files;
string typeName = HttpContext.Current.Request["typeName"];
if (string.IsNullOrEmpty(typeName))
{
typeName = "WebApi";
}
string reUrl = string.Empty;
if (files != null && files.Count > 0)
{
string folderUrl = "FileUpLoad/" + typeName + "/" + DateTime.Now.ToString("yyyy-MM") + "/";
string localRoot = ConfigurationManager.AppSettings["localRoot"] + folderUrl; //物理路径
if (!Directory.Exists(localRoot))
{
Directory.CreateDirectory(localRoot);
}
// foreach (string key in files.AllKeys)
for(int i=0;i<files.Count;i++)
{
string rootUrl = string.Empty;
string fileName = string.Empty;
string extensionstr = string.Empty;
HttpPostedFile file = files[i];//files[key];//file.ContentLength文件长度
if (!string.IsNullOrEmpty(file.FileName))
{
extensionstr = Path.GetExtension(file.FileName).ToLower();
fileName = Guid.NewGuid()+ extensionstr;
rootUrl = localRoot + fileName;
file.SaveAs(localRoot + fileName);
}
if (extensionstr == ".jpg" || extensionstr == ".gif" || extensionstr == ".bmp" || extensionstr == ".png")
{
string TakePicDateTime = string.Empty;
System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream, true, false);
Encoding ascii = Encoding.ASCII;
//遍历图像文件元数据,检索所有属性
foreach (System.Drawing.Imaging.PropertyItem p in image.PropertyItems)
{
//如果是PropertyTagDateTime则返回该属性所对应的值
if (p.Id == 0x0132)
{
TakePicDateTime = ascii.GetString(p.Value);
}
}
TakePicDateTime = string.IsNullOrEmpty(TakePicDateTime) ? string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now) : TakePicDateTime;
if (!string.IsNullOrEmpty(TakePicDateTime))
{
////获取元数据中的拍照日期时间,以字符串形式保存
//TakePicDateTime = GetTakePicDateTime(pi);
//分析字符串分别保存拍照日期和时间的标准格式
var SpaceLocation = TakePicDateTime.IndexOf(" ");
var dt = TakePicDateTime.Substring(0, SpaceLocation);
dt = dt.Replace(":", "-");
var tm = TakePicDateTime.Substring(SpaceLocation + 1, TakePicDateTime.Length - SpaceLocation - 2);
TakePicDateTime = dt + " " + tm;
//由列表中的文件创建内存位图对象
var Pic = new Bitmap(rootUrl);
//由位图对象创建Graphics对象的实例
var g = Graphics.FromImage(Pic);
Font ft = new Font("宋体", 20, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));//定义字体
//在Graphics表面绘制数码照片的日期/时间戳
g.DrawString(TakePicDateTime, ft, Brushes.Gold, 0, Pic.Height - 100);
// - 50);
string newRoot = localRoot + "newfile/";
if (!Directory.Exists(newRoot))
{
Directory.CreateDirectory(newRoot);
}
//将添加日期/时间戳后的图像进行保存
Pic.Save(newRoot + fileName);
fileName = "newfile/" + fileName;
//释放内存位图对象
Pic.Dispose();
}
}
if (!string.IsNullOrEmpty(fileName))
{
if (string.IsNullOrEmpty(reUrl))
{
reUrl += folderUrl + fileName;
}
else
{
reUrl += "," + folderUrl + fileName;
}
}
}
}
return Ok(reUrl);
}
#endregion
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace WebApi.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
}

View File

@ -1,103 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BLL;
using System.Web.Http;
namespace WebApi.Controllers
{
public class MessagePushController : ApiController
{
#region
/// <summary>
/// 推送的热处理委托单
/// </summary>
/// <param name="userId">登陆的用户ID</param>
/// <returns></returns>
public Model.ResponeData GetPushHotTrust(string userId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data =APIMessagePushService.GetPushHotTrust(userId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region NDE检测委托单
/// <summary>
/// 推送的NDE检测委托单
/// </summary>
/// <param name="userId">登陆的用户ID</param>
/// <returns></returns>
public Model.ResponeData GetPushNDTTrust(string userId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIMessagePushService.GetPushNDTTrust(userId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region 96%
/// <summary>
/// 焊工一次合格率低于96%预警
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData GetWelderOnePassRateWarning(string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIMessagePushService.GetWelderOnePassRateWarning(projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region 96%
/// <summary>
/// 施工单位一次合格率低于96%预警
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData GetUnitOnePassRateWarning(string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIMessagePushService.GetUnitOnePassRateWarning(projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using BLL;
namespace WebApi.Controllers
{
public class PreWeldingDailyController : ApiController
{
#region
/// <summary>
/// 保存焊接日报
/// </summary>
/// <param name="newItem">焊口信息</param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SavePreWeldingDaily([FromBody] List<Model.WeldJointItem > newItem)
{
var responeData = new Model.ResponeData();
try
{
APIPreWeldingDailyService.SavePreWeldingDaily(newItem);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -1,108 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BLL;
using System.Web.Http;
namespace WebApi.Controllers
{
public class ReportQueryController : ApiController
{
#region
/// <summary>
/// 根据焊工号获取焊工业绩
/// </summary>
/// <param name="projectId"></param>
/// <param name="welderCode"></param>
/// <returns></returns>
public Model.ResponeData GetWelderPerformanceByWelderCode(string projectId, string welderCode)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIReportQueryService.GetWelderPerformanceByWelderCode(projectId, welderCode);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region 线
/// <summary>
/// 根据条件获取管线综合信息
/// </summary>
/// <param name="projectId">项目</param>
/// <param name="workAreaId">区域</param>
/// <param name="pipelineCode">管线号</param>
/// <returns></returns>
public Model.ResponeData GetPipeLineInfo(string projectId, string workAreaId, string pipelineCode)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIReportQueryService.GetPipeLineInfo(projectId, workAreaId, pipelineCode);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 焊接工作量查询
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <param name="projectId">项目Id</param>
/// <returns></returns>
public Model.ResponeData GetWeldWorkload(string projectArea, string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIReportQueryService.GetWeldWorkload(projectArea, projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 焊接工作量查询
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <param name="projectId">项目Id</param>
/// <returns></returns>
public Model.ResponeData GetWeldNdtFilm(string projectArea, string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIReportQueryService.GetWeldNdtFilm(projectArea, projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace WebApi.Controllers
{
public class TaskController: ApiController
{
[HttpGet]
public Model.ResponeData GetNDEAuditEmailTemplate()
{
var model=new Model.ResponeData();
try
{
//定时任务跑 监理 未审核的点口邮件
BLL.TaskScheduleService.GetNDEAuditEmailTemplate(1);
//定时任务跑 管理公司 未审核的点口邮件
BLL.TaskScheduleService.GetNDEAuditEmailTemplate(2);
model.code = 200;
model.message = "OK";
}
catch (Exception ex)
{
BLL.ErrLogInfo.WriteLog(ex, "The scheduled task failed to run the unaudited point-of-mail. Procedure");
model.code=500;
model.message = "Error";
}
return model;
}
}
}

View File

@ -1,130 +0,0 @@
using BLL;
using System;
using System.Linq;
using System.Web.Http;
namespace WebAPI.Controllers
{
/// <summary>
/// 用户
/// </summary>
public class UserController : ApiController
{
#region
/// <summary>
/// 登录方法
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData postLoginOn([FromBody] Model.UserItem userInfo)
{
//登录方法 Model.UserItem
var responeData = new Model.ResponeData
{
message = "账号密码不匹配!"
};
try
{
////用户登录
var user = APIUserService.UserLogOn(userInfo);
if (user != null)
{
responeData.message = "登录成功!";
responeData.data = user;
}
//else 暂不用
//{
// // 焊工登录
// var user1 = APIWelderService.PersonLogOn(userInfo);
// if (user1 != null)
// {
// responeData.message = "登录成功!";
// responeData.code = 2;
// responeData.data = user1;
// }
//}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region userid获取用户信息
/// <summary>
/// 根据userid获取用户信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public Model.ResponeData getUserByUserId(string userId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIUserService.getUserByUserId(userId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID和选择的项目获取单位类型(12345)
/// <summary>
/// 根据登陆用户的单位ID和选择的项目获取单位类型(1、建设方2、总承包商3、监理4、检测5、施工)
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitId">单位ID</param>
/// <returns></returns>
public Model.ResponeData getUserInfo(string projectId, string unitId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIUserService.getUserInfo(projectId, unitId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 获取项目区域的用户列表
/// </summary>
/// <param name="projectArea">项目区域</param>
/// <returns></returns>
public Model.ResponeData getUserListByProjectArea(string projectArea)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIUserService.getUserListByProjectArea(projectArea);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using BLL;
namespace WebApi.Controllers
{
public class WelderController : ApiController
{
#region
/// <summary>
/// 获取焊工登录信息
/// </summary>
/// <param name="userInfo">焊工登录信息</param>
/// <returns></returns>
public Model.ResponeData WelderLogOn(Model.UserItem userInfo)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIWelderService.WelderLogOn(userInfo);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region ID和施工单位获取项目焊工列表信息
/// <summary>
/// 根据项目ID和施工单位获取项目焊工列表信息
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitId">施工单位ID</param>
/// <returns></returns>
public Model.ResponeData getWelderList(string projectId, string unitId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIWelderService.getWelderList(projectId, unitId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

44
HJGL/WebApi/ErrLog.txt Normal file
View File

@ -0,0 +1,44 @@
错误信息开始=====>
错误类型:NotSupportedException
错误信息:方法“Boolean IsNullOrEmpty(System.String)”不支持转换为 SQL。
错误堆栈:
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.TranslateStringStaticMethod(SqlMethodCall mc)
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.VisitMethodCall(SqlMethodCall mc)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitUnaryOperator(SqlUnary uo)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitBinaryOperator(SqlBinary bo)
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.VisitBinaryOperator(SqlBinary bo)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitBinaryOperator(SqlBinary bo)
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.VisitBinaryOperator(SqlBinary bo)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select)
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.VisitSelect(SqlSelect select)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitAlias(SqlAlias a)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitSource(SqlSource source)
在 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select)
在 System.Data.Linq.SqlClient.PostBindDotNetConverter.Visitor.VisitSelect(SqlSelect select)
在 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
在 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(ResultShape resultShape, Type resultType, SqlNode node, ReadOnlyCollection`1 parentParameters, SqlNodeAnnotations annotations)
在 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
在 System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
在 BLL.Email_Send.Email_SendTemplateService.GetEmailByTemplateId(String templateId, String isCc) 位置 E:\湛江巴斯夫\Basf_TCC7\HJGL\BLL\SendEmail\Email_SendTemplateService.cs:行号 124
在 BLL.TaskScheduleService.GetNDEAuditEmailTemplate(Int32 type) 位置 E:\湛江巴斯夫\Basf_TCC7\HJGL\BLL\Schedule\TaskScheduleService.cs:行号 51
在 WebApi.Controllers.TaskController.GetNDEAuditEmailTemplate() 位置 E:\湛江巴斯夫\Basf_TCC7\HJGL\WebApi\Controllers\TaskController.cs:行号 19
出错时间:05/17/2024 11:16:43
The scheduled task failed to run the unaudited point-of-mail. Procedure
出错时间:05/17/2024 11:16:43
未检测到发送人邮箱,请先配置邮箱地址
未检测到发送人邮箱,请先配置邮箱地址

View File

@ -1,61 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace WebAPI.Filter
{
/// <summary>
///
/// </summary>
public class PermissionAttribute: ActionFilterAttribute
{
/// <summary>
///
/// </summary>
/// <param name="actionContext"></param>
public override void OnActionExecuting(HttpActionContext actionContext)
{
bool isOk = false;
actionContext.Request.Headers.TryGetValues("token", out IEnumerable<string> token);
string strValues = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName + "*" + ((ReflectedHttpActionDescriptor)actionContext.ActionDescriptor).ActionName;
if (lists.FirstOrDefault(x => x == strValues) != null)
{
isOk = true;
}
if (!isOk && token != null)
{
var getUser = BLL.Sys_UserService.GetUsersByUserId(token.FirstOrDefault());
if (getUser != null)
{
isOk = true;
}
else
{
var getPerson = BLL.WelderService .GetWelderById(token.FirstOrDefault());
if (getPerson != null)
{
isOk = true;
}
}
}
// base.OnActionExecuting(actionContext);
if (isOk)
{
base.OnActionExecuting(actionContext);
}
else
{
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
new { code = "0", message = "您没有权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
}
}
/// <summary>
///
/// </summary>
public static List<string> lists = new List<string> { "User*postLoginOn" };
}
}

View File

@ -10,7 +10,7 @@
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<!--连接字符串-->
<add key="ConnectionString" value="Server=.;Database=whhjdb;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Connect Timeout=1200"/>
<add key="ConnectionString" value="Server=.;Database=HJGLDB_ZJBSF;Integrated Security=False;User ID=sa;Password=Sh@nghai9;MultipleActiveResultSets=true;Connect Timeout=1200"/>
<!--版本号-->
<add key="SystemVersion" value="WebApi_V2019-09-20-001"/>
<!--附件上传物理路径-->
@ -27,7 +27,7 @@
</system.Web>
-->
<system.web>
<compilation debug="false" targetFramework="4.8"/>
<compilation debug="true" targetFramework="4.8"/>
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.webServer>

View File

@ -157,16 +157,7 @@
<Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\BaseInfoController.cs" />
<Compile Include="Controllers\CheckController.cs" />
<Compile Include="Controllers\FileUploadController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\MessagePushController.cs" />
<Compile Include="Controllers\PreWeldingDailyController.cs" />
<Compile Include="Controllers\ReportQueryController.cs" />
<Compile Include="Controllers\UserController.cs" />
<Compile Include="Controllers\WelderController.cs" />
<Compile Include="Filter\PermissionAttribute.cs" />
<Compile Include="Controllers\TaskController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@ -228,6 +219,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Filter\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>