123 lines
4.8 KiB
C#
123 lines
4.8 KiB
C#
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
|
|||
|
|
namespace BLL
|
|||
|
|
{
|
|||
|
|
public class CQMS_InspectionService
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取报验信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="UnitWorkId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static Model.Material_Inspection GetInspectionByInspectionId(string InspectionId)
|
|||
|
|
{
|
|||
|
|
return Funs.DB.Material_Inspection.FirstOrDefault(e => e.InspectionId == InspectionId);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加报验信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="WPQ"></param>
|
|||
|
|
public static void AddInspection(Model.Material_Inspection Inspection)
|
|||
|
|
{
|
|||
|
|
Model.SGGLDB db = Funs.DB;
|
|||
|
|
Model.Material_Inspection newInspection = new Model.Material_Inspection();
|
|||
|
|
newInspection.InspectionId = Inspection.InspectionId;
|
|||
|
|
newInspection.ProjectId = Inspection.ProjectId;
|
|||
|
|
newInspection.InspectionType = Inspection.InspectionType;
|
|||
|
|
newInspection.InspectionCode = Inspection.InspectionCode;
|
|||
|
|
newInspection.UnitId = Inspection.UnitId;
|
|||
|
|
newInspection.IsSpotCheck = Inspection.IsSpotCheck;
|
|||
|
|
newInspection.IsNoticeAndSupervision = Inspection.IsNoticeAndSupervision;
|
|||
|
|
newInspection.State = Inspection.State;
|
|||
|
|
newInspection.CompileMan = Inspection.CompileMan;
|
|||
|
|
newInspection.CompileDate = Inspection.CompileDate;
|
|||
|
|
db.Material_Inspection.InsertOnSubmit(newInspection);
|
|||
|
|
db.SubmitChanges();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 修改报验信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="WPQ"></param>
|
|||
|
|
public static void UpdateInspection(Model.Material_Inspection Inspection)
|
|||
|
|
{
|
|||
|
|
Model.SGGLDB db = Funs.DB;
|
|||
|
|
Model.Material_Inspection newInspection = db.Material_Inspection.FirstOrDefault(e => e.InspectionId == Inspection.InspectionId);
|
|||
|
|
if (newInspection != null)
|
|||
|
|
{
|
|||
|
|
newInspection.InspectionCode = Inspection.InspectionCode;
|
|||
|
|
newInspection.UnitId = Inspection.UnitId;
|
|||
|
|
newInspection.IsSpotCheck = Inspection.IsSpotCheck;
|
|||
|
|
newInspection.IsNoticeAndSupervision = Inspection.IsNoticeAndSupervision;
|
|||
|
|
newInspection.State = Inspection.State;
|
|||
|
|
db.SubmitChanges();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据主键删除报验信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="checkerId"></param>
|
|||
|
|
public static void DeleteInspectionById(string InspectionId)
|
|||
|
|
{
|
|||
|
|
Model.SGGLDB db = Funs.DB;
|
|||
|
|
Model.Material_Inspection Inspection = db.Material_Inspection.FirstOrDefault(e => e.InspectionId == InspectionId);
|
|||
|
|
if (Inspection != null)
|
|||
|
|
{
|
|||
|
|
db.Material_Inspection.DeleteOnSubmit(Inspection);
|
|||
|
|
db.SubmitChanges();
|
|||
|
|
}
|
|||
|
|
if (Inspection.InspectionType == "M")
|
|||
|
|
{
|
|||
|
|
var ms = from x in db.Material_Material where x.InspectionId == InspectionId select x;
|
|||
|
|
foreach (var item in ms)
|
|||
|
|
{
|
|||
|
|
item.InspectionId = null;
|
|||
|
|
db.SubmitChanges();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
var es = from x in db.Material_Equipment where x.InspectionId == InspectionId select x;
|
|||
|
|
foreach (var item in es)
|
|||
|
|
{
|
|||
|
|
item.InspectionId = null;
|
|||
|
|
db.SubmitChanges();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据状态选择下一步办理类型
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="state"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static ListItem[] GetDHandleTypeByState(string state)
|
|||
|
|
{
|
|||
|
|
if (state == Const.Inspection_Compile || state == Const.Inspection_ReCompile)
|
|||
|
|
{
|
|||
|
|
ListItem[] lis = new ListItem[1];
|
|||
|
|
lis[0] = new ListItem("总包专业工程师审核", Const.Inspection_Audit1);
|
|||
|
|
return lis;
|
|||
|
|
}
|
|||
|
|
else if (state == Const.Inspection_Audit1)
|
|||
|
|
{
|
|||
|
|
ListItem[] lis = new ListItem[2];
|
|||
|
|
lis[0] = new ListItem("监理工程师审批", Const.Inspection_Audit2);
|
|||
|
|
lis[1] = new ListItem("重新编制", Const.Inspection_ReCompile);
|
|||
|
|
return lis;
|
|||
|
|
}
|
|||
|
|
else if (state == Const.Inspection_Audit2)
|
|||
|
|
{
|
|||
|
|
ListItem[] lis = new ListItem[2];
|
|||
|
|
lis[0] = new ListItem("审批完成", Const.Inspection_Complete);
|
|||
|
|
lis[1] = new ListItem("重新编制", Const.Inspection_ReCompile);
|
|||
|
|
return lis;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|