旧版报表、仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

84 lines
2.5 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
using Warehouse.Models.DTO;
using Warehouse.Models.mesLevel4;
namespace Warehouse.DAL.Config.MaterialCode
{
public class MaterialCodeMSDal
{
/// <summary>
/// 查询物料料号
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
public List<MaterialCodeDto> Query(Expression<Func<master_part, bool>> whereExpression)
{
using (var context = new mesLevel4Model())
{
//context.master_part.Join(context.df_part_type,
// aa=>aa.part_type,
// bb=>bb.part_type,
// (aa, bb) =>new { aa,bb}).Where(a=>)
return context.master_part.Where(whereExpression).Select(a => new MaterialCodeDto()
{
description = a.descriptions,
flag = a.active_flag==1?true:false,
partnumber = a.bom_part_nbr,
parttype = a.df_part_type.descriptions,
}).ToList();
}
}
/// <summary>
/// 添加物料料号
/// </summary>
/// <param name="Obj"></param>
/// <returns></returns>
public bool Add(master_part Obj)
{
using (var context = new mesLevel4Model())
{
context.master_part.Add(Obj);
return context.SaveChanges() > 0 ? true : false;
}
}
/// <summary>
/// 更新物料料号
/// </summary>
/// <param name="Obj"></param>
/// <returns></returns>
public bool Update(master_part Obj)
{
using (var context = new mesLevel4Model())
{
context.Entry(Obj).State = System.Data.Entity.EntityState.Modified;
return context.SaveChanges() > 0 ? true : false;
}
}
/// <summary>
/// 查询物料类别
/// </summary>
public List<PartTypeDto> QueryPartType(Expression<Func<df_part_type, bool>> whereExpression)
{
using (var context = new mesLevel4Model())
{
return context.df_part_type.Where(whereExpression).Where(a=>a.active_flag==1).Select(a => new PartTypeDto { description = a.descriptions, flag = a.active_flag, parttype = a.part_type }).ToList();
}
}
public bool AddPartType(df_part_type Obj)
{
using (var context = new mesLevel4Model())
{
context.df_part_type.Add(Obj);
return context.SaveChanges() > 0 ? true : false;
}
}
}
}