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.

96 lines
3.3 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 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
{
/// <summary>
/// BOM管理业务类
/// </summary>
public class BOMSearchService : BaseService<SysBom>, 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<SysPart> GetPartInfo(string part_no)
{
return repository.GetPartInfo(part_no);
}
/// <summary>
/// 导出Bom信息
/// </summary>
/// <param name="bomType"></param>
/// <param name="partId"></param>
/// <returns></returns>
public List<BOMDefine> exportBOMInfo(String bomType, String partId)
{
return this.repository.getExpotBOMList(bomType, partId, "", "");
}
public List<BOMDefine> exportALL(String bomType)
{
return this.repository.exportALL(bomType, "", "");
}
}
}