You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
4.5 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Estsh.Core.Dapper;
using Estsh.Core.IRepositories;
using Estsh.Core.Models;
using Estsh.Core.Repository.IRepositories;
using Estsh.Core.Services.IServices;
using Estsh.Core.Util;
using System.Collections;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:包规定义
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class PackSpecDefineService : BaseService<SysPackSpec>, IPackSpecDefineService
{
private readonly IPackSpecDefineRepository repository;
public PackSpecDefineService(IPackSpecDefineRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="menuName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getPackSpecListByPage(String spec_name, Pager pager, String direction, String sort, String enabled)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (spec_name != null && !spec_name.Trim().Equals(""))
{
strWhere += " and spec_name like '%" + spec_name.Trim() + "%'";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
strWhere += " and enabled = '" + spec_name+ "'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysPackSpec).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(SysPackSpec).GetEntityColumnName("SpecId") + " " + direction;
}
return repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
}
/// <summary>
/// 保存菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int savePackSpec(SysPackSpec htParams)
{
return repository.savePackSpec(htParams);
}
/// <summary>
/// 更新菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int updatePackSpec(SysPackSpec htParams)
{
return repository.updatePackSpec(htParams);
}
/// <summary>
/// 查看菜单详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public Hashtable getPackSpecDetail(String spec_id)
{
spec_id = " spec_id = " + spec_id;
List<SysPackSpec> dt = repository.getList(spec_id, "");
Hashtable result = new Hashtable();
result.Add("specId", dt[0].SpecId);
result.Add("palletQty", dt[0].PalletQty);
result.Add("specName", dt[0].SpecName);
result.Add("cartonQty", dt[0].CartonQty);
result.Add("boxQty", dt[0].BoxQty);
result.Add("enabled", dt[0].Enabled);
return result;
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deletePackSpec(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deletePackSpec(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);
}
}
}