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.

191 lines
6.4 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.Collections;
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.Dapper;
using Estsh.Core.Model.ExcelModel;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:生产指令转化查询
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
/// <summary>
/// 菜单业务处理类
/// </summary>
public class ProduceSerchService : BaseService<SysPartCustOrder>, IProduceSerchService
{
private readonly IProduceSerchRepository repository;
public ProduceSerchService(IProduceSerchRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="ProduceSerchName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getProduceSerchListByPage(String cust_pdline_id, String comtype_name, String Model, String Type, Pager pager, String direction, String sort, String factoryId, String enabled)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (cust_pdline_id != null && !cust_pdline_id.Trim().Equals(""))
{
strWhere += " and cust_pdline_id='" + cust_pdline_id + "'";
}
if (Model != null && !Model.Trim().Equals(""))
{
strWhere += " and model_part_id ='" + Model + "' ";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
strWhere += " and a.enabled = '" + enabled + "'";
}
if (factoryId != null && !factoryId.Trim().Equals(""))
{
strWhere += " and a.factory_id = '" + factoryId + "'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(GVwOrder).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += " a.create_time DESC " + direction;
}
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
/// <summary>
/// 保存菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int saveProduceSerch(SysPartCustOrder htParams)
{
return repository.saveProduceSerch(htParams);
}
/// <summary>
/// 更新菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int updateProduceSerch(SysPartCustOrder htParams)
{
return repository.updateProduceSerch(htParams);
}
/// <summary>
/// 查看详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public List<SysPartCustOrder> getProduceSerch(String part_id)
{
return repository.getList(part_id, "");
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deleteProduceSerch(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deleteProduceSerch(id);
}
}
return count;
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getCust_pdline_nameListData()
{
return repository.getCust_pdline_nameListData();
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getType_nameListData(String cust_pdline_id)
{
return repository.getType_nameListData(cust_pdline_id);
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getModelListData(String Type)
{
return repository.getModelListData(Type);
}
/// <summary>
/// 根据分页条件获取分页客户订单数据
/// </summary>
/// <param name="menuName">查询条件</param>
/// <param name="pager"></param>
/// <param name="direction">排序方式</param>
/// <param name="sort">排序字段</param>
/// <returns></returns>
public Hashtable getTableListByPage(String part_no, String cust_order, Pager pager, String direction, String sort, Boolean isPage)
{
String strWhere = " 1=1 ";
int rowCount = 0;
if (part_no != null && !part_no.Trim().Equals(""))
{
strWhere = " b.part_no like '%" + part_no.Trim() + "%' ";
}
if (cust_order != null && !cust_order.Trim().Equals(""))
{
strWhere += " AND a.cust_order like '%" + cust_order.Trim() + "%'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysPartCustOrder).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(SysPartCustOrder).GetEntityColumnName("PartId") + " " + direction;
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
return repository.getTableListByPage(rowCount, pager.pageNo, strWhere, orderBy);
}
}
}