using HH.WMS.DAL;
using HH.WMS.DAL.Basic;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Autobom;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Common;
using HH.WMS.Entitys.Entitys;
/********************************************************************************
** auth: DBS
** date: 2018/12/3 17:03:13
** desc: 尚未编写描述
** Ver.: V1.0.0
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HH.WMS.BLL.Basic
{
public class TN_WM_LOCATION_EXTBLL : DapperBaseBLL, ITN_WM_LOCATION_EXTBLL
{
#region 根据巷道获取巷道内的货位状态
///
/// 根据巷道获取巷道内的货位状态
///
/// 仓库号
/// 库区号
/// 巷道号
///
/// [Hanhe(DBS)] created 2018/12/03
public DataTable ViewState(string stockCode, string areaCode, string roadway)
{
var dt = CreateDAL().ViewState(stockCode, areaCode, roadway);
dt.Columns["VIEW_STATE"].ReadOnly = false;
foreach (DataRow row in dt.Rows)
{
if (row["VIEW_STATE"].ToString().Equals("满"))
{
var trayLocation = CreateDAL>().GetSingleEntity(new { CN_S_LOCATION_CODE = row["CN_S_LOCATION_CODE"].ToString() });
if (trayLocation != null)
{
var trayInfo = CreateDAL>().GetSingleEntity(new { CN_S_TRAY_CODE = trayLocation.CN_S_TRAY_CODE });
if (trayInfo != null)
{
if (!string.IsNullOrEmpty(trayInfo.CN_S_USE_STATE) && trayInfo.CN_S_USE_STATE.Trim() != "空")
row["VIEW_STATE"] = trayInfo.CN_S_USE_STATE;
}
}
}
}
return dt;
}
#endregion
public List GetModel(string strWhere)
{
return CreateDAL().GetModel(strWhere);
}
public List GetModelByRow(string strRow, string strArea)
{
return CreateDAL().GetModelByRow(strRow, strArea);
}
public TN_WM_LOCATION_EXTEntity GetExtModel(string strWhere)
{
List lst = CreateDAL().GetModel(strWhere);
if (!lst.Any())
{
return null;
}
return lst[0];
}
#region 删除
///
/// 删除
///
/// 要删除的ID集合
///
///
public SqlExecuteResult Delete(string Where)
{
SqlExecuteResult result = new SqlExecuteResult();
result = CreateDAL().Delete(Where, null);
return result;
}
#endregion
public SqlExecuteResult Add(TN_WM_LOCATION_EXTEntity Entity)
{
SqlExecuteResult result = new SqlExecuteResult();
OperateResult Opresult = CreateDAL>().Add(Entity, null);
result.Success = Opresult.Success;
result.Exception = new Exception(Opresult.Msg);
return result;
}
public SqlExecuteResult UpdateSync(TN_WM_LOCATION_EXTEntity Entity)
{
SqlExecuteResult result = CreateDAL().UpdateSync(Entity, null);
return result;
}
public SqlExecuteResult UpdateBFState(string where, string tableName)
{
SqlExecuteResult result = new SqlExecuteResult();
result = CreateDAL().UpdateBFState(where, tableName, null);
return result;
}
#region 更新状态
public OperateResult UpdateState(string locationCode, string state, string bState)
{
var result = CreateDAL().UpdateLocationExtState(locationCode, state, bState, "", null);
return result;
}
public OperateResult UpdateState(string locationCode, string state, string bState, IDbTransaction trans)
{
var result = CreateDAL().UpdateLocationExtState(locationCode, state, bState, "", trans);
return result;
}
#endregion
#region 更新状态根据托盘码
public OperateResult UpdateStateByTrayCode(string trayCode, string locationState, string useState, IDbTransaction trans)
{
var result = CreateDAL().UpdateStateByTrayCode(trayCode, locationState, useState, trans);
return result;
}
#endregion
#region
public OperateResult UpdateLocationExtState(string locationCode, string locationState, string locationUseState, string taskNo, IDbTransaction trans)
{
var result = CreateDAL().UpdateLocationExtState(locationCode, locationState, locationUseState, taskNo, trans);
return result;
}
#endregion
#region 查询货位拓展表
///
/// 查询货位拓展表
///
/// 实体
///
/// [HANHE(lt)] CREATED BY 2018-12-18
public OperateResult GetLocationExtList(SearchModel searchModel)
{
return CreateDAL().GetLocationExtList(searchModel);
}
#endregion
///
/// 根据仓库获取存储情况
///
/// 仓库号
///
public DataTable GetAreaStorageInfo(string stockCode,string[] areas)
{
return CreateDAL().GetAreaStorageInfo(stockCode, areas);
}
#region 获取货位列表
public List GetLocationList()
{
return CreateDAL().GetLocationList();
}
#endregion
#region 获取货位状态数量
public DataTable GetStateQty(string stockCode)
{
return CreateDAL().GetStateQty(stockCode);
}
#endregion
}
}