feat(hjgl): 完善焊接任务与质量管理流程

This commit is contained in:
2026-08-19 17:13:33 +08:00
parent 08792e0dc8
commit 679e9f6cec
68 changed files with 2481 additions and 1170 deletions
+55 -3
View File
@@ -127,6 +127,15 @@ namespace BLL
/// 根据焊口id组批
/// </summary>
public static string AddBatchByWeldJointId(string weldJointId, DateTime? weldingDate, string batchCondition)
{
return AddBatchByWeldJointId(weldJointId, weldingDate, batchCondition, null);
}
/// <summary>
/// 根据焊口id组批,并在事务场景下复用现有数据库连接。
/// </summary>
internal static string AddBatchByWeldJointId(string weldJointId, DateTime? weldingDate,
string batchCondition, SqlConnection sharedConnection)
{
string errlog = string.Empty;
string[] condition = batchCondition.Split('|');
@@ -222,7 +231,9 @@ namespace BLL
}
SqlParameter[] parameter = listStr.ToArray();
DataTable batchInfo = SQLHelper.GetDataTableRunText(strSql, parameter);
DataTable batchInfo = sharedConnection == null
? SQLHelper.GetDataTableRunText(strSql, parameter)
: GetDataTableRunText(sharedConnection, strSql, parameter);
string batchId = string.Empty;
if (batchInfo.Rows.Count == 0)
@@ -274,13 +285,17 @@ namespace BLL
if (pipeline.PipeArea == PipelineService.PipeArea_FIELD)
{
perfix += "XC-";
batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix);
batch.PointBatchCode = sharedConnection == null
? BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix)
: RunProcNewIdByProjectId(sharedConnection, "SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix);
}
else if (pipeline.PipeArea == PipelineService.PipeArea_SHOP)
{
perfix += "GC-";
batch.PointBatchCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix);
batch.PointBatchCode = sharedConnection == null
? BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix)
: RunProcNewIdByProjectId(sharedConnection, "SpGetNewCode4ByProjectId", "dbo.HJGL_Batch_PointBatch", "PointBatchCode", project.ProjectId, perfix);
}
}
@@ -341,6 +356,43 @@ namespace BLL
return errlog;
}
private static DataTable GetDataTableRunText(SqlConnection connection, string sql, params SqlParameter[] parameters)
{
DataTable dataTable = new DataTable();
using (SqlCommand command = new SqlCommand(sql, connection))
using (SqlDataAdapter adapter = new SqlDataAdapter(command))
{
command.CommandTimeout = 0;
command.CommandType = CommandType.Text;
if (parameters != null)
{
command.Parameters.AddRange(parameters);
}
adapter.Fill(dataTable);
}
return dataTable;
}
private static string RunProcNewIdByProjectId(SqlConnection connection, string storedProcName,
string tableName, string columnName, string projectId, string prefix)
{
using (SqlCommand command = new SqlCommand(storedProcName, connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddRange(new[]
{
new SqlParameter("@tableName", tableName),
new SqlParameter("@columnName", columnName),
new SqlParameter("@projectId", projectId),
new SqlParameter("@prefix", prefix),
new SqlParameter("@returnVal", SqlDbType.VarChar, 50)
});
command.Parameters["@returnVal"].Direction = ParameterDirection.Output;
command.ExecuteNonQuery();
return command.Parameters["@returnVal"].Value.ToString();
}
}
}