162 lines
6.6 KiB
C#
162 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
|
|
namespace BLL
|
|
{
|
|
public class HJGL_BO_BatchDetailService
|
|
{
|
|
/// <summary>
|
|
/// 根据批明细ID获取批明细信息
|
|
/// </summary>
|
|
/// <param name="batchId"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BO_BatchDetail GetBatchDetailById(string batchDetailId)
|
|
{
|
|
return Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.BatchDetailId == batchDetailId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据批焊口ID获取批明细信息
|
|
/// </summary>
|
|
/// <param name="jotId"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BO_BatchDetail GetBatchDetailByJotId(string jotId)
|
|
{
|
|
return Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.JOT_ID == jotId);
|
|
}
|
|
|
|
public static List<Model.HJGL_BO_BatchDetail> GetBatchDetailByBatchId(string batchId)
|
|
{
|
|
return Funs.DB.HJGL_BO_BatchDetail.Where(e => e.BatchId == batchId).ToList();
|
|
}
|
|
|
|
public static List<Model.HJGL_BO_BatchDetail> GetGBatchDetailByBatchId(string batchId)
|
|
{
|
|
return (from x in Funs.DB.HJGL_BO_BatchDetail
|
|
join y in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals y.JOT_ID
|
|
where y.JOT_JointNo.Contains("G") && x.BatchId == batchId
|
|
select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据组批ID获取所有相关明细视图信息
|
|
/// </summary>
|
|
/// <param name="batchId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_BatchDetail> GetViewBatchDetailByBatchId(string batchId)
|
|
{
|
|
return Funs.DB.HJGL_View_BatchDetail.Where(e => e.BatchId == batchId).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据组批ID获取所有明细焊口属性为固定口的视图信息
|
|
/// </summary>
|
|
/// <param name="batchId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_View_BatchDetail> GetViewBatchDetailByBatchIdAndJointAttribute(string batchId)
|
|
{
|
|
return Funs.DB.HJGL_View_BatchDetail.Where(e => e.BatchId == batchId && e.JOT_JointAttribute == "固定").ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="batchDetail"></param>
|
|
public static void UpdateBatchDetail(Model.HJGL_BO_BatchDetail batchDetail)
|
|
{
|
|
Model.HJGL_BO_BatchDetail newBatchDetail = Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.BatchDetailId == batchDetail.BatchDetailId);
|
|
if (newBatchDetail != null)
|
|
{
|
|
newBatchDetail.BatchId = batchDetail.BatchId;
|
|
newBatchDetail.ISO_ID = batchDetail.ISO_ID;
|
|
newBatchDetail.JOT_ID = batchDetail.JOT_ID;
|
|
newBatchDetail.NDT = batchDetail.NDT;
|
|
newBatchDetail.PointType = batchDetail.PointType;
|
|
newBatchDetail.PointDate = batchDetail.PointDate;
|
|
newBatchDetail.ConfirmDate = batchDetail.ConfirmDate;
|
|
newBatchDetail.CheckAddress = batchDetail.CheckAddress;
|
|
newBatchDetail.IsVI = batchDetail.IsVI;
|
|
newBatchDetail.VICheckDate = batchDetail.VICheckDate;
|
|
newBatchDetail.Checker = batchDetail.Checker;
|
|
newBatchDetail.ReportFeedback = batchDetail.ReportFeedback;
|
|
newBatchDetail.ToRepairId = batchDetail.ToRepairId;
|
|
newBatchDetail.Remark = batchDetail.Remark;
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
public static void UpdatePartBatchDetail(Model.HJGL_BO_BatchDetail batchDetail)
|
|
{
|
|
Model.HJGL_BO_BatchDetail newBatchDetail = Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.BatchDetailId == batchDetail.BatchDetailId);
|
|
if (newBatchDetail != null)
|
|
{
|
|
newBatchDetail.NDT = batchDetail.NDT;
|
|
newBatchDetail.PointType = batchDetail.PointType;
|
|
newBatchDetail.PointDate = batchDetail.PointDate;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据批焊口ID删除批明细信息
|
|
/// </summary>
|
|
/// <param name="checkId"></param>
|
|
public static void DeleteBatchDetail(string jotId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BO_BatchDetail batch = db.HJGL_BO_BatchDetail.FirstOrDefault(e => e.JOT_ID == jotId);
|
|
if (batch != null)
|
|
{
|
|
db.HJGL_BO_BatchDetail.DeleteOnSubmit(batch);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="batchDetail"></param>
|
|
public static void AddBatchDetail(Model.HJGL_BO_BatchDetail batchDetail)
|
|
{
|
|
Model.HJGL_BO_BatchDetail newBatchDetail = new Model.HJGL_BO_BatchDetail();
|
|
newBatchDetail.BatchDetailId = batchDetail.BatchDetailId;
|
|
newBatchDetail.BatchId = batchDetail.BatchId;
|
|
newBatchDetail.ISO_ID = batchDetail.ISO_ID;
|
|
newBatchDetail.JOT_ID = batchDetail.JOT_ID;
|
|
newBatchDetail.NDT = batchDetail.NDT;
|
|
newBatchDetail.PointType = batchDetail.PointType;
|
|
newBatchDetail.PointDate = batchDetail.PointDate;
|
|
newBatchDetail.ConfirmDate = batchDetail.ConfirmDate;
|
|
newBatchDetail.CheckAddress = batchDetail.CheckAddress;
|
|
newBatchDetail.IsVI = batchDetail.IsVI;
|
|
newBatchDetail.Checker = batchDetail.Checker;
|
|
newBatchDetail.Remark = batchDetail.Remark;
|
|
newBatchDetail.ToRepairId = batchDetail.ToRepairId;
|
|
newBatchDetail.VICheckDate = batchDetail.VICheckDate;
|
|
newBatchDetail.ReportFeedback = batchDetail.ReportFeedback;
|
|
Funs.DB.HJGL_BO_BatchDetail.InsertOnSubmit(newBatchDetail);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除明细
|
|
/// </summary>
|
|
/// <param name="batchDetailId"></param>
|
|
public static void DeleteBatchDetailById(string batchDetailId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BO_BatchDetail batch = db.HJGL_BO_BatchDetail.FirstOrDefault(e => e.BatchDetailId == batchDetailId);
|
|
if (batch != null)
|
|
{
|
|
db.HJGL_BO_BatchDetail.DeleteOnSubmit(batch);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|