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.

196 lines
6.5 KiB
C#

2 years ago
using System.Data;
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 ProduceStockService : BaseService<GWorkorder>, IProduceStockService
{
private readonly IProduceStockRepository repository;
public ProduceStockService(IProduceStockRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 汇总信息
/// </summary>
/// <returns></returns>
public Hashtable GetSummary(string _where,Pager pager)
{
return repository.GetSummary(_where, pager);
}
public List<GWorkorder> GetSummaryDtail(string _where, string typeID, ref DataTable dt)
{
return repository.GetSummaryDtail(_where, typeID);
}
public Hashtable GetDetail(string _where, Pager pager)
{
return repository.GetDetail(_where, pager);
}
public Hashtable GetStatisticsData(string _where, Pager pager)
{
return repository.GetStatisticsData(_where, pager);
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="ProduceStockName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getProduceStockListByPage(String type_id, String CarNumber, String CarNumber2, String Date, String Date2, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (type_id != null && !type_id.Trim().Equals(""))
{
strWhere += " and type_id='" + type_id + "'";
}
if (!string.IsNullOrEmpty(CarNumber))
{
strWhere += " and a.car_no>= '" + CarNumber + "'";
}
if (!string.IsNullOrEmpty(CarNumber2))
{
strWhere += " and a.car_no<='" + CarNumber2 + "' ";
}
strWhere += " and convert(datetime,a.create_time) between convert(datetime,'" + Date + "') and convert(datetime,'" + Date2 + "') ";
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(GWorkorder).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(GWorkorder).GetEntityColumnName("Ruid") + " " + direction;
}
result = repository.getListByPage(type_id,pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
/// <summary>
/// 保存菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int saveProduceStock(SysPartCustOrder htParams)
{
return repository.saveProduceStock(htParams);
}
/// <summary>
/// 更新菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int updateProduceStock(SysPartCustOrder htParams)
{
return repository.updateProduceStock(htParams);
}
/// <summary>
/// 查看详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public List<SysPartCustOrder> getProduceStock(String part_id)
{
part_id = "part_id = " + part_id;
return repository.getList(part_id, "");
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deleteProduceStock(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deleteProduceStock(id);
}
}
return count;
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getType()
{
return repository.getType();
}
/// <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 += " a."+typeof(SysPartCustOrder).GetEntityColumnName("PartId") + " " + direction;
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
return repository.getTableListByPage(rowCount, pager.pageNo, strWhere, orderBy);
}
}
}