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, IPackSpecDefineService { private readonly IPackSpecDefineRepository repository; public PackSpecDefineService(IPackSpecDefineRepository _repository) : base(_repository) { repository = _repository; } /// /// 根据分页条件获取分页菜单数据 /// /// /// /// /// /// 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); } /// /// 保存菜单数据 /// /// /// public int savePackSpec(SysPackSpec htParams) { return repository.savePackSpec(htParams); } /// /// 更新菜单数据 /// /// /// public int updatePackSpec(SysPackSpec htParams) { return repository.updatePackSpec(htParams); } /// /// 查看菜单详情 /// /// /// public Hashtable getPackSpecDetail(String spec_id) { spec_id = " spec_id = " + spec_id; List 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; } /// /// 删除菜单 /// /// /// 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; } /// /// 启用 /// /// /// public int EnableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.EnableData(ids); } /// /// 禁用 /// /// /// public int DisableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.DisableData(ids); } } }