using System.Data; using System.Collections; using System.Text; using Aspose.Cells; using Estsh.Core.Models; using Estsh.Core.Repository.IRepositories; using Estsh.Core.Util; using Estsh.Core.Services.IServices; using Estsh.Core.Model.Result; using Estsh.Core.Model.ExcelModel; using Estsh.Core.Model.EnumUtil; using Estsh.Core.Dapper; /*************************************************************************************************** * * 更新人:sitong.dong * 描述:BOM管理业务类 * 修改时间:2022.06.22 * 修改日志:系统迭代升级 * **************************************************************************************************/ namespace Estsh.Core.Services { /// /// BOM管理业务类 /// public class BOMSearchService : BaseService, IBOMSearchService { private readonly IBOMSearchRepository repository; public BOMSearchService(IBOMSearchRepository _repository) : base(_repository) { repository = _repository; } public Hashtable getListByPage(String partNo, string partSpec, string itemPartNo, string itemPartSpec, string enabled, string factoryId, Pager pager, string direction, string sort) { String strWhere = " 1=1 "; if (partNo != null && !partNo.Trim().Equals("")) { strWhere += "and a.part_no like '%" + partNo.Trim() + "%'"; } if (itemPartNo != null && !itemPartNo.Trim().Equals("")) { strWhere += "and b.item_part_no like '%" + itemPartNo.Trim() + "%'"; } if (partSpec != null && !partSpec.Trim().Equals("")) { strWhere += "and c.part_spec like '%" + partSpec.Trim() + "%'"; } if (itemPartSpec != null && !itemPartSpec.Trim().Equals("")) { strWhere += "and d.part_spec like '%" + itemPartSpec.Trim() + "%'"; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += "and a.enabled like '%" + enabled.Trim() + "%'"; } strWhere += " and a.factory_id = " + factoryId + " "; String orderBy = ""; if (sort != null && !"".Equals(sort.Trim())) { orderBy += "a." + typeof(SysBom).GetEntityColumnName(sort.Trim()) + " " + direction; } else { orderBy += "a." + typeof(SysBom).GetEntityColumnName("bom_id") + " " + direction; } Hashtable result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy); return result; } public List GetPartInfo(string part_no) { return repository.GetPartInfo(part_no); } /// /// 导出Bom信息 /// /// /// /// public List exportBOMInfo(String bomType, String partId) { return this.repository.getExpotBOMList(bomType, partId, "", ""); } public List exportALL(String bomType) { return this.repository.exportALL(bomType, "", ""); } } }