|
|
using Estsh.Core.Dapper;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using System.Collections;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class CustPreQtyService : BaseService<SysCustPdlineProdinfo>, ICustPreQtyService
|
|
|
{
|
|
|
private readonly ICustPreQtyRepository repository;
|
|
|
|
|
|
public CustPreQtyService(ICustPreQtyRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取分页菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="menuName">查询条件</param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序字段</param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getListByPage(String sql, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(SysCustPdlineProdinfo).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += " a.carton_no " + direction;
|
|
|
}
|
|
|
|
|
|
result = repository.getListByPage(pager.pageSize, pager.pageNo, sql, orderBy);
|
|
|
return result;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 根据客户产线查询对应数据
|
|
|
/// </summary>
|
|
|
/// <param name="custPDLineID">客户产线编号</param>
|
|
|
/// <returns>是否存在</returns>
|
|
|
public Hashtable ExistsCustPDLine(int custPDLineID)
|
|
|
{
|
|
|
Hashtable hs = new Hashtable();
|
|
|
List<SysCustPdlineProdinfo> dt = repository.ExistsCustPDLine(custPDLineID);
|
|
|
if (dt != null && dt.Count > 0)
|
|
|
{
|
|
|
hs.Add("custPdlineId", dt[0].CustPdlineId.ToString());
|
|
|
hs.Add("custPdlineSeq", dt[0].CustPdlineSeq.ToString());
|
|
|
hs.Add("pdlineSeq", dt[0].PdlineSeq.ToString());
|
|
|
hs.Add("preQty", dt[0].PreQty.ToString());
|
|
|
hs.Add("custPdlineName", dt[0].custPdlineName.ToString());
|
|
|
hs.Add("cycleTime", dt[0].CycleTime.ToString());
|
|
|
}
|
|
|
return hs;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 更新
|
|
|
/// </summary>
|
|
|
/// <param name="custPDLineID">产线ID</param>
|
|
|
/// <param name="cust_pdline_seq">客户流水号</param>
|
|
|
/// <param name="cycle_time">标准工时</param>
|
|
|
/// <param name="update_userid">更新用户</param>
|
|
|
/// <returns></returns>
|
|
|
public bool edit(int custPDLineID, string cust_pdline_seq, string cycle_time, int update_userid)
|
|
|
{
|
|
|
return repository.edit(custPDLineID, cust_pdline_seq, cycle_time, update_userid);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 删除
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int Delete(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += repository.delete(Convert.ToInt32(id));
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int EnableData(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.EnableData(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int DisableData(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.DisableData(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存
|
|
|
/// </summary>
|
|
|
/// <param name="htParams">参数</param>
|
|
|
/// <returns></returns>
|
|
|
public int Save(SysCustPdlineProdinfo htParams)
|
|
|
{
|
|
|
return repository.Save(htParams);
|
|
|
}
|
|
|
|
|
|
public List<KeyValueResult> getCust_pdline()
|
|
|
{
|
|
|
return repository.getCust_pdline();
|
|
|
}
|
|
|
}
|
|
|
} |