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.

184 lines
6.1 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 MESOD10Service : BaseService<SysPartCustOrder>, IMESOD10Service
{
private readonly IMESOD10Repository repository;
public MESOD10Service(IMESOD10Repository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="MESOD10Name"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getMESOD10ListByPage(String QiShiHuoYunDan, String JieShuHuoYunDan, Pager pager, String direction, String sort, String enabled)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (QiShiHuoYunDan != null && !QiShiHuoYunDan.Trim().Equals(""))
{
strWhere += " and Number>='" + QiShiHuoYunDan + "' ";
}
if (JieShuHuoYunDan != null && !JieShuHuoYunDan.Trim().Equals(""))
{
strWhere += " and Number<='" + JieShuHuoYunDan + "'";
}
//if (enabled != null && !enabled.Trim().Equals(""))
//{
// strWhere += " and enabled='" + enabled + "'";
//}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(GShipOrder).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(GShipOrder).GetEntityColumnName("OrderNo") + " " + direction;
}
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
/// <summary>
/// 保存菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int saveMESOD10(SysPartCustOrder htParams)
{
return repository.saveMESOD10(htParams);
}
/// <summary>
/// 更新菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int updateMESOD10(SysPartCustOrder htParams)
{
return repository.updateMESOD10(htParams);
}
/// <summary>
/// 查看详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public List<SysPartCustOrder> getMESOD10(String part_id)
{
part_id = "part_id = " + part_id;
List<SysPartCustOrder> dt = repository.getList(part_id, "");
return dt;
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deleteMESOD10(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deleteMESOD10(id);
}
}
return count;
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> GetTerminalName()
{
return repository.GetTerminalName();
}
/// <summary>
/// 根据分页条件获取分页客户订单数据
/// </summary>
/// <param name="menuName">查询条件</param>
/// <param name="pager"></param>
/// <param name="direction">排序方式</param>
/// <param name="sort">排序字段</param>
/// <returns></returns>
public List<MESOD> getTableListByPage(String locationDate, String terminal_name, String Date, String Date2, Pager pager, String direction, String sort, Boolean isPage)
{
String strWhere = " 1=1 ";
int rowCount = 0;
if (locationDate == "按站点查询")
{
if (terminal_name != null && !terminal_name.Trim().Equals(""))
{
strWhere += " and c.terminal_name = '" + terminal_name + "' ";
}
}
else if (locationDate == "按日期段查询")
{
if (!string.IsNullOrEmpty(Date) && !string.IsNullOrEmpty(Date2))
{
strWhere += " and a.create_time between Convert(DateTime,'" + Date + "') and Convert(DateTime,'" + Date2 + "') ";
}
}
else
{
return null;
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(GUserUnlock).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += " c."+typeof(GUserUnlock).GetEntityColumnName("TerminalName") + " " + direction;
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
List<MESOD> result = repository.getTableListByPage(rowCount, pager.pageNo, strWhere, orderBy);
return result;
}
}
}