堆场模糊查询
This commit is contained in:
parent
2da7dd1ae6
commit
937eca3566
|
@ -19,6 +19,7 @@ using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Maticsoft.Common;
|
using Maticsoft.Common;
|
||||||
using Competition.Mysql.Model;
|
using Competition.Mysql.Model;
|
||||||
|
using Competition.Mysql.Other;
|
||||||
namespace Competition.Mysql.BLL
|
namespace Competition.Mysql.BLL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -180,7 +181,11 @@ namespace Competition.Mysql.BLL
|
||||||
|
|
||||||
#endregion BasicMethod
|
#endregion BasicMethod
|
||||||
#region ExtensionMethod
|
#region ExtensionMethod
|
||||||
|
public List<Competition.Mysql.Model.T_STK_STORAGE_SILO> CheckYardList(ReqYardCheck req)
|
||||||
|
{
|
||||||
|
DataSet ds = dal.CheckYardList(req);
|
||||||
|
return DataTableToList(ds.Tables[0]);
|
||||||
|
}
|
||||||
#endregion ExtensionMethod
|
#endregion ExtensionMethod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@ using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using Maticsoft.DBUtility;//Please add references
|
using Maticsoft.DBUtility;
|
||||||
|
using Competition.Mysql.Other;//Please add references
|
||||||
namespace Competition.Mysql.DAL
|
namespace Competition.Mysql.DAL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -405,6 +406,63 @@ namespace Competition.Mysql.DAL
|
||||||
|
|
||||||
#endregion BasicMethod
|
#endregion BasicMethod
|
||||||
#region ExtensionMethod
|
#region ExtensionMethod
|
||||||
|
public DataSet CheckYardList(ReqYardCheck req)
|
||||||
|
{
|
||||||
|
string T1, T2;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(req.SILO_CODE))
|
||||||
|
{
|
||||||
|
T1 = "T_STK_STORAGE_SILO";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
T1 = string.Format("(select * FROM T_STK_STORAGE_SILO WHERE SILO_CODE LIKE '{0}')", req.SILO_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(req.SHIP_NAME_EN) && string.IsNullOrEmpty(req.VOYAGE_NO) && string.IsNullOrEmpty(req.STANDARD_NAME))
|
||||||
|
{
|
||||||
|
T2 = "T_STK_STORAGE";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
T2 = "(select * FROM T_STK_STORAGE WHERE ";
|
||||||
|
string tmp1="",tmp2="",tmp3="";
|
||||||
|
if(!string.IsNullOrEmpty(req.SHIP_NAME_EN))
|
||||||
|
{
|
||||||
|
tmp1 = string.Format("SHIP_NAME_EN LIKE '{0}' AND ", req.SHIP_NAME_EN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(req.VOYAGE_NO))
|
||||||
|
{
|
||||||
|
tmp2 = string.Format("VOYAGE_NO LIKE '{0}' AND ", req.VOYAGE_NO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(req.STANDARD_NAME))
|
||||||
|
{
|
||||||
|
tmp3 = string.Format("STANDARD_NAME LIKE '{0}' AND ", req.STANDARD_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
//拼接
|
||||||
|
T2 = T2 + tmp1 + tmp2 + tmp3;
|
||||||
|
T2 = T2.TrimEnd(" AND ".ToCharArray());
|
||||||
|
|
||||||
|
//结尾
|
||||||
|
T2 += ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
string sql = string.Format(
|
||||||
|
"select T1.* " +
|
||||||
|
"FROM " +
|
||||||
|
"{0} T1 " +
|
||||||
|
"INNER JOIN " +
|
||||||
|
"{1} T2 " +
|
||||||
|
"ON T1.STORAGE_CODE = T2.STORAGE_CODE",T1,T2);
|
||||||
|
|
||||||
|
StringBuilder strSql = new StringBuilder();
|
||||||
|
strSql.Append(sql);
|
||||||
|
|
||||||
|
return DbHelperSQL.Query(strSql.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
#endregion ExtensionMethod
|
#endregion ExtensionMethod
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Competition.Mysql.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// YardController_CheckYard()查询条件
|
||||||
|
/// </summary>
|
||||||
|
public class ReqYardCheck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 船名
|
||||||
|
/// </summary>
|
||||||
|
public string SHIP_NAME_EN;
|
||||||
|
/// <summary>
|
||||||
|
/// 航次
|
||||||
|
/// </summary>
|
||||||
|
public string VOYAGE_NO;
|
||||||
|
/// <summary>
|
||||||
|
/// 商品名称
|
||||||
|
/// </summary>
|
||||||
|
public string STANDARD_NAME;
|
||||||
|
/// <summary>
|
||||||
|
/// 卸货地(堆场编码)
|
||||||
|
/// </summary>
|
||||||
|
public string SILO_CODE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
using Competition.Common.Util;
|
using Competition.Common.Util;
|
||||||
|
using Competition.Mysql.Other;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NPOI.POIFS.Crypt.Dsig;
|
using NPOI.POIFS.Crypt.Dsig;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
|
|
||||||
namespace CompetitionAPI.Controllers.api
|
namespace CompetitionAPI.Controllers.api
|
||||||
{
|
{
|
||||||
|
@ -97,6 +100,24 @@ namespace CompetitionAPI.Controllers.api
|
||||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 堆场模糊查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="req"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public JsonResult CheckYard([FromBody] ReqYardCheck req)
|
||||||
|
{
|
||||||
|
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||||
|
//查询商品库存地列表
|
||||||
|
var list = bll_storageSILO.CheckYardList(req);
|
||||||
|
var silos=list.GroupBy(a => a.SILO_CODE).ToList();
|
||||||
|
List<object> tmps= new List<object>();
|
||||||
|
silos.ForEach(a =>
|
||||||
|
{
|
||||||
|
tmps.Add(new { SILO_CODE = a.Key, SILO_NAME = a.First().SILO_NAME });
|
||||||
|
});
|
||||||
|
return Json(Tool.GetJsonWithCode(APICode.Success, tmps));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue