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.
73 lines
3.0 KiB
73 lines
3.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using Warehouse.Models.DTO;
|
|
using Warehouse.Models.mesLevel4;
|
|
using Warehouse.Models.mesModel;
|
|
|
|
namespace Warehouse.DAL.Config.BOM
|
|
{
|
|
public class BomIdMSDal
|
|
{
|
|
public List<BomIdBomDto> QueryBomIdBom(string BomId)
|
|
{
|
|
using (var context = new mesModel())
|
|
{
|
|
using (var level4 = new mesLevel4Model())
|
|
{
|
|
|
|
string sql = @"SELECT a.[bom_id] as bomId
|
|
,a.[bom_part_nbr] as partnumber
|
|
,[is_primary] as isPrimary
|
|
,[primary_part] as alternativePartNumber
|
|
,[serial_requirement] as unitConsumption
|
|
,[uom] as unit
|
|
,[part_type_desc] as parttype
|
|
,[lost_ratio] as lossRate
|
|
,b.descriptions as partnumberDescription
|
|
FROM [mes_main].[dbo].[config_bom_id] a
|
|
inner join mes_level4_iface.dbo.master_part b on a.bom_part_nbr = b.bom_part_nbr
|
|
where a.bom_id=@bomId";
|
|
var Res= context.Database.SqlQuery<BomIdBomDto>(sql, new SqlParameter("@bomId",BomId));
|
|
//var Res= context.DynamicListFromSql(sql, new Dictionary<string, object> { { "bomid", BomId } });
|
|
return Res.ToList();
|
|
//var BomIDBomList =context.config_bom_id.Where(a => a.bom_id == BomId).ToList();
|
|
//var res = from a in context.config_bom_id
|
|
// where (a.bom_id == BomId)
|
|
// select a;
|
|
//var res2 = from a in context.config_bom_id.AsEnumerable()
|
|
// join b in level4.master_part on a.bom_part_nbr equals b.bom_part_nbr
|
|
// where (a.bom_id==BomId)
|
|
// select new BomIdBomDto()
|
|
// {
|
|
// partnumber = a.bom_part_nbr,
|
|
// parttypeDescription = b.descriptions
|
|
// };
|
|
//return res2.ToList();
|
|
|
|
|
|
|
|
//var Res = context.config_bom_id.Join(level4.master_part,
|
|
// aa => aa.bom_part_nbr,
|
|
// bb => bb.bom_part_nbr,
|
|
// (aa, bb) => new { aa, bb }).Where(a => a.aa.bom_id == BomId).Select(a =>
|
|
// new BomIdBomDto()
|
|
// {
|
|
// bomId = a.aa.bom_id,
|
|
// alternativePartNumber = a.aa.primary_part,
|
|
// isPrimary = a.aa.is_primary,
|
|
// lossRate = a.aa.lost_ratio,
|
|
// partnumber = a.aa.bom_part_nbr,
|
|
// parttye = a.aa.part_type,
|
|
// parttypeDescription = a.bb.descriptions,
|
|
// unit = a.aa.uom,
|
|
// unitConsumption = a.aa.serial_requirement
|
|
// }).ToList();
|
|
//return Res;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|