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
@@ -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
}
}
}