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 { /// /// 安东呼叫统计分析 /// 于子清 /// 2017-11-13 /// public class AnDongCallBLL : BaseBLL { public DataResult> GetAllList(AnDongCallDModel condition) { DataResult> result = new DataResult>(); 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> GetRepairTimeAvg(AnDongCallDModel condition) { DataResult> result = new DataResult>(); 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 导出数据 /// /// 获取导出的数据 /// /// 查询条件 /// 数据 public DataResult GetExportData(AnDongCallDModel model) { DataResult result = new DataResult(); try { result.IsSuccess = true; result.Result = new AnDongCallDAL().GetExportData(model); } catch (Exception ex) { result.IsSuccess = false; result.Msg = "导出错误!"; } return result; } #endregion } }