This commit is contained in:
佘春生 2024-06-28 14:11:00 +08:00
parent 8cc67a3f48
commit 29a6bad939
11 changed files with 258 additions and 116 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
using BLL; using BLL;
using Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@ -30,8 +31,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
(CASE WHEN IsWelderFirst=1 THEN '是' ELSE '否' END) AS IsWelderFirst, (CASE WHEN IsWelderFirst=1 THEN '是' ELSE '否' END) AS IsWelderFirst,
JLAudit,GLGSAudit,QTAudit,IsPointAudit JLAudit,GLGSAudit,QTAudit,IsPointAudit
FROM dbo.View_Batch_PointBatchItem FROM dbo.View_Batch_PointBatchItem
WHERE PointState IS NOT NULL AND TrustBatchItemId IS NULL WHERE PointState IS NOT NULL AND TrustBatchItemId IS NULL";
AND PointDate>'2024-06-24 23:59:59'";
List<SqlParameter> listStr = new List<SqlParameter>(); List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.txtPipeCode.Text)) if (!string.IsNullOrEmpty(this.txtPipeCode.Text))
{ {
@ -75,11 +75,9 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
} }
SqlParameter[] parameter = listStr.ToArray(); SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = dt.Rows.Count;
Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, dt);
// tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table; Grid1.DataSource = table;
Grid1.DataBind(); Grid1.DataBind();
} }
@ -216,127 +214,136 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{ {
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointManageMenuId, Const.BtnHandGenerate)) if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointManageMenuId, Const.BtnHandGenerate))
{ {
List<string> selectRow = new List<string>(); bool isAudit = true;
string[] selectedRowIDArray = Grid1.SelectedRowIDArray;
foreach (string pitem in Grid1.SelectedRowIDArray) foreach (string rowId in selectedRowIDArray)
{ {
selectRow.Add(pitem); var q =from x in Funs.DB.Batch_PointBatchItem where x.PointBatchItemId== rowId && (x.JLAudit==null || x.GLGSAudit==null) select x;
if (q.Count() > 0)
{
isAudit=false;
break;
}
}
if (!isAudit)
{
Alert.ShowInTop("有未审核的焊口!", MessageBoxIcon.Warning);
return;
} }
if (selectRow.Count() > 0) string PointBatchItemList = string.Join(",", selectedRowIDArray);
if (selectedRowIDArray.Length > 0)
{ {
List<string> weldMot = new List<string>(); string strSql = @"SELECT pItem.PointBatchId,jot.WeldingMethodId,jot.GrooveTypeId,
List<string> grooveType = new List<string>(); (CASE WHEN pItem.IsWelderFirst=1 THEN 1 ELSE 0 END) AS IsWelderFirst
List<bool> IsFist = new List<bool>(); FROM Batch_PointBatchItem AS pItem
List<string> pointBatchIds = new List<string>(); LEFT JOIN Pipeline_WeldJoint AS jot ON jot.WeldJointId=pItem.WeldJointId
string error = string.Empty; WHERE CHARINDEX(PointBatchItemId,@PointBatchItemList)>0
GROUP BY pItem.PointBatchId, jot.WeldingMethodId,jot.GrooveTypeId,
(CASE WHEN pItem.IsWelderFirst=1 THEN 1 ELSE 0 END)";
foreach (string pointItemId in selectRow) List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@PointBatchItemList", PointBatchItemList));
SqlParameter[] parameter = listStr.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
if (dt.Rows.Count > 0)
{ {
var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointItemId); foreach (DataRow r in dt.Rows)
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(pointItem.WeldJointId);
weldMot.Add(jot.WeldingMethodId);
grooveType.Add(jot.GrooveTypeId);
IsFist.Add(pointItem.IsWelderFirst == true ? true : false);
pointBatchIds.Add(pointItem.PointBatchId);
}
if (pointBatchIds.Distinct().Count() > 1)
{
error = "勾选的焊口不在一个批次中,";
}
if (weldMot.Distinct().Count() > 1)
{
error = "勾选的焊口焊接方法不一至,";
}
if (grooveType.Distinct().Count() > 1)
{
error = error + "勾选的焊口坡口类型不一至,";
}
if (IsFist.Distinct().Count() > 1)
{
error = error + "勾选的焊口是否首三不一至,";
}
if (error == string.Empty)
{
var point = BLL.Batch_PointBatchService.GetPointBatchById(pointBatchIds[0]);
var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(point.PipelineId);
var project = BLL.Base_ProjectService.GetProjectByProjectId(point.ProjectId);
var unit = BLL.Base_UnitService.GetUnit(point.UnitId);
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(point.DetectionTypeId);
var work = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(iso.WorkAreaId);
Model.Batch_BatchTrust newBatchTrust = new Model.Batch_BatchTrust();
string perfix = string.Empty;
//perfix = unit.UnitCode + "-" + ins.InstallationCode + "-GD-" + ndt.DetectionTypeCode + "-";
perfix = ndt.DetectionTypeCode + "-" + unit.UnitCode + "-" + work.WorkAreaCode + "-PI" + "-";
newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode", "dbo.Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
string trustBatchId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrust));
newBatchTrust.TrustBatchId = trustBatchId;
newBatchTrust.TrustDate = DateTime.Now;
newBatchTrust.ProjectId = point.ProjectId;
newBatchTrust.UnitId = point.UnitId;
newBatchTrust.InstallationId = point.InstallationId;
newBatchTrust.WorkAreaId = iso.WorkAreaId;
newBatchTrust.WeldingMethodId = weldMot[0];
newBatchTrust.GrooveTypeId = grooveType[0];
newBatchTrust.IsWelderFirst = IsFist[0];
newBatchTrust.DetectionTypeId = point.DetectionTypeId;
newBatchTrust.PipelineId = point.PipelineId;
BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
// 生成委托明细,并回写点口明细信息
string toPointBatch = string.Empty;
foreach (string pointItemId in selectRow)
{ {
var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointItemId); var point = BLL.Batch_PointBatchService.GetPointBatchById(r["PointBatchId"].ToString());
if (BLL.Batch_PointBatchService.GetIsGenerateTrust(pointItem.PointBatchItemId)) ////生成委托单的条件判断 var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(point.PipelineId);
var project = BLL.Base_ProjectService.GetProjectByProjectId(point.ProjectId);
var unit = BLL.Base_UnitService.GetUnit(point.UnitId);
var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(point.DetectionTypeId);
var work = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(iso.WorkAreaId);
Model.Batch_BatchTrust newBatchTrust = new Model.Batch_BatchTrust();
string perfix = string.Empty;
perfix = ndt.DetectionTypeCode + "-" + unit.UnitCode + "-" + work.WorkAreaCode + "-PI" + "-";
newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode", "dbo.Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
string trustBatchId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrust));
newBatchTrust.TrustBatchId = trustBatchId;
newBatchTrust.TrustDate = DateTime.Now;
newBatchTrust.ProjectId = point.ProjectId;
newBatchTrust.UnitId = point.UnitId;
newBatchTrust.InstallationId = point.InstallationId;
newBatchTrust.WorkAreaId = iso.WorkAreaId;
newBatchTrust.WeldingMethodId = r["WeldingMethodId"].ToString();
newBatchTrust.GrooveTypeId = r["GrooveTypeId"].ToString();
newBatchTrust.IsWelderFirst = Convert.ToBoolean(r["IsWelderFirst"]);
newBatchTrust.DetectionTypeId = point.DetectionTypeId;
newBatchTrust.PipelineId = point.PipelineId;
BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
// 生成委托明细,并回写点口明细信息
string itemSql = @"SELECT pItem.PointBatchItemId,pItem.PointBatchId,jot.WeldingMethodId,
jot.GrooveTypeId,(CASE WHEN pItem.IsWelderFirst=1 THEN 1 ELSE 0 END) AS IsWelderFirst
FROM Batch_PointBatchItem AS pItem
LEFT JOIN Pipeline_WeldJoint AS jot ON jot.WeldJointId=pItem.WeldJointId
WHERE CHARINDEX(PointBatchItemId,@PointBatchItemList)>0
AND PointBatchId=@PointBatchId AND jot.WeldingMethodId=@WeldingMethodId
AND jot.GrooveTypeId=@GrooveTypeId
AND (CASE WHEN pItem.IsWelderFirst=1 THEN '1' ELSE '0' END)=@IsWelderFirst";
List<SqlParameter> param = new List<SqlParameter>();
param.Add(new SqlParameter("@PointBatchItemList", PointBatchItemList));
param.Add(new SqlParameter("@PointBatchId", r["PointBatchId"].ToString()));
param.Add(new SqlParameter("@WeldingMethodId", newBatchTrust.WeldingMethodId));
param.Add(new SqlParameter("@GrooveTypeId", newBatchTrust.GrooveTypeId));
param.Add(new SqlParameter("@IsWelderFirst", r["IsWelderFirst"].ToString()));
SqlParameter[] paramList = param.ToArray();
DataTable dtItem = SQLHelper.GetDataTableRunText(itemSql, paramList);
string toPointBatch = string.Empty;
foreach (DataRow item in dtItem.Rows)
{ {
if (!toPointBatch.Contains(pointItem.PointBatchId)) //str pointItemId = "";
var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(item["PointBatchItemId"].ToString());
if (BLL.Batch_PointBatchService.GetIsGenerateTrust(pointItem.PointBatchItemId)) // 生成委托单的条件判断
{ {
toPointBatch = toPointBatch + pointItem.PointBatchId + ","; if (!toPointBatch.Contains(pointItem.PointBatchId))
{
toPointBatch = toPointBatch + pointItem.PointBatchId + ",";
}
Model.Batch_BatchTrustItem trustItem = new Model.Batch_BatchTrustItem
{
TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrustItem)),
TrustBatchId = trustBatchId,
PointBatchItemId = pointItem.PointBatchItemId,
WeldJointId = pointItem.WeldJointId,
//FilmNum = fileNum,
CreateDate = DateTime.Now
};
Batch_BatchTrustItemService.AddBatchTrustItem(trustItem);
} }
Model.Batch_BatchTrustItem trustItem = new Model.Batch_BatchTrustItem //Model.Batch_PointBatchItem pointBatchItem = Funs.DB.Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId);
{
TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrustItem)), pointItem.IsBuildTrust = true;
TrustBatchId = trustBatchId, Funs.DB.SubmitChanges();
PointBatchItemId = pointItem.PointBatchItemId,
WeldJointId = pointItem.WeldJointId,
//FilmNum = fileNum,
CreateDate = DateTime.Now
};
Batch_BatchTrustItemService.AddBatchTrustItem(trustItem);
} }
//Model.Batch_PointBatchItem pointBatchItem = Funs.DB.Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId); // 回写委托批对应点口信息
if (!string.IsNullOrEmpty(toPointBatch))
pointItem.IsBuildTrust = true;
Funs.DB.SubmitChanges();
}
// 回写委托批对应点口信息
if (!string.IsNullOrEmpty(toPointBatch))
{
toPointBatch = toPointBatch.Substring(0, toPointBatch.Length - 1);
var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
if (updateTrut != null)
{ {
updateTrut.TopointBatch = toPointBatch; toPointBatch = toPointBatch.Substring(0, toPointBatch.Length - 1);
BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut); var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
if (updateTrut != null)
{
updateTrut.TopointBatch = toPointBatch;
BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut);
}
} }
} }
BindGrid();
Alert.ShowInTop("委托单已生成!", MessageBoxIcon.Success); Alert.ShowInTop("委托单已生成!", MessageBoxIcon.Success);
} }
else
{
Alert.ShowInTop(error + "不能组成一个委托单!", MessageBoxIcon.Warning);
}
} }
else else
{ {
@ -348,6 +355,141 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
return; return;
} }
#region
// List<string> selectRow = new List<string>();
// foreach (string pitem in Grid1.SelectedRowIDArray)
// {
// selectRow.Add(pitem);
// }
// if (selectRow.Count() > 0)
// {
// List<string> weldMot = new List<string>();
// List<string> grooveType = new List<string>();
// List<bool> IsFist = new List<bool>();
// List<string> pointBatchIds = new List<string>();
// string error = string.Empty;
// foreach (string pointItemId in selectRow)
// {
// var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointItemId);
// var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(pointItem.WeldJointId);
// weldMot.Add(jot.WeldingMethodId);
// grooveType.Add(jot.GrooveTypeId);
// IsFist.Add(pointItem.IsWelderFirst == true ? true : false);
// pointBatchIds.Add(pointItem.PointBatchId);
// }
// if (pointBatchIds.Distinct().Count() > 1)
// {
// error = "勾选的焊口不在一个批次中,";
// }
// if (weldMot.Distinct().Count() > 1)
// {
// error = "勾选的焊口焊接方法不一至,";
// }
// if (grooveType.Distinct().Count() > 1)
// {
// error = error + "勾选的焊口坡口类型不一至,";
// }
// if (IsFist.Distinct().Count() > 1)
// {
// error = error + "勾选的焊口是否首三不一至,";
// }
// if (error == string.Empty)
// {
// var point = BLL.Batch_PointBatchService.GetPointBatchById(pointBatchIds[0]);
// var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(point.PipelineId);
// var project = BLL.Base_ProjectService.GetProjectByProjectId(point.ProjectId);
// var unit = BLL.Base_UnitService.GetUnit(point.UnitId);
// var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(point.DetectionTypeId);
// var work = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(iso.WorkAreaId);
// Model.Batch_BatchTrust newBatchTrust = new Model.Batch_BatchTrust();
// string perfix = string.Empty;
// //perfix = unit.UnitCode + "-" + ins.InstallationCode + "-GD-" + ndt.DetectionTypeCode + "-";
// perfix = ndt.DetectionTypeCode + "-" + unit.UnitCode + "-" + work.WorkAreaCode + "-PI" + "-";
// newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode", "dbo.Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
// string trustBatchId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrust));
// newBatchTrust.TrustBatchId = trustBatchId;
// newBatchTrust.TrustDate = DateTime.Now;
// newBatchTrust.ProjectId = point.ProjectId;
// newBatchTrust.UnitId = point.UnitId;
// newBatchTrust.InstallationId = point.InstallationId;
// newBatchTrust.WorkAreaId = iso.WorkAreaId;
// newBatchTrust.WeldingMethodId = weldMot[0];
// newBatchTrust.GrooveTypeId = grooveType[0];
// newBatchTrust.IsWelderFirst = IsFist[0];
// newBatchTrust.DetectionTypeId = point.DetectionTypeId;
// newBatchTrust.PipelineId = point.PipelineId;
// BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
// // 生成委托明细,并回写点口明细信息
// string toPointBatch = string.Empty;
// foreach (string pointItemId in selectRow)
// {
// var pointItem = BLL.Batch_PointBatchItemService.GetPointBatchItemByPointBatchItemId(pointItemId);
// if (BLL.Batch_PointBatchService.GetIsGenerateTrust(pointItem.PointBatchItemId)) ////生成委托单的条件判断
// {
// if (!toPointBatch.Contains(pointItem.PointBatchId))
// {
// toPointBatch = toPointBatch + pointItem.PointBatchId + ",";
// }
// Model.Batch_BatchTrustItem trustItem = new Model.Batch_BatchTrustItem
// {
// TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.Batch_BatchTrustItem)),
// TrustBatchId = trustBatchId,
// PointBatchItemId = pointItem.PointBatchItemId,
// WeldJointId = pointItem.WeldJointId,
// //FilmNum = fileNum,
// CreateDate = DateTime.Now
// };
// Batch_BatchTrustItemService.AddBatchTrustItem(trustItem);
// }
// //Model.Batch_PointBatchItem pointBatchItem = Funs.DB.Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId);
// pointItem.IsBuildTrust = true;
// Funs.DB.SubmitChanges();
// }
// // 回写委托批对应点口信息
// if (!string.IsNullOrEmpty(toPointBatch))
// {
// toPointBatch = toPointBatch.Substring(0, toPointBatch.Length - 1);
// var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
// if (updateTrut != null)
// {
// updateTrut.TopointBatch = toPointBatch;
// BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut);
// }
// }
// Alert.ShowInTop("委托单已生成!", MessageBoxIcon.Success);
// }
// else
// {
// Alert.ShowInTop(error + "不能组成一个委托单!", MessageBoxIcon.Warning);
// }
// }
// else
// {
// Alert.ShowInTop("请勾选要生成委托单的焊口!", MessageBoxIcon.Warning);
// }
//}
//else
//{
// ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
// return;
//}
#endregion
} }
} }
} }

View File

@ -129,8 +129,8 @@
</f:Toolbar> </f:Toolbar>
<f:Toolbar ID="Toolbar4" Position="Top" runat="server" ToolbarAlign="Right"> <f:Toolbar ID="Toolbar4" Position="Top" runat="server" ToolbarAlign="Right">
<Items> <Items>
<f:Button ID="btnDailyCompPoint" Text="日报完成点口" ToolTip="日报完成审核点口" Icon="ArrowUndo" <f:Button ID="btnDailyCompPoint" Text="日报完成点口" ToolTip="日报完成审核点口" Icon="ArrowUndo"
runat="server" OnClick="btnDailyCompPoint_Click"> ConfirmText="确定日报审核完成点口吗?" ConfirmTarget="Top" runat="server" OnClick="btnDailyCompPoint_Click">
</f:Button> </f:Button>
<f:Button ID="btnbtnOpenResetPoint" Text="打开重新点口" ToolTip="打开重新点口" Icon="ArrowUndo" <f:Button ID="btnbtnOpenResetPoint" Text="打开重新点口" ToolTip="打开重新点口" Icon="ArrowUndo"
runat="server" OnClick="btnbtnOpenResetPoint_Click"> runat="server" OnClick="btnbtnOpenResetPoint_Click">

View File

@ -1145,6 +1145,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
} }
} }
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointManageMenuId, "日报完成点口", string.Empty);
ShowNotify("批量点口完成", MessageBoxIcon.Success); ShowNotify("批量点口完成", MessageBoxIcon.Success);
} }
else else

View File

@ -96,9 +96,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
} }
if (drpAudit.SelectedValue!= Const._Null && drpAudit.SelectedValue != "全部") if (drpAudit.SelectedValue!= Const._Null && drpAudit.SelectedValue != "全部")
{ {
int status = drpAudit.SelectedValue == "已审核" ? 1 : 0; strSql += " AND (case weldJoint.AuditStatus when 1 then '已审核' else '未审核' end )=@AuditStatus";
strSql += " AND weldJoint.AuditStatus=@AuditStatus"; listStr.Add(new SqlParameter("@AuditStatus", drpAudit.SelectedValue));
listStr.Add(new SqlParameter("@AuditStatus", status));
} }
if (this.drpWorkAreaId.SelectedValue != Const._Null && this.drpWorkAreaId.SelectedValue != null) if (this.drpWorkAreaId.SelectedValue != Const._Null && this.drpWorkAreaId.SelectedValue != null)
{ {