dd
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 规格
|
||||
/// </summary>
|
||||
public static class SpecificationsService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取规格
|
||||
/// </summary>
|
||||
/// <param name="specificationsId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_Specifications GetSpecificationsById(string specificationsId)
|
||||
{
|
||||
return Funs.DB.Weld_Specifications.FirstOrDefault(e => e.SpecificationsId == specificationsId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加规格设置
|
||||
/// </summary>
|
||||
/// <param name="specifications"></param>
|
||||
public static void AddSpecifications(Model.Weld_Specifications specifications)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Specifications newSpecifications = new Model.Weld_Specifications();
|
||||
newSpecifications.SpecificationsId = specifications.SpecificationsId;
|
||||
newSpecifications.Specifications = specifications.Specifications;
|
||||
newSpecifications.MaxUsingNum = specifications.MaxUsingNum;
|
||||
newSpecifications.WeldTypeId = specifications.WeldTypeId;
|
||||
newSpecifications.CreateMan = specifications.CreateMan;
|
||||
newSpecifications.Remark = specifications.Remark;
|
||||
db.Weld_Specifications.InsertOnSubmit(newSpecifications);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改规格设置
|
||||
/// </summary>
|
||||
/// <param name="specifications"></param>
|
||||
public static void UpdateSpecifications(Model.Weld_Specifications specifications)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Specifications newSpecifications = db.Weld_Specifications.FirstOrDefault(e => e.SpecificationsId == specifications.SpecificationsId);
|
||||
if (newSpecifications != null)
|
||||
{
|
||||
newSpecifications.Specifications = specifications.Specifications;
|
||||
newSpecifications.WeldTypeId = specifications.WeldTypeId;
|
||||
newSpecifications.MaxUsingNum = specifications.MaxUsingNum;
|
||||
newSpecifications.ModifyMan = specifications.ModifyMan;
|
||||
newSpecifications.Remark = specifications.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除规格设置
|
||||
/// </summary>
|
||||
/// <param name="specificationsId"></param>
|
||||
public static void DeleteSpecificationsById(string specificationsId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Specifications specifications = db.Weld_Specifications.FirstOrDefault(e => e.SpecificationsId == specificationsId);
|
||||
if (specifications != null)
|
||||
{
|
||||
db.Weld_Specifications.DeleteOnSubmit(specifications);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊材类型获取相关规格
|
||||
/// </summary>
|
||||
/// <param name="weldTypeId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Weld_Specifications> GetSpecificationsByWeldTypeId(string weldTypeId)
|
||||
{
|
||||
return (from x in Funs.DB.Weld_Specifications where x.WeldTypeId == weldTypeId orderby x.Specifications select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证规格是否存在
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitSpecifications(string weldTypeId, string specifications, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_Specifications.FirstOrDefault(x => x.WeldTypeId == weldTypeId && x.Specifications == specifications && x.SpecificationsId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊材类型、规格获取规格设置信息
|
||||
/// </summary>
|
||||
/// <param name="weldTypeId"></param>
|
||||
/// <param name="spec"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_Specifications GetSpecificationsByWeldTypeIdSpec(string weldTypeId, string spec)
|
||||
{
|
||||
return Funs.DB.Weld_Specifications.FirstOrDefault(e => e.WeldTypeId == weldTypeId && e.Specifications == spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
namespace BLL
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
|
||||
/// <summary>
|
||||
/// 保管员信息
|
||||
/// </summary>
|
||||
public static class StoremanInfoService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取保管员信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_Storeman GetStoremanById(string id)
|
||||
{
|
||||
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.StoremanId == id);
|
||||
}
|
||||
|
||||
public static Model.Weld_Storeman GetStoremanByUserId(string userId)
|
||||
{
|
||||
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.UserId == userId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加保管员信息
|
||||
/// </summary>
|
||||
/// <param name="storeMan"></param>
|
||||
public static void AddStoreMan(Model.Weld_Storeman storeMan)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Storeman newStoreman = new Model.Weld_Storeman();
|
||||
newStoreman.StoremanId = storeMan.StoremanId;
|
||||
newStoreman.StoreCode = storeMan.StoreCode;
|
||||
newStoreman.StoreName = storeMan.StoreName;
|
||||
newStoreman.UserId = storeMan.UserId;
|
||||
db.Weld_Storeman.InsertOnSubmit(newStoreman);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改保管员信息
|
||||
/// </summary>
|
||||
/// <param name="storeMan"></param>
|
||||
public static void UpdateStoreMan(Model.Weld_Storeman storeMan)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storeMan.StoremanId);
|
||||
if (newStoreman != null)
|
||||
{
|
||||
newStoreman.StoreCode = storeMan.StoreCode;
|
||||
newStoreman.StoreName = storeMan.StoreName;
|
||||
// newStoreman.UserId = storeMan.UserId;
|
||||
newStoreman.IdentityCard = storeMan.IdentityCard;
|
||||
newStoreman.SignatureUrl = storeMan.SignatureUrl;
|
||||
//newStoreman.MyFinger = storeMan.MyFinger;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除保管员信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
public static void DeleteStoreManById(string id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Storeman storeMan = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == id);
|
||||
if (storeMan!=null)
|
||||
{
|
||||
db.Weld_Storeman.DeleteOnSubmit(storeMan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登记保管员指纹信息
|
||||
/// </summary>
|
||||
/// <param name="teamGroup"></param>
|
||||
public static void StoremanFinger(string storemanId, string myFinger)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storemanId);
|
||||
if (newStoreman != null)
|
||||
{
|
||||
newStoreman.MyFinger = myFinger;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证代号是否存在
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitStoreName(string name, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_Storeman.FirstOrDefault(x => x.StoreName == name && x.StoremanId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取保管员列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetStoremanList()
|
||||
{
|
||||
var q = (from x in Funs.DB.Weld_Storeman orderby x.StoreCode select x).ToList(); // where x.MyFinger != null 这个条件这里暂不用
|
||||
ListItem[] lis = new ListItem[q.Count()];
|
||||
|
||||
for (int i = 0; i < q.Count(); i++)
|
||||
{
|
||||
lis[i] = new ListItem(q[i].StoreName ?? "", q[i].StoremanId.ToString());
|
||||
}
|
||||
|
||||
return lis;
|
||||
}
|
||||
|
||||
public static ListItem[] GetStoremanList(string projectId, string unitId)
|
||||
{
|
||||
var q = (from x in Funs.DB.Project_User
|
||||
join y in Funs.DB.Sys_User on x.UserId equals y.UserId
|
||||
where x.ProjectId == projectId && y.UnitId == unitId
|
||||
&& x.RoleId == Const.StoreManRole
|
||||
select new { x.UserId,y.UserName}).ToList();
|
||||
ListItem[] lis = new ListItem[q.Count()];
|
||||
|
||||
for (int i = 0; i < q.Count(); i++)
|
||||
{
|
||||
lis[i] = new ListItem(q[i].UserName ?? "", q[i].UserId.ToString());
|
||||
}
|
||||
|
||||
return lis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据身份证号码id查询保管员信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_Storeman GetStoremanByIdentityCard(string identityCard)
|
||||
{
|
||||
return Funs.DB.Weld_Storeman.FirstOrDefault(e => e.IdentityCard == identityCard);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改保管员是否已人脸训练
|
||||
/// </summary>
|
||||
/// <param name="storeman"></param>
|
||||
public static void UpdateStoreManIsFaceTrain(Weld_Storeman storeman)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Storeman newStoreman = db.Weld_Storeman.FirstOrDefault(e => e.StoremanId == storeman.StoremanId);
|
||||
if (newStoreman!=null)
|
||||
{
|
||||
newStoreman.IsFaceTrain = storeman.IsFaceTrain;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 供应商信息
|
||||
/// </summary>
|
||||
public static class SupplierService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取供应商信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_Supplier GetSupplierById(string id)
|
||||
{
|
||||
return Funs.DB.Weld_Supplier.FirstOrDefault(e => e.SupplierId == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加供应商信息
|
||||
/// </summary>
|
||||
/// <param name="supplier"></param>
|
||||
public static void AddSupplier(Model.Weld_Supplier supplier)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Supplier newSupplier = new Model.Weld_Supplier();
|
||||
newSupplier.SupplierId = supplier.SupplierId;
|
||||
newSupplier.SupplierCode = supplier.SupplierCode;
|
||||
newSupplier.SupplierName = supplier.SupplierName;
|
||||
newSupplier.ContactMan = supplier.ContactMan;
|
||||
newSupplier.ContactPhone = supplier.ContactPhone;
|
||||
db.Weld_Supplier.InsertOnSubmit(newSupplier);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改供应商信息
|
||||
/// </summary>
|
||||
/// <param name="supplier"></param>
|
||||
public static void UpdateSupplier(Model.Weld_Supplier supplier)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Supplier newSupplier = db.Weld_Supplier.FirstOrDefault(e => e.SupplierId == supplier.SupplierId);
|
||||
if (newSupplier != null)
|
||||
{
|
||||
newSupplier.SupplierCode = supplier.SupplierCode;
|
||||
newSupplier.SupplierName = supplier.SupplierName;
|
||||
newSupplier.ContactMan = supplier.ContactMan;
|
||||
newSupplier.ContactPhone = supplier.ContactPhone;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除供应商信息
|
||||
/// </summary>
|
||||
/// <param name="supplierId"></param>
|
||||
public static void DeleteSupplierById(string supplierId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_Supplier supplier = db.Weld_Supplier.FirstOrDefault(e => e.SupplierId == supplierId);
|
||||
if (supplier != null)
|
||||
{
|
||||
db.Weld_Supplier.DeleteOnSubmit(supplier);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证供应商代号是否存在
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitSupplierCode(string code, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_Supplier.FirstOrDefault(x => x.SupplierCode == code && x.SupplierId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取供应商
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetSupplierList()
|
||||
{
|
||||
var q = (from x in Funs.DB.Weld_Supplier orderby x.SupplierName select x).ToList();
|
||||
ListItem[] lis = new ListItem[q.Count()];
|
||||
|
||||
for (int i = 0; i < q.Count(); i++)
|
||||
{
|
||||
lis[i] = new ListItem(q[i].SupplierName ?? "", q[i].SupplierId);
|
||||
}
|
||||
|
||||
return lis;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class UnitStoreService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取单位仓库
|
||||
/// </summary>
|
||||
/// <param name="specificationsId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_UnitStore GetUnitStoreById(string unitStoreId)
|
||||
{
|
||||
return Funs.DB.Weld_UnitStore.FirstOrDefault(e => e.UnitStoreId == unitStoreId);
|
||||
}
|
||||
|
||||
public static List<Model.Weld_UnitStore> GetUnitStoreByUnitId(string unitId)
|
||||
{
|
||||
return Funs.DB.Weld_UnitStore.Where(e => e.UnitId==unitId).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加单位仓库
|
||||
/// </summary>
|
||||
/// <param name="specifications"></param>
|
||||
public static void AddUnitStore(Model.Weld_UnitStore unitStore)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_UnitStore newUnitStore = new Model.Weld_UnitStore();
|
||||
newUnitStore.UnitStoreId = unitStore.UnitStoreId;
|
||||
newUnitStore.UnitId = unitStore.UnitId;
|
||||
newUnitStore.UnitStoreCode = unitStore.UnitStoreCode;
|
||||
newUnitStore.UnitStoreName = unitStore.UnitStoreName;
|
||||
newUnitStore.StorePosition = unitStore.StorePosition;
|
||||
db.Weld_UnitStore.InsertOnSubmit(newUnitStore);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改单位仓库
|
||||
/// </summary>
|
||||
/// <param name="unitStore"></param>
|
||||
public static void UpdateUnitStore(Model.Weld_UnitStore unitStore)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_UnitStore newUnitStore = db.Weld_UnitStore.FirstOrDefault(e => e.UnitStoreId == unitStore.UnitStoreId);
|
||||
if (newUnitStore != null)
|
||||
{
|
||||
newUnitStore.UnitId = unitStore.UnitId;
|
||||
newUnitStore.UnitStoreCode = unitStore.UnitStoreCode;
|
||||
newUnitStore.UnitStoreName = unitStore.UnitStoreName;
|
||||
newUnitStore.StorePosition = unitStore.StorePosition;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除单位仓库
|
||||
/// </summary>
|
||||
/// <param name="unitStoreId"></param>
|
||||
public static void DeleteUnitStoreById(string unitStoreId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_UnitStore delUnitStore = db.Weld_UnitStore.FirstOrDefault(e => e.UnitStoreId == unitStoreId);
|
||||
if (delUnitStore != null)
|
||||
{
|
||||
db.Weld_UnitStore.DeleteOnSubmit(delUnitStore);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证单位仓库是否存在
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="unitStoreCode"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitUnitStore(string unitId, string unitStoreCode, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_UnitStore.FirstOrDefault(x => x.UnitId == unitId && x.UnitStoreCode == unitStoreCode && x.UnitStoreId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitUnitStoreDropDownList(FineUIPro.DropDownList dropName, string unitId, bool isShowPlease)
|
||||
{
|
||||
var store = from x in Funs.DB.Weld_UnitStore
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
orderby y.UnitName, x.UnitStoreCode
|
||||
select new { x.UnitStoreId, UnitStoreName = (y.UnitName + "(" + x.UnitStoreName + ")"), y.UnitName, x.UnitId };
|
||||
if (!string.IsNullOrEmpty(unitId))
|
||||
{
|
||||
store = store.Where(x => x.UnitId == unitId);
|
||||
}
|
||||
|
||||
dropName.DataValueField = "UnitStoreId";
|
||||
dropName.DataTextField = "UnitStoreName";
|
||||
dropName.DataGroupField = "UnitName";
|
||||
dropName.DataSource = store.ToList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 焊材信息设置
|
||||
/// </summary>
|
||||
public static class WeldInfoService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取焊材信息
|
||||
/// </summary>
|
||||
/// <param name="weldId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_WeldInfo GetWeldInfoById(string weldId)
|
||||
{
|
||||
return Funs.DB.Weld_WeldInfo.FirstOrDefault(e => e.WeldId == weldId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加焊材信息
|
||||
/// </summary>
|
||||
/// <param name="weld"></param>
|
||||
public static void AddWeldInfo(Model.Weld_WeldInfo weld)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldInfo newWeld = new Model.Weld_WeldInfo();
|
||||
newWeld.WeldId = weld.WeldId;
|
||||
newWeld.WeldCode = weld.WeldCode;
|
||||
newWeld.WeldName = weld.WeldName;
|
||||
newWeld.WeldSpec = weld.WeldSpec;
|
||||
newWeld.WeldTypeId = weld.WeldTypeId;
|
||||
newWeld.ConvertValue = weld.ConvertValue;
|
||||
newWeld.WarnAmount = weld.WarnAmount;
|
||||
newWeld.SteelType = weld.SteelType;
|
||||
newWeld.CreateMan = weld.CreateMan;
|
||||
db.Weld_WeldInfo.InsertOnSubmit(newWeld);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改焊材管理
|
||||
/// </summary>
|
||||
/// <param name="weld"></param>
|
||||
public static void UpdateWeldInfo(Model.Weld_WeldInfo weld)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldInfo newWeld = db.Weld_WeldInfo.FirstOrDefault(e => e.WeldId == weld.WeldId);
|
||||
if (newWeld != null)
|
||||
{
|
||||
newWeld.WeldCode = weld.WeldCode;
|
||||
newWeld.WeldName = weld.WeldName;
|
||||
newWeld.WeldSpec = weld.WeldSpec;
|
||||
newWeld.WeldTypeId = weld.WeldTypeId;
|
||||
newWeld.ConvertValue = weld.ConvertValue;
|
||||
newWeld.WarnAmount = weld.WarnAmount;
|
||||
newWeld.SteelType = weld.SteelType;
|
||||
newWeld.ModifyMan = weld.ModifyMan;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除焊材信息
|
||||
/// </summary>
|
||||
/// <param name="weldId"></param>
|
||||
public static void DeleteWeldInfoById(string weldId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldInfo weldInfo = db.Weld_WeldInfo.FirstOrDefault(e => e.WeldId == weldId);
|
||||
if (weldInfo != null)
|
||||
{
|
||||
db.Weld_WeldInfo.DeleteOnSubmit(weldInfo);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证是否存在相同的编号
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWeld(string weldName, string weldSpec, string weldId)
|
||||
{
|
||||
var q = Funs.DB.Weld_WeldInfo.FirstOrDefault(x => x.WeldName == weldName && x.WeldSpec == weldName && x.WeldId != weldId);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取焊材信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Weld_WeldInfo> GetWeldInfoList()
|
||||
{
|
||||
return (from x in Funs.DB.Weld_WeldInfo orderby x.WeldCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据焊材类型ID获取焊材信息数量
|
||||
/// </summary>
|
||||
/// <param name="weldtypeId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetWeldInfoByWeldTypeId(string weldtypeId)
|
||||
{
|
||||
return (from x in Funs.DB.Weld_WeldInfo where x.WeldTypeId == weldtypeId select x).Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证焊材牌号、规格是否存在
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="spec"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWeldNameAndSpec(string name, string spec, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_WeldInfo.FirstOrDefault(x => x.WeldName == name && x.WeldSpec == spec && x.WeldId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 焊材类型
|
||||
/// </summary>
|
||||
public static class WeldTypeService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取焊材类型
|
||||
/// </summary>
|
||||
/// <param name="weldTypeId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Weld_WeldType GetWeldTypeById(string weldTypeId)
|
||||
{
|
||||
return Funs.DB.Weld_WeldType.FirstOrDefault(e => e.WeldTypeId == weldTypeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加焊材类型
|
||||
/// </summary>
|
||||
/// <param name="weldType"></param>
|
||||
public static void AddWeldType(Model.Weld_WeldType weldType)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldType newWeldType = new Model.Weld_WeldType();
|
||||
newWeldType.WeldTypeId = weldType.WeldTypeId;
|
||||
newWeldType.WeldTypeName = weldType.WeldTypeName;
|
||||
newWeldType.WeldUnit = weldType.WeldUnit;
|
||||
newWeldType.Remark = weldType.Remark;
|
||||
db.Weld_WeldType.InsertOnSubmit(newWeldType);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改焊材类型
|
||||
/// </summary>
|
||||
/// <param name="weldType"></param>
|
||||
public static void UpdateWeldType(Model.Weld_WeldType weldType)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldType newWeldType = db.Weld_WeldType.FirstOrDefault(e => e.WeldTypeId == weldType.WeldTypeId);
|
||||
if (newWeldType != null)
|
||||
{
|
||||
newWeldType.WeldTypeName = weldType.WeldTypeName;
|
||||
newWeldType.WeldUnit = weldType.WeldUnit;
|
||||
newWeldType.Remark = weldType.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除焊材类型
|
||||
/// </summary>
|
||||
/// <param name="weldTypeId"></param>
|
||||
public static void DeleteWeldTypeById(string weldTypeId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Weld_WeldType weldType = db.Weld_WeldType.FirstOrDefault(e => e.WeldTypeId == weldTypeId);
|
||||
if (weldType != null)
|
||||
{
|
||||
db.Weld_WeldType.DeleteOnSubmit(weldType);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证焊材类型是否存在
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWeldTypeName(string name, string id)
|
||||
{
|
||||
var q = Funs.DB.Weld_WeldType.FirstOrDefault(x => x.WeldTypeName == name && x.WeldTypeId != id);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取焊材类型列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Weld_WeldType> GetWeldTypeList()
|
||||
{
|
||||
return (from x in Funs.DB.Weld_WeldType orderby x.WeldTypeName select x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user