1
This commit is contained in:
@@ -308,6 +308,74 @@ namespace BLL
|
||||
return res;
|
||||
}
|
||||
|
||||
public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time, string weldingLocation)
|
||||
{
|
||||
string res = "";
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
try
|
||||
{
|
||||
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 weldingLocationModel = db.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationId == weldingLocation);
|
||||
if (weldingLocationModel == null)
|
||||
{
|
||||
res = "焊口位置不存在";
|
||||
return res;
|
||||
}
|
||||
var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date && x.UnitWorkId == joint.UnitWorkId);
|
||||
var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
|
||||
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
|
||||
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 = weldTask?.UnitId;
|
||||
weldingDaily.Tabler = Personid;
|
||||
weldingDaily.TableDate = Convert.ToDateTime(time).Date;
|
||||
db.HJGL_WeldingDaily.InsertOnSubmit(weldingDaily);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
//更新焊口位置
|
||||
if (weldingDaily != null)
|
||||
{
|
||||
weldJoint.WeldingLocationId= weldingLocation;
|
||||
WeldJointService.UpdateWeldJoint(weldJoint);
|
||||
}
|
||||
BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(WeldJointId, (DateTime)weldingDaily.WeldingDate);//更改预制口实际时间和状态
|
||||
PipelineService.UpdataDateByWeldJointId(WeldJointId);//更改安装口时间和状态
|
||||
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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APICommonService.SaveSysAPILog("erro", ex.ToString(), "-1");
|
||||
}
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#region 保存焊接日报明细
|
||||
/// <summary>
|
||||
/// 保存焊接日报明细
|
||||
|
||||
Reference in New Issue
Block a user