2024-01-25 15:21:19 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace BLL
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 开车方案计划明细表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class DriverPrepareSchemePlanItemService
|
|
|
|
|
{
|
|
|
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据主键获取开车方案计划明细信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SchemePlanItemId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static Model.DriverPrepare_SchemePlanItem GetSchemePlanItemById(string SchemePlanItemId)
|
|
|
|
|
{
|
|
|
|
|
return Funs.DB.DriverPrepare_SchemePlanItem.FirstOrDefault(e => e.SchemePlanItemId == SchemePlanItemId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据开车方案计划ID获取所有相关明细信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="schemePlanId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<Model.DriverPrepare_SchemePlanItem> GetSchemePlanItemByschemePlanId(string schemePlanId)
|
|
|
|
|
{
|
2024-01-25 16:16:18 +08:00
|
|
|
|
return (from x in Funs.DB.DriverPrepare_SchemePlanItem where x.SchemePlanId == schemePlanId orderby x.SolutionType, x.SortIndex select x).ToList();
|
2024-01-25 15:21:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据开车方案计划ID获取所有相关明细信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="schemePlanId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static List<Model.DriverPrepare_SchemePlanItem> GetModelList()
|
|
|
|
|
{
|
|
|
|
|
return (from x in Funs.DB.DriverPrepare_SchemePlanItem where x.SchemePlanId == "公用工程" || x.SchemePlanId == "空分" || x.SchemePlanId == "气化" || x.SchemePlanId == "净化" || x.SchemePlanId == "合成" || x.SchemePlanId == "尿素" || x.SchemePlanId == "磷酸项目" || x.SchemePlanId == "LNG项目" select x).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加开车方案计划明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SchemePlanItem"></param>
|
|
|
|
|
public static void AddSchemePlanItem(Model.DriverPrepare_SchemePlanItem SchemePlanItem)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.DriverPrepare_SchemePlanItem newEquipmentItem = new Model.DriverPrepare_SchemePlanItem
|
|
|
|
|
{
|
|
|
|
|
SchemePlanItemId = SchemePlanItem.SchemePlanItemId,
|
|
|
|
|
SchemePlanId = SchemePlanItem.SchemePlanId,
|
|
|
|
|
SolutionName = SchemePlanItem.SolutionName,
|
|
|
|
|
SortIndex = SchemePlanItem.SortIndex,
|
|
|
|
|
SolutionType = SchemePlanItem.SolutionType,
|
|
|
|
|
};
|
|
|
|
|
db.DriverPrepare_SchemePlanItem.InsertOnSubmit(newEquipmentItem);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改开车方案计划明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SchemePlanItem"></param>
|
|
|
|
|
public static void UpdateSchemePlanItem(Model.DriverPrepare_SchemePlanItem SchemePlanItem)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.DriverPrepare_SchemePlanItem newSchemePlanItem = db.DriverPrepare_SchemePlanItem.FirstOrDefault(e => e.SchemePlanItemId == SchemePlanItem.SchemePlanItemId);
|
|
|
|
|
if (newSchemePlanItem != null)
|
|
|
|
|
{
|
|
|
|
|
newSchemePlanItem.SchemePlanId = SchemePlanItem.SchemePlanId;
|
|
|
|
|
newSchemePlanItem.SolutionName = SchemePlanItem.SolutionName;
|
|
|
|
|
newSchemePlanItem.SortIndex = SchemePlanItem.SortIndex;
|
|
|
|
|
newSchemePlanItem.SolutionType = SchemePlanItem.SolutionType;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据主键删除开车方案计划明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SchemePlanItemId"></param>
|
|
|
|
|
public static void DeleteSchemePlanItemById(string SchemePlanItemId)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.DriverPrepare_SchemePlanItem SchemePlanItem = db.DriverPrepare_SchemePlanItem.FirstOrDefault(e => e.SchemePlanItemId == SchemePlanItemId);
|
|
|
|
|
if (SchemePlanItem != null)
|
|
|
|
|
{
|
|
|
|
|
db.DriverPrepare_SchemePlanItem.DeleteOnSubmit(SchemePlanItem);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据开车方案计划ID删除所有相关明细信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="schemePlanId"></param>
|
|
|
|
|
public static void DeleteSchemePlanItemByschemePlanId(string schemePlanId)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
var q = (from x in Funs.DB.DriverPrepare_SchemePlanItem where x.SchemePlanId == schemePlanId select x).ToList();
|
|
|
|
|
if (q != null)
|
|
|
|
|
{
|
|
|
|
|
db.DriverPrepare_SchemePlanItem.DeleteAllOnSubmit(q);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否存在方案名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="postName"></param>
|
|
|
|
|
/// <returns>true-存在,false-不存在</returns>
|
|
|
|
|
public static bool IsExistSolutionName(string projectId, string solutionName, string schemePlanItemId)
|
|
|
|
|
{
|
|
|
|
|
var q = from x in Funs.DB.DriverPrepare_SchemePlanItem
|
|
|
|
|
join y in Funs.DB.DriverPrepare_SchemePlan on x.SchemePlanId equals y.SchemePlanId
|
|
|
|
|
where y.ProjectId == projectId && x.SolutionName == solutionName && (x.SchemePlanItemId != schemePlanItemId || schemePlanItemId == null)
|
|
|
|
|
select x;
|
|
|
|
|
if (q.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|