天津投入产出系统后端
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.
 
 
 
 
 
 

79 lines
3.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.Entity.Basic;
using QMFrameWork.Data;
using System.Data;
using QMAPP.Entity;
namespace QMAPP.FJC.DAL.Basic
{
/// </summary>
/// 模块名称:配置表
/// 作 者:张松男
/// 编写日期:2021年05月14日
/// </summary>
public class MaterialBomConfigDAL
{
/// <summary>
/// 查询自动输入的输入条码
/// </summary>
/// <param name="pBomCode"></param>
/// <param name="pWorkLoc"></param>
/// <returns></returns>
public List<string> GetAutoInputBarCode(string pBomCode, string pWorkLoc)
{
List<DataParameter> parameter = new List<DataParameter>();
List<string> list = new List<string>();
var data = new DataTable();
//var sqlScript = $"select Product_Code from T_MD_MaterialBomConfig_QD where workloc = '{pWorkLoc}' and material_code = '{pBomCode}'";
string sqlScript = $@"select Product_Code from T_MD_MaterialBomConfig_QD
where material_code is not null and material_code in
(select material_code from T_MD_PBOM_ITEM where pbom_code = '{pBomCode}'
INTERSECT
select material_code from T_MD_MaterialBomConfig_QD where workloc = '{pWorkLoc}' ) and workloc ='{pWorkLoc}'";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript);
data = session.GetTable(sqlScript, parameter.ToArray());
}
if (data.Rows.Count > 0)
{
foreach (DataRow dataRow in data.Rows)
{
string pbom = dataRow["Product_Code"].ToString();
if (!list.Contains(pbom) && !string.IsNullOrEmpty(pbom))
{
list.Add(pbom);
}
}
}
return list;
}
/// <summary>
/// 获取全部规则
/// </summary>
/// <returns></returns>
public List<MaterialBomConfig> Get(MaterialBomConfig MaterialBomConfig)
{
try
{
string sql = $"SELECT PID,Material_Code,Workloc,Product_Code,Material_Name FROM [T_MD_ScanIPConfig_QD] where Workloc = '{MaterialBomConfig.Workloc}' and Material_Code = '{MaterialBomConfig.Material_Code}' ";
List<DataParameter> parameters = new List<DataParameter>();
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.GetList<MaterialBomConfig>(sql, parameters.ToArray()).ToList();
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}