This commit is contained in:
commit
c803f8e20b
|
|
@ -376,6 +376,115 @@ namespace BLL
|
|||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存焊接日报(支持打底和盖面焊工分别指定)
|
||||
/// </summary>
|
||||
/// <param name="WeldJointId">焊口ID</param>
|
||||
/// <param name="Personid">焊工人员ID</param>
|
||||
/// <param name="time">日期</param>
|
||||
/// <param name="weldingLocation">焊接位置ID</param>
|
||||
/// <param name="welderType">焊工类型 0 全部 1 打底 2 盖面</param>
|
||||
/// <returns></returns>
|
||||
public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time, string weldingLocation, int welderType)
|
||||
{
|
||||
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 weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
|
||||
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
|
||||
|
||||
// 根据焊工类型确定盖面/打底焊工ID,以及是否两者都已填充
|
||||
string coverWelderId;
|
||||
string backingWelderId;
|
||||
bool bothWeldersFilled;
|
||||
|
||||
if (welderType == 0)
|
||||
{
|
||||
// 全部:打底和盖面都是同一人
|
||||
coverWelderId = Personid;
|
||||
backingWelderId = Personid;
|
||||
bothWeldersFilled = true;
|
||||
}
|
||||
else if (welderType == 1)
|
||||
{
|
||||
// 打底:只更新backingWelderId,coverWelderId取焊口已有值
|
||||
weldJoint.BackingWelderId = Personid;
|
||||
coverWelderId = weldJoint.CoverWelderId;
|
||||
backingWelderId = Personid;
|
||||
bothWeldersFilled = !string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId);
|
||||
}
|
||||
else // welderType == 2
|
||||
{
|
||||
// 盖面:只更新coverWelderId,backingWelderId取焊口已有值
|
||||
weldJoint.CoverWelderId = Personid;
|
||||
coverWelderId = Personid;
|
||||
backingWelderId = weldJoint.BackingWelderId;
|
||||
bothWeldersFilled = !string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId);
|
||||
}
|
||||
|
||||
// 更新焊口位置
|
||||
weldJoint.WeldingLocationId = weldingLocation;
|
||||
WeldJointService.UpdateWeldJoint(weldJoint);
|
||||
|
||||
// 只有打底和盖面都填充了时才保存WeldingDate和进批
|
||||
if (bothWeldersFilled)
|
||||
{
|
||||
var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date && x.UnitWorkId == joint.UnitWorkId);
|
||||
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();
|
||||
}
|
||||
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, coverWelderId, backingWelderId, 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>
|
||||
/// 保存焊接日报明细
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
<f:Label runat="server" Text="红色表示分数低于80分。" CssClass="LabelColor"></f:Label>
|
||||
<f:Label runat="server" Text="红色表示分数低于60分。" CssClass="LabelColor"></f:Label>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -201,6 +201,38 @@ namespace WebAPI.Controllers
|
|||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊口id保存到日报
|
||||
/// </summary>
|
||||
/// <param name="WeldJointId">焊口号</param>
|
||||
/// <param name="Personid">人员ID</param>
|
||||
/// <param name="time">时间</param>
|
||||
/// <param name="weldingLocation">焊接位置</param>
|
||||
/// <param name="welderType">焊工类型</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Model.ResponeData SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time,string weldingLocation,int welderType)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
string res = APIPreWeldingDailyService.SaveWeldingDailyByWeldJointId(WeldJointId, Personid, time, weldingLocation, welderType);
|
||||
|
||||
if (!string.IsNullOrEmpty(res))
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = res;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 更新焊接日报焊口信息
|
||||
|
|
|
|||
Loading…
Reference in New Issue