1
This commit is contained in:
@@ -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>
|
||||
/// 点口调整
|
||||
|
||||
Reference in New Issue
Block a user