public Stream GetBaseInfo() { ResGetBaseInfo response = new ResGetBaseInfo(); try { //*.取得机型列表 List <NodeInfo> modelList = List2Tree(MACHINETYPEMSTRule.GetList()); //*.取得点检部位树形菜单 List <PatrolSpotParts> spotPartsListBase = PatrolSpotPartsRule.GetList(); List <NodeInfo> checkList = SpotPartsList2Tree(spotPartsListBase); //*.取得机器状态列表 List <NodeInfo> machineStatusList = List2Tree(PatrolCodeMstRule.GetListOfMachineStatus()); //*.取得问题程度列表 List <NodeInfo> questionLevelList = List2Tree(PatrolCodeMstRule.GetListOfQuestionLevel()); //*.取得点检状态列表 List <NodeInfo> spotStatusList = List2Tree(PatrolCodeMstRule.GetListOfSpotStatus()); //*.取得联系方式列表 List <NodeInfo> contactTypeList = List2Tree(PatrolCodeMstRule.GetListOfContactType()); //*.取得联系人类型列表 List <NodeInfo> contactorTypeList = List2Tree(PatrolCodeMstRule.GetListOfContactorType()); //组织数据 response.model_list = modelList; response.check_list = checkList; response.machine_status_list = machineStatusList; response.level_list = questionLevelList; response.spot_status_list = spotStatusList; response.phone_type_list = contactTypeList; response.contact_type_list = contactorTypeList; //输出成功状态 response.SetSuccess(); } catch (Exception ex) { Console.WriteLine(ex.Message); #region 日志输出 CommonInfo.Error("手机端获取基础数据错误" + ex.Message); #endregion } //将消息序列化为Json格式数据 DataContractJsonSerializer obj2Json = new DataContractJsonSerializer(typeof(ResGetBaseInfo)); MemoryStream ms = new MemoryStream(); obj2Json.WriteObject(ms, response); //注意一定要设置流的位置到开始位置,否则没有消息输出 ms.Position = 0; return(ms); }
/// <summary> /// 取得基础数据 用于查询特巡报告条件 /// </summary> /// <param name="data"></param> /// <returns></returns> public Stream GetPatrolBase(Stream data) { #region 查找数据 ResGetPatrolBase response = new ResGetPatrolBase(); bool success = false; try { PatrolBaseInfo patrolbase = new PatrolBaseInfo(); #region 单独处理 未启用 ////代理店信息列表 //List<NodeInfo> agency_shop_list = List2Tree(COMPANYMSTRule.GetList()); ////分公司信息列表 //List<SUBCOMPANYMST> filiale_list = List2Tree(SUBCOMPANYMSTRule.GetList()); ////报告人信息列表(建友用户系统) //List<NodeInfo> reporter_list = List2Tree(STAFFMSTRule.GetList()); #endregion //代理店信息列表 List <CompanyInfo> agency_shop_list = ResGetPatrolBase.Transfer(COMPANYMSTRule.GetList()); //分公司信息列表 List <SubCompanyInfo> filiale_list = ResGetPatrolBase.Transfer(SUBCOMPANYMSTRule.GetList()); ////报告人信息列表(建友用户系统) List <StaffInfo> reporter_list = ResGetPatrolBase.Transfer(BaseEntity.getStaffListInPatrol()); ////代理店分公司树形结构数据 //List<NodeInfo> company_list = GetCompanyTree(agency_shop_list, filiale_list, reporter_list); //机型信息列表 List <NodeInfo> machine_type_list = List2Tree(MACHINETYPEMSTRule.GetList());; //机器状态信息列表 List <NodeInfo> machine_status_list = List2Tree(PatrolCodeMstRule.GetListOfMachineStatus()); //*.取得点检部位树形菜单 List <PatrolSpotParts> spotPartsListBase = PatrolSpotPartsRule.GetList(); List <NodeInfo> checkList = SpotPartsList2Tree(spotPartsListBase); //组织数据 patrolbase.agency_shop_list = agency_shop_list; patrolbase.filiale_list = filiale_list; patrolbase.reporter_list = reporter_list; patrolbase.machine_type_list = machine_type_list; patrolbase.machine_status_list = machine_status_list; patrolbase.check_list = checkList; response.patrolbase = patrolbase; //输出成功状态 success = true; } catch (Exception ex) { Console.WriteLine(ex.Message); #region 日志输出 CommonInfo.Error("获取特巡基础数据错误" + ex.Message); #endregion } //返回消息体 if (success) { response.SetSuccess(); } else { ////默认是失败 //response.SetFailed(); } //将消息序列化为Json格式数据 DataContractJsonSerializer obj2Json = new DataContractJsonSerializer(typeof(ResGetPatrolBase)); MemoryStream ms = new MemoryStream(); obj2Json.WriteObject(ms, response); //注意一定要设置流的位置到开始位置,否则没有消息输出 ms.Position = 0; return(ms); #endregion }