Fork me on GitHub

批次起源流程图

#region 批次起源流程图 查询
/// <summary>
/// 批次起源流程图 查询
/// </summary>
/// <param name="YGPCDJDW_ID"></param>
/// <param name="YGPCDJ_YLPCH"></param>
/// <returns></returns>
[HttpGet]
public string GetFySyList(string YGPCDJ_YLPCH)
{

list = new List<FySyList>();

newlist = new List<FySyList>();

_Data(YGPCDJ_YLPCH);
_Datas(YGPCDJ_YLPCH);
var n33 = list;

var sql = new StringBuilder();
sql.Append("('");

sql.Append(string.Join("','", list.Select(x => x.YGPCDJ_ID).ToArray()));

sql.Append("')");

var sql2 = "SELECT * from YLGL_YGPCDJ where YGPCDJ_ID in "+sql+" ";

DataTable dt = DbHelperSQL.GetDataTable(sql2);
var list2= ModelConvertHelper<FyList>.DataTableToList(dt);
foreach (var q1 in list2)
{
FySyList n3 = new FySyList();

if(q1.YGPCDJ_FYFS== "机坪发油")
{
n3.YGPCDJ_ID = q1.YGPCDJ_ID;
//n3.YGPCDJ_LYPCH = q1.YGPCDJ_LYPCH;
//n3.YG_ID = q1.YG_ID;
//n3.YGPCDJDW_ID = q1.DW_ID;
n3.YGPCDJ_YLPCH = q1.YGPCDJ_YLPCH;
//n3.YGPCDJ_YLZSH = q1.YGPCDJ_YLZSH;
//n3.YGPCDJ_DYSL = q1.YGPCDJ_DYSL;
//n3.YGPCDJ_DYPCH = q1.YGPCDJ_DYPCH;
//n3.GSYLFC_ID = q1.GSYLFC_ID;
//n3.FY_AddTime = q1.FY_AddTime;
//n3.SYDW_ID = q1.SYDW_ID;
//n3.YGPCDJ_FYSL = q1.YGPCDJ_FYSL;
n3.YGPCDJ_FYFS = q1.YGPCDJ_FYFS;
//n3.FyRenName = q1.FyRenName;
var d1 = DbHelperSQL.GetDataTable("SELECT DW_Name from SYS_DW where DW_ID='" + q1.DW_ID + "'");
string a = d1.Rows[0]["DW_Name"].ToString();
n3.FyDWName = a;
n3.SyDWName = "机坪";
}
else
{
n3.YGPCDJ_ID = q1.YGPCDJ_ID;
//n3.YGPCDJ_LYPCH = q1.YGPCDJ_LYPCH;
//n3.YG_ID = q1.YG_ID;
//n3.YGPCDJDW_ID = q1.DW_ID;
n3.YGPCDJ_YLPCH = q1.YGPCDJ_YLPCH;
//n3.YGPCDJ_YLZSH = q1.YGPCDJ_YLZSH;
//n3.YGPCDJ_DYSL = q1.YGPCDJ_DYSL;
//n3.YGPCDJ_DYPCH = q1.YGPCDJ_DYPCH;
//n3.GSYLFC_ID = q1.GSYLFC_ID;
//n3.FY_AddTime = q1.FY_AddTime;
//n3.SYDW_ID = q1.SYDW_ID;
//n3.YGPCDJ_FYSL = q1.YGPCDJ_FYSL;
n3.YGPCDJ_FYFS = q1.YGPCDJ_FYFS;
//n3.FyRenName = q1.FyRenName;

var d1 = DbHelperSQL.GetDataTable("SELECT DW_Name from SYS_DW where DW_ID='" + q1.DW_ID + "'");
string a = d1.Rows[0]["DW_Name"].ToString();
var d2 = DbHelperSQL.GetDataTable("SELECT DW_Name from SYS_DW where DW_ID='" +q1.SYDW_ID + "'");
string b = d2.Rows[0]["DW_Name"].ToString();
n3.FyDWName = a;
n3.SyDWName = b;
}

 

newlist.Add(n3);

}
var p = newlist;
var data = JsonConvert.SerializeObject(newlist);
return data;


}
#endregion

 

 


#region 查询发油批次登记表
/// <summary>
/// 查询发油批次登记表
/// </summary>
/// <param name="pch"></param>
/// <returns></returns>
public void _Data(string pch)
{

string sql = string.Empty;
sql = "select * from YLGL_YGPCDJ where YGPCDJ_YLPCH = '" + pch + "'";
DataTable dt = DbHelperSQL.GetDataTable(sql);
for (int i = 0; i < dt.Rows.Count; i++)
{
FySyList fy = new FySyList();
fy.YGPCDJ_ID = dt.Rows[i]["YGPCDJ_ID"].ToString();

//var fdwid= dt.Rows[i]["DW_ID"].ToString();
//var sdwid= dt.Rows[i]["SYDW_ID"].ToString();

//fy.YGPCDJDW_ID = fdwid; //发油单位
//fy.SYDW_ID = sdwid; //收油单位

//fy.YGPCDJ_YLPCH = dt.Rows[i]["YGPCDJ_YLPCH"].ToString();
//fy.YGPCDJ_FYFS = dt.Rows[i]["YGPCDJ_FYFS"].ToString();
list.Add(fy);
if (string.IsNullOrWhiteSpace(dt.Rows[i]["YGPCDJ_LYPCH"].ToString()))
{
continue;
}
string[] n1 = dt.Rows[i]["YGPCDJ_LYPCH"].ToString().Split(',');
for (int k = 0; k < n1.Length; k++)
{
_Data(DbHelperSQL.ExecuteScalar("select YGRYJL_YLPCH from YLGL_YGRYJL_NEW where YGRYJL_ID='" + n1[k] + "'").ToString());
}
}
}

/// <summary>
///
/// </summary>
/// <param name="Id"></param>
public void _Datas(string YGPCDJ_YLPCH)
{
string sql2 = string.Empty;
sql2 = "select YGRYJL_ID from YLGL_YGRYJL_NEW where YGRYJL_YLPCH = '" + YGPCDJ_YLPCH + "'";
DataTable dt2 = DbHelperSQL.GetDataTable(sql2);
for (int j = 0; j < dt2.Rows.Count; j++)
{
string sql = "select * from YLGL_YGPCDJ where YGPCDJ_LYPCH like '%" + dt2.Rows[j]["YGRYJL_ID"] + "%'";
DataTable dt = DbHelperSQL.GetDataTable(sql);
for (int i = 0; i < dt.Rows.Count; i++)
{
FySyList fy = new FySyList();
fy.YGPCDJ_ID = dt.Rows[i]["YGPCDJ_ID"].ToString();
//fy.YGPCDJDW_ID = dt.Rows[i]["DW_ID"].ToString();//发油单位
//fy.SYDW_ID = dt.Rows[i]["SYDW_ID"].ToString();//收油单位
//fy.YGPCDJ_YLPCH = dt.Rows[i]["YGPCDJ_YLPCH"].ToString();
//fy.YGPCDJ_FYFS = dt.Rows[i]["YGPCDJ_FYFS"].ToString();
list.Add(fy);
_Datas(dt.Rows[i]["YGPCDJ_YLPCH"].ToString());
}
}

}
#endregion

posted @ 2023-04-24 20:16  残风飞雪  阅读(16)  评论(0编辑  收藏  举报

博客地址 - 创建于 2022年4月12日

这是一位.Net软件研发工程师的个人站,内容主要是网站开发方面的技术文章,大部分来自学习或工作,部分来源于网络,希望对大家有所帮助。

致力于web网站开发工作,专注软件开发,关注互联网前沿技术与趋势。


Font Awesome Bootstrap中文网