This commit is contained in:
2024-09-27 18:17:21 +08:00
parent be070f85e2
commit 064a849b97
73 changed files with 3248 additions and 589 deletions
+119 -1
View File
@@ -1,4 +1,5 @@
using System;
using FineUIPro;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -257,7 +258,124 @@ namespace BLL
BLL.PointBatchDetailService.AutoPoint(pointBatchId);
}
#endregion
/// <summary>
/// 手动点口
/// </summary>
/// <param name="weldJointId"></param>
/// <returns></returns>
public static string ManualPointSave(string weldJointId)
{
string res = "";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var PointBatchItemModel = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == weldJointId);
var PointBatchId= PointBatchItemModel.PointBatchId;
var batch = BLL.PointBatchService.GetPointBatchById(PointBatchId);
if (!batch.EndDate.HasValue)
{
var weldJoint = (from x in db.View_HJGL_WeldJoint
where x.WeldJointId == weldJointId
select x).FirstOrDefault();
Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", weldJoint.ProjectId);
if (batchSet != null && weldJoint != null)
{
int needJointNum = 0;
int pointNumG = 0;
int pointNumA = 0;
if (batchSet.SetValue.Contains("6")) //按管线组批
{
var pipeline = (from x in db.HJGL_Pipeline
join y in db.HJGL_WeldJoint on x.PipelineId equals y.PipelineId
join z in db.HJGL_Batch_PointBatchItem on y.WeldJointId equals z.WeldJointId
where z.PointBatchId == PointBatchId
select x).FirstOrDefault();
if (pipeline != null)
{
Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
if (rate != null)
{
int totalJointCount = db.HJGL_WeldJoint.Count(x => x.PipelineId == pipeline.PipelineId);
needJointNum = Convert.ToInt32(Math.Ceiling((totalJointCount * rate.DetectionRateValue.Value) * 0.01));
// 安装口检测数量
pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
// 预制口要检测的数量
pointNumA = needJointNum - pointNumG;
var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "安装口"
select x).Count();
var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "预制口"
select x).Count();
if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
{
res = "安装口已达检测标准,无需再点此安装口!";
return res;
}
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
{
res = "预制口已达检测标准,无需再点此预制口!";
return res;
}
}
}
}
else //不按管线组批
{
string unitWorkId = weldJoint.UnitWorkId;
string rateId = weldJoint.DetectionRateId;
string detectionType = weldJoint.DetectionType;
int totalJointNum = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionType == detectionType
select x).Count();
Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(rateId);
if (rate != null)
{
needJointNum = Convert.ToInt32(Math.Ceiling((totalJointNum * rate.DetectionRateValue.Value) * 0.01));
// 安装口检测数量
pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
// 预制口要检测的数量
pointNumA = needJointNum - pointNumG;
var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
&& x.PointState == "1" && z.JointAttribute == "安装口"
select x).Count();
var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
&& x.PointState == "1" && z.JointAttribute == "预制口"
select x).Count();
if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
{
res = "安装口已达检测标准,无需再点此安装口!";
return res;
}
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
{
res = "预制口已达检测标准,无需再点此预制口!";
return res;
}
}
}
}
PointBatchDetailService.UpdatePointBatchDetail(PointBatchItemModel.PointBatchItemId, "1", System.DateTime.Now);
}
else
{
res = "批已关闭,不能点口!";
}
}
return res;
}
#region
/// <summary>
/// 点口调整
@@ -67,6 +67,7 @@ namespace BLL
where PipelineComponentIdList.Contains(x.PipelineComponentId)
select new PackagingPrepipeItem
{
PipelineComponentId = x.PipelineComponentId,
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = "1/个",
UnitWorkName = z.UnitWorkName,
@@ -101,6 +102,18 @@ namespace BLL
HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(q);
}
}
public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId);
if (table != null)
{
table.PipelineComponentId = PipelineComponentIds;
}
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
}
}
}
}
+13 -1
View File
@@ -1,4 +1,5 @@
using System;
using Microsoft.SqlServer.Dts.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -45,6 +46,17 @@ namespace BLL
#endregion 线
public static Model.View_HJGL_WeldJoint GetHJGL_WeldJoint(string WeldJointId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
// 从数据库中获取符合条件的管线数据
var weldjoint = db.View_HJGL_WeldJoint
.Where(p => p.WeldJointId == WeldJointId)
.FirstOrDefault();
return weldjoint;
}
}
#region
+50 -1
View File
@@ -1,8 +1,11 @@
using System;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using static QRCoder.PayloadGenerator;
namespace BLL
{
@@ -254,6 +257,52 @@ namespace BLL
}
#endregion
public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time)
{
string res = "";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var peson=db.Person_Persons.FirstOrDefault(x => x.PersonId == Personid);
if (peson == null)
{
res = "人员不存在";
return res;
}
var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
if (joint == null)
{
res = "焊口不存在";
return res;
}
var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date);
if (weldingDaily == null)
{
string perfix = string.Format("{0:yyyyMMdd}", System.DateTime.Now) + "-" + peson.PersonName + "-";
weldingDaily = new Model.HJGL_WeldingDaily();
weldingDaily.WeldingDailyId = Guid.NewGuid().ToString();
weldingDaily.WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", joint.ProjectId, perfix);
weldingDaily.WeldingDate = Convert.ToDateTime(time).Date;
weldingDaily.ProjectId = joint.ProjectId;
weldingDaily.UnitWorkId = joint.UnitWorkId;
weldingDaily.UnitId = joint.UnitId;
weldingDaily.Tabler = Personid;
weldingDaily.TableDate = Convert.ToDateTime(time).Date;
db.HJGL_WeldingDaily.InsertOnSubmit(weldingDaily);
db.SubmitChanges();
}
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", joint.ProjectId);
if (batchC != null)
{
string batchCondition = batchC.SetValue;
InsertWeldingDailyItem(WeldJointId, Personid, Personid, joint.JointAttribute, weldingDaily.WeldingDate, batchCondition, true, weldingDaily.WeldingDailyId, joint.ProjectId);
}
BLL.WeldJointService.UpdateWeldJointAddG(WeldJointId, joint.JointAttribute, Const.BtnAdd);
}
return res;
}
#region
/// <summary>
/// 保存焊接日报明细