using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace BLL { public class HJGL_BO_BatchDetailService { /// /// 根据批明细ID获取批明细信息 /// /// /// public static Model.HJGL_BO_BatchDetail GetBatchDetailById(string batchDetailId) { return Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.BatchDetailId == batchDetailId); } /// /// 根据批焊口ID获取批明细信息 /// /// /// public static Model.HJGL_BO_BatchDetail GetBatchDetailByJotId(string jotId) { return Funs.DB.HJGL_BO_BatchDetail.FirstOrDefault(e => e.JOT_ID == jotId); } public static List GetBatchDetailByBatchId(string batchId) { return Funs.DB.HJGL_BO_BatchDetail.Where(e => e.BatchId == batchId).ToList(); } public static List 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(); } /// /// 根据组批ID获取所有相关明细视图信息 /// /// /// public static List GetViewBatchDetailByBatchId(string batchId) { return Funs.DB.HJGL_View_BatchDetail.Where(e => e.BatchId == batchId).ToList(); } /// /// 根据组批ID获取所有明细焊口属性为固定口的视图信息 /// /// /// public static List GetViewBatchDetailByBatchIdAndJointAttribute(string batchId) { return Funs.DB.HJGL_View_BatchDetail.Where(e => e.BatchId == batchId && e.JOT_JointAttribute == "固定").ToList(); } /// /// 修改 /// /// 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(); } } /// /// 根据批焊口ID删除批明细信息 /// /// 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(); } } /// /// 增加 /// /// 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(); } /// /// 根据主键删除明细 /// /// 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(); } } } }