提交代码

This commit is contained in:
2023-11-24 18:29:30 +08:00
parent 00db9731bf
commit 3aeb7e47de
12 changed files with 541 additions and 27 deletions
@@ -647,8 +647,103 @@ namespace FineUIPro.Web.HJGL.PointTrust
{
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
{
Model.SGGLDB db = Funs.DB;
var weldJoint = (from x in db.HJGL_WeldJoint
join y in db.HJGL_Batch_PointBatchItem on x.WeldJointId equals y.WeldJointId
where y.PointBatchItemId == Grid1.SelectedRowID
select x).FirstOrDefault();
Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", this.CurrUser.LoginProjectId);
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 == this.PointBatchId
select x).FirstOrDefault();
if (pipeline != null)
{
this.lbPipelineCode.Text = pipeline.PipelineCode;
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)
{
Alert.ShowInTop("安装口已达检测标准,无需再点此安装口!", MessageBoxIcon.Warning);
return;
}
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
{
Alert.ShowInTop("预制口已达检测标准,无需再点此预制口!", MessageBoxIcon.Warning);
return;
}
}
}
}
else //不按管线组批
{
string unitWorkId = this.tvControlItem.SelectedNode.ParentNode.ParentNode.ParentNode.NodeID;
string rateId = this.tvControlItem.SelectedNode.ParentNode.NodeID.Split('|')[0];
string detectionType = this.tvControlItem.SelectedNode.ParentNode.ParentNode.NodeID.Split('|')[0];
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)
{
Alert.ShowInTop("安装口已达检测标准,无需再点此安装口!", MessageBoxIcon.Warning);
return;
}
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
{
Alert.ShowInTop("预制口已达检测标准,无需再点此预制口!", MessageBoxIcon.Warning);
return;
}
}
}
}
PointBatchDetailService.UpdatePointBatchDetail(Grid1.SelectedRowID, "1", System.DateTime.Now);
this.BindGrid();
tvControlItem_NodeCommand(null, null);
Alert.ShowInTop("已成功点口!", MessageBoxIcon.Success);
}
else
@@ -893,5 +988,18 @@ namespace FineUIPro.Web.HJGL.PointTrust
return newTrustCode;
}
/// <summary>
/// 已检测口明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnShow_Click(object sender, EventArgs e)
{
string unitWorkId = this.tvControlItem.SelectedNode.ParentNode.ParentNode.ParentNode.NodeID;
string rateId = this.tvControlItem.SelectedNode.ParentNode.NodeID.Split('|')[0];
string detectionType = this.tvControlItem.SelectedNode.ParentNode.ParentNode.NodeID.Split('|')[0];
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PointWeldJointView.aspx?unitWorkId={0}&rateId={1}&detectionType={2}", unitWorkId, rateId, detectionType, "新增 - ")));
}
}
}