using System; using System.Collections.Generic; using System.Linq; using System.Text; using QMAPP.MESReport.Entity.LineQTY; using QMAPP.MESReport.DAL.LineQTY; using QMAPP.BLL; using QMFrameWork.Data; using QMAPP.Entity; using System.Data; using QMAPP.FJC.BLL.Basic; using QMAPP.FJC.Entity.Basic; using QMAPP.MD.BLL; using QMAPP.MD.Entity; using QMAPP.MESReport.Entity.Tables; namespace QMAPP.MESReport.BLL.LineQTY { /// <summary> /// 安东呼叫统计分析 /// 于子清 /// 2017-11-13 /// </summary> public class AnDongCallBLL : BaseBLL { public DataResult<List<AnDongCallDModel>> GetAllList(AnDongCallDModel condition) { DataResult<List<AnDongCallDModel>> result = new DataResult<List<AnDongCallDModel>>(); try { result.Result = new AnDongCallDAL().GetAllList(condition); //var machines = new MachineInfoBLL().GetMachineList(new Material()); foreach (AnDongCallDModel item in result.Result) { //呼叫类型名称 if (!string.IsNullOrEmpty(item.CALL_TYPE)) { if (item.CALL_TYPE == "0") { item.CALL_TYPE_NAME = "维修"; } else if (item.CALL_TYPE == "1") { item.CALL_TYPE_NAME = "质量"; } else if (item.CALL_TYPE == "2") { item.CALL_TYPE_NAME = "物料"; } else if (item.CALL_TYPE == "3") { item.CALL_TYPE_NAME = "工程"; } } //设备名称 if (!string.IsNullOrEmpty(item.MACHINENAME)) { if (string.IsNullOrEmpty(item.MACHINENAME_SHORT)) { item.MACHINENAME_SHORT = item.MACHINENAME; } } } result.IsSuccess = true; return result; } catch (Exception ex) { result.IsSuccess = false; result.Msg = ex.ToString(); return result; } } public DataResult<List<AnDongCallDModel>> GetRepairTimeAvg(AnDongCallDModel condition) { DataResult<List<AnDongCallDModel>> result = new DataResult<List<AnDongCallDModel>>(); try { result.Result = new AnDongCallDAL().GetRepairTimeAvg(condition); var machineInfos = new MachineInfoBLL().GetAllList(new MachineInfo()); foreach (AnDongCallDModel item in result.Result) { //处理人 if (!string.IsNullOrEmpty(item.MACHINECODDE)) { var machineInfo = machineInfos.FirstOrDefault(x => x.MACHINECODDE == item.MACHINECODDE); if (machineInfo != null) { if (!string.IsNullOrEmpty(machineInfo.MACHINENAME_SHORT)) { item.MACHINENAME = machineInfo.MACHINENAME_SHORT; } else { item.MACHINENAME = machineInfo.MACHINENAME; } } else { item.MACHINENAME = item.MACHINECODDE; } } } result.IsSuccess = true; return result; } catch (Exception ex) { result.IsSuccess = false; result.Msg = ex.ToString(); return result; } } #region 导出数据 /// <summary> /// 获取导出的数据 /// </summary> /// <param name="user">查询条件</param> /// <returns>数据</returns> public DataResult<DataTable> GetExportData(AnDongCallDModel model) { DataResult<DataTable> result = new DataResult<DataTable>(); try { result.IsSuccess = true; result.Result = new AnDongCallDAL().GetExportData(model); } catch (Exception ex) { result.IsSuccess = false; result.Msg = "导出错误!"; } return result; } #endregion } }