feat(hjgl):增加焊接日报审核流程

This commit is contained in:
2026-05-29 14:35:20 +08:00
parent 13bff0fc63
commit cb3c2c65ad
9 changed files with 2109 additions and 641 deletions
+26 -214
View File
@@ -255,125 +255,12 @@ namespace BLL
public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time)
{
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 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);
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, 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;
return BLL.WeldingDailyService.SaveWeldingDailyTempDetailByMobile(WeldJointId, Personid, time, null, 0);
}
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;
return BLL.WeldingDailyService.SaveWeldingDailyTempDetailByMobile(WeldJointId, Personid, time, weldingLocation, 0);
}
/// <summary>
@@ -387,101 +274,7 @@ namespace BLL
/// <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)
{
// 打底:只更新backingWelderIdcoverWelderId取焊口已有值
weldJoint.BackingWelderId = Personid;
coverWelderId = weldJoint.CoverWelderId;
backingWelderId = Personid;
bothWeldersFilled = !string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId);
}
else // welderType == 2
{
// 盖面:只更新coverWelderIdbackingWelderId取焊口已有值
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;
BLL.WeldingDailyService.AddWeldingDaily(weldingDaily);
}
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;
return BLL.WeldingDailyService.SaveWeldingDailyTempDetailByMobile(WeldJointId, Personid, time, weldingLocation, welderType);
}
#region
@@ -635,6 +428,25 @@ namespace BLL
/// <param name="weldingDailyId"></param>
/// <returns></returns>
private static string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave, string weldingDailyId, string projectId)
{
return InsertWeldingDailyItem(weldJointId, coverWelderId, backingWelderId, jointAttribute, weldingDate, batchCondition, isSave, weldingDailyId, projectId, null);
}
/// <summary>
/// 日报明细插入(更新焊口信息),组批等
/// </summary>
/// <param name="weldJointId">焊口ID</param>
/// <param name="coverWelderId">盖面焊工ID</param>
/// <param name="backingWelderId">打底焊工ID</param>
/// <param name="jointAttribute">焊口属性</param>
/// <param name="weldingDate">焊接日期</param>
/// <param name="batchCondition">组批条件</param>
/// <param name="isSave">是否保存</param>
/// <param name="weldingDailyId">日报ID</param>
/// <param name="projectId">项目ID</param>
/// <param name="weldingLocationId">焊接位置ID</param>
/// <returns>错误信息</returns>
private static string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave, string weldingDailyId, string projectId, string weldingLocationId)
{
string errlog = string.Empty;
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
@@ -652,10 +464,10 @@ namespace BLL
newWeldJoint.BackingWelderId = backingWelderId;
newWeldJoint.CoverWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, coverWelderId).TeamGroupId;
newWeldJoint.BackingWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, backingWelderId).TeamGroupId;
//if (item.WeldingLocationId != Const._Null)
//{
// newWeldJoint.WeldingLocationId = item.WeldingLocationId;
//}
if (!string.IsNullOrEmpty(weldingLocationId))
{
newWeldJoint.WeldingLocationId = weldingLocationId;
}
newWeldJoint.JointAttribute = jointAttribute;
BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
@@ -293,6 +293,408 @@ namespace BLL
db.SubmitChanges();
}
}
#region
/// <summary>
/// 移动端按焊口保存焊接日报待审核明细
/// </summary>
/// <param name="weldJointId">焊口ID</param>
/// <param name="personId">提交焊工ID</param>
/// <param name="time">焊接日期</param>
/// <param name="weldingLocationId">焊接位置ID</param>
/// <param name="welderType">焊工类型 0 全部 1 打底 2 盖面</param>
/// <returns>错误信息</returns>
public static string SaveWeldingDailyTempDetailByMobile(string weldJointId, string personId, string time, string weldingLocationId, int welderType)
{
string res = string.Empty;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
DateTime weldingDate;
if (!DateTime.TryParse(time, out weldingDate))
{
return "焊接日期不正确";
}
weldingDate = weldingDate.Date;
var person = db.Person_Persons.FirstOrDefault(x => x.PersonId == personId);
if (person == null)
{
return "人员不存在";
}
var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == weldJointId);
string err = CheckWeldingDailyTempJoint(db, joint, weldingLocationId);
if (!string.IsNullOrEmpty(err))
{
return err;
}
var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == joint.WeldJointId);
var pending = GetPendingTempDetail(db, weldJointId, weldingDate);
string coverWelderId = pending != null ? pending.CoverWelderId : weldJoint.CoverWelderId;
string backingWelderId = pending != null ? pending.BackingWelderId : weldJoint.BackingWelderId;
if (welderType == 0)
{
coverWelderId = personId;
backingWelderId = personId;
}
else if (welderType == 1)
{
backingWelderId = personId;
}
else if (welderType == 2)
{
coverWelderId = personId;
}
else
{
return "焊工类型不正确";
}
SaveWeldingDailyTempDetail(db, joint, weldTask, weldingDate, personId, coverWelderId, backingWelderId,
joint.JointAttribute, weldingLocationId, joint.ProjectId, null, null, joint.WeldingMode);
db.SubmitChanges();
}
catch (Exception ex)
{
APICommonService.SaveSysAPILog("erro", ex.ToString(), "-1");
res = ex.Message;
}
}
return res;
}
/// <summary>
/// Web端保存焊接日报待审核明细
/// </summary>
/// <param name="weldJointId">焊口ID</param>
/// <param name="submitPersonId">提交人ID</param>
/// <param name="weldingDate">焊接日期</param>
/// <param name="coverWelderId">盖面焊工ID</param>
/// <param name="backingWelderId">打底焊工ID</param>
/// <param name="jointAttribute">焊口属性</param>
/// <param name="weldingLocationId">焊接位置ID</param>
/// <param name="projectId">项目ID</param>
/// <param name="unitId">单位ID</param>
/// <param name="unitWorkId">单位工程ID</param>
/// <param name="weldingMode">焊接模式</param>
/// <returns>错误信息</returns>
public static string SaveWeldingDailyTempDetailByWeb(string weldJointId, string submitPersonId, DateTime weldingDate, string coverWelderId,
string backingWelderId, string jointAttribute, string weldingLocationId, string projectId, string unitId, string unitWorkId, string weldingMode)
{
string res = string.Empty;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
weldingDate = weldingDate.Date;
weldingLocationId = NormalizeNullValue(weldingLocationId);
unitId = NormalizeNullValue(unitId);
unitWorkId = NormalizeNullValue(unitWorkId);
if (string.IsNullOrEmpty(weldJointId))
{
return "焊口不能为空";
}
if (string.IsNullOrEmpty(coverWelderId) || string.IsNullOrEmpty(backingWelderId))
{
return "未选择完整焊工";
}
var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == weldJointId);
string err = CheckWeldingDailyTempJoint(db, joint, weldingLocationId);
if (!string.IsNullOrEmpty(err))
{
return err;
}
var coverWelder = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.PersonId == coverWelderId);
if (coverWelder == null)
{
return "盖面焊工不存在";
}
var backingWelder = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.PersonId == backingWelderId);
if (backingWelder == null)
{
return "打底焊工不存在";
}
var weldTask = db.HJGL_WeldTask.FirstOrDefault(x => x.WeldJointId == weldJointId);
SaveWeldingDailyTempDetail(db, joint, weldTask, weldingDate, submitPersonId, coverWelderId, backingWelderId,
jointAttribute, weldingLocationId, projectId, unitId, unitWorkId, weldingMode);
db.SubmitChanges();
}
catch (Exception ex)
{
APICommonService.SaveSysAPILog("erro", ex.ToString(), "-1");
res = ex.Message;
}
}
return res;
}
/// <summary>
/// 审核通过焊接日报待审核明细
/// </summary>
/// <param name="tempDetailIds">待审核明细ID集合</param>
/// <param name="auditMan">审核人</param>
/// <returns>错误信息</returns>
public static string AuditWeldingDailyTempDetails(string[] tempDetailIds, string auditMan)
{
string errlog = string.Empty;
if (tempDetailIds == null || tempDetailIds.Length == 0)
{
return "请选择要审核的记录";
}
foreach (string tempDetailId in tempDetailIds.Where(x => !string.IsNullOrEmpty(x)).Distinct())
{
var tempDetail = Funs.DB.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.TempDetailId == tempDetailId);
if (tempDetail == null)
{
errlog += "待审核记录不存在;";
continue;
}
if (tempDetail.AuditState != 0)
{
errlog += "焊口待审核记录已审核;";
continue;
}
if (string.IsNullOrEmpty(tempDetail.CoverWelderId) || string.IsNullOrEmpty(tempDetail.BackingWelderId))
{
errlog += "焊口待审核记录未选择完整焊工;";
continue;
}
var weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(tempDetail.WeldJointId);
if (weldJoint == null)
{
errlog += "焊口不存在;";
continue;
}
if (!string.IsNullOrEmpty(weldJoint.WeldingDailyId))
{
errlog += "焊口【" + weldJoint.WeldJointCode + "】已生成焊接日报;";
continue;
}
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", tempDetail.ProjectId);
if (batchC == null)
{
errlog += "请设置项目的组批条件;";
continue;
}
var weldingDaily = GetOrCreateWeldingDailyByTempDetail(tempDetail);
string itemErr = InsertWeldingDailyItem(tempDetail.WeldJointId, tempDetail.CoverWelderId, tempDetail.BackingWelderId,
tempDetail.JointAttribute, weldingDaily.WeldingDate, batchC.SetValue, true, weldingDaily.WeldingDailyId,
tempDetail.ProjectId, tempDetail.WeldingLocationId);
if (!string.IsNullOrEmpty(itemErr))
{
errlog += itemErr;
continue;
}
BLL.HJGL_PipelineComponentjointService.UpdateStateByWeldJointId(tempDetail.WeldJointId, (DateTime)weldingDaily.WeldingDate);//更改预制口实际时间和状态
PipelineService.UpdataDateByWeldJointId(tempDetail.WeldJointId);//更改安装口时间和状态
tempDetail.AuditState = 1;
tempDetail.AuditMan = auditMan;
tempDetail.AuditDate = DateTime.Now;
Funs.DB.SubmitChanges();
}
return errlog;
}
/// <summary>
/// 删除未审核的焊接日报待审核明细
/// </summary>
/// <param name="tempDetailIds">待审核明细ID集合</param>
/// <returns>错误信息</returns>
public static string DeleteWeldingDailyTempDetails(string[] tempDetailIds)
{
if (tempDetailIds == null || tempDetailIds.Length == 0)
{
return "请选择要删除的记录";
}
string errlog = string.Empty;
foreach (string tempDetailId in tempDetailIds.Where(x => !string.IsNullOrEmpty(x)).Distinct())
{
var tempDetail = Funs.DB.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.TempDetailId == tempDetailId);
if (tempDetail == null)
{
continue;
}
if (tempDetail.AuditState != 0)
{
errlog += "已审核记录不能删除;";
continue;
}
Funs.DB.HJGL_WeldingDailyTempDetail.DeleteOnSubmit(tempDetail);
}
Funs.DB.SubmitChanges();
return errlog;
}
private static string CheckWeldingDailyTempJoint(Model.SGGLDB db, Model.View_HJGL_WeldJoint joint, string weldingLocationId)
{
if (joint == null)
{
return "焊口不存在";
}
if (!string.IsNullOrEmpty(joint.WeldingDailyId))
{
return "焊口【" + joint.WeldJointCode + "】已生成焊接日报,不能提交待审核";
}
if (!string.IsNullOrEmpty(weldingLocationId))
{
var weldingLocationModel = db.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationId == weldingLocationId);
if (weldingLocationModel == null)
{
return "焊口位置不存在";
}
}
return string.Empty;
}
private static Model.HJGL_WeldingDailyTempDetail GetPendingTempDetail(Model.SGGLDB db, string weldJointId, DateTime weldingDate)
{
return db.HJGL_WeldingDailyTempDetail.FirstOrDefault(x => x.WeldJointId == weldJointId
&& x.WeldingDate >= weldingDate.Date
&& x.WeldingDate < weldingDate.Date.AddDays(1)
&& x.AuditState == 0);
}
private static void SaveWeldingDailyTempDetail(Model.SGGLDB db, Model.View_HJGL_WeldJoint joint, Model.HJGL_WeldTask weldTask,
DateTime weldingDate, string submitPersonId, string coverWelderId, string backingWelderId, string jointAttribute,
string weldingLocationId, string projectId, string unitId, string unitWorkId, string weldingMode)
{
var pending = GetPendingTempDetail(db, joint.WeldJointId, weldingDate);
if (pending == null)
{
pending = new Model.HJGL_WeldingDailyTempDetail
{
TempDetailId = Guid.NewGuid().ToString(),
WeldJointId = joint.WeldJointId,
WeldingDate = weldingDate.Date,
AuditState = 0,
SubmitDate = DateTime.Now
};
db.HJGL_WeldingDailyTempDetail.InsertOnSubmit(pending);
}
pending.ProjectId = !string.IsNullOrEmpty(projectId) ? projectId : joint.ProjectId;
pending.UnitId = !string.IsNullOrEmpty(unitId) ? unitId : (weldTask != null && !string.IsNullOrEmpty(weldTask.UnitId) ? weldTask.UnitId : joint.UnitId);
pending.UnitWorkId = !string.IsNullOrEmpty(unitWorkId) ? unitWorkId : joint.UnitWorkId;
pending.CoverWelderId = coverWelderId;
pending.BackingWelderId = backingWelderId;
pending.JointAttribute = !string.IsNullOrEmpty(jointAttribute) ? jointAttribute : joint.JointAttribute;
pending.WeldingLocationId = !string.IsNullOrEmpty(weldingLocationId) ? weldingLocationId : joint.WeldingLocationId;
pending.WeldingMode = !string.IsNullOrEmpty(weldingMode) ? weldingMode : joint.WeldingMode;
pending.SubmitPersonId = submitPersonId;
pending.SubmitDate = DateTime.Now;
}
private static Model.HJGL_WeldingDaily GetOrCreateWeldingDailyByTempDetail(Model.HJGL_WeldingDailyTempDetail tempDetail)
{
var weldingDaily = Funs.DB.HJGL_WeldingDaily.FirstOrDefault(x => x.UnitWorkId == tempDetail.UnitWorkId
&& x.WeldingDate >= tempDetail.WeldingDate.Date
&& x.WeldingDate < tempDetail.WeldingDate.Date.AddDays(1));
if (weldingDaily != null)
{
return weldingDaily;
}
var submitPerson = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == tempDetail.SubmitPersonId);
string personName = submitPerson != null ? submitPerson.PersonName : string.Empty;
string perfix = string.Format("{0:yyyyMMdd}", tempDetail.WeldingDate) + "-" + personName + "-";
weldingDaily = new Model.HJGL_WeldingDaily
{
WeldingDailyId = Guid.NewGuid().ToString(),
WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", tempDetail.ProjectId, perfix),
WeldingDate = tempDetail.WeldingDate.Date,
ProjectId = tempDetail.ProjectId,
UnitWorkId = tempDetail.UnitWorkId,
UnitId = tempDetail.UnitId,
Tabler = tempDetail.SubmitPersonId,
TableDate = tempDetail.WeldingDate.Date,
Remark = "焊接日报待审核通过"
};
BLL.WeldingDailyService.AddWeldingDaily(weldingDaily);
return weldingDaily;
}
private static string NormalizeNullValue(string value)
{
return value == Const._Null ? null : value;
}
/// <summary>
/// 日报明细插入(更新焊口信息),组批等
/// </summary>
/// <param name="weldJointId">焊口ID</param>
/// <param name="coverWelderId">盖面焊工ID</param>
/// <param name="backingWelderId">打底焊工ID</param>
/// <param name="jointAttribute">焊口属性</param>
/// <param name="weldingDate">焊接日期</param>
/// <param name="batchCondition">组批条件</param>
/// <param name="isSave">是否保存</param>
/// <param name="weldingDailyId">日报ID</param>
/// <param name="projectId">项目ID</param>
/// <param name="weldingLocationId">焊接位置ID</param>
/// <returns>错误信息</returns>
private static string InsertWeldingDailyItem(string weldJointId, string coverWelderId, string backingWelderId, string jointAttribute, DateTime? weldingDate, string batchCondition, bool isSave, string weldingDailyId, string projectId, string weldingLocationId)
{
string errlog = string.Empty;
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
if (newWeldJoint == null)
{
return "焊口不存在;";
}
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
var weldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(weldingDailyId);
if (pipeline == null || weldingDaily == null)
{
return "焊口关联管线或日报不存在;";
}
if (!string.IsNullOrEmpty(coverWelderId) && !string.IsNullOrEmpty(backingWelderId))
{
if (isSave)
{
newWeldJoint.WeldingDailyId = weldingDailyId;
newWeldJoint.WeldingDailyCode = weldingDaily.WeldingDailyCode;
newWeldJoint.CoverWelderId = coverWelderId;
newWeldJoint.BackingWelderId = backingWelderId;
newWeldJoint.CoverWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, coverWelderId).TeamGroupId;
newWeldJoint.BackingWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, backingWelderId).TeamGroupId;
if (!string.IsNullOrEmpty(weldingLocationId))
{
newWeldJoint.WeldingLocationId = weldingLocationId;
}
newWeldJoint.JointAttribute = jointAttribute;
BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
// 更新焊口号 修改固定焊口号后 +G
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
errlog = PointBatchService.AddBatchByWeldJointId(weldJointId, weldingDate, batchCondition);//自动组批
}
}
else
{
errlog = "焊口" + "【" + newWeldJoint.WeldJointCode + "】" + "未选择焊工";
}
return errlog;
}
#endregion
/// <summary>
/// 日报明细删除
/// </summary>
+1 -1
View File
@@ -17042,7 +17042,7 @@
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@@ -52,10 +52,10 @@
</Items>
</f:Panel>--%>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" RegionSplit="true" EnableCollapse="true" ShowBorder="true"
Layout="Fit" ShowHeader="false" RegionSplitWidth="20px" BodyPadding="1px" Height="400px" IconFont="PlusCircle" Title="焊接日报"
Layout="VBox" BoxConfigAlign="Stretch" ShowHeader="false" RegionSplitWidth="20px" BodyPadding="1px" Height="400px" IconFont="PlusCircle" Title="焊接日报"
TitleToolTip="焊接日报" AutoScroll="true">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="焊接日报明细" EnableCollapse="true"
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" Title="焊接日报" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="WeldJointId" AllowCellEditing="true" OnRowClick="Grid1_RowClick" EnableRowClickEvent="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="WeldJointId"
AllowSorting="true" SortField="PipelineCode,WeldJointCode" SortDirection="ASC" OnSort="Grid1_Sort"
@@ -195,6 +195,91 @@
</f:DropDownList>
</PageItems>
</f:Grid>
<f:Grid ID="GridPending" ShowBorder="true" ShowHeader="true" Title="待审核"
runat="server" BoxFlex="1" DataKeyNames="TempDetailId" AllowCellEditing="false"
AllowColumnLocking="true" EnableColumnLines="true" DataIDField="TempDetailId"
AllowSorting="true" SortField="PipelineCode,WeldJointCode" SortDirection="ASC" OnSort="GridPending_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="30" OnPageIndexChange="GridPending_PageIndexChange"
EnableTextSelection="true" EnableCheckBoxSelect="true" KeepCurrentSelection="true">
<Toolbars>
<f:Toolbar ID="ToolbarPending" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:DatePicker ID="txtPendingWeldingDate" runat="server" Label="焊接日期" LabelAlign="Right"
LabelWidth="90px" Width="220px" AutoPostBack="true" OnTextChanged="PendingFilter_TextChanged">
</f:DatePicker>
<f:TextBox ID="txtPendingPipelineCode" runat="server" Label="管线号" EmptyText="输入查询条件"
LabelAlign="Right" AutoPostBack="true" OnTextChanged="PendingFilter_TextChanged">
</f:TextBox>
<f:TextBox ID="txtPendingWelderCode" runat="server" Label="焊工号" EmptyText="输入查询条件"
LabelAlign="Right" AutoPostBack="true" OnTextChanged="PendingFilter_TextChanged">
</f:TextBox>
<f:ToolbarFill ID="ToolbarFillPending" runat="server">
</f:ToolbarFill>
<f:Button ID="btnPendingAudit" Text="审核通过" ToolTip="审核通过" Icon="ApplicationEdit" runat="server"
ConfirmText="确认审核通过选中记录?" ConfirmTarget="Top" OnClick="btnPendingAudit_Click">
</f:Button>
<f:Button ID="btnPendingDelete" Text="删除" ToolTip="删除未审核记录" Icon="Delete" runat="server"
ConfirmText="确认删除选中待审核记录?" ConfirmTarget="Top" OnClick="btnPendingDelete_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center"/>
<f:RenderField HeaderText="管线号" ColumnID="PipelineCode" DataField="PipelineCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" Width="180px">
</f:RenderField>
<f:RenderField HeaderText="焊口号" ColumnID="WeldJointCode" DataField="WeldJointCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField HeaderText="焊接日期" ColumnID="WeldingDate" DataField="WeldingDate" FieldType="Date"
Renderer="Date" HeaderTextAlign="Center" TextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField HeaderText="盖面焊工" ColumnID="CoverWelderCode" DataField="CoverWelderCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="90px">
</f:RenderField>
<f:RenderField HeaderText="打底焊工" ColumnID="BackingWelderCode" DataField="BackingWelderCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="90px">
</f:RenderField>
<f:RenderField HeaderText="焊口属性" ColumnID="JointAttribute" DataField="JointAttribute" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField HeaderText="焊接位置" ColumnID="WeldingLocationCode" DataField="WeldingLocationCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField HeaderText="达因" ColumnID="Size" DataField="Size" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="80px">
</f:RenderField>
<f:RenderField HeaderText="外径" ColumnID="Dia" DataField="Dia" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="80px">
</f:RenderField>
<f:RenderField HeaderText="壁厚" ColumnID="Thickness" DataField="Thickness" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="80px">
</f:RenderField>
<f:RenderField HeaderText="焊接方法" ColumnID="WeldingMethodCode" DataField="WeldingMethodCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="160px">
</f:RenderField>
<f:RenderField HeaderText="提交人" ColumnID="SubmitPersonName" DataField="SubmitPersonName" FieldType="String"
HeaderTextAlign="Center" TextAlign="Center" Width="90px">
</f:RenderField>
<f:RenderField HeaderText="提交时间" ColumnID="SubmitDate" DataField="SubmitDate" FieldType="Date"
Renderer="Date" HeaderTextAlign="Center" TextAlign="Center" Width="140px">
</f:RenderField>
</Columns>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparatorPending" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarTextPending" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPendingPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPendingPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10"/>
<f:ListItem Text="30" Value="30"/>
<f:ListItem Text="50" Value="50"/>
<f:ListItem Text="100" Value="100"/>
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
@@ -245,4 +330,4 @@
}
</script>
</body>
</html>
</html>
@@ -19,7 +19,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
this.txtMonth.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.ddlPendingPageSize.SelectedValue = this.GridPending.PageSize.ToString();
this.txtPendingWeldingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.InitTreeMenu();//加载树
this.BindPendingGrid();
}
}
@@ -146,12 +149,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
{
this.BindGrid();
this.BindPendingGrid();
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(tvControlItem.SelectedNodeID);
txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(daily.UnitId);
if (daily != null)
{
txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(daily.UnitId);
txtTabler.Text = BLL.Person_PersonsService.GetPersonsNameById(daily.Tabler);
txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", daily.TableDate);
txtWeldingDate.Text = string.Format("{0:yyyy-MM-dd}", daily.WeldingDate);
txtTabler.Text = BLL.Person_PersonsService.GetPersonsNameById(daily.Tabler);
txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", daily.TableDate);
txtWeldingDate.Text = string.Format("{0:yyyy-MM-dd}", daily.WeldingDate);
}
//Model.Parameter3D parameter3D = new Model.Parameter3D();
//Model.ColorModel colorModel = new Model.ColorModel();
//colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
@@ -188,6 +195,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
if (this.tvControlItem.SelectedNode != null)
{
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(tvControlItem.SelectedNodeID);
if (daily == null)
{
Grid1.DataSource = null;
Grid1.DataBind();
return;
}
string strSql = @"SELECT WeldingDailyId,WeldJointId,PipelineCode,WeldJointCode,
BackingWelderCode,CoverWelderCode,Material1Code,Material2Code,
Dia,DNDia,Thickness,WeldTypeCode,WeldingMethodCode,WeldingWireCode,WeldingMode,
@@ -229,6 +243,79 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
#endregion
#region
/// <summary>
/// 绑定待审核焊接日报明细
/// </summary>
private void BindPendingGrid()
{
string strSql = @"SELECT temp.TempDetailId,
temp.WeldJointId,
temp.WeldingDate,
jot.PipelineCode,
jot.WeldJointCode,
coverWelder.WelderCode AS CoverWelderCode,
backingWelder.WelderCode AS BackingWelderCode,
temp.JointAttribute,
location.WeldingLocationCode,
jot.Size,
jot.Dia,
jot.Thickness,
jot.WeldingMethodCode,
submitPerson.PersonName AS SubmitPersonName,
temp.SubmitDate
FROM dbo.HJGL_WeldingDailyTempDetail AS temp
LEFT JOIN dbo.View_HJGL_WeldJoint AS jot ON jot.WeldJointId = temp.WeldJointId
LEFT JOIN dbo.SitePerson_Person AS coverWelder ON coverWelder.PersonId = temp.CoverWelderId
LEFT JOIN dbo.SitePerson_Person AS backingWelder ON backingWelder.PersonId = temp.BackingWelderId
LEFT JOIN dbo.Base_WeldingLocation AS location ON location.WeldingLocationId = temp.WeldingLocationId
LEFT JOIN dbo.Person_Persons AS submitPerson ON submitPerson.PersonId = temp.SubmitPersonId
WHERE temp.ProjectId = @ProjectId AND temp.AuditState = 0";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(tvControlItem.SelectedNodeID);
if (unitWork == null)
{
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(tvControlItem.SelectedNodeID);
if (daily != null)
{
unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(daily.UnitWorkId);
}
}
if (unitWork != null)
{
strSql += " AND temp.UnitWorkId = @UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", unitWork.UnitWorkId));
}
if (!string.IsNullOrEmpty(txtPendingWeldingDate.Text.Trim()))
{
strSql += " AND temp.WeldingDate >= @WeldingDate AND temp.WeldingDate < @WeldingDateEnd";
DateTime weldingDate = Convert.ToDateTime(txtPendingWeldingDate.Text.Trim()).Date;
listStr.Add(new SqlParameter("@WeldingDate", weldingDate));
listStr.Add(new SqlParameter("@WeldingDateEnd", weldingDate.AddDays(1)));
}
if (!string.IsNullOrEmpty(txtPendingPipelineCode.Text.Trim()))
{
strSql += " AND jot.PipelineCode LIKE @PendingPipelineCode";
listStr.Add(new SqlParameter("@PendingPipelineCode", "%" + txtPendingPipelineCode.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtPendingWelderCode.Text.Trim()))
{
strSql += " AND (coverWelder.WelderCode LIKE @PendingWelderCode OR backingWelder.WelderCode LIKE @PendingWelderCode)";
listStr.Add(new SqlParameter("@PendingWelderCode", "%" + txtPendingWelderCode.Text.Trim() + "%"));
}
strSql += " ORDER BY jot.PipelineCode, jot.WeldJointCode";
DataTable tb = SQLHelper.GetDataTableRunText(strSql, listStr.ToArray());
GridPending.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(GridPending.FilteredData, tb);
var table = this.GetPagedDataTable(GridPending, tb);
GridPending.DataSource = table;
GridPending.DataBind();
}
#endregion
#region
#region
/// <summary>
@@ -252,6 +339,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
BindGrid();
}
/// <summary>
/// 待审核排序
/// </summary>
protected void GridPending_Sort(object sender, GridSortEventArgs e)
{
BindPendingGrid();
}
#endregion
#region
@@ -265,6 +360,23 @@ namespace FineUIPro.Web.HJGL.WeldingManage
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 待审核页索引改变事件
/// </summary>
protected void GridPending_PageIndexChange(object sender, GridPageEventArgs e)
{
BindPendingGrid();
}
/// <summary>
/// 待审核分页选择下拉改变事件
/// </summary>
protected void ddlPendingPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
GridPending.PageSize = Convert.ToInt32(ddlPendingPageSize.SelectedValue);
BindPendingGrid();
}
#endregion
#endregion
@@ -509,6 +621,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
this.InitTreeMenu();
this.BindGrid();
this.BindPendingGrid();
}
#endregion
@@ -522,6 +635,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
BindGrid();
}
/// <summary>
/// 待审核筛选
/// </summary>
protected void PendingFilter_TextChanged(object sender, EventArgs e)
{
BindPendingGrid();
}
#endregion
protected void btnOut_Click(object sender, EventArgs e)
@@ -584,5 +705,52 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
/// <summary>
/// 待审核记录审核通过
/// </summary>
protected void btnPendingAudit_Click(object sender, EventArgs e)
{
if (GridPending.SelectedRowIDArray.Length == 0)
{
ShowNotify("请选择要审核的记录", MessageBoxIcon.Warning);
return;
}
string errlog = BLL.WeldingDailyService.AuditWeldingDailyTempDetails(GridPending.SelectedRowIDArray, this.CurrUser.PersonId);
this.InitTreeMenu();
this.BindPendingGrid();
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("审核通过!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("部分记录处理失败:" + errlog, MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除未审核记录
/// </summary>
protected void btnPendingDelete_Click(object sender, EventArgs e)
{
if (GridPending.SelectedRowIDArray.Length == 0)
{
ShowNotify("请选择要删除的记录", MessageBoxIcon.Warning);
return;
}
string errlog = BLL.WeldingDailyService.DeleteWeldingDailyTempDetails(GridPending.SelectedRowIDArray);
this.BindPendingGrid();
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("删除成功!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop(errlog, MessageBoxIcon.Warning);
}
}
}
}
}
@@ -92,7 +92,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Grid1 控件。
/// </summary>
@@ -245,6 +245,105 @@ namespace FineUIPro.Web.HJGL.WeldingManage {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// GridPending 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid GridPending;
/// <summary>
/// ToolbarPending 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolbarPending;
/// <summary>
/// txtPendingWeldingDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtPendingWeldingDate;
/// <summary>
/// txtPendingPipelineCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPendingPipelineCode;
/// <summary>
/// txtPendingWelderCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPendingWelderCode;
/// <summary>
/// ToolbarFillPending 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFillPending;
/// <summary>
/// btnPendingAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPendingAudit;
/// <summary>
/// btnPendingDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPendingDelete;
/// <summary>
/// ToolbarSeparatorPending 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparatorPending;
/// <summary>
/// ToolbarTextPending 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarTextPending;
/// <summary>
/// ddlPendingPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPendingPageSize;
/// <summary>
/// Window1 控件。
@@ -1,4 +1,4 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WeldingLocationId.aspx.cs"
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WeldReportEdit.aspx.cs"
Inherits="FineUIPro.Web.WeldingProcess.WeldingManage.WeldReportEdit" %>
<!DOCTYPE html>
@@ -466,23 +466,17 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
ShowNotify("请选择单位名称!", MessageBoxIcon.Warning);
return;
}
if (BLL.WeldingDailyService.IsExistWeldingDailyCode(this.txtWeldingDailyCode.Text,
!string.IsNullOrEmpty(this.WeldingDailyId) ? this.WeldingDailyId : "", CurrUser.LoginProjectId))
{
ShowNotify("日报编号已存在,请重新录入", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtWeldingDate.Text) ||
string.IsNullOrEmpty(this.txtWeldingDailyCode.Text.Trim()))
{
ShowNotify("日报告号、焊接日期不能为空", MessageBoxIcon.Warning);
return;
}
// 创建新的焊接日报
var newWeldingDaily = CreateNewWeldingDaily();
// 获取焊接信息
var weldJointView = GetWeldJointView();
if (this.Grid1.SelectedRowIDArray == null || this.Grid1.SelectedRowIDArray.Length == 0)
{
ShowNotify("请选择要提交待审核的焊口!", MessageBoxIcon.Warning);
return;
}
string errlog = string.Empty;
string eventArg = string.Empty;
@@ -491,20 +485,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
if (eventArg == string.Empty) //焊工焊接的所有焊口资质都符合要求)
{
if (!string.IsNullOrEmpty(this.WeldingDailyId))
{
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
BLL.WeldingDailyService.UpdateWeldingDaily(newWeldingDaily);
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldReportMenuId, Const.BtnModify, this.WeldingDailyId);
}
else
{
this.WeldingDailyId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingDaily));
newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
BLL.WeldingDailyService.AddWeldingDaily(newWeldingDaily);
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldReportMenuId, Const.BtnAdd, this.WeldingDailyId);
}
DateTime weldingDate = Funs.GetNewDateTime(this.txtWeldingDate.Text) ?? DateTime.Now;
int saveCount = 0;
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
@@ -514,119 +496,57 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
if (this.Grid1.SelectedRowIDArray.Contains(rowId))
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (newWeldJoint != null)
if (t == null)
{
newWeldJoint.JointAttribute = values.Value<string>("JointAttribute");
newWeldJoint.WeldingLocationId = values.Value<string>("WeldingLocationId");
var coverWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId &&
x.WelderCode == values.Value<string>("CoverWelderCode")
select x).FirstOrDefault();
if (coverWelderCode != null)
{
t.CoverWelderId = coverWelderCode.PersonId;
newWeldJoint.CoverWelderId = coverWelderCode.PersonId;
newWeldJoint.CoverWelderTeamGroupId = coverWelderCode.TeamGroupId;
}
var backingWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId &&
x.WelderCode == values.Value<string>("BackingWelderCode")
select x).FirstOrDefault();
if (backingWelderCode != null)
{
t.BackingWelderId = backingWelderCode.PersonId;
newWeldJoint.BackingWelderId = backingWelderCode.PersonId;
newWeldJoint.BackingWelderTeamGroupId = backingWelderCode.TeamGroupId;
}
WeldTaskService.UpdateWeldTask(t);
WeldJointService.UpdateWeldJoint(newWeldJoint);
//if (!string.IsNullOrEmpty(values.Value<string>("JointAttribute").ToString()))
//{
// newWeldJoint.JointAttribute = values.Value<string>("JointAttribute").ToString();
//}
//BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId,
newWeldJoint.JointAttribute, Const.BtnAdd);
errlog += "焊接任务不存在;";
continue;
}
}
}
// 获取组批条件
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", CurrUser.LoginProjectId);
if (batchC != null)
{
string batchCondition = batchC.SetValue;
// 新建日报
if (weldJointView.Count() == 0)
{
foreach (string row in Grid1.SelectedRowIDArray)
var weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (weldJoint == null)
{
var t = BLL.WeldTaskService.GetWeldTaskById(row);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId,
newWeldJoint.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
errlog += "焊口不存在;";
continue;
}
}
else
{
for (int i = 0; i < Grid1.Rows.Count; i++)
string weldJointCode = values.Value<string>("WeldJointCode");
var coverWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId &&
x.WelderCode == values.Value<string>("CoverWelderCode")
select x).FirstOrDefault();
if (coverWelderCode == null)
{
if (Grid1.SelectedRowIDArray.Contains(Grid1.Rows[i].RowID))
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
errlog += InsertWeldingDailyItem(t.WeldJointId, t.CoverWelderId, t.BackingWelderId,
newWeldJoint.JointAttribute, newWeldingDaily.WeldingDate, batchCondition, true);
}
else
{
var t = BLL.WeldTaskService.GetWeldTaskById(Grid1.Rows[i].RowID);
errlog += BLL.WeldingDailyService
.DeleteWeldingDailyItemByweldJointId(t.WeldJointId);
}
errlog += "焊口【" + weldJointCode + "】盖面焊工不存在;";
continue;
}
var backingWelderCode = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == CurrUser.LoginProjectId &&
x.WelderCode == values.Value<string>("BackingWelderCode")
select x).FirstOrDefault();
if (backingWelderCode == null)
{
errlog += "焊口【" + weldJointCode + "】打底焊工不存在;";
continue;
}
string itemErr = BLL.WeldingDailyService.SaveWeldingDailyTempDetailByWeb(
t.WeldJointId,
CurrUser.PersonId,
weldingDate,
coverWelderCode.PersonId,
backingWelderCode.PersonId,
values.Value<string>("JointAttribute"),
values.Value<string>("WeldingLocationId"),
CurrUser.LoginProjectId,
this.drpUnit.SelectedValue,
this.drpUnitWork.SelectedValue != BLL.Const._Null ? this.drpUnitWork.SelectedValue : this.UnitWorkId,
weldJoint.WeldingMode);
if (!string.IsNullOrEmpty(itemErr))
{
errlog += "焊口【" + weldJointCode + "】" + itemErr + "";
continue;
}
saveCount++;
}
// 日报已存在的情况 暂时
//else
//{
// var weldJoints = from x in weldJointView select x.WeldJointId;
// foreach (var item in GetWeldingDailyItem)
// {
// // 如日报明细存在则只更新焊口信息,如进批条件改变,则只有删除后再重新增加
// if (weldJoints.Contains(item.WeldJointId))
// {
// var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// newWeldJoint.WeldingDailyId = this.WeldingDailyId;
// newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
// newWeldJoint.CoverWelderId = item.CoverWelderId;
// newWeldJoint.BackingWelderId = item.BackingWelderId;
// if (!string.IsNullOrEmpty(item.JointAttribute))
// {
// newWeldJoint.JointAttribute = item.JointAttribute;
// }
// BLL.WeldJointService.UpdateWeldJoint(newWeldJoint);
// //更新焊口号 修改固定焊口号后 +G
// BLL.WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
// }
// else
// {
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, batchCondition, true);
// }
// }
//}
}
else
{
errlog += "请设置项目的组批条件";
}
#region 60
@@ -676,14 +596,9 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
#endregion
System.Threading.Tasks.Task.Run(() =>
{
ChanggeState();
});
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("保存成功", MessageBoxIcon.Success);
ShowNotify("已提交待审核", MessageBoxIcon.Success);
drpJointAttribute_SelectedIndexChanged(null, null);
BindGrid(null);
//PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
@@ -691,7 +606,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
else
{
// string okj = ActiveWindow.GetWriteBackValueReference(newWeldReportMain.WeldingDailyId) + ActiveWindow.GetHidePostBackReference();
Alert.ShowInTop("保存成功!" + "焊接明细中" + errlog, "提交结果", MessageBoxIcon.Warning);
Alert.ShowInTop("已提交待审核" + saveCount + "条;焊接明细中" + errlog, "提交结果", MessageBoxIcon.Warning);
drpJointAttribute_SelectedIndexChanged(null, null);
BindGrid(null);
// ShowAlert("焊接明细中" + errlog, MessageBoxIcon.Warning);
@@ -1228,4 +1143,4 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
#endregion
}
}
}
+1264 -277
View File
File diff suppressed because it is too large Load Diff