This commit is contained in:
2026-01-04 15:22:41 +08:00
35 changed files with 3253 additions and 111 deletions
+1
View File
@@ -276,6 +276,7 @@
<Compile Include="BaseInfo\UnitTypeService.cs" />
<Compile Include="BaseInfo\WorkPostService.cs" />
<Compile Include="BaseInfo\WorkStageService.cs" />
<Compile Include="CQMS\ProjectHighlightsSite\ProjectHighlightsSiteService.cs" />
<Compile Include="HJGL\BaseInfo\Base_MaterialColorService.cs" />
<Compile Include="CLGL\TwArrivalStatisticsService.cs" />
<Compile Include="CLGL\TwConst.cs" />
@@ -0,0 +1,328 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// 项目现场亮点照片收集
/// </summary>
public class ProjectHighlightsSiteService
{
#region
#region
/// <summary>
/// 获取项目现场亮点类型
/// </summary>
/// <returns></returns>
public static Model.ResponeData GetProjectHighlightsSiteTypeFromGroup()
{
var responeData = new Model.ResponeData();
try
{
string unitId = BLL.Const.UnitId_SEDIN;
string baseurl = $"{SysConstSetService.CNCECPath}/api/CQMSData/getProjectHighlightsSiteType?unitId=" + unitId;
string contenttype = "application/json;charset=unicode";
Hashtable newToken = new Hashtable
{
{ "token", ServerService.GetToken().Token }
};
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
if (!string.IsNullOrEmpty(strJosn))
{
JObject obj = JObject.Parse(strJosn);
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
responeData.message = obj["message"].ToString();
if (responeData.code == 1)
{
JArray getData = JArray.Parse(obj["data"].ToString());
if (getData.Count() > 0)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<string> ids = new List<string>();
foreach (var item in getData)
{
string Id = item["Id"].ToString();
var model = db.Base_ProjectHighlightsSiteType.FirstOrDefault(e => e.Id == Id);
if (model == null)
{
Model.Base_ProjectHighlightsSiteType newModel = new Model.Base_ProjectHighlightsSiteType
{
Id = item["Id"].ToString(),
MainType = int.Parse(item["MainType"].ToString()),
MainTypeName = item["MainTypeName"].ToString(),
SubType = item["SubType"].ToString(),
Remark = item["Remark"].ToString(),
CompileMan = item["CompileMan"].ToString(),
CompileManName = item["CompileManName"].ToString(),
CompileDate = DateTime.Now
};
db.Base_ProjectHighlightsSiteType.InsertOnSubmit(newModel);
db.SubmitChanges();
}
else
{
model.MainType = int.Parse(item["MainType"].ToString());
model.MainTypeName = item["MainTypeName"].ToString();
model.SubType = item["SubType"].ToString();
model.Remark = item["Remark"].ToString();
model.CompileMan = item["CompileMan"].ToString();
model.CompileManName = item["CompileManName"].ToString();
model.CompileDate = DateTime.Now;
db.SubmitChanges();
}
}
}
}
responeData.message = "获取成功:项目现场亮点类型" + getData.Count().ToString() + "条";
}
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = "获取失败:" + ex.Message;
ErrLogInfo.WriteLog("获取集团项目现场亮点类型!", ex);
}
return responeData;
}
#endregion
/// <summary>
/// 项目现场亮点类型下拉
/// </summary>
/// <param name="dropName"></param>
/// <param name="isShowPlease"></param>
public static void InitProjectHighlightsSiteTypeNameDropDownList(DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "string";
dropName.DataTextField = "string";
dropName.DataSource = GetProjectHighlightsSiteTypeDropDownList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
/// <summary>
/// 项目现场亮点类型下拉
/// </summary>
/// <returns></returns>
public static List<string> GetProjectHighlightsSiteTypeDropDownList()
{
return (from x in (from x in Funs.DB.Base_ProjectHighlightsSiteType select new { x.MainType, x.MainTypeName }).Distinct()
orderby x.MainType
select x.MainTypeName).ToList();
}
#endregion
#region
/// <summary>
/// 项目亮点
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Model.CQMS_ProjectHighlightsSitePic GetProjectHighlightsSiteById(string Id)
{
return Funs.DB.CQMS_ProjectHighlightsSitePic.FirstOrDefault(e => e.Id == Id);
}
/// <summary>
/// 修改项目亮点
/// </summary>
/// <param name="model"></param>
public static void UpdateProjectHighlightsSite(Model.CQMS_ProjectHighlightsSitePic model)
{
Model.SGGLDB db = Funs.DB;
Model.CQMS_ProjectHighlightsSitePic newModel = db.CQMS_ProjectHighlightsSitePic.FirstOrDefault(e => e.Id == model.Id);
if (newModel != null)
{
newModel.IsReport = false;//维护项目亮点后,状态自动改为未上报
newModel.Resume = model.Resume;
newModel.PicUrl = model.PicUrl;
newModel.CompileMan = model.CompileMan;
newModel.CompileManName = model.CompileManName;
newModel.CompileDate = model.CompileDate;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键Id重置项目亮点描述和照片信息
/// </summary>
/// <param name="Id"></param>
public static void ResetProjectHighlightsSitePicById(string Id)
{
Model.SGGLDB db = Funs.DB;
Model.CQMS_ProjectHighlightsSitePic model = db.CQMS_ProjectHighlightsSitePic.FirstOrDefault(e => e.Id == Id);
if (model != null)
{
//删除亮点照片
BLL.CommonService.DeleteAttachFileById(Id);
model.PicUrl = null;
model.IsReport = false;
model.Resume = string.Empty;
db.SubmitChanges();
}
}
/// <summary>
/// 更新项目亮点类型
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static bool UpdateProjectHighlightsSiteTypeFromGroup(string projectId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var lstBaseType = db.Base_ProjectHighlightsSiteType.ToList();
var lstProPic = db.CQMS_ProjectHighlightsSitePic.Where(e => e.ProjectId == projectId);
//var oldProPicList = db.CQMS_ProjectHighlightsSitePic.Where(x=> lstBaseType.Contains());
foreach (var item in lstProPic)
{
if (!lstBaseType.Where(e => e.Id == item.TypeId).Any())
{//项目亮点类型不存在集团项目亮点类型库中时,删除冗余数据
//删除亮点照片
BLL.CommonService.DeleteAttachFileById(item.Id);
//删除冗余数据
db.CQMS_ProjectHighlightsSitePic.DeleteOnSubmit(item);
db.SubmitChanges();
}
}
lstProPic = db.CQMS_ProjectHighlightsSitePic.Where(e => e.ProjectId == projectId);
foreach (var item in lstBaseType)
{
var model = lstProPic.FirstOrDefault(e => e.TypeId == item.Id);
if (model == null)
{
Model.CQMS_ProjectHighlightsSitePic newModel = new Model.CQMS_ProjectHighlightsSitePic
{
Id = SQLHelper.GetNewID(),
ProjectId = projectId,
TypeId = item.Id,
MainType = item.MainType,
MainTypeName = item.MainTypeName,
SubType = item.SubType,
Remark = item.Remark
};
db.CQMS_ProjectHighlightsSitePic.InsertOnSubmit(newModel);
db.SubmitChanges();
}
else
{
model.MainType = item.MainType;
model.MainTypeName = item.MainTypeName;
model.SubType = item.SubType;
model.Remark = item.Remark;
db.SubmitChanges();
}
}
return true;
}
}
#endregion
#region
/// <summary>
/// 上报项目现场亮点信息到集团
/// </summary>
/// <param name="projectId"></param>
/// <param name="currUser"></param>
/// <returns></returns>
public static Model.ResponeData ReportProjectHighlightsSiteTypeToGroup(string projectId, Person_Persons currUser)
{
var responeData = new Model.ResponeData();
var db = Funs.DB;
try
{
var lstPic = (from x in db.CQMS_ProjectHighlightsSitePic
//where x.IsReport == false
orderby x.MainType, x.SubType
select x).ToList();
if (!string.IsNullOrWhiteSpace(projectId))
{
lstPic = lstPic.Where(x => x.ProjectId == projectId).ToList();
}
if (lstPic.Any())
{
var thisUnit = CommonService.GetIsThisUnit();
var newItem = new { CollCropCode = thisUnit.CollCropCode, ProjectId = projectId, Items = lstPic };
string baseurl = $"{SysConstSetService.CNCECPath}/api/CQMSData/ReportProjectHighlightsSiteTypeToGroup";
string contenttype = "application/json;charset=unicode";
Hashtable newToken = new Hashtable { { "token", ServerService.GetToken().Token } };
var pushContent = JsonConvert.SerializeObject(newItem);
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
if (!string.IsNullOrEmpty(strJosn))
{//推送成功后,修改数据状态
JObject obj = JObject.Parse(strJosn);
string code = obj["code"].ToString();
string message = obj["message"].ToString();
responeData.message = message;
if (code == "1")
{
var ReportDate = DateTime.Now;
foreach (var item in lstPic)
{
Model.CQMS_ProjectHighlightsSitePic model = db.CQMS_ProjectHighlightsSitePic.FirstOrDefault(e => e.Id == item.Id);
if (model != null)
{
model.IsReport = true;
model.ReportMan = currUser.PersonId;
model.ReportManName = currUser.PersonName;
model.ReportDate = ReportDate;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
}
}
else
{
responeData.code = 0;
responeData.message = "上报失败,请稍候再试!";
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有未上报数据";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = "上报失败:" + ex.Message;
ErrLogInfo.WriteLog("上报项目现场亮点信息到集团!", ex);
}
return responeData;
}
#endregion
}
}
+14
View File
@@ -5261,5 +5261,19 @@ namespace BLL
public const string BaseMaterialcolorMenuId = "F6194C00-D256-485D-9056-171FAB75928A";
#region
/// <summary>
/// 项目现场亮点照片
/// </summary>
public const string ProjectHighlightsSitePicMenuId = "D81AE7C1-2022-4089-B0F9-49903798DEEF";
/// <summary>
/// 公司级项目现场亮点照片
/// </summary>
public const string ProjectHighlightsSitePicReportMenuId = "38177E89-4BA8-4D66-AFB9-93644DFE7451";
#endregion
}
}
+9 -6
View File
@@ -463,12 +463,15 @@ namespace BLL
/// <returns></returns>
public static ListItem[] GetBidType()
{
ListItem[] list = new ListItem[5];
list[0] = new ListItem("招标", "公开招标");
list[1] = new ListItem("谈判", "邀请招标");
list[2] = new ListItem("询比 ", "询比");
list[3] = new ListItem("竞价", "竞争性谈判");
list[4] = new ListItem("直接分包", "单一来源");
ListItem[] list = new ListItem[8];
list[0] = new ListItem("公开招标", "公开招标");
list[1] = new ListItem("邀请招标", "邀请招标");
list[2] = new ListItem("公开询比 ", "公开询比");
list[3] = new ListItem("邀请询比 ", "邀请询比");
list[4] = new ListItem("公开谈判", "公开谈判");
list[5] = new ListItem("邀请谈判", "邀请谈判");
list[6] = new ListItem("竞价", "竞价");
list[7] = new ListItem("直接分包", "直接分包");
return list;
}
@@ -127,8 +127,8 @@ namespace BLL
/// <param name="isShowPlease">是否显示请选择</param>
public static void InitGetBidTypeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "Text";
dropName.DataTextField = "Value";
dropName.DataValueField = "Value";
dropName.DataTextField = "Text";
dropName.DataSource = BLL.DropListService.GetBidType();
dropName.DataBind();
if (isShowPlease)