2023-01-02 焊接日报修改

This commit is contained in:
2023-01-02 12:21:10 +08:00
parent e9196b94ce
commit dc31914fe7
5 changed files with 170 additions and 93 deletions
@@ -193,7 +193,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </summary>
private void BindGrid(List<Model.SpWeldingDailyItem> weldingDailyItem)
{
var aw = this.Grid1.SelectedRowIDArray;
DataTable dt = null;
var list = from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (weldingDailyItem != null)
@@ -247,26 +247,32 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
Grid1.DataSource = table;
Grid1.DataBind();
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
// var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
// if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
// {
// // Grid1.Rows[i].RowSelectable = false;
// }
// var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
// if (pointBatchItem != null) //已生成委托,不能编辑或删除
// {
// // Grid1.Rows[i].RowSelectable = false;
// }
//}
if (weldingDailyItem != null)
{
var task = from x in Funs.DB.View_HJGL_WeldingTask
var task = (from x in Funs.DB.View_HJGL_WeldingTask
where x.WeldingDailyId == this.WeldingDailyId
select x;
select x).ToList();
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
{
task = task.Where(x => x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).ToList();
}
var weldTaskIds = task.Select(x => x.WeldTaskId).ToArray();
this.Grid1.SelectedRowIDArray = weldTaskIds;
}
for (int i = 0; i < this.Grid1.Rows.Count; i++)
{
var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
{
Grid1.Rows[i].RowSelectable = false;
}
var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
if (pointBatchItem != null) //已生成委托,不能编辑或删除
{
Grid1.Rows[i].RowSelectable = false;
}
var a = this.Grid1.SelectedRowIDArray;
}
}
#endregion
@@ -456,6 +462,47 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
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);
}
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
string rowId = Grid1.Rows[i].RowID;
if (this.Grid1.SelectedRowIDArray.Contains(rowId))
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (newWeldJoint != null)
{
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;
}
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;
}
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);
}
}
}
// 获取组批条件
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", CurrUser.LoginProjectId);
@@ -573,47 +620,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
#endregion
//更新焊口属性
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
int i = mergedRow.Value<int>("index");
string rowId = Grid1.Rows[i].RowID;
if (this.Grid1.SelectedRowIDArray.Contains(rowId))
{
var t = BLL.WeldTaskService.GetWeldTaskById(rowId);
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(t.WeldJointId);
if (newWeldJoint != null)
{
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;
}
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;
}
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);
}
}
}
if (string.IsNullOrEmpty(errlog))
{
ShowNotify("保存成功!", MessageBoxIcon.Success);
@@ -1240,5 +1246,38 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
}
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
var id= row["WeldJointId"].ToString();
var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == id);
if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
{
e.RowSelectable = false;
// Grid1.DeleteRow(e.RowID);
// Grid1.DeleteRow(e.RowID);
}
var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == id && x.PointState != null);
if (pointBatchItem != null) //已生成委托,不能编辑或删除
{
e.RowSelectable = false;
// Grid1.DeleteRow(e.RowID);
// Grid1.DeleteRow(e.RowID);
}
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
// var hotProesssItem = Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString());
// if (hotProesssItem != null) //已生成热处理委托,不能编辑或删除
// {
// Grid1.Rows[i].RowSelectable = false;
// }
// var pointBatchItem = Funs.DB.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == this.Grid1.Rows[i].DataKeys[1].ToString() && x.PointState != null);
// if (pointBatchItem != null) //已生成委托,不能编辑或删除
// {
// Grid1.Rows[i].RowSelectable = false;
// }
//}
}
}
}