2023-09-09
This commit is contained in:
@@ -814,14 +814,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
|||||||
private string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave)
|
private string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave)
|
||||||
{
|
{
|
||||||
string errlog = string.Empty;
|
string errlog = string.Empty;
|
||||||
string[] condition = batchCondition.Split('|');
|
|
||||||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
|
||||||
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
|
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
|
||||||
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
|
|
||||||
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(pipeline.UnitWorkId);
|
|
||||||
var unit = BLL.UnitService.GetUnitByUnitId(pipeline.UnitId);
|
|
||||||
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(newWeldJoint.DetectionTypeId);
|
|
||||||
var ndtr = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
|
|
||||||
|
|
||||||
if (newWeldJoint != null && string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
|
if (newWeldJoint != null && string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
|
||||||
{
|
{
|
||||||
@@ -842,178 +835,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
|||||||
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
|
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
|
||||||
if (isSave)
|
if (isSave)
|
||||||
{
|
{
|
||||||
// 进批
|
|
||||||
//BLL.Batch_PointBatchItemService.InsertPointBatch(this.ProjectId, this.drpUnit.SelectedValue, this.drpUnitWork.SelectedValue, item.CoverWelderId, item.WeldJointId, weldingDate);
|
|
||||||
bool isPass = true;
|
|
||||||
foreach (string c in condition)
|
|
||||||
{
|
|
||||||
if (c == "1")
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pipeline.UnitWorkId))
|
|
||||||
{
|
|
||||||
isPass = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c == "2")
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pipeline.UnitId))
|
|
||||||
{
|
|
||||||
isPass = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c == "3")
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(newWeldJoint.DetectionTypeId))
|
|
||||||
{
|
|
||||||
isPass = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c == "4")
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pipeline.DetectionRateId))
|
|
||||||
{
|
|
||||||
isPass = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c == "5")
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pipeline.PipingClassId))
|
|
||||||
{
|
|
||||||
isPass = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 6是管线,7是焊工都不可能为空,这里就不判断了
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isPass)
|
|
||||||
{
|
|
||||||
string strSql = @"SELECT PointBatchId FROM dbo.HJGL_Batch_PointBatch
|
|
||||||
WHERE (EndDate IS NULL OR EndDate ='')
|
|
||||||
AND ProjectId = @ProjectId
|
|
||||||
AND UnitWorkId = @UnitWorkId AND UnitId =@UnitId
|
|
||||||
AND DetectionTypeId =@DetectionTypeId
|
|
||||||
AND DetectionRateId =@DetectionRateId";
|
|
||||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
||||||
listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
|
|
||||||
listStr.Add(new SqlParameter("@UnitWorkId", pipeline.UnitWorkId));
|
|
||||||
listStr.Add(new SqlParameter("@UnitId", pipeline.UnitId));
|
|
||||||
listStr.Add(new SqlParameter("@DetectionTypeId", newWeldJoint.DetectionTypeId));
|
|
||||||
listStr.Add(new SqlParameter("@DetectionRateId", pipeline.DetectionRateId));
|
|
||||||
|
|
||||||
// 5,6,7项为可选项
|
|
||||||
if (condition.Contains("5"))
|
|
||||||
{
|
|
||||||
strSql += " AND PipingClassId =@PipingClassId";
|
|
||||||
listStr.Add(new SqlParameter("@PipingClassId", pipeline.PipingClassId));
|
|
||||||
}
|
|
||||||
if (condition.Contains("6"))
|
|
||||||
{
|
|
||||||
strSql += " AND PipelineId =@PipelineId";
|
|
||||||
listStr.Add(new SqlParameter("@PipelineId", newWeldJoint.PipelineId));
|
|
||||||
}
|
|
||||||
if (condition.Contains("7"))
|
|
||||||
{
|
|
||||||
strSql += " AND WelderId =@WelderId";
|
|
||||||
listStr.Add(new SqlParameter("@WelderId", newWeldJoint.CoverWelderId));
|
|
||||||
}
|
|
||||||
|
|
||||||
SqlParameter[] parameter = listStr.ToArray();
|
|
||||||
DataTable batchInfo = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
||||||
|
|
||||||
string batchId = string.Empty;
|
|
||||||
if (batchInfo.Rows.Count == 0)
|
|
||||||
{
|
|
||||||
Model.HJGL_Batch_PointBatch batch = new Model.HJGL_Batch_PointBatch();
|
|
||||||
batch.PointBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_PointBatch));
|
|
||||||
batchId = batch.PointBatchId;
|
|
||||||
string perfix = project.ProjectCode + "-" + unitWork.UnitWorkCode + "-GD-DK-" + ndt.DetectionTypeCode + "-" + ndtr.DetectionRateValue.ToString() + "%-";
|
|
||||||
batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", this.CurrUser.LoginProjectId, perfix);
|
|
||||||
|
|
||||||
batch.ProjectId = CurrUser.LoginProjectId;
|
|
||||||
batch.UnitWorkId = pipeline.UnitWorkId;
|
|
||||||
batch.BatchCondition = batchCondition;
|
|
||||||
batch.UnitId = pipeline.UnitId;
|
|
||||||
batch.DetectionTypeId = newWeldJoint.DetectionTypeId;
|
|
||||||
batch.DetectionRateId = pipeline.DetectionRateId;
|
|
||||||
if (condition.Contains("5"))
|
|
||||||
{
|
|
||||||
batch.PipingClassId = pipeline.PipingClassId;
|
|
||||||
}
|
|
||||||
if (condition.Contains("6"))
|
|
||||||
{
|
|
||||||
batch.PipelineId = newWeldJoint.PipelineId;
|
|
||||||
if (pipeline.PipeArea==PipelineService.PipeArea_FIELD)
|
|
||||||
{
|
|
||||||
perfix += "XC-";
|
|
||||||
batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", this.CurrUser.LoginProjectId, perfix);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (pipeline.PipeArea == PipelineService.PipeArea_SHOP)
|
|
||||||
{
|
|
||||||
perfix += "GC-";
|
|
||||||
batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", this.CurrUser.LoginProjectId, perfix);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (condition.Contains("7"))
|
|
||||||
{
|
|
||||||
batch.WelderId = newWeldJoint.CoverWelderId;
|
|
||||||
}
|
|
||||||
batch.StartDate = DateTime.Now;
|
|
||||||
BLL.PointBatchService.AddPointBatch(batch);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
batchId = batchInfo.Rows[0][0].ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var b = BLL.PointBatchDetailService.GetBatchDetailByJotId(weldJointId);
|
|
||||||
if (b == null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Model.HJGL_Batch_PointBatchItem batchDetail = new Model.HJGL_Batch_PointBatchItem();
|
|
||||||
string pointBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_PointBatchItem));
|
|
||||||
batchDetail.PointBatchItemId = pointBatchItemId;
|
|
||||||
batchDetail.PointBatchId = batchId;
|
|
||||||
batchDetail.WeldJointId = weldJointId;
|
|
||||||
batchDetail.WeldingDate = weldingDate;
|
|
||||||
batchDetail.CreatDate = DateTime.Now;
|
|
||||||
BLL.Funs.DB.HJGL_Batch_PointBatchItem.InsertOnSubmit(batchDetail);
|
|
||||||
BLL.Funs.DB.SubmitChanges();
|
|
||||||
|
|
||||||
// 焊工首道口RT必点
|
|
||||||
var joints = from x in Funs.DB.HJGL_Batch_PointBatchItem
|
|
||||||
join y in Funs.DB.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
|
|
||||||
join z in Funs.DB.Base_DetectionType on y.DetectionTypeId equals z.DetectionTypeId
|
|
||||||
join j in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals j.WeldJointId
|
|
||||||
where z.DetectionTypeCode == "RT"
|
|
||||||
&& j.CoverWelderId == newWeldJoint.CoverWelderId
|
|
||||||
select x;
|
|
||||||
if (joints.Count() <= 1)
|
|
||||||
{
|
|
||||||
BLL.PointBatchDetailService.UpdatePointBatchDetail(pointBatchItemId, "1", System.DateTime.Now);
|
|
||||||
BLL.PointBatchDetailService.UpdateWelderFirst(pointBatchItemId, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errlog += "焊口【" + newWeldJoint.WeldJointCode + "】组批条件不能为空。";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
errlog = PointBatchService.AddBatchByWeldJointId(weldJointId, weldingDate, batchCondition);//自动组批
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1040,9 +863,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
|||||||
string errlog = string.Empty;
|
string errlog = string.Empty;
|
||||||
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
|
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
|
||||||
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
|
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
|
||||||
var unit = BLL.UnitService.GetUnitByUnitId(pipeline.UnitId);
|
|
||||||
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(newWeldJoint.DetectionTypeId);
|
|
||||||
var ndtr = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
|
|
||||||
|
|
||||||
if (newWeldJoint != null && !string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
|
if (newWeldJoint != null && !string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user