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, IRollDefineService { private readonly IRollDefineRepository repository; public RollDefineService(IRollDefineRepository _repository) : base(_repository) { repository = _repository; } /// /// 查询数据 /// /// /// /// public List GetQuery(string awhere) { return repository.GetQuery(awhere); } /// /// 获取辊道编号 /// /// public List GetRollNO() { return repository.GetRollNO(); } /// /// 获取辊道名称 /// /// public List GetRollName() { return repository.GetRollName(); } /// /// 查看菜单详情 /// /// /// public Hashtable getRollDetail(String ruid) { ruid = " ruid = " + ruid; List 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; } /// /// 删除数据 /// /// /// 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; } /// /// 启用 /// /// /// public int EnableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.EnableData(ids); } /// /// 禁用 /// /// /// public int DisableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.DisableData(ids); } /// /// 判断辊道编号 /// /// /// //public bool pdrollNo(string rollNo) //{ // return repository.pdrollNo(rollNo); //} /// /// 根据分页条件获取分页菜单数据 /// /// /// /// /// /// 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; } /// /// 保存数据 /// /// /// public int insertRoll(GRoll htParams) { return repository.insertRoll(htParams); } /// /// 修改数据 /// /// public int updateRoll(GRoll htParams) { return repository.updateRoll(htParams); } /// /// 获取配置数据 /// /// //public ArrayList getSelectPartMaster_Model_name() //{ // Hashtable result = new Hashtable(); // DataTable dt = repository.getSelectPartMaster_Model_name(); // return DataTypeConvert.NewObject.DataTableToArrayList(dt); //} /// /// 获取客户产线列表 /// /// public List GetCustPDLine() { return repository.GetCustPDLine(); } /// /// 根据客户产线查询车型 /// /// public List GetMode_type(string CustPDLine) { return repository.GetMode_type(CustPDLine); } /// /// 根据车型编号查询座椅配置 /// /// public List GetModelList(int ModelType) { return repository.GetModelList(ModelType); } /// /// 判断辊道编号是否存在 /// /// 辊道编号 /// false:不存在 true :已存在 public bool IsExistOrd(string rollno) { Hashtable hsTalbe = new Hashtable(); string strWhere = " and roll_no ='" + rollno + "'"; List dt = repository.getRollNoList(strWhere); if (dt == null || dt.Count < 1) { return false; } return true; } /// /// 获取客户产线编号 /// /// public List GetCustID() { return repository.GetCustID(); } } }