SGGL_JT/SUBQHSE/WebAPI/Controllers/Customization/7HJ/7HJ_HjglController.cs

3732 lines
158 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Linq;
using System.Web.Http;
using BLL;
using System;
using System.Collections.Generic;
using Model;
using System.Web.UI.WebControls;
namespace WebAPI.Controllers.Customization._7HJ
{
public class Api_7HJ_HjglController : ApiController
{
#region -
/// <summary>
/// 焊接耗材新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveConsumables([FromBody] Model.Base_Consumables consumables)
{
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Consumables.FirstOrDefault(x =>
x.ConsumablesCode == consumables.ConsumablesCode.Trim() &&
(x.ConsumablesId != consumables.ConsumablesId ||
(consumables.ConsumablesId == null && x.ConsumablesId != null)));
if (q != null)
{
responeData.message = "此焊接耗材代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_Consumables.FirstOrDefault(x =>
x.ConsumablesName == consumables.ConsumablesName.Trim() &&
(x.ConsumablesId != consumables.ConsumablesId ||
(consumables.ConsumablesId == null && x.ConsumablesId != null)));
if (q2 != null)
{
responeData.message = "此焊接耗材名称已存在";
return responeData;
}
// consumables.ConsumablesId = SQLHelper.GetNewID(typeof(Model.Base_Consumables));
if (consumables.ConsumablesId == null || consumables.ConsumablesId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.Base_ConsumablesService.AddConsumables(consumables);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接耗材修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateConsumables([FromBody] Model.Base_Consumables consumables)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Consumables.FirstOrDefault(x =>
x.ConsumablesCode == consumables.ConsumablesCode.Trim() &&
(x.ConsumablesId != consumables.ConsumablesId ||
(consumables.ConsumablesId == null && x.ConsumablesId != null)));
if (q != null)
{
responeData.message = "此焊接耗材代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_Consumables.FirstOrDefault(x =>
x.ConsumablesName == consumables.ConsumablesName.Trim() &&
(x.ConsumablesId != consumables.ConsumablesId ||
(consumables.ConsumablesId == null && x.ConsumablesId != null)));
if (q2 != null)
{
responeData.message = "此焊接耗材名称已存在";
return responeData;
}
BLL.Base_ConsumablesService.UpdateConsumables(consumables);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管道级别新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SavePipingClass([FromBody] Model.Base_PipingClass pipingClass)
{
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_PipingClass.FirstOrDefault(x =>
x.PipingClassCode == pipingClass.PipingClassCode.Trim() &&
(x.PipingClassId != pipingClass.PipingClassId ||
(pipingClass.PipingClassId == null && x.PipingClassId != null)) &&
x.ProjectId == pipingClass.ProjectId);
if (q != null)
{
responeData.message = "此等级代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_PipingClass.FirstOrDefault(x =>
x.PipingClassName == pipingClass.PipingClassName.Trim() &&
(x.PipingClassId != pipingClass.PipingClassId ||
(pipingClass.PipingClassId == null && x.PipingClassId != null)) &&
x.ProjectId == pipingClass.ProjectId);
if (q2 != null)
{
responeData.message = "此等级名称已存在";
return responeData;
}
// pipingClass.PipingClassId = SQLHelper.GetNewID(typeof(Model.Base_PipingClass));
if (pipingClass.PipingClassId == null || pipingClass.PipingClassId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.Base_PipingClassService.AddPipingClass(pipingClass);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管道级别修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdatePipingClass([FromBody] Model.Base_PipingClass pipingClass)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_PipingClass.FirstOrDefault(x =>
x.PipingClassCode == pipingClass.PipingClassCode.Trim() &&
(x.PipingClassId != pipingClass.PipingClassId ||
(pipingClass.PipingClassId == null && x.PipingClassId != null)) &&
x.ProjectId == pipingClass.ProjectId);
if (q != null)
{
responeData.message = "此等级代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_PipingClass.FirstOrDefault(x =>
x.PipingClassName == pipingClass.PipingClassName.Trim() &&
(x.PipingClassId != pipingClass.PipingClassId ||
(pipingClass.PipingClassId == null && x.PipingClassId != null)) &&
x.ProjectId == pipingClass.ProjectId);
if (q2 != null)
{
responeData.message = "此等级名称已存在";
return responeData;
}
BLL.Base_PipingClassService.UpdatePipingClass(pipingClass);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管道材质新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveMaterial([FromBody] Model.Base_Material material)
{
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Material.FirstOrDefault(x =>
x.MaterialCode == material.MaterialCode.Trim() && (x.MaterialId != material.MaterialId ||
(material.MaterialId == null &&
x.MaterialId != null)));
if (q != null)
{
responeData.message = "此管道材质代号已经存在";
return responeData;
}
var q2 = Funs.DB.Base_Material.FirstOrDefault(x =>
x.MaterialType == material.MaterialType.Trim() && (x.MaterialId != material.MaterialId ||
(material.MaterialId == null &&
x.MaterialId != null)));
if (q2 != null)
{
responeData.message = "此管道材质类型已经存在";
return responeData;
}
// material.MaterialId = SQLHelper.GetNewID(typeof(Model.Base_Material));
if (material.MaterialId == null || material.MaterialId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.Base_MaterialService.AddMaterial(material);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管道材质修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateMaterial([FromBody] Model.Base_Material material)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Material.FirstOrDefault(x =>
x.MaterialCode == material.MaterialCode.Trim() && (x.MaterialId != material.MaterialId ||
(material.MaterialId == null &&
x.MaterialId != null)));
if (q != null)
{
responeData.message = "此管道材质代号已经存在";
return responeData;
}
var q2 = Funs.DB.Base_Material.FirstOrDefault(x =>
x.MaterialType == material.MaterialType.Trim() && (x.MaterialId != material.MaterialId ||
(material.MaterialId == null &&
x.MaterialId != null)));
if (q2 != null)
{
responeData.message = "此管道材质类型已经存在";
return responeData;
}
BLL.Base_MaterialService.UpdateMaterial(material);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 安装组件新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveComponents([FromBody] Model.Base_Components components)
{
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Components.FirstOrDefault(x =>
x.ComponentsCode == components.ComponentsCode.Trim() &&
(x.ComponentsId != components.ComponentsId ||
(components.ComponentsId == null && x.ComponentsId != null)) &&
x.ProjeceId == components.ProjeceId);
if (q != null)
{
responeData.message = "此安装组件代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_Components.FirstOrDefault(x =>
x.ComponentsName == components.ComponentsName.Trim() &&
(x.ComponentsId != components.ComponentsId ||
(components.ComponentsId == null && x.ComponentsId != null)) &&
x.ProjeceId == components.ProjeceId);
if (q2 != null)
{
responeData.message = "此安装组件名称已存在";
return responeData;
}
// components.ComponentsId = SQLHelper.GetNewID(typeof(Model.Base_Components));
if (components.ComponentsId == null || components.ComponentsId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.Base_ComponentsService.AddComponents(components);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 安装组件修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateComponents([FromBody] Model.Base_Components components)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = Funs.DB.Base_Components.FirstOrDefault(x =>
x.ComponentsCode == components.ComponentsCode.Trim() &&
(x.ComponentsId != components.ComponentsId ||
(components.ComponentsId == null && x.ComponentsId != null)) &&
x.ProjeceId == components.ProjeceId);
if (q != null)
{
responeData.message = "此安装组件代号已存在";
return responeData;
}
var q2 = Funs.DB.Base_Components.FirstOrDefault(x =>
x.ComponentsName == components.ComponentsName.Trim() &&
(x.ComponentsId != components.ComponentsId ||
(components.ComponentsId == null && x.ComponentsId != null)) &&
x.ProjeceId == components.ProjeceId);
if (q2 != null)
{
responeData.message = "此安装组件名称已存在";
return responeData;
}
BLL.Base_ComponentsService.UpdateComponents(components);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 介质新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveMedium([FromBody] Model.Base_TestMedium medium)
{
{
var responeData = new Model.ResponeData();
try
{
// medium.TestMediumId = SQLHelper.GetNewID(typeof(Model.Base_TestMedium));
if (medium.TestMediumId == null || medium.TestMediumId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.Base_TestMediumService.AddTestMedium(medium);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 介质修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateMedium([FromBody] Model.Base_TestMedium medium)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
BLL.Base_TestMediumService.UpdateTestMedium(medium);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region
/// <summary>
/// 获取焊接数据列表
/// </summary>
/// <returns></returns>
public Model.ResponeData getWeldingData()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (
from project in db.Base_Project
where (project.ProjectState == "1" && (project.IsDelete == null || project.IsDelete == false))
join jotSize in (
from jointInfo in db.PW_JointInfo
group jointInfo by jointInfo.ProjectId
into jotGroup
select new
{
ProjectId = jotGroup.Key,
JOT_Size = jotGroup.Sum(j => j.JOT_Size)
}
) on project.ProjectId equals jotSize.ProjectId into jotSizeJoin
from jotSize in jotSizeJoin.DefaultIfEmpty()
join jotDoneDin in (
from x in db.PW_JointInfo
join y in db.BO_WeldReportMain on x.DReportID equals y.DReportID into weldReportJoin
from y in weldReportJoin.DefaultIfEmpty()
group x by x.ProjectId
into jotDoneGroup
select new
{
ProjectId = jotDoneGroup.Key,
JOT_DoneDin = jotDoneGroup.Sum(j => j.JOT_DoneDin)
}
) on project.ProjectId equals jotDoneDin.ProjectId into jotDoneDinJoin
from jotDoneDin in jotDoneDinJoin.DefaultIfEmpty()
join chtTotalFilm in (
from x in db.CH_CheckItem
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID into checkJoin
from y in checkJoin.DefaultIfEmpty()
group x by y.ProjectId
into chtTotalGroup
select new
{
ProjectId = chtTotalGroup.Key,
CHT_TotalFilm = chtTotalGroup.Sum(c => c.CHT_TotalFilm)
}
) on project.ProjectId equals chtTotalFilm.ProjectId into chtTotalFilmJoin
from chtTotalFilm in chtTotalFilmJoin.DefaultIfEmpty()
join chtPassFilm in (
from x in db.CH_CheckItem
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID into checkJoin
from y in checkJoin.DefaultIfEmpty()
group x by y.ProjectId
into chtPassGroup
select new
{
ProjectId = chtPassGroup.Key,
CHT_PassFilm = chtPassGroup.Sum(c => c.CHT_PassFilm)
}
) on project.ProjectId equals chtPassFilm.ProjectId into chtPassFilmJoin
from chtPassFilm in chtPassFilmJoin.DefaultIfEmpty()
select new
{
project.ProjectId,
project.ProjectCode,
project.ProjectName,
JOT_Size = jotSize.JOT_Size ?? 0,
JOT_DoneDin = jotDoneDin.JOT_DoneDin ?? 0,
CHT_TotalFilm = chtTotalFilm.CHT_TotalFilm ?? 0,
CHT_PassFilm = chtPassFilm.CHT_PassFilm ?? 0
}
).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 根据项目获取焊接数据明细
/// </summary>
/// <param name="projectId"> </param>
/// <returns></returns>
public Model.ResponeData getWeldingListByProjectId(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (
from jointInfo in db.View_JointInfo
join detectionRate in db.Base_DetectionRate on jointInfo.DetectionRateId equals detectionRate.DetectionRateId into detectionRateJoin
from detectionRate in detectionRateJoin.DefaultIfEmpty()
join detectionType in db.Base_DetectionType on jointInfo.DetectionTypeId equals detectionType.DetectionTypeId into detectionTypeJoin
from detectionType in detectionTypeJoin.DefaultIfEmpty()
where (jointInfo.ProjectId == projectId)
select new
{
jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_JointNo,
jointInfo.Is_hj,
jointInfo.JointStatusName,
jointInfo.JOT_TrustFlagName,
jointInfo.JOT_CheckFlagName,
jointInfo.ISO_ID,
jointInfo.ISO_IsoNo,
jointInfo.WorkAreaId,
jointInfo.WorkAreaCode,
jointInfo.JOT_WeldDate,
jointInfo.JOT_DailyReportNo,
jointInfo.STE_Name1,
jointInfo.STE_Name2,
jointInfo.Component1,
jointInfo.Component2,
jointInfo.WED_Code1,
jointInfo.WED_Name1,
jointInfo.WED_Code2,
jointInfo.WED_Name2,
jointInfo.JOT_JointDesc,
jointInfo.JOT_Dia,
jointInfo.JOT_Size,
jointInfo.JOT_Sch,
jointInfo.JOT_FactSch,
jointInfo.GrooveTypeName,
jointInfo.JOTY_ID,
jointInfo.WeldTypeName,
jointInfo.WME_ID,
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
jointInfo.WeldMat,
jointInfo.WLO_Code,
jointInfo.WeldingLocationName,
jointInfo.JOT_DoneDin,
jointInfo.JOT_PrepareTemp,
jointInfo.JOT_JointAttribute,
jointInfo.JOT_CellTemp,
jointInfo.JOT_LastTemp,
jointInfo.JOT_HeartNo1,
jointInfo.JOT_HeartNo2,
jointInfo.PointDate,
jointInfo.PointNo,
jointInfo.CH_TrustCode,
jointInfo.CH_TrustDate,
jointInfo.JOT_FaceCheckResult,
jointInfo.JOT_FaceCheckDate,
jointInfo.JOT_FaceChecker,
detectionRate.DetectionRateValue,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
detectionType.DetectionTypeName,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
jointInfo.Extend_Length,
CHT_CheckDate = (from c in db.CH_Check
join ci in db.CH_CheckItem on c.CHT_CheckID equals ci.CHT_CheckID
where ci.JOT_ID == jointInfo.JOT_ID
orderby c.CHT_CheckDate descending
select c.CHT_CheckDate).FirstOrDefault(),
CHT_CheckCode = (from c in db.CH_Check
join ci in db.CH_CheckItem on c.CHT_CheckID equals ci.CHT_CheckID
where ci.JOT_ID == jointInfo.JOT_ID
orderby c.CHT_CheckDate descending
select c.CHT_CheckCode).FirstOrDefault(),
}
).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 根据项目获取焊口信息
/// </summary>
/// <param name="projectId"> </param>
/// <param name="isoId"> 管线主键 </param>
/// <returns></returns>
public Model.ResponeData getJointInfoByProjectId(string projectId, string isoId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (
from jointInfo in db.View_JointInfo
join detectionRate in db.Base_DetectionRate on jointInfo.DetectionRateId equals detectionRate.DetectionRateId into detectionRateJoin
from detectionRate in detectionRateJoin.DefaultIfEmpty()
join detectionType in db.Base_DetectionType on jointInfo.DetectionTypeId equals detectionType.DetectionTypeId into detectionTypeJoin
from detectionType in detectionTypeJoin.DefaultIfEmpty()
where (jointInfo.ProjectId == projectId && jointInfo.ISO_ID == isoId)
select new
{
jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_JointNo,
jointInfo.Is_hj,
jointInfo.JointStatusName,
jointInfo.JOT_TrustFlagName,
jointInfo.JOT_CheckFlagName,
jointInfo.ISO_ID,
jointInfo.ISO_IsoNo,
jointInfo.WorkAreaId,
jointInfo.WorkAreaCode,
jointInfo.JOT_WeldDate,
jointInfo.JOT_DailyReportNo,
jointInfo.STE_Name1,
jointInfo.STE_Name2,
jointInfo.Component1,
jointInfo.Component2,
jointInfo.WED_Code1,
jointInfo.WED_Name1,
jointInfo.WED_Code2,
jointInfo.WED_Name2,
jointInfo.JOT_JointDesc,
jointInfo.JOT_Dia,
jointInfo.JOT_Size,
jointInfo.JOT_Sch,
jointInfo.JOT_FactSch,
jointInfo.GrooveTypeName,
jointInfo.JOTY_ID,
jointInfo.WeldTypeName,
jointInfo.WME_ID,
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
jointInfo.WeldMat,
jointInfo.WLO_Code,
jointInfo.WeldingLocationName,
jointInfo.JOT_DoneDin,
jointInfo.JOT_PrepareTemp,
jointInfo.JOT_JointAttribute,
jointInfo.JOT_CellTemp,
jointInfo.JOT_LastTemp,
jointInfo.JOT_HeartNo1,
jointInfo.JOT_HeartNo2,
jointInfo.PointDate,
jointInfo.PointNo,
jointInfo.CH_TrustCode,
jointInfo.CH_TrustDate,
jointInfo.JOT_FaceCheckResult,
jointInfo.JOT_FaceCheckDate,
jointInfo.JOT_FaceChecker,
detectionRate.DetectionRateValue,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
detectionType.DetectionTypeName,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
jointInfo.Extend_Length,
CHT_CheckDate = (from c in db.CH_Check
join ci in db.CH_CheckItem on c.CHT_CheckID equals ci.CHT_CheckID
where ci.JOT_ID == jointInfo.JOT_ID
orderby c.CHT_CheckDate descending
select c.CHT_CheckDate).FirstOrDefault(),
CHT_CheckCode = (from c in db.CH_Check
join ci in db.CH_CheckItem on c.CHT_CheckID equals ci.CHT_CheckID
where ci.JOT_ID == jointInfo.JOT_ID
orderby c.CHT_CheckDate descending
select c.CHT_CheckCode).FirstOrDefault(),
jointInfo.JOT_Remark
}
).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 根据项目获取管线列表信息
/// </summary>
/// <param name="projectId"> </param>
/// <returns></returns>
public Model.ResponeData getIsoInfoByProjectId(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from iso in db.PW_IsoInfo
join unit in db.Base_Unit on iso.UnitId equals unit.UnitId into unitJoin
from unit in unitJoin.DefaultIfEmpty()
join testMedium in db.Base_TestMedium on iso.TestMediumId equals testMedium.TestMediumId into testMediumJoin
from testMedium in testMediumJoin.DefaultIfEmpty()
join detectionRate in db.Base_DetectionRate on iso.DetectionRateId equals detectionRate.DetectionRateId into detectionRateJoin
from detectionRate in detectionRateJoin.DefaultIfEmpty()
join detectionType in db.Base_DetectionType on iso.DetectionTypeId equals detectionType.DetectionTypeId into detectionTypeJoin
from detectionType in detectionTypeJoin.DefaultIfEmpty()
join workArea in db.ProjectData_WorkArea on iso.WorkAreaId equals workArea.WorkAreaId into workAreaJoin
from workArea in workAreaJoin.DefaultIfEmpty()
join material in db.Base_Material on iso.MaterialId equals material.MaterialId into materialJoin
from material in materialJoin.DefaultIfEmpty()
join pipingClass in db.Base_PipingClass on iso.PipingClassId equals pipingClass.PipingClassId into pipingClassJoin
from pipingClass in pipingClassJoin.DefaultIfEmpty()
where iso.ProjectId == projectId
select new
{
iso.ISO_ID,
iso.ProjectId,
iso.ISO_IsoNo,
iso.UnitId,
iso.TestMediumId,
ISO_IfPickling = iso.ISO_IfPickling == true ? "是" : "否",
ISO_IfChasing = iso.ISO_IfChasing == true ? "是" : "否",
iso.ISO_Remark
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 根据焊口主键获取明细数据
/// </summary>
/// <param name="id"> </param>
/// <returns></returns>
public Model.ResponeData getJointInfoById(string id)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
Model.PW_JointInfo jointInfo = BLL.PW_JointInfoService.GetJointInfoByJotID(id);
if (jointInfo != null)
{
if (!string.IsNullOrEmpty(jointInfo.ISO_ID))
{
dictionary.Add("JOT_ID", jointInfo.JOT_ID);
dictionary.Add("ProjectId", jointInfo.ProjectId);
if (!string.IsNullOrEmpty(jointInfo.WLO_Code))
{
dictionary.Add("WLO_Code", jointInfo.WLO_Code);
}
if (!string.IsNullOrEmpty(jointInfo.MaterialId))
{
dictionary.Add("MaterialId", jointInfo.MaterialId);
}
if (!string.IsNullOrEmpty(jointInfo.MaterialId2))
{
dictionary.Add("MaterialId2", jointInfo.MaterialId2);
}
dictionary.Add("JOT_BelongPipe", jointInfo.JOT_BelongPipe);
if (!string.IsNullOrEmpty(jointInfo.JOT_Component1))
{
dictionary.Add("JOT_Component1", jointInfo.JOT_Component1);
}
if (!string.IsNullOrEmpty(jointInfo.JOT_Component2))
{
dictionary.Add("JOT_Component2", jointInfo.JOT_Component2);
}
dictionary.Add("JOT_JointDesc", jointInfo.JOT_JointDesc);
dictionary.Add("JOT_HeartNo1", jointInfo.JOT_HeartNo1);
dictionary.Add("JOT_HeartNo2", jointInfo.JOT_HeartNo2);
if (!string.IsNullOrEmpty(jointInfo.DetectionRateId))
{
dictionary.Add("DetectionRateId", jointInfo.DetectionRateId);
}
if (!string.IsNullOrEmpty(jointInfo.DetectionTypeId))
{
dictionary.Add("DetectionTypeId", jointInfo.DetectionTypeId);
}
if (!string.IsNullOrEmpty(jointInfo.JOTY_ID))
{
dictionary.Add("JOTY_ID", jointInfo.JOTY_ID);
}
dictionary.Add("Size", jointInfo.JOT_Size.HasValue ? jointInfo.JOT_Size.ToString() : "");
dictionary.Add("Dia", jointInfo.JOT_Dia.HasValue ? jointInfo.JOT_Dia.ToString() : "");
if (!string.IsNullOrEmpty(jointInfo.JST_ID))
{
dictionary.Add("JST_ID", jointInfo.JST_ID);
}
dictionary.Add("ExtendLength", jointInfo.Extend_Length);
dictionary.Add("Sch", jointInfo.JOT_Sch);
dictionary.Add("FactSch",
jointInfo.JOT_FactSch.HasValue ? jointInfo.JOT_FactSch.ToString() : "");
dictionary.Add("LastTemp",
jointInfo.JOT_LastTemp.HasValue ? jointInfo.JOT_LastTemp.ToString() : "");
if (jointInfo.JOT_CellTemp.HasValue)
{
var tem = BLL.Base_TemperatureSetService.GetTemperatureByTemAndType(
jointInfo.JOT_CellTemp, "2");
if (tem != null)
{
dictionary.Add("CellTemp", tem.TemperatureSetId);
}
}
if (jointInfo.JOT_PrepareTemp.HasValue)
{
var tem = BLL.Base_TemperatureSetService.GetTemperatureByTemAndType(
jointInfo.JOT_PrepareTemp, "1");
if (tem != null)
{
dictionary.Add("PrepareTemp", tem.TemperatureSetId);
}
}
if (!string.IsNullOrEmpty(jointInfo.JOT_JointAttribute))
{
dictionary.Add("JointAttribute", jointInfo.JOT_JointAttribute);
}
if (!string.IsNullOrEmpty(jointInfo.WME_ID))
{
dictionary.Add("WME_ID", jointInfo.WME_ID);
}
if (!string.IsNullOrEmpty(jointInfo.JOT_WeldSilk))
{
dictionary.Add("WeldSilk", jointInfo.JOT_WeldSilk);
}
if (!string.IsNullOrEmpty(jointInfo.JOT_WeldMat))
{
dictionary.Add("WeldMat", jointInfo.JOT_WeldMat);
}
dictionary.Add("Electricity", jointInfo.JOT_Electricity);
dictionary.Add("Voltage", jointInfo.JOT_Voltage);
if (!string.IsNullOrEmpty(jointInfo.IS_Proess))
{
dictionary.Add("IS_Proess", jointInfo.IS_Proess);
}
dictionary.Add("Remark", jointInfo.JOT_Remark);
if (!string.IsNullOrEmpty(jointInfo.DReportID))
{
dictionary.Add("ReportCode", jointInfo.DReportID);
dictionary.Add("ReportDate",
Convert.ToString(
BLL.PW_JointInfoService.GetReportDateByDReportID(jointInfo.DReportID)));
dictionary.Add("Report", "已焊接");
}
else
{
dictionary.Add("Report", "未焊接");
dictionary.Add("ReportCode", BLL.Const._Null);
}
//日报日期
if (!String.IsNullOrEmpty(jointInfo.JOT_FloorWelder))
{
var floorWelder = BLL.WelderService.GetWelderById(jointInfo.JOT_FloorWelder);
if (floorWelder != null)
{
dictionary.Add("FloorWelder", floorWelder.WED_Code);
dictionary.Add("FloorWelderName", floorWelder.WED_Name);
}
}
if (!String.IsNullOrEmpty(jointInfo.JOT_CellWelder))
{
var cellWelder = BLL.WelderService.GetWelderById(jointInfo.JOT_CellWelder);
dictionary.Add("CellWelder", cellWelder.WED_Code);
dictionary.Add("CellWelderName", cellWelder.WED_Name);
}
dictionary.Add("DoneDia",
jointInfo.JOT_DoneDin.HasValue ? jointInfo.JOT_DoneDin.ToString() : "");
if (!string.IsNullOrEmpty(jointInfo.PW_PointID))
{
dictionary.Add("Point", "已点口");
}
else
{
dictionary.Add("Point", "未点口");
}
if (!string.IsNullOrEmpty(jointInfo.JOT_TrustFlag))
{
dictionary.Add("TrustFlag", jointInfo.JOT_TrustFlag);
}
else
{
dictionary.Add("TrustFlag", "00");
}
if (!string.IsNullOrEmpty(jointInfo.JOT_CheckFlag))
{
dictionary.Add("CheckFlag", jointInfo.JOT_CheckFlag);
}
else
{
dictionary.Add("CheckFlag", "00");
}
if (!string.IsNullOrEmpty(jointInfo.JOT_JointStatus))
{
dictionary.Add("JointStatus", jointInfo.JOT_JointStatus);
}
dictionary.Add("WeldingGasProtection", jointInfo.WeldingGasProtection);
dictionary.Add("WeldingSpeed", jointInfo.WeldingSpeed);
if (jointInfo.ActualPrepareTemp.HasValue)
{
dictionary.Add("ActualPrepareTemp", jointInfo.ActualPrepareTemp.ToString());
}
dictionary.Add("ComponentNum", jointInfo.ComponentNum);
if (!string.IsNullOrEmpty(jointInfo.MaterialType))
{
dictionary.Add("JointStatus", jointInfo.MaterialType);
}
dictionary.Add("Material1", jointInfo.Material1);
dictionary.Add("Material2", jointInfo.Material2);
var isoInfo = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(jointInfo.ISO_ID);
if (isoInfo != null)
{
dictionary.Add("ISONO", isoInfo.ISO_IsoNo);
if (!string.IsNullOrEmpty(isoInfo.WorkAreaId))
{
dictionary.Add("WorkAreaId", isoInfo.WorkAreaId);
}
var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(isoInfo.WorkAreaId);
if (workArea != null)
{
dictionary.Add("WorkAreaCode", workArea.WorkAreaCode);
}
if (isoInfo.Is_Standard.HasValue && !isoInfo.Is_Standard.Value)
{
dictionary.Add("NDTName", true);
dictionary.Add("NDTRate", true);
dictionary.Add("WallBoard", true);
}
}
}
}
responeData.data = new { dictionary };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region
/// <summary>
/// 根据单位工程获取焊接一次合格率
/// </summary>
/// <param name="projectId"> 项目id</param>
/// <param name="unitId"> 单位id</param>
/// <returns></returns>
public Model.ResponeData getWeldingOnePassRateByUnit(string projectId, string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getList = (
from ch_checkitem in db.CH_CheckItem
join jointInfo in db.PW_JointInfo on ch_checkitem.JOT_ID equals jointInfo.JOT_ID into jointInfoGroup
from jointInfo in jointInfoGroup.DefaultIfEmpty()
join isoInfo in db.PW_IsoInfo on jointInfo.ISO_ID equals isoInfo.ISO_ID into isoInfoGroup
from isoInfo in isoInfoGroup.DefaultIfEmpty()
join unit in db.Base_Unit on isoInfo.UnitId equals unit.UnitId into unitGroup
from unit in unitGroup.DefaultIfEmpty()
where jointInfo.ProjectId == projectId && isoInfo.UnitId == unitId
group ch_checkitem by new { unit.UnitId, unit.UnitName } into grouped
select new
{
grouped.Key.UnitId,
grouped.Key.UnitName,
total_film = grouped.Sum(x => x.CHT_TotalFilm ?? 0),
pass_film = grouped.Sum(x => x.CHT_PassFilm ?? 0)
}).ToList();
responeData.data = new { getList };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 根据分包商获取焊接一次合格率
/// </summary>
/// <param name="projectId"> 项目id</param>
/// <param name="unitId"> 单位id</param>
/// <returns></returns>
public Model.ResponeData getWeldingOnePassRateBySub(string projectId, string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getList = (
from ch_checkitem in db.CH_CheckItem
join jointInfo in db.PW_JointInfo on ch_checkitem.JOT_ID equals jointInfo.JOT_ID into jointInfoGroup
from jointInfo in jointInfoGroup.DefaultIfEmpty()
join isoInfo in db.PW_IsoInfo on jointInfo.ISO_ID equals isoInfo.ISO_ID into isoInfoGroup
from isoInfo in isoInfoGroup.DefaultIfEmpty()
join WorkArea in db.ProjectData_WorkArea on isoInfo.WorkAreaId equals WorkArea.WorkAreaId into workAreaGroup
from WorkArea in workAreaGroup.DefaultIfEmpty()
where jointInfo.ProjectId == projectId && isoInfo.UnitId == unitId
group ch_checkitem by new { WorkArea.WorkAreaId, WorkArea.WorkAreaName } into grouped
select new
{
grouped.Key.WorkAreaId,
grouped.Key.WorkAreaName,
total_film = grouped.Sum(x => x.CHT_TotalFilm ?? 0),
pass_film = grouped.Sum(x => x.CHT_PassFilm ?? 0)
}).ToList();
responeData.data = new { getList };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 焊工新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveWelder([FromBody] Model.BS_Welder welder)
{
{
var responeData = new Model.ResponeData();
try
{
if (BLL.WelderService.IsExistWEDName(welder.WED_Name.Trim(), welder.ProjectId, "1"))
{
responeData.message = "焊工姓名已存在";
return responeData;
}
if (string.IsNullOrEmpty(welder.WED_Code.Trim()) || welder.WED_Code.Trim() == "")
{
responeData.message = "焊工代号不能为空";
return responeData;
}
if (BLL.WelderService.IsExistWEDCode(welder.WED_Code.Trim(), welder.ProjectId, "1"))
{
responeData.message = "焊工代号已存在";
return responeData;
}
welder.WederType = "1";//人员信息
// welder.WED_ID = SQLHelper.GetNewID(typeof(Model.BS_Welder));
if (welder.WED_ID == null || welder.WED_ID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.WelderService.AddBSWelder(welder);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊工修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateWelder([FromBody] Model.BS_Welder welder)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var wed = BLL.PersonManageService.GetBSWelderByTeamWEDID(welder.WED_ID);
string name = wed.WED_Name;
string wedCode = wed.WED_Code;
if (name != welder.WED_Name.Trim())
{
if (BLL.WelderService.IsExistWEDName(welder.WED_Name.Trim(), welder.ProjectId, "1"))
{
responeData.message = "焊工姓名已存在";
return responeData;
}
}
if (wedCode != welder.WED_Code.Trim())
{
if (BLL.WelderService.IsExistWEDCode(welder.WED_Code.Trim(), welder.ProjectId, "1"))
{
responeData.message = "焊工代号已存在";
return responeData;
}
}
BLL.WelderService.UpdateBSWelder(welder);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 焊接工艺评定新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveWeldingProcedure([FromBody] Model.PW_WeldingProcedure weldProcedure)
{
{
var responeData = new Model.ResponeData();
try
{
if (weldProcedure.WeldingProcedureId == null || weldProcedure.WeldingProcedureId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.WeldingProcedureService.AddWeldProcedure(weldProcedure);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接工艺评定修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateWeldingProcedure([FromBody] Model.PW_WeldingProcedure weldProcedure)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
BLL.WeldingProcedureService.UpdateWeldProcedure(weldProcedure);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 管线新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveIsoInfo([FromBody] Model.PW_IsoInfo isoInfo)
{
{
var responeData = new Model.ResponeData();
try
{
// isoInfo.ISO_ID = SQLHelper.GetNewID(typeof(Model.PW_IsoInfo));
if (isoInfo.ISO_ID == null || isoInfo.ISO_ID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
if (string.IsNullOrEmpty(isoInfo.ISO_IsoNo)||isoInfo.ISO_IsoNo == "")
{
responeData.message = "管线代号不能为空!";
return responeData;
}
if (string.IsNullOrEmpty(isoInfo.ProjectId)||isoInfo.ProjectId == "")
{
responeData.message = "项目ID不能为空!";
return responeData;
}
if (string.IsNullOrEmpty(isoInfo.UnitId)||isoInfo.UnitId == "")
{
responeData.message = "单位ID不能为空!";
return responeData;
}
if (BLL.PW_IsoInfoService.IsExistIsoInfoCode(isoInfo.ISO_IsoNo.Trim(), isoInfo.WorkAreaId) == true)
{
responeData.message = "这个区域已存在这条管线,不能增加!";
return responeData;
}
else
{
BLL.PW_IsoInfoService.AddIsoInfo(isoInfo);
responeData.message = "保存成功";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管线修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateIsoInfo([FromBody] Model.PW_IsoInfo isoInfo)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var data = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoInfo.ISO_ID);
if (data.ISO_IsoNo != isoInfo.ISO_IsoNo && data.WorkAreaId != isoInfo.WorkAreaId)
{
if (BLL.PW_IsoInfoService.IsExistIsoInfoCode(isoInfo.ISO_IsoNo.Trim(), isoInfo.WorkAreaId) ==
true)
{
responeData.message = "这个区域已存在这条管线,不能修改!";
return responeData;
}
}
BLL.PW_IsoInfoService.UpdateIsoInfo(isoInfo);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊口新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveJointInfo([FromBody] Model.PW_JointInfo jointInfo)
{
{
var responeData = new Model.ResponeData();
try
{
if (string.IsNullOrEmpty(jointInfo.JOT_JointNo)||jointInfo.JOT_JointNo == "")
{
responeData.message = "焊口代号不能为空!";
return responeData;
}
if (string.IsNullOrEmpty(jointInfo.ProjectId)||jointInfo.ProjectId == "")
{
responeData.message = "项目ID不能为空!";
return responeData;
}
if (string.IsNullOrEmpty(jointInfo.ISO_ID)||jointInfo.ISO_ID == "")
{
responeData.message = "管线ID不能为空!";
return responeData;
}
var JOT_ID = BLL.PW_JointInfoService.AddJointInfo(jointInfo);
responeData.data = new { JOT_ID };
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊口修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateJointInfo([FromBody] Model.PW_JointInfo jointInfo)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
BLL.PW_JointInfoService.UpdateJointInfo(jointInfo);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接日报新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveWeldReport([FromBody] Model.Customization._7HJ.WeldReportMainInfo weldReport)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var GetWeldReportItem = weldReport.GetWeldReportItem;
if (GetWeldReportItem.Count <= 0)
{
responeData.message = "焊口信息不能为空!";
return responeData;
}
if (weldReport.JOT_WeldDate == null || weldReport.InstallationId == BLL.Const._Null)
{
responeData.message = "装置、焊接日期不能为空!";
return responeData;
}
#region
var workAreaCode = string.Empty;
var welderCode = string.Empty;
string jotId = GetWeldReportItem.FirstOrDefault().JOT_ID;
if (!string.IsNullOrEmpty(jotId))
{
var jotInfo = BLL.PW_JointInfoService.GetJointInfoByJotID(jotId);
if (jotInfo != null)
{
if (!string.IsNullOrEmpty(jotInfo.ISO_ID))
{
var isoInfo = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(jotInfo.ISO_ID);
if (isoInfo != null)
{
workAreaCode = BLL.WorkAreaService.GetWorkAreaCodeByWorkAreaId(isoInfo.WorkAreaId);
}
}
}
}
string welderId = GetWeldReportItem.FirstOrDefault().JOT_CellWelder;
if (!string.IsNullOrEmpty(welderId))
{
welderCode = BLL.WelderService.GetWelderById(welderId).WED_Code;
}
string perfix = workAreaCode + "-" + welderCode + "-";
weldReport.JOT_DailyReportNo = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId",
"dbo.BO_WeldReportMain", "JOT_DailyReportNo", weldReport.ProjectId, perfix);
#endregion
// weldReport.DReportID = SQLHelper.GetNewID(typeof(Model.BO_WeldReportMain));
if (weldReport.DReportID == null || weldReport.DReportID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.BO_WeldReportMain newWeldReport = new Model.BO_WeldReportMain();
newWeldReport.DReportID = weldReport.DReportID;
newWeldReport.ProjectId = weldReport.ProjectId;
newWeldReport.InstallationId = weldReport.InstallationId;
newWeldReport.UnitId = weldReport.UnitId;
newWeldReport.JOT_WeldDate = weldReport.JOT_WeldDate;
newWeldReport.JOT_DailyReportNo = weldReport.JOT_DailyReportNo;
newWeldReport.CHT_Tabler = weldReport.CHT_Tabler;
newWeldReport.CHT_TableDate = weldReport.CHT_TableDate;
newWeldReport.JOT_Remark = weldReport.JOT_Remark;
db.BO_WeldReportMain.InsertOnSubmit(newWeldReport);
db.SubmitChanges();
foreach (var item in weldReport.GetWeldReportItem)
{
Model.PW_JointInfo jot = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
jot.DReportID = weldReport.DReportID;
jot.JOT_CellWelder = item.JOT_CellWelder;
jot.JOT_FloorWelder = item.JOT_FloorWelder;
jot.WLO_Code = item.WLO_Code == "安装" ? "F" : "S";
jot.JOT_JointAttribute = item.JOT_JointAttribute;
jot.JOT_Location = item.JOT_Location;
jot.JOT_DoneDin = item.JOT_DoneDin;
jot.JOT_Electricity = item.JOT_Electricity;
jot.JOT_Voltage = item.JOT_Voltage;
jot.JOT_JointStatus = "100";
jot.WeldingSpeed = item.WeldingSpeed;
jot.JOT_PrepareTemp = item.JOT_PrepareTemp;
jot.ActualPrepareTemp = item.ActualPrepareTemp;
jot.JOT_CellTemp = item.JOT_CellTemp;
jot.JOT_LastTemp = item.JOT_LastTemp;
BLL.PW_JointInfoService.UpdateJointInfoByDReport(jot);
//更新焊口号 修改固定焊口号后 +G
BLL.PW_JointInfoService.UpdateJointNoAddG(item.JOT_ID, item.JOT_JointAttribute, "Add");
}
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接日报修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateWeldReport([FromBody] Model.Customization._7HJ.WeldReportMainInfo weldReport)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
Model.BO_WeldReportMain newWeldReport =
db.BO_WeldReportMain.First(e => e.DReportID == weldReport.DReportID);
newWeldReport.UnitId = weldReport.UnitId;
newWeldReport.InstallationId = weldReport.InstallationId;
newWeldReport.JOT_WeldDate = weldReport.JOT_WeldDate;
newWeldReport.JOT_DailyReportNo = weldReport.JOT_DailyReportNo;
newWeldReport.CHT_Tabler = weldReport.CHT_Tabler;
newWeldReport.CHT_TableDate = weldReport.CHT_TableDate;
newWeldReport.JOT_Remark = weldReport.JOT_Remark;
db.SubmitChanges();
foreach (var item in weldReport.GetWeldReportItem)
{
Model.PW_JointInfo jot = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
jot.DReportID = weldReport.DReportID;
jot.JOT_CellWelder = item.JOT_CellWelder;
jot.JOT_FloorWelder = item.JOT_FloorWelder;
jot.WLO_Code = item.WLO_Code == "安装" ? "F" : "S";
jot.JOT_JointAttribute = item.JOT_JointAttribute;
jot.JOT_Location = item.JOT_Location;
jot.JOT_DoneDin = item.JOT_DoneDin;
jot.JOT_Electricity = item.JOT_Electricity;
jot.JOT_Voltage = item.JOT_Voltage;
jot.JOT_JointStatus = "100";
jot.WeldingSpeed = item.WeldingSpeed;
jot.JOT_PrepareTemp = item.JOT_PrepareTemp;
jot.ActualPrepareTemp = item.ActualPrepareTemp;
jot.JOT_CellTemp = item.JOT_CellTemp;
jot.JOT_LastTemp = item.JOT_LastTemp;
BLL.PW_JointInfoService.UpdateJointInfoByDReport(jot);
//更新焊口号 修改固定焊口号后 +G
BLL.PW_JointInfoService.UpdateJointNoAddG(item.JOT_ID, item.JOT_JointAttribute, "Add");
}
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 点口信息新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SavePoint([FromBody] Model.Customization._7HJ.PointInfo point)
{
{
var responeData = new Model.ResponeData();
try
{
var jointInfos = point.JointInfos;
if (jointInfos.Count > 0)
{
if (BLL.PointManageService.IsExistPointNO(point.PW_PointID, point.ProjectId))
{
responeData.message = "点口编号已存在,请重新录入!";
return responeData;
}
Model.BO_Point newPoint = new Model.BO_Point();
// newPoint.PW_PointID = SQLHelper.GetNewID(typeof(Model.BO_Point));
if (newPoint.PW_PointID == null || newPoint.PW_PointID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
newPoint.ProjectId = point.ProjectId;
newPoint.UnitId = point.UnitId;
newPoint.InstallationId = point.InstallationId;
newPoint.PW_PointNo = point.PW_PointNo;
newPoint.PW_PointDate = point.PW_PointDate;
newPoint.PW_Tabler = point.PW_Tabler;
newPoint.PW_TablerDate = point.PW_TablerDate;
newPoint.PW_Remark = point.PW_Remark;
Funs.DB.BO_Point.InsertOnSubmit(newPoint);
Funs.DB.SubmitChanges();
foreach (var item in jointInfos)
{
var joint = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
if (joint != null)
{
joint.JOT_JointStatus = "101";
joint.PW_PointID = point.PW_PointID;
BLL.PW_JointInfoService.UpdateJointPoint(joint);
}
}
responeData.message = "保存成功";
}
else
{
responeData.message = "焊口信息不能为空!";
return responeData;
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 点口信息修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdatePoint([FromBody] Model.Customization._7HJ.PointInfo point)
{
{
var responeData = new Model.ResponeData();
try
{
var jointInfos = point.JointInfos;
Model.BO_Point newPoint = Funs.DB.BO_Point.FirstOrDefault(e => e.PW_PointID == point.PW_PointID);
if (newPoint != null)
{
newPoint.UnitId = point.UnitId;
newPoint.InstallationId = point.InstallationId;
newPoint.PW_PointNo = point.PW_PointNo;
newPoint.PW_PointDate = point.PW_PointDate;
newPoint.PW_Tabler = point.PW_Tabler;
newPoint.PW_TablerDate = point.PW_TablerDate;
newPoint.PW_Remark = point.PW_Remark;
Funs.DB.SubmitChanges();
}
if (jointInfos.Count > 0)
{
foreach (var item in jointInfos)
{
var joint = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
if (joint != null)
{
joint.JOT_JointStatus = "101";
joint.PW_PointID = point.PW_PointID;
BLL.PW_JointInfoService.UpdateJointPoint(joint);
}
}
}
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 检测单数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveCheck([FromBody] Model.Customization._7HJ.CheckInfo check)
{
{
var responeData = new Model.ResponeData();
try
{
var checkItems = check.CheckItems;
if (checkItems.Count > 0)
{
#region
if (BLL.CheckManageService.IsExistCheckCode(check.ProjectId,
check.CHT_CheckCode.Trim()))
{
responeData.message = "此检测单号已经存在!";
return responeData;
}
// check.CHT_CheckID = SQLHelper.GetNewID(typeof(Model.CH_Check));
if (check.CHT_CheckID == null || check.CHT_CheckID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.CH_Check newCheck = new Model.CH_Check();
newCheck.CHT_CheckID = check.CHT_CheckID;
newCheck.CH_TrustID = check.CH_TrustID;
newCheck.ProjectId = check.ProjectId;
newCheck.UnitId = check.UnitId;
newCheck.InstallationId = check.InstallationId;
newCheck.CHT_CheckCode = check.CHT_CheckCode;
newCheck.CHT_CheckDate = check.CHT_CheckDate;
newCheck.CHT_CheckType = check.CHT_CheckType;
newCheck.CHT_CheckMan = check.CHT_CheckMan;
newCheck.CHT_Tabler = check.CHT_Tabler;
newCheck.CHT_TableDate = check.CHT_TableDate;
newCheck.CHT_AuditMan = check.CHT_AuditMan;
newCheck.CHT_AuditDate = check.CHT_AuditDate;
newCheck.CHT_Remark = check.CHT_Remark;
newCheck.ContractualUnits = check.ContractualUnits;
Funs.DB.CH_Check.InsertOnSubmit(newCheck);
Funs.DB.SubmitChanges();
#endregion
#region
foreach (var item in checkItems)
{
Model.CH_CheckItem checkitem = new Model.CH_CheckItem();
checkitem.CHT_CheckID = check.CHT_CheckID;
checkitem.JOT_ID = item.JOT_ID;
checkitem.CH_TrustItemID = item.CH_TrustItemID;
checkitem.CHT_CheckMethod = item.CH_NDTMethod;
checkitem.CHT_RequestDate = item.CHT_RequestDate;
checkitem.CHT_RepairLocation = item.CHT_RepairLocation;
checkitem.CHT_TotalFilm = item.CHT_TotalFilm;
checkitem.CHT_PassFilm = item.CHT_PassFilm;
checkitem.CHT_CheckResult = item.CHT_CheckResult;
checkitem.CHT_CheckNo = item.CHT_CheckNo;
checkitem.CHT_FilmDate = item.CHT_FilmDate;
checkitem.CHT_ReportDate = item.CHT_ReportDate;
checkitem.CHT_Remark = item.CHT_Remark;
checkitem.FilmSpecifications = item.FilmSpecifications;
checkitem.DefectLength = item.DefectLength;
checkitem.DefectDepth = item.DefectDepth;
checkitem.DefectHeight = item.DefectHeight;
checkitem.ExtendingRice = item.ExtendingRice;
checkitem.Defects_Definition = item.Defects_Definition;
BLL.CheckItemManageService.AddCheckItem(checkitem);
BLL.CheckItemManageService.UpdateJointCheckFlag(checkitem.JOT_ID, "1");
}
#endregion
responeData.message = "保存成功";
}
else
{
responeData.message = "检测单明细不能为空";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 检测单数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateCheck([FromBody] Model.Customization._7HJ.CheckInfo check)
{
{
var responeData = new Model.ResponeData();
try
{
var checkItems = check.CheckItems;
var updateCheck = BLL.CheckManageService.GetCheckByCHT_CheckID(check.CHT_CheckID);
if (updateCheck != null && updateCheck.CHT_AuditDate.HasValue)
{
responeData.message = "此检测单已审核不能修改!";
return responeData;
}
if (checkItems.Count > 0)
{
#region
if (updateCheck != null && !string.IsNullOrEmpty(check.CHT_CheckID))
{
if (updateCheck.CHT_CheckCode != check.CHT_CheckCode.Trim())
{
if (BLL.CheckManageService.IsExistCheckCode(check.ProjectId,
check.CHT_CheckCode.Trim()))
{
responeData.message = "此检测单号已经存在!";
return responeData;
}
}
Model.CH_Check newCheck =
Funs.DB.CH_Check.FirstOrDefault(e => e.CHT_CheckID == check.CHT_CheckID);
if (newCheck != null)
{
newCheck.UnitId = check.UnitId;
newCheck.InstallationId = check.InstallationId;
newCheck.CHT_CheckCode = check.CHT_CheckCode;
newCheck.CHT_CheckDate = check.CHT_CheckDate;
newCheck.CHT_CheckType = check.CHT_CheckType;
newCheck.CHT_CheckMan = check.CHT_CheckMan;
newCheck.CHT_Tabler = check.CHT_Tabler;
newCheck.CHT_TableDate = check.CHT_TableDate;
newCheck.CHT_AuditMan = check.CHT_AuditMan;
newCheck.CHT_AuditDate = check.CHT_AuditDate;
newCheck.CHT_Remark = check.CHT_Remark;
newCheck.ContractualUnits = check.ContractualUnits;
Funs.DB.SubmitChanges();
BLL.CheckItemManageService.DeleteCheckItemByCheckId(check.CHT_CheckID);
}
}
#endregion
#region
foreach (var item in checkItems)
{
Model.CH_CheckItem checkitem = new Model.CH_CheckItem();
checkitem.CHT_CheckID = check.CHT_CheckID;
checkitem.JOT_ID = item.JOT_ID;
checkitem.CH_TrustItemID = item.CH_TrustItemID;
checkitem.CHT_CheckMethod = item.CH_NDTMethod;
checkitem.CHT_RequestDate = item.CHT_RequestDate;
checkitem.CHT_RepairLocation = item.CHT_RepairLocation;
checkitem.CHT_TotalFilm = item.CHT_TotalFilm;
checkitem.CHT_PassFilm = item.CHT_PassFilm;
checkitem.CHT_CheckResult = item.CHT_CheckResult;
checkitem.CHT_CheckNo = item.CHT_CheckNo;
checkitem.CHT_FilmDate = item.CHT_FilmDate;
checkitem.CHT_ReportDate = item.CHT_ReportDate;
checkitem.CHT_Remark = item.CHT_Remark;
checkitem.FilmSpecifications = item.FilmSpecifications;
checkitem.DefectLength = item.DefectLength;
checkitem.DefectDepth = item.DefectDepth;
checkitem.DefectHeight = item.DefectHeight;
checkitem.ExtendingRice = item.ExtendingRice;
checkitem.Defects_Definition = item.Defects_Definition;
BLL.CheckItemManageService.AddCheckItem(checkitem);
BLL.CheckItemManageService.UpdateJointCheckFlag(checkitem.JOT_ID, "1");
}
#endregion
responeData.message = "修改成功";
}
else
{
responeData.message = "检测单信息不能为空!";
return responeData;
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 返修委托单新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveRepair([FromBody] Model.Customization._7HJ.TrustInfo trust)
{
{
var responeData = new Model.ResponeData();
try
{
var trustItems = trust.TrustItems;
if (trustItems.Count <= 0)
{
responeData.message = "委托单信息不能为空!";
return responeData;
}
string isoId = null;
//7表示无损委托单对应管线True表示只对应一条管线
var sysSet = BLL.Project_SysSetService.GetSysSetBySetId("7", trust.ProjectId);
if (sysSet != null && sysSet.IsAuto.HasValue && sysSet.IsAuto.Value)
{
var isoNum = (from x in trustItems select x.ISO_IsoNo).Distinct();
if (isoNum.Count() > 1)
{
responeData.message = "一个委托单只对应一条管线!";
return responeData;
}
else
{
isoId = BLL.PW_JointInfoService.GetJointInfoByJotID(trustItems.FirstOrDefault().JOT_ID)
.ISO_ID;
}
}
trust.CH_TrustType = "2";
trust.ToIso_Id = isoId;
trust.CH_TrustID = SQLHelper.GetNewID(typeof(Model.CH_Trust));
if (trust.CH_TrustID == null || trust.CH_TrustID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.SUBQHSEDB db = Funs.DB;
Model.CH_Trust newCH_Trust = new Model.CH_Trust();
newCH_Trust.CH_TrustID = trust.CH_TrustID;
newCH_Trust.CH_TrustCode = trust.CH_TrustCode;
newCH_Trust.CH_TrustUnit = trust.CH_TrustUnit;
newCH_Trust.CH_TrustDate = trust.CH_TrustDate;
newCH_Trust.CH_TrustType = trust.CH_TrustType;
newCH_Trust.CH_TrustMan = trust.CH_TrustMan;
newCH_Trust.CH_Tabler = trust.CH_Tabler;
newCH_Trust.CH_TableDate = trust.CH_TableDate;
newCH_Trust.CH_UnitName = trust.CH_UnitName;
newCH_Trust.CH_WorkNo = trust.CH_WorkNo;
newCH_Trust.CH_ItemName = trust.CH_ItemName;
newCH_Trust.CH_SlopeType = trust.CH_SlopeType;
newCH_Trust.CH_ServiceTemp = trust.CH_ServiceTemp;
newCH_Trust.CH_Press = trust.CH_Press;
newCH_Trust.CH_WeldMethod = trust.CH_WeldMethod;
newCH_Trust.CH_NDTRate = trust.CH_NDTRate;
newCH_Trust.CH_NDTMethod = trust.CH_NDTMethod;
newCH_Trust.CH_NDTCriteria = trust.CH_NDTCriteria;
newCH_Trust.CH_AcceptGrade = trust.CH_AcceptGrade;
newCH_Trust.CH_Remark = trust.CH_Remark;
newCH_Trust.CH_CheckUnit = trust.CH_CheckUnit;
newCH_Trust.ProjectId = trust.ProjectId;
newCH_Trust.InstallationId = trust.InstallationId;
newCH_Trust.CH_RequestDate = trust.CH_RequestDate;
newCH_Trust.ToIso_Id = trust.ToIso_Id;
db.CH_Trust.InsertOnSubmit(newCH_Trust);
db.SubmitChanges();
foreach (var item in trustItems)
{
Model.CH_TrustItem newitem = new Model.CH_TrustItem();
newitem.CH_TrustID = trust.CH_TrustID;
newitem.JOT_ID = item.JOT_ID;
newitem.CH_Remark = item.CH_Remark;
newitem.CH_RepairLocation = item.CH_RepairLocation;
BLL.TrustManageEditService.AddCH_TrustItem(newitem);
//更新焊口委托情况
BLL.TrustManageEditService.UpdateJOT_TrustFlag(item.JOT_ID, "1");
////更新焊口 是否扩透 切除口
var jotitem = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
foreach (var data in trustItems)
{
if (item.JOT_ID == data.JOT_ID)
{
if (data.JOT_JointStatus == "true")
{
jotitem.JOT_JointStatus = "104";
}
else
{
jotitem.JOT_JointStatus = "101";
}
}
else
{
jotitem.JOT_JointStatus = "102";
}
}
//更新焊口加R
BLL.PW_JointInfoService.UpdateJointPoint(jotitem);
//BLL.RepairService.UpdateNewJointNo(item.JOT_ID, "R");
var ndttype =
BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
if (ndttype.DetectionTypeCode == "RT")
{
BLL.CheckManageService.UpdateCheckIsRepair(item.JOT_ID, trust.CH_TrustID, true, "1");
}
else
{
BLL.CheckManageService.UpdateCheckIsRepair(item.JOT_ID, trust.CH_TrustID, true, "2");
}
}
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 返修委托单修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateRepair([FromBody] Model.Customization._7HJ.TrustInfo trust)
{
{
var responeData = new Model.ResponeData();
try
{
var trustItems = trust.TrustItems;
if (trustItems.Count <= 0)
{
responeData.message = "委托单信息不能为空!";
return responeData;
}
string isoId = null;
//7表示无损委托单对应管线True表示只对应一条管线
var sysSet = BLL.Project_SysSetService.GetSysSetBySetId("7", trust.ProjectId);
if (sysSet != null && sysSet.IsAuto.HasValue && sysSet.IsAuto.Value)
{
var isoNum = (from x in trustItems select x.ISO_IsoNo).Distinct();
if (isoNum.Count() > 1)
{
responeData.message = "一个委托单只对应一条管线!";
return responeData;
}
else
{
isoId = BLL.PW_JointInfoService.GetJointInfoByJotID(trustItems.FirstOrDefault().JOT_ID)
.ISO_ID;
}
}
trust.CH_TrustType = "2";
trust.ToIso_Id = isoId;
var updatetrust = BLL.TrustManageEditService.GetCH_TrustByID(trust.CH_TrustID);
if (updatetrust != null && updatetrust.CH_AuditDate.HasValue)
{
responeData.message = "此条委托单已审核不能修改!";
return responeData;
}
if (updatetrust != null && !string.IsNullOrEmpty(trust.CH_TrustID))
{
Model.SUBQHSEDB db = Funs.DB;
Model.CH_Trust newCH_Trust = db.CH_Trust.First(e => e.CH_TrustID == trust.CH_TrustID);
newCH_Trust.CH_TrustID = trust.CH_TrustID;
newCH_Trust.CH_TrustCode = trust.CH_TrustCode;
newCH_Trust.CH_TrustUnit = trust.CH_TrustUnit;
newCH_Trust.CH_TrustDate = trust.CH_TrustDate;
newCH_Trust.CH_TrustType = trust.CH_TrustType;
newCH_Trust.CH_TrustMan = trust.CH_TrustMan;
newCH_Trust.CH_Tabler = trust.CH_Tabler;
newCH_Trust.CH_TableDate = trust.CH_TableDate;
newCH_Trust.CH_UnitName = trust.CH_UnitName;
newCH_Trust.CH_WorkNo = trust.CH_WorkNo;
newCH_Trust.CH_ItemName = trust.CH_ItemName;
newCH_Trust.CH_SlopeType = trust.CH_SlopeType;
newCH_Trust.CH_ServiceTemp = trust.CH_ServiceTemp;
newCH_Trust.CH_Press = trust.CH_Press;
newCH_Trust.CH_WeldMethod = trust.CH_WeldMethod;
newCH_Trust.CH_NDTRate = trust.CH_NDTRate;
newCH_Trust.CH_NDTMethod = trust.CH_NDTMethod;
newCH_Trust.CH_NDTCriteria = trust.CH_NDTCriteria;
newCH_Trust.CH_AcceptGrade = trust.CH_AcceptGrade;
newCH_Trust.CH_Remark = trust.CH_Remark;
newCH_Trust.CH_CheckUnit = trust.CH_CheckUnit;
newCH_Trust.ProjectId = trust.ProjectId;
newCH_Trust.InstallationId = trust.InstallationId;
newCH_Trust.CH_RequestDate = trust.CH_RequestDate;
newCH_Trust.ToIso_Id = trust.ToIso_Id;
db.SubmitChanges();
BLL.TrustManageEditService.DeleteCH_TrustItemByCH_TrustID(trust.CH_TrustID);
if (trustItems.Count > 0)
{
foreach (var j in trustItems)
{
BLL.TrustManageEditService.UpdateJOT_TrustFlag(j.JOT_ID, "2");
}
}
}
foreach (var item in trustItems)
{
Model.CH_TrustItem newitem = new Model.CH_TrustItem();
newitem.CH_TrustID = trust.CH_TrustID;
newitem.JOT_ID = item.JOT_ID;
newitem.CH_Remark = item.CH_Remark;
newitem.CH_RepairLocation = item.CH_RepairLocation;
BLL.TrustManageEditService.AddCH_TrustItem(newitem);
//更新焊口委托情况
BLL.TrustManageEditService.UpdateJOT_TrustFlag(item.JOT_ID, "1");
////更新焊口 是否扩透 切除口
var jotitem = BLL.PW_JointInfoService.GetJointInfoByJotID(item.JOT_ID);
foreach (var data in trustItems)
{
if (item.JOT_ID == data.JOT_ID)
{
if (data.JOT_JointStatus == "true")
{
jotitem.JOT_JointStatus = "104";
}
else
{
jotitem.JOT_JointStatus = "101";
}
}
else
{
jotitem.JOT_JointStatus = "102";
}
}
//更新焊口加R
BLL.PW_JointInfoService.UpdateJointPoint(jotitem);
//BLL.RepairService.UpdateNewJointNo(item.JOT_ID, "R");
var ndttype =
BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
if (ndttype.DetectionTypeCode == "RT")
{
BLL.CheckManageService.UpdateCheckIsRepair(item.JOT_ID, trust.CH_TrustID, true, "1");
}
else
{
BLL.CheckManageService.UpdateCheckIsRepair(item.JOT_ID, trust.CH_TrustID, true, "2");
}
}
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region -
/// <summary>
/// 热处理报告数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveHotProessReport([FromBody] Model.Customization._7HJ.HotProessTrustInfo hotProessTrust)
{
{
var responeData = new Model.ResponeData();
try
{
hotProessTrust.HotProessTrustId = SQLHelper.GetNewID(typeof(Model.HJGL_HotProess_Trust));
if (hotProessTrust.HotProessTrustId == null || hotProessTrust.HotProessTrustId == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.SUBQHSEDB db = Funs.DB;
Model.HJGL_HotProess_Trust newHotProessTrust = new Model.HJGL_HotProess_Trust();
newHotProessTrust.HotProessTrustId = hotProessTrust.HotProessTrustId;
newHotProessTrust.HotProessTrustNo = hotProessTrust.HotProessTrustNo;
newHotProessTrust.ProessDate = hotProessTrust.ProessDate;
newHotProessTrust.ProjectId = hotProessTrust.ProjectId;
newHotProessTrust.UnitId = hotProessTrust.UnitId;
newHotProessTrust.InstallationId = hotProessTrust.InstallationId;
newHotProessTrust.WorkAreaId = hotProessTrust.WorkAreaId;
newHotProessTrust.Tabler = hotProessTrust.Tabler;
newHotProessTrust.Remark = hotProessTrust.Remark;
newHotProessTrust.ProessMethod = hotProessTrust.ProessMethod;
newHotProessTrust.ProessEquipment = hotProessTrust.ProessEquipment;
db.HJGL_HotProess_Trust.InsertOnSubmit(newHotProessTrust);
db.SubmitChanges();
var items = from x in Funs.DB.HJGL_HotProess_TrustItem select x;
foreach (var item in hotProessTrust.TrustItems)
{
var item1 = items.FirstOrDefault(x => x.HotProessTrustItemId == item.HotProessTrustItemId);
if (item1 == null)
{
item.HotProessTrustId = hotProessTrust.HotProessTrustId;
BLL.HotProessTrustItemService.AddHotProessTrustItem(item);
}
}
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 热处理报告数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateHotProessReport([FromBody] Model.Customization._7HJ.HotProessTrustInfo hotProessTrust)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
if (BLL.HotProess_TrustService.IsExistTrustCode(hotProessTrust.HotProessTrustNo, hotProessTrust.HotProessTrustId, hotProessTrust.ProjectId))
{
responeData.message = "委托单号已存在,请重新录入!";
return responeData;
}
Model.HJGL_HotProess_Trust newHotProessTrust = db.HJGL_HotProess_Trust.FirstOrDefault(e => e.HotProessTrustId == hotProessTrust.HotProessTrustId);
if (newHotProessTrust != null)
{
newHotProessTrust.HotProessTrustNo = hotProessTrust.HotProessTrustNo;
newHotProessTrust.ProessDate = hotProessTrust.ProessDate;
newHotProessTrust.ProjectId = hotProessTrust.ProjectId;
newHotProessTrust.UnitId = hotProessTrust.UnitId;
newHotProessTrust.Tabler = hotProessTrust.Tabler;
newHotProessTrust.Remark = hotProessTrust.Remark;
newHotProessTrust.ProessMethod = hotProessTrust.ProessMethod;
newHotProessTrust.ProessEquipment = hotProessTrust.ProessEquipment;
newHotProessTrust.ReportNo = hotProessTrust.ReportNo;
db.SubmitChanges();
}
var items = from x in Funs.DB.HJGL_HotProess_TrustItem select x;
foreach (var item in hotProessTrust.TrustItems)
{
var item1 = items.FirstOrDefault(x => x.HotProessTrustItemId == item.HotProessTrustItemId);
if (item1 == null)
{
item.HotProessTrustId = hotProessTrust.HotProessTrustId;
BLL.HotProessTrustItemService.AddHotProessTrustItem(item);
}
}
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 硬度检测报告数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveHardReport([FromBody] Model.Customization._7HJ.HardTrustInfo hardTrust)
{
{
var responeData = new Model.ResponeData();
try
{
if (BLL.Hard_TrustService.IsExistTrustCode(hardTrust.HardTrustNo,
!string.IsNullOrEmpty(hardTrust.HardTrustID) ? hardTrust.HardTrustID : "",
hardTrust.ProjectId))
{
responeData.message = "委托单号已存在,请重新录入!";
return responeData;
}
if (hardTrust.HardTrustDate == null || string.IsNullOrEmpty(hardTrust.HardTrustNo.Trim()))
{
responeData.message = "委托单号、委托日期不能为空";
return responeData;
}
// hardTrust.HardTrustID = SQLHelper.GetNewID(typeof(Model.HJGL_Hard_Trust));
if (hardTrust.HardTrustID == null || hardTrust.HardTrustID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.SUBQHSEDB db = Funs.DB;
Model.HJGL_Hard_Trust newHardTrust = new Model.HJGL_Hard_Trust();
newHardTrust.HardTrustID = hardTrust.HardTrustID;
newHardTrust.HardTrustNo = hardTrust.HardTrustNo;
newHardTrust.HardTrustUnit = hardTrust.HardTrustUnit;
newHardTrust.HardTrustDate = hardTrust.HardTrustDate;
newHardTrust.AuditMan = hardTrust.AuditMan;
newHardTrust.AuditDate = hardTrust.AuditDate;
newHardTrust.HardnessRate = hardTrust.HardnessRate;
newHardTrust.HardnessMethod = hardTrust.HardnessMethod;
newHardTrust.CheckUnit = hardTrust.CheckUnit;
newHardTrust.ProjectId = hardTrust.ProjectId;
newHardTrust.DetectionTime = hardTrust.DetectionTime;
newHardTrust.Sendee = hardTrust.Sendee;
newHardTrust.Standards = hardTrust.Standards;
newHardTrust.InspectionNum = hardTrust.InspectionNum;
newHardTrust.CheckNum = hardTrust.CheckNum;
newHardTrust.TestWeldNum = hardTrust.TestWeldNum;
newHardTrust.HardTrustMan = hardTrust.HardTrustMan;
newHardTrust.CheckName = hardTrust.CheckName;
newHardTrust.AcceptStandard = hardTrust.AcceptStandard;
newHardTrust.EquipmentModel = hardTrust.EquipmentModel;
newHardTrust.InstallationId = hardTrust.InstallationId;
newHardTrust.WorkAreaId = hardTrust.WorkAreaId;
db.HJGL_Hard_Trust.InsertOnSubmit(newHardTrust);
db.SubmitChanges();
var hardTrustItems = from x in Funs.DB.HJGL_Hard_TrustItem select x;
foreach (var item in hardTrust.GetHardTrustItem)
{
var oldHardTrustItem = hardTrustItems.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
if (oldHardTrustItem == null)
{
Model.HJGL_Hard_TrustItem trustItem = new Model.HJGL_Hard_TrustItem();
trustItem.HardTrustItemID = SQLHelper.GetNewID(typeof(Model.HJGL_Hard_TrustItem));
trustItem.HardTrustID = hardTrust.HardTrustID;
trustItem.HotProessTrustItemId = item.HotProessTrustItemId;
trustItem.WeldJointId = item.WeldJointId;
BLL.Hard_TrustItemService.AddHardTrustItem(trustItem);
}
//更新热处理委托明细的口已做硬度委托
Model.HJGL_HotProess_TrustItem hotProessTrustItem = BLL.HotProessTrustItemService.GetHotProessTrustItemById(item.HotProessTrustItemId);
if (hotProessTrustItem != null)
{
hotProessTrustItem.IsTrust = true;
BLL.HotProessTrustItemService.UpdateHotProessTrustItem(hotProessTrustItem);
}
}
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 硬度检测报告数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateHardReport([FromBody] Model.Customization._7HJ.HardTrustInfo hardTrust)
{
{
var responeData = new Model.ResponeData();
try
{
if (BLL.Hard_TrustService.IsExistTrustCode(hardTrust.HardTrustNo,
!string.IsNullOrEmpty(hardTrust.HardTrustID) ? hardTrust.HardTrustID : "",
hardTrust.ProjectId))
{
responeData.message = "委托单号已存在,请重新录入!";
return responeData;
}
if (hardTrust.HardTrustDate == null || string.IsNullOrEmpty(hardTrust.HardTrustNo.Trim()))
{
responeData.message = "委托单号、委托日期不能为空";
return responeData;
}
Model.SUBQHSEDB db = Funs.DB;
Model.HJGL_Hard_Trust newHardTrust = db.HJGL_Hard_Trust.FirstOrDefault(e => e.HardTrustID == hardTrust.HardTrustID);
if (newHardTrust != null)
{
newHardTrust.HardTrustNo = hardTrust.HardTrustNo;
newHardTrust.HardTrustUnit = hardTrust.HardTrustUnit;
newHardTrust.HardTrustDate = hardTrust.HardTrustDate;
newHardTrust.AuditMan = hardTrust.AuditMan;
newHardTrust.AuditDate = hardTrust.AuditDate;
newHardTrust.HardnessRate = hardTrust.HardnessRate;
newHardTrust.HardnessMethod = hardTrust.HardnessMethod;
newHardTrust.CheckUnit = hardTrust.CheckUnit;
newHardTrust.ProjectId = hardTrust.ProjectId;
newHardTrust.DetectionTime = hardTrust.DetectionTime;
newHardTrust.Sendee = hardTrust.Sendee;
newHardTrust.Standards = hardTrust.Standards;
newHardTrust.InspectionNum = hardTrust.InspectionNum;
newHardTrust.CheckNum = hardTrust.CheckNum;
newHardTrust.TestWeldNum = hardTrust.TestWeldNum;
newHardTrust.HardTrustMan = hardTrust.HardTrustMan;
newHardTrust.CheckName = hardTrust.CheckName;
newHardTrust.AcceptStandard = hardTrust.AcceptStandard;
newHardTrust.EquipmentModel = hardTrust.EquipmentModel;
db.SubmitChanges();
}
var hardTrustItems = from x in Funs.DB.HJGL_Hard_TrustItem select x;
foreach (var item in hardTrust.GetHardTrustItem)
{
var oldHardTrustItem = hardTrustItems.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
if (oldHardTrustItem == null)
{
Model.HJGL_Hard_TrustItem trustItem = new Model.HJGL_Hard_TrustItem();
trustItem.HardTrustItemID = SQLHelper.GetNewID(typeof(Model.HJGL_Hard_TrustItem));
trustItem.HardTrustID = hardTrust.HardTrustID;
trustItem.HotProessTrustItemId = item.HotProessTrustItemId;
trustItem.WeldJointId = item.WeldJointId;
BLL.Hard_TrustItemService.AddHardTrustItem(trustItem);
}
//更新热处理委托明细的口已做硬度委托
Model.HJGL_HotProess_TrustItem hotProessTrustItem = BLL.HotProessTrustItemService.GetHotProessTrustItemById(item.HotProessTrustItemId);
if (hotProessTrustItem != null)
{
hotProessTrustItem.IsTrust = true;
BLL.HotProessTrustItemService.UpdateHotProessTrustItem(hotProessTrustItem);
}
}
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region
/// <summary>
/// 试压包数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveTestPackage([FromBody] Model.Customization._7HJ.TestPackageInfo testPackage)
{
{
var responeData = new Model.ResponeData();
try
{
// testPackage.PTP_ID = SQLHelper.GetNewID(typeof(Model.TP_TestPackage));
if (testPackage.PTP_ID == null || testPackage.PTP_ID == "")
{
responeData.message = "主键id不能为空";
return responeData;
}
Model.TP_TestPackage newTestPackage = new Model.TP_TestPackage();
newTestPackage.PTP_ID = testPackage.PTP_ID;
newTestPackage.BSU_ID = testPackage.BSU_ID;
newTestPackage.PT_ID = testPackage.PT_ID;
newTestPackage.PTP_TestPackageNo = testPackage.PTP_TestPackageNo;
newTestPackage.PTP_TestPackageName = testPackage.PTP_TestPackageName;
newTestPackage.PTP_TestHeat = testPackage.PTP_TestHeat;
newTestPackage.PTP_TestService = testPackage.PTP_TestService;
newTestPackage.PTP_TestType = testPackage.PTP_TestType;
newTestPackage.PTP_Finisher = testPackage.PTP_Finisher;
newTestPackage.PTP_FinishDate = testPackage.PTP_FinishDate;
newTestPackage.PTP_Tabler = testPackage.PTP_Tabler;
newTestPackage.PTP_TableDate = testPackage.PTP_TableDate;
newTestPackage.PTP_Modifier = testPackage.PTP_Modifier;
newTestPackage.PTP_ModifyDate = testPackage.PTP_ModifyDate;
newTestPackage.PTP_Auditer = testPackage.PTP_Auditer;
newTestPackage.PTP_AduditDate = testPackage.PTP_AduditDate;
newTestPackage.PTP_Remark = testPackage.PTP_Remark;
newTestPackage.PTP_TestPackageCode = testPackage.PTP_TestPackageCode;
newTestPackage.PTP_TestAmbientTemp = testPackage.PTP_TestAmbientTemp;
newTestPackage.PTP_TestMediumTemp = testPackage.PTP_TestMediumTemp;
newTestPackage.PTP_TestPressure = testPackage.PTP_TestPressure;
newTestPackage.PTP_TestPressureTemp = testPackage.PTP_TestPressureTemp;
newTestPackage.PTP_TestPressureTime = testPackage.PTP_TestPressureTime;
newTestPackage.PTP_TightnessTest = testPackage.PTP_TightnessTest;
newTestPackage.PTP_TightnessTestTemp = testPackage.PTP_TightnessTestTemp;
newTestPackage.PTP_TightnessTestTime = testPackage.PTP_TightnessTestTime;
newTestPackage.PTP_LeakageTestService = testPackage.PTP_LeakageTestService;
newTestPackage.PTP_LeakageTestPressure = testPackage.PTP_LeakageTestPressure;
newTestPackage.PTP_VacuumTestService = testPackage.PTP_VacuumTestService;
newTestPackage.PTP_VacuumTestPressure = testPackage.PTP_VacuumTestPressure;
newTestPackage.PTP_OperationMedium = testPackage.PTP_OperationMedium;
newTestPackage.PTP_PurgingMedium = testPackage.PTP_PurgingMedium;
newTestPackage.PTP_CleaningMedium = testPackage.PTP_CleaningMedium;
newTestPackage.PTP_AllowSeepage = testPackage.PTP_AllowSeepage;
newTestPackage.PTP_FactSeepage = testPackage.PTP_FactSeepage;
newTestPackage.ProjectId = testPackage.ProjectId;
newTestPackage.InstallationId = testPackage.InstallationId;
Funs.DB.TP_TestPackage.InsertOnSubmit(newTestPackage);
Funs.DB.SubmitChanges();
var isoInfos = testPackage.IsoInfos;
var oldios = Funs.DB.TP_IsoList.Where(x => x.PTP_ID == testPackage.PTP_ID).ToList();
//添加新的
foreach (var item in isoInfos)
{
bool has = false;
foreach (var old in oldios)
{
if (old.ISO_ID == item.ISO_ID)
{
has = true;
break;
}
}
if (!has)
{
Model.TP_IsoList newitem = new Model.TP_IsoList();
newitem.PT_ID = SQLHelper.GetNewID(typeof(Model.TP_IsoList));
newitem.PTP_ID = testPackage.PTP_ID;
newitem.ISO_ID = item.ISO_ID;
Funs.DB.TP_IsoList.InsertOnSubmit(newitem);
}
}
foreach (var old in oldios)
{
bool has = false;
foreach (var newios in isoInfos)
{
if(old.ISO_ID== newios.ISO_ID)
{
has = true;
break;
}
if (!has)
{
Funs.DB.TP_IsoList.DeleteOnSubmit(old);
}
}
}
Funs.DB.SubmitChanges();
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 试压包数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateTestPackage([FromBody] Model.Customization._7HJ.TestPackageInfo testPackage)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var updatetestPackage = BLL.TestPackageManageEditService.GetTP_TestPackageByID(testPackage.PTP_ID);
if (updatetestPackage != null)
{
if (updatetestPackage.PTP_AduditDate.HasValue)
{
responeData.message = "此条试压单已审核不能修改!";
return responeData;
}
else
{
Model.TP_TestPackage newTestPackage =
Funs.DB.TP_TestPackage.FirstOrDefault(e => e.PTP_ID == testPackage.PTP_ID);
if (newTestPackage != null)
{
newTestPackage.BSU_ID = testPackage.BSU_ID;
newTestPackage.PT_ID = testPackage.PT_ID;
newTestPackage.PTP_TestPackageNo = testPackage.PTP_TestPackageNo;
newTestPackage.PTP_TestPackageName = testPackage.PTP_TestPackageName;
newTestPackage.PTP_TestHeat = testPackage.PTP_TestHeat;
newTestPackage.PTP_TestService = testPackage.PTP_TestService;
newTestPackage.PTP_TestType = testPackage.PTP_TestType;
newTestPackage.PTP_Finisher = testPackage.PTP_Finisher;
newTestPackage.PTP_FinishDate = testPackage.PTP_FinishDate;
newTestPackage.PTP_Tabler = testPackage.PTP_Tabler;
newTestPackage.PTP_TableDate = testPackage.PTP_TableDate;
newTestPackage.PTP_Modifier = testPackage.PTP_Modifier;
newTestPackage.PTP_ModifyDate = testPackage.PTP_ModifyDate;
newTestPackage.PTP_Auditer = testPackage.PTP_Auditer;
newTestPackage.PTP_AduditDate = testPackage.PTP_AduditDate;
newTestPackage.PTP_Remark = testPackage.PTP_Remark;
newTestPackage.PTP_TestPackageCode = testPackage.PTP_TestPackageCode;
newTestPackage.PTP_TestAmbientTemp = testPackage.PTP_TestAmbientTemp;
newTestPackage.PTP_TestMediumTemp = testPackage.PTP_TestMediumTemp;
newTestPackage.PTP_TestPressure = testPackage.PTP_TestPressure;
newTestPackage.PTP_TestPressureTemp = testPackage.PTP_TestPressureTemp;
newTestPackage.PTP_TestPressureTime = testPackage.PTP_TestPressureTime;
newTestPackage.PTP_TightnessTest = testPackage.PTP_TightnessTest;
newTestPackage.PTP_TightnessTestTemp = testPackage.PTP_TightnessTestTemp;
newTestPackage.PTP_TightnessTestTime = testPackage.PTP_TightnessTestTime;
newTestPackage.PTP_LeakageTestService = testPackage.PTP_LeakageTestService;
newTestPackage.PTP_LeakageTestPressure = testPackage.PTP_LeakageTestPressure;
newTestPackage.PTP_VacuumTestService = testPackage.PTP_VacuumTestService;
newTestPackage.PTP_VacuumTestPressure = testPackage.PTP_VacuumTestPressure;
newTestPackage.PTP_OperationMedium = testPackage.PTP_OperationMedium;
newTestPackage.PTP_PurgingMedium = testPackage.PTP_PurgingMedium;
newTestPackage.PTP_CleaningMedium = testPackage.PTP_CleaningMedium;
newTestPackage.PTP_AllowSeepage = testPackage.PTP_AllowSeepage;
newTestPackage.PTP_FactSeepage = testPackage.PTP_FactSeepage;
newTestPackage.ProjectId = testPackage.ProjectId;
newTestPackage.InstallationId = testPackage.InstallationId;
Funs.DB.SubmitChanges();
}
var isoInfos = testPackage.IsoInfos;
var oldios = Funs.DB.TP_IsoList.Where(x => x.PTP_ID == testPackage.PTP_ID).ToList();
//添加新的
foreach (var item in isoInfos)
{
bool has = false;
foreach (var old in oldios)
{
if (old.ISO_ID == item.ISO_ID)
{
has = true;
break;
}
}
if (!has)
{
Model.TP_IsoList newitem = new Model.TP_IsoList();
newitem.PT_ID = SQLHelper.GetNewID(typeof(Model.TP_IsoList));
newitem.PTP_ID = testPackage.PTP_ID;
newitem.ISO_ID = item.ISO_ID;
Funs.DB.TP_IsoList.InsertOnSubmit(newitem);
}
}
foreach (var old in oldios)
{
bool has = false;
foreach (var newios in isoInfos)
{
if(old.ISO_ID== newios.ISO_ID)
{
has = true;
break;
}
if (!has)
{
Funs.DB.TP_IsoList.DeleteOnSubmit(old);
}
}
}
Funs.DB.SubmitChanges();
responeData.message = "修改成功";
}
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// A项尾工录入数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveAItemEndCheck([FromBody] Model.TP_AItemEndCheck aItemEndCheck)
{
{
var responeData = new Model.ResponeData();
try
{
if ( aItemEndCheck.EIC_ID == null || aItemEndCheck.EIC_ID == "" )
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.AItemEndCheckService.AddTP_AItemEndCheck(aItemEndCheck);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// A项尾工录入数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateAItemEndCheck([FromBody] Model.TP_AItemEndCheck aItemEndCheck)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
BLL.AItemEndCheckService.UpdateTP_AItemEndCheck(aItemEndCheck);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// A项尾工录入数据新增
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SaveBItemEndCheck([FromBody] Model.TP_BItemEndCheck bItemEndCheck)
{
{
var responeData = new Model.ResponeData();
try
{
if ( bItemEndCheck.EIC_ID == null || bItemEndCheck.EIC_ID == "" )
{
responeData.message = "主键id不能为空";
return responeData;
}
BLL.BItemEndCheckService.AddTP_BItemEndCheck(bItemEndCheck);
responeData.message = "保存成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// A项尾工录入数据修改
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData UpdateBItemEndCheck([FromBody] Model.TP_BItemEndCheck bItemEndCheck)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
BLL.BItemEndCheckService.UpdateTP_BItemEndCheck(bItemEndCheck);
responeData.message = "修改成功";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
#region
/// <summary>
/// 单位下拉
/// </summary>
/// <returns></returns>
public Model.ResponeData getUnitDropDownList(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var units = (from x in db.Base_Unit
orderby x.UnitCode
select new
{
x.UnitId,
x.UnitName,
x.UnitCode
}).ToList();
if (!string.IsNullOrEmpty(projectId))
{
units = (from x in units
join y in db.Project_ProjectUnit on x.UnitId equals y.UnitId
where y.ProjectId == projectId
select new
{
x.UnitId,
x.UnitName,
x.UnitCode
}).ToList();
}
var getLists = units.OrderBy(x => x.UnitCode).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 班组下拉
/// </summary>
/// <returns></returns>
public Model.ResponeData getTeamGroupDropDownList(string projectId,string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.ProjectData_TeamGroup
where x.ProjectId == projectId && x.UnitId == unitId
orderby x.TeamGroupCode
select new
{
x.TeamGroupId,
x.TeamGroupName,
x.TeamGroupCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接方法下拉
/// </summary>
/// <returns></returns>
public Model.ResponeData getWeldingMethodDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_WeldingMethod
orderby x.WeldingMethodCode
select new
{
x.WeldingMethodId,
x.WeldingMethodName,
x.WeldingMethodCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 材质下拉
/// </summary>
/// <returns></returns>
public Model.ResponeData getMaterialDropDownList(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_Material
join y in Funs.DB.Project_Material on x.MaterialId equals y.MaterialId
into cc
from c in cc
where c.ProjectId == projectId
orderby x.MaterialCode
select new
{
x.MaterialId,
x.MaterialCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 介质下拉
/// </summary>
/// <returns></returns>
public Model.ResponeData getMediumDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_TestMedium
orderby x.MediumCode
select new
{
x.TestMediumId,
x.MediumName,
x.MediumCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 探伤比例
/// </summary>
/// <returns></returns>
public Model.ResponeData getDetectionRateDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = (from x in Funs.DB.Base_DetectionRate orderby x.DetectionRateCode select x).ToList();
ListItem[] getLists = new ListItem[q.Count()];
for (int i = 0; i < q.Count(); i++)
{
getLists[i] = new ListItem(q[i].DetectionRateCode + "-" + q[i].DetectionRate.ToString() + "%", q[i].DetectionRateId.ToString());
}
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 探伤类型
/// </summary>
/// <returns></returns>
public Model.ResponeData getDetectionTypeDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_DetectionType
orderby x.DetectionTypeCode
select new
{
x.DetectionTypeId,
x.DetectionTypeName,
x.DetectionTypeCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 管道等级
/// </summary>
/// <returns></returns>
public Model.ResponeData getPipingClassDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_PipingClass
orderby x.PipingClassCode
select new
{
x.PipingClassId,
x.PipingClassName,
x.PipingClassCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 委托情况
/// </summary>
/// <returns></returns>
public Model.ResponeData getTrustFlagDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = BLL.DropListService.HJGL_TrustFlag();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 探伤情况
/// </summary>
/// <returns></returns>
public Model.ResponeData getCheckFlagDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = BLL.DropListService.HJGL_CheckFlag();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 组件下拉数据
/// </summary>
/// <returns></returns>
public Model.ResponeData getComponentsDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_Components
orderby x.ComponentsCode
select new
{
x.ComponentsId,
x.ComponentsName,
x.ComponentsCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊缝下拉数据
/// </summary>
/// <returns></returns>
public Model.ResponeData getWeldTypeDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists =(from x in Funs.DB.Base_WeldType
orderby x.WeldTypeCode
select new
{
x.WeldTypeId,
x.WeldTypeName,
x.WeldTypeCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 坡口类型下拉数据
/// </summary>
/// <returns></returns>
public Model.ResponeData getGrooveTypeDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists =(from x in Funs.DB.Base_GrooveType
orderby x.GrooveTypeCode
select new
{
x.GrooveTypeId,
x.GrooveTypeName,
x.GrooveTypeCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 温度下拉数据 1.预热温度 2.层间温度
/// </summary>
/// <returns></returns>
public Model.ResponeData getTemperatureDropDownList(string temperatureType)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists =(from x in Funs.DB.Base_TemperatureSet
where x.TemperatureType == temperatureType orderby x.Temperature
select new
{
x.Temperature,
x.TemperatureType,
x.TemperatureSetId
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接耗材下拉项 1.焊丝 2.焊条
/// </summary>
/// <returns></returns>
public Model.ResponeData getConsumablesDropDownList(string consumablesType)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in Funs.DB.Base_Consumables
orderby x.ConsumablesName
select new
{
x.ConsumablesId,
x.ConsumablesName,
x.ConsumablesType
}).ToList();
if (!string.IsNullOrEmpty(consumablesType))
{
getLists = getLists.Where(x => x.ConsumablesType == consumablesType).ToList();
}
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊口状态
/// </summary>
/// <returns></returns>
public Model.ResponeData getJointStatusDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = BLL.DropListService.HJGL_JointStatus();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 装置下拉数据
/// </summary>
/// <returns></returns>
public Model.ResponeData getInstallationDropDownList(string projectId,string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var q = (from x in BLL.Funs.DB.Project_Installation
join y in BLL.Funs.DB.ProjectData_WorkArea on x.InstallationId equals y.InstallationId
where x.ProjectId == projectId && y.UnitId == unitId
orderby x.InstallationId
select x).Distinct().ToList();
ListItem[] getLists = new ListItem[q.Count()];
for (int i = 0; i < q.Count(); i++)
{
getLists[i] = new ListItem(q[i].InstallationName ?? "", q[i].InstallationId.ToString());
}
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 获取项目焊工信息
/// </summary>
/// <returns></returns>
public Model.ResponeData getWelderCodeDropDownList(string projectId,string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = BLL.WelderService.GetWelderCodeListByProjectIdAndUnitId(projectId, unitId);
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 焊接位置
/// </summary>
/// <returns></returns>
public Model.ResponeData getLocationDropDownList()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = BLL.DropListService.HJGL_JOT_LocationItem();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 获取在岗用户下拉选项
/// </summary>
/// <returns></returns>
public Model.ResponeData getProjectUserDropDownList(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var users = (from x in db.Sys_User
where x.IsPost == true && x.UserId != Const.hfnbdId && x.UserId != Const.sedinId
orderby x.UserName
select new
{
x.UserId,
x.UserName
}).ToList();
if (!string.IsNullOrEmpty(projectId))
{
users = (from x in users
join y in db.Project_ProjectUser on x.UserId equals y.UserId
where y.ProjectId == projectId
orderby x.UserName
select new
{
x.UserId,
x.UserName
}).ToList();
}
responeData.data = new { users };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 检测单位
/// </summary>
/// <returns></returns>
public Model.ResponeData getContractualUnitDropDownList(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
var getLists = (from x in db.Base_Unit
join y in db.Project_ProjectUnit
on x.UnitId equals y.UnitId
where y.ProjectId == projectId && (y.UnitType == BLL.Const.ProjectUnitType_5 || string.IsNullOrEmpty(BLL.Const.ProjectUnitType_5))
orderby x.UnitCode
select new
{
x.UnitId,
x.UnitName,
x.UnitCode
}).ToList();
responeData.data = new { getLists };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
/// <summary>
/// 检测人
/// </summary>
/// <returns></returns>
public Model.ResponeData getContractualUserDropDownList(string projectId,string unitId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
object list;
if (!string.IsNullOrEmpty(projectId))
{
if (!string.IsNullOrEmpty(unitId))
{
list = (from x in db.Sys_User
join y in db.Project_ProjectUser
on x.UserId equals y.UserId
where y.ProjectId == projectId && x.UnitId == unitId
orderby x.UserName
select new
{
x.UserId,
x.UserName
}).ToList();
}
else
{
list = (from x in db.Sys_User
join y in db.Project_ProjectUser
on x.UserId equals y.UserId
where y.ProjectId == projectId
orderby x.UserName
select new
{
x.UserId,
x.UserName
}).ToList();
}
}
else
{
list = (from x in db.Sys_User
where x.UnitId == unitId
orderby x.UserName
select new
{
x.UserId,
x.UserName
}).ToList();
}
responeData.data = new { list };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
// /// <summary>
// /// 获取探伤类型信息
// /// </summary>
// /// <returns></returns>
// public Model.ResponeData getDetectionTypeDropDownList()
// {
// using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
// {
// var responeData = new Model.ResponeData();
// try
// {
// var getLists = (from x in db.Base_DetectionType
// select new
// {
// x.DetectionTypeId,
// x.DetectionTypeName,
// x.DetectionTypeCode
// }).ToList();
// responeData.data = new { getLists };
// }
// catch (Exception ex)
// {
// responeData.code = 0;
// responeData.message = ex.Message;
// }
//
// return responeData;
// }
// }
#endregion
}
}