|
|
|
|
|
using Aspose.Cells;
|
|
|
using Estsh.Core.Dapper;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using System.Collections;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:料架信息模块业务处理类
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 料架信息模块管理业务处理类
|
|
|
/// </summary>
|
|
|
public class TrayService : BaseService<GTray>, ITrayService
|
|
|
{
|
|
|
private readonly ITrayRepository repository;
|
|
|
|
|
|
public TrayService(ITrayRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
#region 料架信息管理
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取料架信息列表
|
|
|
/// </summary>
|
|
|
/// <param name="account"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getTrayByPage(String tray_code, String tray_name, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
StringBuilder strWhere = new StringBuilder(1024);
|
|
|
strWhere.Append(" 1=1 ");
|
|
|
if (tray_code != null && !tray_code.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_code like '%" + tray_code.Trim() + "%'");
|
|
|
}
|
|
|
if (tray_name != null && !tray_name.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_name like '%" + tray_name.Trim() + "%'");
|
|
|
}
|
|
|
strWhere.Append(" and c.enum_type = 'g_tray_seq' AND a.Enabled = 'Y' ");
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(GTray).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a."+typeof(GTray).GetEntityColumnName("TrayId") + " " + direction;
|
|
|
}
|
|
|
result = repository.getTrayByPage(pager.pageSize, pager.pageNo, strWhere.ToString(), orderBy);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取料架信息列表
|
|
|
/// </summary>
|
|
|
/// <param name="account"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getTrayByPageToList(String tray_code, String tray_name, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
StringBuilder strWhere = new StringBuilder(1024);
|
|
|
strWhere.Append(" 1=1 ");
|
|
|
if (tray_code != null && !tray_code.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_code like '%" + tray_code.Trim() + "%'");
|
|
|
}
|
|
|
if (tray_name != null && !tray_name.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_name like '%" + tray_name.Trim() + "%'");
|
|
|
}
|
|
|
strWhere.Append(" and c.enum_type = 'g_tray_seq' AND a.Enabled = 'Y' ");
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTray).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTray).GetEntityColumnName("TrayId") + " " + direction;
|
|
|
}
|
|
|
return repository.getTrayByPageToList(pager.pageSize, pager.pageNo, strWhere.ToString(), orderBy);
|
|
|
}
|
|
|
|
|
|
public Hashtable getTableListByPage(String tray_code, String tray_name, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
StringBuilder strWhere = new StringBuilder(1024);
|
|
|
strWhere.Append(" 1=1 ");
|
|
|
if (tray_code != null && !tray_code.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_code like '%" + tray_code.Trim() + "%'");
|
|
|
}
|
|
|
if (tray_name != null && !tray_name.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_name like '%" + tray_name.Trim() + "%'");
|
|
|
}
|
|
|
strWhere.Append(" and c.enum_type = 'g_tray_seq' AND a.Enabled = 'Y' ");
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTray).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTray).GetEntityColumnName("TrayId") + " " + direction;
|
|
|
}
|
|
|
return repository.getTableListByPage(pager.pageSize, pager.pageNo, strWhere.ToString(), orderBy);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取料架类型列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> getTrayType()
|
|
|
{
|
|
|
return repository.getTrayType();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存料架信息数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int saveTrayInfo(GTray htParams)
|
|
|
{
|
|
|
return repository.saveTrayInfo(htParams);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新料架信息数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int updateTrayInfo(GTray htParams)
|
|
|
{
|
|
|
return repository.updateTrayInfo(htParams);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据trayid,获取Tray数据
|
|
|
/// </summary>
|
|
|
/// <param name="tray_id"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GTray> GetTrayById(string tray_id)
|
|
|
{
|
|
|
return this.repository.GetTrayById(tray_id);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除料架信息信息
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int deleteTray(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.deleteTray(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int EnableData(String ids)
|
|
|
{
|
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
|
return this.repository.EnableData(ids);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int DisableData(String ids)
|
|
|
{
|
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
|
return this.repository.DisableData(ids);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取料架信息列表
|
|
|
/// </summary>
|
|
|
/// <param name="account"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getTrayDetailOfPager(String tray_id, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
StringBuilder strWhere = new StringBuilder(1024);
|
|
|
strWhere.Append(" 1=1 ");
|
|
|
if (tray_id != null && !tray_id.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_id =" + tray_id.Trim());
|
|
|
}
|
|
|
strWhere.Append(" AND a.Enabled = 'Y' ");
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTrayDetail).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTrayDetail).GetEntityColumnName("TrayLoc") + " " + direction;
|
|
|
}
|
|
|
|
|
|
result = repository.getTrayDetailOfPager(pager.pageSize, pager.pageNo, strWhere.ToString(), orderBy);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取料架信息列表
|
|
|
/// </summary>
|
|
|
/// <param name="account"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getTrayDetailToList(String tray_id, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
StringBuilder strWhere = new StringBuilder(1024);
|
|
|
strWhere.Append(" 1=1 ");
|
|
|
if (tray_id != null && !tray_id.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere.Append(" and a.tray_id =" + tray_id.Trim());
|
|
|
}
|
|
|
strWhere.Append(" AND a.Enabled = 'Y' ");
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTrayDetail).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a." + typeof(GTrayDetail).GetEntityColumnName("TrayLoc") + " " + direction;
|
|
|
}
|
|
|
|
|
|
return repository.getTrayDetailToList(pager.pageSize, pager.pageNo, strWhere.ToString(), orderBy);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据guid,获取Tray明细数据
|
|
|
/// </summary>
|
|
|
/// <param name="tray_id"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GTrayDetail> GetTrayDetailByGuid(string guid)
|
|
|
{
|
|
|
return this.repository.GetTrayDetailByGuid(guid);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存料架明细信息数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int saveTrayDetailInfo(GTrayDetail htParams)
|
|
|
{
|
|
|
return repository.saveTrayDetailInfo(htParams);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新料架明细信息数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int updateTrayDetailInfo(GTrayDetail htParams)
|
|
|
{
|
|
|
return repository.updateTrayDetailInfo(htParams);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除料架明细信息信息
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int deleteTrayDetail(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.deleteTrayDetail(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
} |