|
|
using System.Collections;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.IRepositories;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class RollDefineService : BaseService<GRoll>, IRollDefineService
|
|
|
{
|
|
|
private readonly IRollDefineRepository repository;
|
|
|
public RollDefineService(IRollDefineRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查询数据
|
|
|
/// </summary>
|
|
|
/// <param name="awhere"></param>
|
|
|
/// <param name="dt"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GRoll> GetQuery(string awhere)
|
|
|
{
|
|
|
return repository.GetQuery(awhere);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取辊道编号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetRollNO()
|
|
|
{
|
|
|
return repository.GetRollNO();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取辊道名称
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetRollName()
|
|
|
{
|
|
|
return repository.GetRollName();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看菜单详情
|
|
|
/// </summary>
|
|
|
/// <param name="type_id"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getRollDetail(String ruid)
|
|
|
{
|
|
|
ruid = " ruid = " + ruid;
|
|
|
List<GRoll> dt = repository.getList(ruid, "");
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
result.Add("rollNo", dt[0].RollNo);
|
|
|
result.Add("rollName", dt[0].RollName);
|
|
|
result.Add("rollType", dt[0].RollType);
|
|
|
result.Add("maxQty", dt[0].MaxQty);
|
|
|
result.Add("minQty", dt[0].MinQty);
|
|
|
result.Add("qty", dt[0].Qty);
|
|
|
result.Add("cbCustPDLine", dt[0].CustPdlineId);
|
|
|
result.Add("modelId", dt[0].ModelId);
|
|
|
result.Add("cbModelType", dt[0].TypeId);
|
|
|
result.Add("ruid", dt[0].Ruid);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除数据
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int deleteRoll(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.deleteRoll(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int EnableData(String ids)
|
|
|
{
|
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
|
return this.repository.EnableData(ids);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int DisableData(String ids)
|
|
|
{
|
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
|
return this.repository.DisableData(ids);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 判断辊道编号
|
|
|
/// </summary>
|
|
|
/// <param name="rollNo"></param>
|
|
|
/// <returns></returns>
|
|
|
//public bool pdrollNo(string rollNo)
|
|
|
//{
|
|
|
// return repository.pdrollNo(rollNo);
|
|
|
//}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取分页菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="VendorName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getRollListByPage(String cust_pdline_id, String roll_no, String roll_name, String roll_type, Pager pager, String direction, String sort, String factoryId, String enabled)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
String strWhere = " 1=1 ";
|
|
|
if (roll_no != null && !roll_no.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere = " a.roll_no like '%" + roll_no.Trim() + "%' ";
|
|
|
}
|
|
|
if (roll_name != null && !roll_name.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " AND a.roll_name like '%" + roll_name.Trim() + "%'";
|
|
|
}
|
|
|
if (roll_type != null && !roll_type.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " AND a.roll_type like '%" + roll_type.Trim() + "%'";
|
|
|
}
|
|
|
|
|
|
if (cust_pdline_id != null && !cust_pdline_id.Trim().Equals(""))
|
|
|
{
|
|
|
if (cust_pdline_id == "1005")
|
|
|
{
|
|
|
strWhere += " AND a.cust_pdline_id like '%" + cust_pdline_id.Trim() + "%'";
|
|
|
}
|
|
|
else if (cust_pdline_id == "1002")
|
|
|
{
|
|
|
strWhere += " AND a.cust_pdline_id like '%" + cust_pdline_id.Trim() + "%'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
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 = "a.cust_pdline_id desc,a.roll_no";
|
|
|
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int insertRoll(GRoll htParams)
|
|
|
{
|
|
|
return repository.insertRoll(htParams);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 修改数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
public int updateRoll(GRoll htParams)
|
|
|
{
|
|
|
return repository.updateRoll(htParams);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
//public ArrayList getSelectPartMaster_Model_name()
|
|
|
//{
|
|
|
// Hashtable result = new Hashtable();
|
|
|
|
|
|
// DataTable dt = repository.getSelectPartMaster_Model_name();
|
|
|
|
|
|
// return DataTypeConvert.NewObject.DataTableToArrayList(dt);
|
|
|
//}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取客户产线列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetCustPDLine()
|
|
|
{
|
|
|
return repository.GetCustPDLine();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据客户产线查询车型
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetMode_type(string CustPDLine)
|
|
|
{
|
|
|
return repository.GetMode_type(CustPDLine);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据车型编号查询座椅配置
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetModelList(int ModelType)
|
|
|
{
|
|
|
return repository.GetModelList(ModelType);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 判断辊道编号是否存在
|
|
|
/// </summary>
|
|
|
/// <param name="rollno">辊道编号</param>
|
|
|
/// <returns>false:不存在 true :已存在</returns>
|
|
|
public bool IsExistOrd(string rollno)
|
|
|
{
|
|
|
Hashtable hsTalbe = new Hashtable();
|
|
|
string strWhere = " and roll_no ='" + rollno + "'";
|
|
|
List<GRoll> dt = repository.getRollNoList(strWhere);
|
|
|
|
|
|
if (dt == null || dt.Count < 1)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取客户产线编号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetCustID()
|
|
|
{
|
|
|
return repository.GetCustID();
|
|
|
}
|
|
|
}
|
|
|
}
|