feat:增加焊前管理,材料管理条码扫码接口,材料信息导入支持无炉批号/有炉批号 多种导入方式
This commit is contained in:
@@ -208,6 +208,27 @@ namespace BLL
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取坡口类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.BaseInfoItem> getGrooveType()
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Base_GrooveType
|
||||
orderby x.GrooveTypeCode
|
||||
select new Model.BaseInfoItem
|
||||
{
|
||||
BaseInfoId = x.GrooveTypeId,
|
||||
BaseInfoCode = x.GrooveTypeCode,
|
||||
BaseInfoName = x.GrooveTypeName
|
||||
}
|
||||
).ToList();
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据类型获取巡检隐患类型表
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序焊前抽检接口服务
|
||||
/// </summary>
|
||||
public static class APIPreWeldInspectionService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据焊口ID获取焊前抽检基础信息
|
||||
/// </summary>
|
||||
/// <param name="weldJointId">焊口ID</param>
|
||||
/// <returns>焊口基础信息</returns>
|
||||
public static Model.PreWeldJointItem GetPreWeldJointByWeldJointId(string weldJointId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var query = from x in db.HJGL_WeldJoint
|
||||
join g in db.Base_GrooveType on x.GrooveTypeId equals g.GrooveTypeId into grooveTypes
|
||||
from g in grooveTypes.DefaultIfEmpty()
|
||||
where x.WeldJointId == weldJointId
|
||||
select new Model.PreWeldJointItem
|
||||
{
|
||||
WeldJointId = x.WeldJointId,
|
||||
WeldJointCode = x.WeldJointCode,
|
||||
PipelineId = x.PipelineId,
|
||||
PipelineCode = x.PipelineCode,
|
||||
ProjectId = x.ProjectId,
|
||||
GrooveTypeId = x.GrooveTypeId,
|
||||
GrooveTypeCode = g == null ? string.Empty : g.GrooveTypeCode,
|
||||
GrooveTypeName = g == null ? string.Empty : g.GrooveTypeName,
|
||||
GrooveProcessType = x.GrooveProcessType,
|
||||
GrooveAngle = x.GrooveAngle,
|
||||
FitupGap = x.FitupGap,
|
||||
Misalignment = x.Misalignment
|
||||
};
|
||||
|
||||
return query.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存下料抽检,已存在同一焊口记录时更新原记录
|
||||
/// </summary>
|
||||
/// <param name="item">下料抽检参数</param>
|
||||
public static void SaveCuttingCheck(Model.PreWeldCuttingCheckItem item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
if (string.IsNullOrEmpty(item.WeldJointId))
|
||||
{
|
||||
throw new ArgumentException("焊口ID不能为空。");
|
||||
}
|
||||
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
|
||||
if (weldJoint == null)
|
||||
{
|
||||
throw new ArgumentException("未找到对应焊口。");
|
||||
}
|
||||
|
||||
var check = db.HJGL_PreWeldCuttingCheck.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
|
||||
if (check == null)
|
||||
{
|
||||
check = new Model.HJGL_PreWeldCuttingCheck
|
||||
{
|
||||
CuttingCheckId = Guid.NewGuid().ToString(),
|
||||
WeldJointId = item.WeldJointId,
|
||||
ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId,
|
||||
CreateUser = item.CreateUser ?? item.CheckPerson,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
db.HJGL_PreWeldCuttingCheck.InsertOnSubmit(check);
|
||||
}
|
||||
|
||||
check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId;
|
||||
check.IsMaterialCodeBatchNoAccurate = item.IsMaterialCodeBatchNoAccurate;
|
||||
check.IsMaterialQuantityAccurate = item.IsMaterialQuantityAccurate;
|
||||
// 下料抽检合格规则:材料编码及炉批号、材料数量两个检查项均准确才合格。
|
||||
check.IsQualified = item.IsMaterialCodeBatchNoAccurate && item.IsMaterialQuantityAccurate;
|
||||
check.CheckPerson = item.CheckPerson;
|
||||
check.CheckTime = item.CheckTime ?? DateTime.Now;
|
||||
check.Remark = item.Remark;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存组对抽检,已存在同一焊口记录时更新原记录并回写焊口主表
|
||||
/// </summary>
|
||||
/// <param name="item">组对抽检参数</param>
|
||||
public static void SaveFitupCheck(Model.PreWeldFitupCheckItem item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
if (string.IsNullOrEmpty(item.WeldJointId))
|
||||
{
|
||||
throw new ArgumentException("焊口ID不能为空。");
|
||||
}
|
||||
if (string.IsNullOrEmpty(item.GrooveTypeId))
|
||||
{
|
||||
throw new ArgumentException("坡口类型不能为空。");
|
||||
}
|
||||
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
|
||||
if (weldJoint == null)
|
||||
{
|
||||
throw new ArgumentException("未找到对应焊口。");
|
||||
}
|
||||
if (!db.Base_GrooveType.Any(x => x.GrooveTypeId == item.GrooveTypeId))
|
||||
{
|
||||
throw new ArgumentException("坡口类型不存在。");
|
||||
}
|
||||
|
||||
var check = db.HJGL_PreWeldFitupCheck.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
|
||||
if (check == null)
|
||||
{
|
||||
check = new Model.HJGL_PreWeldFitupCheck
|
||||
{
|
||||
FitupCheckId = Guid.NewGuid().ToString(),
|
||||
WeldJointId = item.WeldJointId,
|
||||
ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId,
|
||||
CreateUser = item.CreateUser ?? item.CheckPerson,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
db.HJGL_PreWeldFitupCheck.InsertOnSubmit(check);
|
||||
}
|
||||
|
||||
check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId;
|
||||
check.GrooveTypeId = item.GrooveTypeId;
|
||||
check.GrooveProcessType = item.GrooveProcessType;
|
||||
check.GrooveAngle = item.GrooveAngle;
|
||||
check.FitupGap = item.FitupGap;
|
||||
check.Misalignment = item.Misalignment;
|
||||
check.CheckPerson = item.CheckPerson;
|
||||
check.CheckTime = item.CheckTime ?? DateTime.Now;
|
||||
check.Remark = item.Remark;
|
||||
|
||||
// 组对抽检字段需同步回写焊口主表,供焊口台账和后续业务复用。
|
||||
weldJoint.GrooveTypeId = item.GrooveTypeId;
|
||||
weldJoint.GrooveProcessType = item.GrooveProcessType;
|
||||
weldJoint.GrooveAngle = item.GrooveAngle;
|
||||
weldJoint.FitupGap = item.FitupGap;
|
||||
weldJoint.Misalignment = item.Misalignment;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,6 +203,7 @@
|
||||
<Compile Include="API\HJGL\APINDETrustService.cs" />
|
||||
<Compile Include="API\HJGL\APIPipeJointService.cs" />
|
||||
<Compile Include="API\HJGL\APIPipelineComponentService.cs" />
|
||||
<Compile Include="API\HJGL\APIPreWeldInspectionService.cs" />
|
||||
<Compile Include="API\HJGL\APIPreWeldingDailyService.cs" />
|
||||
<Compile Include="API\HJGL\APIReportQueryService.cs" />
|
||||
<Compile Include="API\HJGL\APITestPackageService.cs" />
|
||||
@@ -461,6 +462,7 @@
|
||||
<Compile Include="HJGL\WeldingManage\PipelineComponentService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\PipelineMatService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\PipelineService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\PreWeldInspectionService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\WeldingDailyService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\WeldJointService.cs" />
|
||||
<Compile Include="HJGL\WeldingManage\WeldTaskService.cs" />
|
||||
|
||||
@@ -247,6 +247,12 @@ namespace BLL
|
||||
try
|
||||
{
|
||||
temeplateDtoIns = MiniExcel.Query<Tw_InputDataIn>(path, startCell: "A1").ToList();
|
||||
foreach (var item in temeplateDtoIns)
|
||||
{
|
||||
item.MaterialCode = item.MaterialCode.Trim();
|
||||
item.HeatNo = item.HeatNo.Trim();
|
||||
item.BatchNo = item.BatchNo.Trim();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -621,12 +627,12 @@ namespace BLL
|
||||
|
||||
private static string CleanImportText(string value)
|
||||
{
|
||||
return Convert.ToString(value).Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim();
|
||||
return (value ?? string.Empty).Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim();
|
||||
}
|
||||
|
||||
private static string CleanImportDateText(string value)
|
||||
{
|
||||
return Convert.ToString(value).Replace("\n", "").Replace("\t", " ").Replace("\r", "").Trim();
|
||||
return (value ?? string.Empty).Replace("\n", "").Replace("\t", " ").Replace("\r", "").Trim();
|
||||
}
|
||||
|
||||
private static bool TryParseImportDate(string value, out DateTime date)
|
||||
|
||||
@@ -50,7 +50,9 @@ namespace BLL
|
||||
BatchNo = mat.BatchNo,
|
||||
MaterialName = mat.MaterialName,
|
||||
MaterialDef = mat.MaterialDef,
|
||||
BarCode = x.BarCode
|
||||
MaterialSpec = mat.MaterialSpec,
|
||||
MaterialUnit = mat.MaterialUnit,
|
||||
BarCode = x.MaterialCode
|
||||
};
|
||||
|
||||
return q.ToList();
|
||||
@@ -119,7 +121,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static string BuildBarCode(Tw_InputMaster inputMaster, Tw_InputDetail inputDetail, string barCodeDetailId)
|
||||
{
|
||||
return "IB" + barCodeDetailId.Replace("-", string.Empty).ToUpperInvariant();
|
||||
return inputDetail == null ? string.Empty : inputDetail.MaterialCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2939,6 +2939,16 @@ namespace BLL
|
||||
/// 焊接日常管理
|
||||
/// </summary>
|
||||
public const string HJGL_WeldReportMenuId = "5TYHMD2F-2582-4DEB-905E-6E9DCFEFBGHO";
|
||||
|
||||
/// <summary>
|
||||
/// 下料抽检记录台账
|
||||
/// </summary>
|
||||
public const string HJGL_PreWeldCuttingCheckMenuId = "D1B5A8B7-5D2A-4C51-9B7E-6A2F15B7F002";
|
||||
|
||||
/// <summary>
|
||||
/// 组对抽检列表台账
|
||||
/// </summary>
|
||||
public const string HJGL_PreWeldFitupCheckMenuId = "D1B5A8B7-5D2A-4C51-9B7E-6A2F15B7F003";
|
||||
#endregion
|
||||
|
||||
#region 预制设计
|
||||
@@ -3456,6 +3466,11 @@ namespace BLL
|
||||
/// </summary>
|
||||
public const string PipelineMatTemplateUrl = "File\\Excel\\DataIn\\PipelineMat.xlsx";
|
||||
|
||||
/// <summary>
|
||||
/// 管线材料导入模板(包含炉号、批号)
|
||||
/// </summary>
|
||||
public const string PipelineMatWithBatchTemplateUrl = "File\\Excel\\DataIn\\PipelineMatWithBatch.xlsx";
|
||||
|
||||
/// <summary>
|
||||
/// 材料信息数据导入模板
|
||||
/// </summary>
|
||||
|
||||
@@ -14,6 +14,27 @@
|
||||
{
|
||||
return Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(e => e.MaterialCode == materialCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据材料主编码获取条码扫码所需的材料信息。
|
||||
/// </summary>
|
||||
public static Model.MaterialCodeLibBarCodeOutput GetBarCodeMaterialInfo(string materialCode)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_MaterialCodeLib
|
||||
where x.MaterialCode == materialCode
|
||||
select new Model.MaterialCodeLibBarCodeOutput
|
||||
{
|
||||
MaterialCode = x.MaterialCode,
|
||||
Code = x.Code,
|
||||
HeatNo = x.HeatNo,
|
||||
BatchNo = x.BatchNo,
|
||||
MaterialName = x.MaterialName,
|
||||
MaterialDef = x.MaterialDef,
|
||||
MaterialSpec = x.MaterialSpec,
|
||||
MaterialUnit = x.MaterialUnit
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public static List<Model.HJGL_MaterialCodeLib> GetMaterialCodeLibList()
|
||||
{
|
||||
var q = (from x in Funs.DB.HJGL_MaterialCodeLib select x).ToList();
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 焊前抽检台账服务
|
||||
/// </summary>
|
||||
public static class PreWeldInspectionService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取下料抽检台账
|
||||
/// </summary>
|
||||
public static Tuple<List<Model.PreWeldCuttingCheckItem>, int> GetCuttingCheckList(string projectId, string pipelineCode, string weldJointCode, int pageIndex, int pageSize)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var query = from c in db.HJGL_PreWeldCuttingCheck
|
||||
join w in db.HJGL_WeldJoint on c.WeldJointId equals w.WeldJointId
|
||||
join p in db.Person_Persons on c.CheckPerson equals p.PersonId into persons
|
||||
from p in persons.DefaultIfEmpty()
|
||||
where string.IsNullOrEmpty(projectId) || c.ProjectId == projectId || w.ProjectId == projectId
|
||||
select new
|
||||
{
|
||||
c,
|
||||
w,
|
||||
CheckPersonName = p == null ? string.Empty : p.PersonName
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(pipelineCode))
|
||||
{
|
||||
query = query.Where(x => x.w.PipelineCode.Contains(pipelineCode));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(weldJointCode))
|
||||
{
|
||||
query = query.Where(x => x.w.WeldJointCode.Contains(weldJointCode));
|
||||
}
|
||||
|
||||
int total = query.Count();
|
||||
var data = query.OrderByDescending(x => x.c.CheckTime)
|
||||
.Skip(pageIndex * pageSize)
|
||||
.Take(pageSize)
|
||||
.Select(x => new Model.PreWeldCuttingCheckItem
|
||||
{
|
||||
CuttingCheckId = x.c.CuttingCheckId,
|
||||
ProjectId = x.c.ProjectId,
|
||||
WeldJointId = x.c.WeldJointId,
|
||||
PipelineCode = x.w.PipelineCode,
|
||||
WeldJointCode = x.w.WeldJointCode,
|
||||
IsMaterialCodeBatchNoAccurate = x.c.IsMaterialCodeBatchNoAccurate,
|
||||
IsMaterialQuantityAccurate = x.c.IsMaterialQuantityAccurate,
|
||||
IsQualified = x.c.IsQualified,
|
||||
CheckPerson = x.c.CheckPerson,
|
||||
CheckPersonName = x.CheckPersonName,
|
||||
CheckTime = x.c.CheckTime,
|
||||
CreateUser = x.c.CreateUser,
|
||||
CreateTime = x.c.CreateTime,
|
||||
Remark = x.c.Remark
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return Tuple.Create(data, total);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取组对抽检台账
|
||||
/// </summary>
|
||||
public static Tuple<List<Model.PreWeldFitupCheckItem>, int> GetFitupCheckList(string projectId, string pipelineCode, string weldJointCode, int pageIndex, int pageSize)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var query = from f in db.HJGL_PreWeldFitupCheck
|
||||
join w in db.HJGL_WeldJoint on f.WeldJointId equals w.WeldJointId
|
||||
join g in db.Base_GrooveType on f.GrooveTypeId equals g.GrooveTypeId into grooveTypes
|
||||
from g in grooveTypes.DefaultIfEmpty()
|
||||
join p in db.Person_Persons on f.CheckPerson equals p.PersonId into persons
|
||||
from p in persons.DefaultIfEmpty()
|
||||
where string.IsNullOrEmpty(projectId) || f.ProjectId == projectId || w.ProjectId == projectId
|
||||
select new
|
||||
{
|
||||
f,
|
||||
w,
|
||||
g,
|
||||
CheckPersonName = p == null ? string.Empty : p.PersonName
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(pipelineCode))
|
||||
{
|
||||
query = query.Where(x => x.w.PipelineCode.Contains(pipelineCode));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(weldJointCode))
|
||||
{
|
||||
query = query.Where(x => x.w.WeldJointCode.Contains(weldJointCode));
|
||||
}
|
||||
|
||||
int total = query.Count();
|
||||
var data = query.OrderBy(x => x.w.PipelineCode).ThenBy(x => x.w.WeldJointCode)
|
||||
.Skip(pageIndex * pageSize)
|
||||
.Take(pageSize)
|
||||
.Select(x => new Model.PreWeldFitupCheckItem
|
||||
{
|
||||
FitupCheckId = x.f.FitupCheckId,
|
||||
ProjectId = x.f.ProjectId,
|
||||
WeldJointId = x.w.WeldJointId,
|
||||
PipelineCode = x.w.PipelineCode,
|
||||
WeldJointCode = x.w.WeldJointCode,
|
||||
GrooveTypeId = x.f.GrooveTypeId,
|
||||
GrooveTypeCode = x.g == null ? string.Empty : x.g.GrooveTypeCode,
|
||||
GrooveTypeName = x.g == null ? string.Empty : x.g.GrooveTypeName,
|
||||
GrooveProcessType = x.f.GrooveProcessType,
|
||||
GrooveAngle = x.f.GrooveAngle,
|
||||
FitupGap = x.f.FitupGap,
|
||||
Misalignment = x.f.Misalignment,
|
||||
CheckPerson = x.f.CheckPerson,
|
||||
CheckPersonName = x.CheckPersonName,
|
||||
CheckTime = x.f.CheckTime,
|
||||
CreateUser = x.f.CreateUser,
|
||||
CreateTime = x.f.CreateTime,
|
||||
Remark = x.f.Remark
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return Tuple.Create(data, total);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下料抽检实体
|
||||
/// </summary>
|
||||
public static Model.HJGL_PreWeldCuttingCheck GetCuttingCheckById(string cuttingCheckId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
return db.HJGL_PreWeldCuttingCheck.FirstOrDefault(x => x.CuttingCheckId == cuttingCheckId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取组对抽检实体
|
||||
/// </summary>
|
||||
public static Model.HJGL_PreWeldFitupCheck GetFitupCheckByWeldJointId(string weldJointId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
return db.HJGL_PreWeldFitupCheck.FirstOrDefault(x => x.WeldJointId == weldJointId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user