This commit is contained in:
2025-09-24 17:32:36 +08:00
19 changed files with 807 additions and 121 deletions
+1
View File
@@ -369,6 +369,7 @@
<Compile Include="CQMS\WBS\WorkPackageParentDetailService.cs" />
<Compile Include="CQMS\WBS\WorkPackageProjectService.cs" />
<Compile Include="CQMS\WBS\WorkPackageService.cs" />
<Compile Include="DCGL\ServerCheck\DCGLCheckNoticeItemService.cs" />
<Compile Include="DCGL\ServerCheck\DCGLCheckRectifyItemService.cs" />
<Compile Include="DCGL\ServerCheck\DCGLCheckRectifyService.cs" />
<Compile Include="DigData\CQMSDataCollectService.cs" />
+5
View File
@@ -73,6 +73,11 @@ namespace BLL
}
}
/// <summary>
/// 服务器路径
/// </summary>
public static string AttachRootPath { get; set; }
/// <summary>
/// 系统名称
/// </summary>
@@ -0,0 +1,39 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 督查检查整改明细表
/// </summary>
public static class DCGLCheckNoticeItemService
{
/// <summary>
/// 根据主键获取督查检查整改明细信息
/// </summary>
/// <param name="checkRectifyItemId"></param>
/// <returns></returns>
public static Model.DCGL_Check_CheckInfo_TableNoticeItem GetCheckNoticeItemByCheckNoticeItemId(string checkNoticeItemId)
{
return Funs.DB.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(e => e.ID == checkNoticeItemId);
}
/// <summary>
/// 添加督查检查整改明细信息
/// </summary>
/// <param name="CheckNoticeItem"></param>
public static void UpdateCheckNoticeItem(Model.DCGL_Check_CheckInfo_TableNoticeItem CheckNoticeItem)
{
var newCheckNoticeItem = Funs.DB.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(x => x.ID == CheckNoticeItem.ID);
if (newCheckNoticeItem != null)
{
newCheckNoticeItem.Situation = CheckNoticeItem.Situation;
Funs.DB.SubmitChanges();
}
}
}
}
@@ -55,6 +55,8 @@ namespace BLL
newPlan.CompletedCount = plan.CompletedCount;
newPlan.CompletedRate = plan.CompletedRate;
newPlan.TotalCompletedRate = plan.TotalCompletedRate;
newPlan.OnDayCompleteDyne = plan.OnDayCompleteDyne;
newPlan.NextDayCompleteDyne = plan.NextDayCompleteDyne;
db.HJGL_ProductionSchedulingPlan.InsertOnSubmit(newPlan);
db.SubmitChanges();
}
+107 -25
View File
@@ -640,9 +640,9 @@ namespace BLL
/// <param name="flowingSection">流水段</param>
/// <param name="steelType">材质</param>
/// <param name="caliber">口径</param>
/// <param name="type">1-达因,2-完成达因</param>
/// <param name="type">1-达因,2-完成达因</param>
/// <returns></returns>
public static decimal? GetSizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber,string type)
public static decimal? GetSizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber, string type)
{
Model.SGGLDB db = Funs.DB;
decimal? sizeSum = 0;
@@ -654,39 +654,41 @@ namespace BLL
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Material on y.MaterialId equals z.MaterialId
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && z.SteelType == steelType
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
//&& Convert.ToInt32(x.DNDia.Substring(2, x.DNDia.Length - 2)) < c
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
select x);
foreach (var item in weldjoints)
{
int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2));
if (caliber.Substring(0, 1) == "<" && s < c)
if (!string.IsNullOrEmpty(item.DNDia) && item.DNDia != null)
{
if (type == "1")
int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2));
if (caliber.Substring(0, 1) == "<" && s < c)
{
sizeSum += item.Size;
}
else
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
if (type == "1")
{
sizeSum += item.Size;
}
else
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
{
sizeSum += item.Size;
}
}
}
}
else if (caliber.Substring(0, 1) == "≥" && s >= c)
{
if (type == "1")
else if (caliber.Substring(0, 1) == "≥" && s >= c)
{
sizeSum += item.Size;
}
else
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
if (type == "1")
{
sizeSum += item.Size;
}
else
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
{
sizeSum += item.Size;
}
}
}
}
}
@@ -695,14 +697,14 @@ namespace BLL
}
/// <summary>
/// 根据单位工程、流水段获取总达因
/// 根据单位工程、流水段获取优先级总达因、完成总达因
/// </summary>
/// <param name="projectId">项目id</param>
/// <param name="unitWorkId">单位工程</param>
/// <param name="flowingSection">流水段</param>
/// <param name="type">1-总达因,2-完成总达因</param>
/// <returns></returns>
public static decimal? GetSizeSumByUnitWorkIdAndFlowingSection(string projectId, string unitWorkId, string flowingSection,string type)
public static decimal? GetSizeSumByUnitWorkIdAndFlowingSection(string projectId, string unitWorkId, string flowingSection, string type)
{
Model.SGGLDB db = Funs.DB;
decimal? sizeSum = 0;
@@ -710,7 +712,7 @@ namespace BLL
{
sizeSum = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Material on y.MaterialId equals z.MaterialId
//join z in db.Base_Material on y.MaterialId equals z.MaterialId
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
select x.Size).Sum();
@@ -719,7 +721,7 @@ namespace BLL
{
sizeSum = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Material on y.MaterialId equals z.MaterialId
//join z in db.Base_Material on y.MaterialId equals z.MaterialId
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
&& x.WeldingDailyId != "" && x.WeldingDailyId != null
@@ -727,5 +729,85 @@ namespace BLL
}
return sizeSum;
}
/// <summary>
/// 根据单位工程、流水段、材质获取总达因(按材质)
/// </summary>
/// <param name="projectId">项目id</param>
/// <param name="unitWorkId">单位工程id</param>
/// <param name="flowingSection">流水号</param>
/// <param name="material">材质</param>
/// <returns></returns>
public static decimal? GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(string projectId, string unitWorkId, string flowingSection, string steelType)
{
Model.SGGLDB db = Funs.DB;
decimal? sizeSum = 0;
sizeSum = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Material on y.MaterialId equals z.MaterialId
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
&& z.SteelType == steelType
select x.Size).Sum();
return sizeSum;
}
/// <summary>
/// 获取当日已完成量
/// </summary>
/// <param name="projectId"></param>
/// <param name="unitWorkId"></param>
/// <param name="flowingSection"></param>
/// <param name="steelType"></param>
/// <param name="caliber"></param>
/// <returns></returns>
public static decimal? GetCurrentDaySizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber)
{
Model.SGGLDB db = Funs.DB;
decimal? sizeSum = 0;
int c = 0;
if (!string.IsNullOrEmpty(caliber))
{
c = Convert.ToInt32(caliber.Substring(1, caliber.Length - 1));
var weldjoints = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Material on y.MaterialId equals z.MaterialId
where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && z.SteelType == steelType
&& y.PipeArea == "1" && x.JointAttribute == "预制口"
select x);
foreach (var item in weldjoints)
{
if (!string.IsNullOrEmpty(item.DNDia) && item.DNDia != null)
{
int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2));
if (caliber.Substring(0, 1) == "<" && s < c)
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
{
var weldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(item.WeldingDailyId);
if (weldingDaily != null && weldingDaily.WeldingDate.HasValue && weldingDaily.WeldingDate.Value.ToShortDateString() == DateTime.Now.ToShortDateString())
{
sizeSum += item.Size;
}
}
}
else if (caliber.Substring(0, 1) == "≥" && s >= c)
{
if (!string.IsNullOrEmpty(item.WeldingDailyId))
{
var weldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(item.WeldingDailyId);
if (weldingDaily != null && weldingDaily.WeldingDate.HasValue && weldingDaily.WeldingDate.Value.ToShortDateString() == DateTime.Now.ToShortDateString())
{
sizeSum += item.Size;
}
}
}
}
}
}
return sizeSum;
}
}
}
+101 -9
View File
@@ -5,11 +5,52 @@ using System.Text;
using System.Collections;
using System.IO;
using System.Web;
using System.Text.RegularExpressions;
using System.Net;
namespace BLL
{
public static class FileInsertService
{
/// <summary>
/// 获取服务器图片转byte
/// </summary>
/// <param name="fileHost"></param>
/// <param name="attachUrl"></param>
/// <returns></returns>
public static List<byte[]> FilePathTransStream(string fileHost, string attachUrl)
{
List<byte[]> bytes = new List<byte[]>();
var strs = attachUrl.Trim().Split(',');
try
{
foreach (var fileUrl in strs)
{
string filepath = $"{fileHost}{fileUrl}";
// 创建WebClient实例
using (WebClient webClient = new WebClient())
{
// 下载图片并保存到内存流
using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
{
// 将MemoryStream转换为byte数组
byte[] imageBytes = ms.ToArray();
bytes.Add(imageBytes);
//// 使用byte数组(例如,保存到文件或进行其他处理)
//File.WriteAllBytes("localImage.jpg", imageBytes);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
return bytes;
}
/// <summary>
/// 获取附件数据流类
/// </summary>
@@ -19,7 +60,7 @@ namespace BLL
{
if (fileContextList != null && fileContextList.Count > 0)
{
string physicalpath = Funs.RootPath;
string physicalpath = Funs.AttachRootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
string fullPath = physicalpath + attachUrl;
if (!File.Exists(fullPath))
@@ -61,18 +102,29 @@ namespace BLL
{
if (strs.Count() > i)
{
string physicalpath = Funs.RootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
string fullPath = physicalpath + strs[i];
string physicalpath = Funs.AttachRootPath;
string fpath = strs[i];
string fullPath = physicalpath + fpath;
if (!File.Exists(fullPath))
{
byte[] fileContext = item;
int index = fullPath.LastIndexOf("\\");
string filePath = fullPath.Substring(0, index);
string fileName = Regex.Match(fullPath, @"[^/\\?]+(\?.*)?$").Value;
string filePath = fullPath.Replace(fileName, "");
//int index = fullPath.LastIndexOf("\\");
//string filePath = fullPath.Substring(0, index) ;
//string filePath = index > 0 ? fullPath.Substring(0, index) : fullPath;
if (!Directory.Exists(filePath))
try
{
Directory.CreateDirectory(filePath);
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog($"附件【{filePath}】获取异常!");
//continue;
}
//string savePath = fullPath + fileName;
@@ -125,7 +177,7 @@ namespace BLL
if (attachFile.AttachUrl != attachUrl)
{
///删除附件文件
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
BLL.UploadAttachmentService.DeleteFile(Funs.AttachRootPath, attachFile.AttachUrl);
////插入附件文件
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
attachFile.AttachSource = attachSource;
@@ -134,5 +186,45 @@ namespace BLL
}
}
}
/// <summary>
/// 数据和附件插入到多附件表【不存实际文件,只存地址】
/// </summary>
public static void InsertAttachFileRecord(string attachFileId, string dataId, string attachSource, string attachUrl)
{
var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFileId);
if (getAtt != null)
{
Funs.DB.AttachFile.DeleteOnSubmit(getAtt);
Funs.DB.SubmitChanges();
}
//多附件
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
if (attachFile == null && !string.IsNullOrEmpty(attachSource))
{
Model.AttachFile newAttachFile = new Model.AttachFile
{
AttachFileId = attachFileId,
ToKeyId = dataId,
AttachSource = attachSource,
AttachUrl = attachUrl
};
Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
Funs.DB.SubmitChanges();
}
else
{
if (attachFile.AttachUrl != attachUrl)
{
///删除附件文件
BLL.UploadAttachmentService.DeleteFile(Funs.AttachRootPath, attachFile.AttachUrl);
attachFile.AttachSource = attachSource;
attachFile.AttachUrl = attachUrl;
Funs.DB.SubmitChanges();
}
}
}
}
}