137 lines
5.0 KiB
C#
137 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
|
|
public static class HJGL_ConsumablesService
|
|
{
|
|
/// <summary>
|
|
/// 根据焊接耗材ID获取区域信息
|
|
/// </summary>
|
|
/// <param name="ConsumablesName"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_WeldMaterial getConsumablesByConsumablesId(string ConsumablesId)
|
|
{
|
|
return Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == ConsumablesId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊接耗材Code获取区域信息
|
|
/// </summary>
|
|
/// <param name="ConsumablesName"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistConsumablesCode(string consumablesCode, string consumablesId)
|
|
{
|
|
var q = Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(x => x.WMT_MatCode == consumablesCode && x.WMT_ID != consumablesId);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加焊接耗材
|
|
/// </summary>
|
|
/// <param name="Consumables"></param>
|
|
public static void AddConsumables(Model.HJGL_BS_WeldMaterial Consumables)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_WeldMaterial));
|
|
Model.HJGL_BS_WeldMaterial newConsumables = new Model.HJGL_BS_WeldMaterial();
|
|
newConsumables.WMT_ID = newKeyID;
|
|
newConsumables.WMT_MatCode = Consumables.WMT_MatCode;
|
|
newConsumables.WMT_MatName = Consumables.WMT_MatName;
|
|
newConsumables.WMT_MatType = Consumables.WMT_MatType;
|
|
newConsumables.WMT_Remark = Consumables.WMT_Remark;
|
|
|
|
db.HJGL_BS_WeldMaterial.InsertOnSubmit(newConsumables);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改焊接耗材
|
|
/// </summary>
|
|
/// <param name="Consumables"></param>
|
|
public static void updateConsumables(Model.HJGL_BS_WeldMaterial Consumables)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_WeldMaterial newConsumables = db.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == Consumables.WMT_ID);
|
|
if (newConsumables != null)
|
|
{
|
|
newConsumables.WMT_MatCode = Consumables.WMT_MatCode;
|
|
newConsumables.WMT_MatName = Consumables.WMT_MatName;
|
|
newConsumables.WMT_MatType = Consumables.WMT_MatType;
|
|
newConsumables.WMT_Remark = Consumables.WMT_Remark;
|
|
newConsumables.WMT_Remark = Consumables.WMT_Remark;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊接耗材Id删除一个焊接耗材信息
|
|
/// </summary>
|
|
/// <param name="ConsumablesId"></param>
|
|
public static void DeleteConsumables(string ConsumablesId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_WeldMaterial Consumables = db.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == ConsumablesId);
|
|
if (Consumables != null)
|
|
{
|
|
db.HJGL_BS_WeldMaterial.DeleteOnSubmit(Consumables);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊接耗材代码获取焊接耗材信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_WeldMaterial GetMaterialByMaterialCode(string materialCode)
|
|
{
|
|
return Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(x => x.WMT_MatCode == materialCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取材料信息名称
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_WeldMaterial> GetMaterialList(string type)
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_WeldMaterial
|
|
where (type != null && x.WMT_MatType == type)
|
|
orderby x.WMT_MatCode select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
///// <summary>
|
|
///// 获取焊丝代号
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//public static List<Model.HJGL_BS_WeldMaterial> GetMaterialSilkList()
|
|
//{
|
|
// var q = (from x in Funs.DB.HJGL_BS_WeldMaterial where x.WMT_MatType=="1" orderby x.WMT_MatCode select x).ToList();
|
|
// return q;
|
|
//}
|
|
|
|
///// <summary>
|
|
///// 获取焊条代号
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//public static List<Model.HJGL_BS_WeldMaterial> GetMaterialWeldMatList()
|
|
//{
|
|
// var q = (from x in Funs.DB.HJGL_BS_WeldMaterial where x.WMT_MatType == "2" orderby x.WMT_MatCode select x).ToList();
|
|
// return q;
|
|
//}
|
|
}
|
|
}
|