using BLL.IDAL;
|
using Common;
|
using Model;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace BLL
|
{
|
public class DALPalletMatOut:IDALPalletMatOut
|
{
|
public IList<PltOut> GetList(AjaxPalletMatOutList ajaxPalletMatOut, ref PageInfo page)
|
{
|
try
|
{
|
List<SqlParam> para = new List<SqlParam>();
|
StringBuilder strSql = new StringBuilder();
|
strSql.Append("select * from View_Log_Store where TurnoverDemand = '02' " + $" AND DepartGuid='{ajaxPalletMatOut.DepartGuid}' ");
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.LocationCode))
|
{
|
strSql.Append("and LocationCode like '%' + @LocationCode + '%' ");
|
para.Add(new SqlParam("@LocationCode", ajaxPalletMatOut.LocationCode));
|
}
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.Palno))
|
{
|
strSql.Append("and Palno like '%' + @Palno + '%' ");
|
para.Add(new SqlParam("@Palno", ajaxPalletMatOut.Palno));
|
}
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.MatNo))
|
{
|
strSql.Append("and MatNo like '%' + @MatNo + '%' ");
|
para.Add(new SqlParam("@MatNo", ajaxPalletMatOut.MatNo));
|
}
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.MatName))
|
{
|
strSql.Append("and MatName like '%' + @MatName + '%' ");
|
para.Add(new SqlParam("@MatName", ajaxPalletMatOut.MatName));
|
}
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.BatchNo))
|
{
|
strSql.Append("and BatchNo like '%' + @BatchNo + '%' ");
|
para.Add(new SqlParam("@BatchNo", ajaxPalletMatOut.BatchNo));
|
}
|
if (!string.IsNullOrEmpty(ajaxPalletMatOut.LingNo))
|
{
|
strSql.Append("and LingNo like '%' + @LingNo + '%' ");
|
para.Add(new SqlParam("@LingNo", ajaxPalletMatOut.LingNo));
|
}
|
|
SqlParam[] param = null;
|
if (para != null)
|
{
|
param = para.ToArray();
|
}
|
|
DataTable dt = DataFactory.SqlDataBase().GetPageList(strSql.ToString(), param, "Palno", "asc", ref page);
|
return ModelConvertHelper<PltOut>.DataTableToModel(dt);
|
}
|
catch(Exception ex)
|
{
|
throw ex;
|
}
|
}
|
|
public bool IsCanPalletOut(string PalletNo, string Addre)
|
{
|
try
|
{
|
bool r = false;
|
StringBuilder strSQL = new StringBuilder();
|
|
//liudl add 验证库位状态
|
strSQL.Append("select count(*) from DepotsLocation ");
|
strSQL.Append("where LocationCode = '"+ Addre + "' and TurnoverDemand='02'");
|
DataTable dtt = DataFactory.SqlDataBase().GetDataTableBySQL(strSQL);
|
if (dtt.Rows[0][0].ToString() == "0")
|
{
|
return r;
|
}
|
|
// 验证托盘是否存在
|
strSQL.Clear();
|
strSQL.Append( "select * from View_Log_Store where Palno = '");
|
strSQL.Append(PalletNo);
|
strSQL.Append("'");
|
DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(strSQL);
|
if(dt == null)
|
{
|
return r;
|
}
|
if(dt.Rows.Count == 0)
|
{
|
return r;
|
}
|
|
r = true;
|
return r;
|
}
|
catch(Exception ex)
|
{
|
throw ex;
|
}
|
}
|
}
|
}
|