示例#1
0
 /// <summary>
 /// 获取实时重量数据日志信息函数
 /// </summary>
 /// <param name="asyc"></param>
 private void GetWeightRealDataRecordsCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult    = ComHelpClass.ResponseStr(asyc);
         var    serviceModel = InfoExchange.DeConvert(typeof(WeightRealServiceModel), strResult) as WeightRealServiceModel;
         WeightRealDataList = serviceModel.rows;
         #region 测试用
         if (wrd != null && !WeightRealDataList.Contains(wrd))
         {
             WeightRealDataList.Add(wrd);
         }
         #endregion 测试用
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_重量日志窗体_获取实时重量数据日志信息函数",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取实时重量信息失败!原因:" + ex.Message,
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
     this.ShowBusy = false;
 }
示例#2
0
        private List <Module> GetListModule(string str)
        {
            List <Module> list = new List <Module>();

            try
            {
                if (str != "[]")
                {
                    //JObject jo = JsonHelpClass.JsonStringToJObject(str);

                    List <moudleQx> equModels = InfoExchange.DeConvert(typeof(List <moudleQx>), str) as List <moudleQx>;
                    foreach (var item in equModels)
                    {
                        Module mm = new Module();
                        mm.Resourcecode = item.RESOURCECODE;
                        mm.Resourcename = item.RESOURCENAME;
                        mm.Resourcetype = item.RESOURCECODE;
                        mm.Resourcememo = item.RESOURCECODE;
                        mm.modulecode   = item.RESOURCECODE;
                        mm.modulename   = item.RESOURCECODE;
                        //mm.Children = GetListButtonmemu(jo["children"].ToString());
                        list.Add(mm);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(list);
        }
示例#3
0
        /// <summary>
        /// 绑定计量任务流水
        /// </summary>
        /// <param name="asyc"></param>
        private void BindTaskDoResult(IAsyncResult asyc)
        {
            try
            {
                string strResult = ComHelpClass.ResponseStr(asyc);
                PersonalStatisticsModelList = InfoExchange.DeConvert(typeof(ObservableCollection <PersonalStatisticsModel>), strResult) as ObservableCollection <PersonalStatisticsModel>;
                string temp = string.Format("{0}的个人统计({1}车)", _selectedUser.DisplayName, PersonalStatisticsModelList.Count);
                //构造统计图信息
                var chartData = from r in PersonalStatisticsModelList
                                select new ChartClass()
                {
                    Name  = r.taskbegintime.ToString("yyyy-MM-dd HH:mm:ss"),
                    Value = Convert.ToInt32(r.timecount)
                };
                List <ChartClass> tempList = chartData.ToList <ChartClass>();
                ChartClassList1 = new ObservableCollection <ChartClass>();

                tempList.ForEach(m =>
                {
                    ChartClassList1.Add(m);
                });
            }
            catch //(Exception ex)
            {
            }
        }
        public async void GetMaterialsBySelectType()
        {
            string typeId = SelectedType.Id.ToString();

            HqlQuerySetting qsMaterial = new HqlQuerySetting();

            qsMaterial.QueryString = string.Format("select r from SMES.FrameworkAdpt.MaterialChooseControl.MaterialModelAdpt r where r.MaterialType.Id = {0} and r.IsUsed = true", typeId);

            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var resultMaterial      = await wcf.Invoke <MDF.Framework.Db.IDatabaseService>(c => c.Query(qsMaterial));

            if (resultMaterial.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MaterialModelAdpt> >(resultMaterial.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

                SetVisbleDatas(list);

                MaterialsTemp = list;

                list.Insert(0, new MaterialModelAdpt()
                {
                    Id = -1, Name = "请选择", Cd = ""
                });
                this.ItemSource = list;

                QueryBySerachText();
            }
        }
示例#5
0
 /// <summary>
 /// 获取衡器回调函数
 /// </summary>
 /// <param name="ar"></param>
 private void GetCarMeasuresCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult          = ComHelpClass.ResponseStr(asyc);
         var    SeatAttentionInfos = InfoExchange.DeConvert(typeof(List <SeatAttentionWeightModel>), strResult) as List <SeatAttentionWeightModel>;
         var    equs = (from r in SeatAttentionInfos
                        select r).OrderBy(c => c.equcode).ToList();
         CarMeasures   = new ObservableCollection <SeatAttentionWeightModel>(equs);
         this.ShowBusy = false;
     }
     catch (Exception ex)
     {
         this.ShowBusy = false;
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_数据查询窗体",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取衡器信息失败!原因:" + ex.Message,
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
示例#6
0
 /// <summary>
 /// 获取图片信息回调方法
 /// </summary>
 /// <param name="asyc"></param>
 private void GetMeasurePhotoCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult = ComHelpClass.ResponseStr(asyc);
         List <PictureModel> pictureInfos = InfoExchange.DeConvert(typeof(List <PictureModel>), strResult) as List <PictureModel>;
         System.Windows.Application.Current.Dispatcher.BeginInvoke(new System.Threading.ThreadStart(() =>
         {
             this.Pictures.ItemsSource = null;
             DownloadImags(pictureInfos);
             this.Pictures.ItemsSource = pictureInfos;
         }
                                                                                                    ));
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_Out,
             FunctionName    = "坐席_历史相似重量信息_获取图片信息回调方法",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "通过服务读取图片信息失败!原因:" + ex.Message,
             Origin          = LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
示例#7
0
 /// <summary>
 /// 获取关注的汽车衡称点信息回调函数
 /// </summary>
 /// <param name="asyc"></param>
 private void GetWeighterClientInfoCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult = ComHelpClass.ResponseStr(asyc);
         SeatAttentionInfos = InfoExchange.DeConvert(typeof(List <SeatAttentionWeightModel>), strResult) as List <SeatAttentionWeightModel>;
         var clientInfos = (from r in SeatAttentionInfos
                            where r.isinseat == "是" &&
                            r.seatid == LoginUser.Role.Code
                            select r).OrderBy(c => c.equcode).ToList();
         ConfigSynchronous(clientInfos);
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_登录窗体_获取关注的汽车衡称点信息回调函数",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取坐席关注的称点信息失败!原因:" + ex.Message,
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
示例#8
0
        /// <summary>
        /// 下载配置文件
        /// </summary>
        /// <param name="configFileName">配置文件名称(带路径)</param>
        /// <param name="versionNum">版本号</param>
        /// <param name="clientCode">称点编号</param>
        /// <param name="ClientName">称点名称</param>
        private void ConfigFileDownLoad(string configFileName, string versionNum, string clientCode, string ClientName)
        {
            try
            {
                string serviceUrl = ConfigurationManager.AppSettings["getEquParamInfo"].ToString();
                var    param      = new
                {
                    versionnum = -1,
                    equcode    = clientCode,
                    equname    = ""//ClientName
                };
                string         getUrl  = string.Format(serviceUrl, "[" + JsonConvert.SerializeObject(param) + "]");
                HttpWebRequest request = WebRequestCommon.GetHttpGetWebRequest(getUrl, 10);

                WebResponse  response  = request.GetResponse();
                StreamReader sr        = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                String       strResult = sr.ReadToEnd();
                sr.Close();
                if (string.IsNullOrEmpty(strResult))
                {
                    return;
                }
                List <EquModel> equModels = InfoExchange.DeConvert(typeof(List <EquModel>), strResult) as List <EquModel>;
                if (equModels.Count > 0)
                {
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(configFileName);
                    sw.WriteLine(equModels.First().paraminfos.Replace("GBK", "UTF-8"));
                    sw.Close();
                }
            }
            catch //(Exception ex)
            {
            }
        }
示例#9
0
 /// <summary>
 /// 获取坐席信息回调函数
 /// </summary>
 /// <param name="asyc"></param>
 private void GetSeatListCallback(IAsyncResult asyc)
 {
     try
     {
         List <SeatAttentionWeightModel> equModels;
         string strResult = ComHelpClass.ResponseStr(asyc);
         equModels = InfoExchange.DeConvert(typeof(List <SeatAttentionWeightModel>), strResult) as List <SeatAttentionWeightModel>;
         Seats     = (from r in equModels
                      where r.seatid != LoginUser.Role.Code
                      select r).OrderBy(c => c.seatid).ToList();
         System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { this.itemsControlMenu.ItemsSource = Seats; }));
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席任务处理_关闭窗体_获取坐席信息回调方法",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取坐席信息失败!原因:" + ex.Message,
             Origin          = LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
示例#10
0
 public static T ObjectClone <T>(T src_obj)
 {
     return
         (InfoExchange.DeConvert <T>(
              InfoExchange.ConvertToJson(src_obj, InfoExchange.SetingsKonwnTypesBinder),
              InfoExchange.SetingsKonwnTypesBinder
              ));
 }
示例#11
0
        public override object Process(MDF.Framework.BusinessService.ServiceResponse response)
        {
            if (response.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MaterialTypeModelAdpt> >(response.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                MaterialTypes = list;
            }

            return(null);
        }
示例#12
0
文件: RenderMainUI.cs 项目: rcw0125/-
 /// <summary>
 /// 通过业务号查询相关基础信息的回调方法
 /// </summary>
 /// <param name="asyc"></param>
 public void getBusinessAbortInfosCallback(IAsyncResult asyc)
 {
     //以下代码未开发完
     try
     {
         string strResult     = ComHelpClass.ResponseStr(asyc);
         var    taskCodeInfos = InfoExchange.DeConvert(typeof(List <TaskCodeModel>), strResult) as List <TaskCodeModel>;
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席任务处理窗体",
             Level           = LogConstParam.LogLevel_Info,
             Msg             = "从服务器查询基础数据成功!",
             Origin          = LoginUser.Role.Name,
             OperateUserName = LoginUser.Name,
             Data            = taskCodeInfos,
             IsDataValid     = LogConstParam.DataValid_Ok
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
         if (taskCodeInfos != null && taskCodeInfos.Count > 0)
         {
             gridReader.Dispatcher.BeginInvoke(new Action(() =>
             {
                 dataViewPop.PlacementTarget = curQueryUI;
                 dataViewPop.Placement       = PlacementMode.Bottom;
                 DataGrid dg        = dataViewPop.FindName("PopDataGrid") as DataGrid;
                 dg.ItemsSource     = taskCodeInfos;
                 dataViewPop.IsOpen = true;
             }));
             //dataViewPop.PlacementTarget = curQueryUI;
             //dataViewPop.Placement = PlacementMode.Bottom;
             //dataViewPop.IsOpen = true;
         }
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_Out,
             FunctionName    = "坐席任务处理窗体",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "通过服务查询基础信息失败!原因:" + ex.Message,
             Origin          = LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
        public async void GetTypes(List <string> QueryTypeIds)
        {
            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var result = await wcf.Invoke <IMeasureService>(c => c.GetTypes(QueryTypeIds));

            if (result.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MeasureTypeModelFAdpt> >(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                MeasureTypes = list;
            }
        }
示例#14
0
 /// <summary>
 /// 绑定计量员
 /// </summary>
 /// <param name="asyc"></param>
 private void BindUserCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult = ComHelpClass.ResponseStr(asyc);
         UserList = InfoExchange.DeConvert(typeof(ObservableCollection <MeasureUserModel>), strResult) as ObservableCollection <MeasureUserModel>;
     }
     catch //(Exception ex)
     {
     }
 }
        public async void GetAreas()
        {
            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var result = await wcf.Invoke <IOrgInfoService>(c => c.GetAreas(QueryAreaIds.First()));

            if (result.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <IHierarchyModel> >(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                Areas = list;
            }
        }
        public async void LoadDatas()
        {
            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var result = await wcf.Invoke <IComMaterialTypeService>(c => c.GetMaterialTypes(GetMaterialTypeIds()));

            if (result.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MaterialTypeModelAdpt> >(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                MaterialTypes = list;
            }
        }
示例#17
0
 /// <summary>
 /// 获取关注的汽车衡称点信息回调函数
 /// </summary>
 /// <param name="asyc"></param>
 private void GetWeighterClientInfoCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult = ComHelpClass.ResponseStr(asyc);
         var    oldlist   = InfoExchange.DeConvert(typeof(List <SeatAttentionWeightModel>), strResult) as List <SeatAttentionWeightModel>;
         var    list      = GetNewList(oldlist);
         System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             if (this.attentionTypes == AttentionTypes.CarMeasure)
             {
                 Attentions = (from r in list where r.seattype == "RC" select r).OrderBy(c => c.equcode).ToList();
             }
             else if (this.attentionTypes == AttentionTypes.TrainMeasure)
             {
                 Attentions = (from r in list where r.seattype == "RT" select r).OrderBy(c => c.equcode).ToList();
             }
             else if (this.attentionTypes == AttentionTypes.MoltenIron)
             {
                 Attentions = (from r in list where r.seattype == "RI" select r).OrderBy(c => c.equcode).ToList();
             }
             DataGrid.ItemsSource = attentions;
         }));
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_发送通知窗体_获取关注的汽车衡称点信息回调函数",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取坐席关注的称点信息失败!原因:" + ex.Message,
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name,
             ParamList       = new List <DataParam>()
             {
                 new DataParam()
                 {
                     ParamName = "seatname", ParamValue = LoginUser.Role.Name
                 },
                 new DataParam()
                 {
                     ParamName = "seatid", ParamValue = LoginUser.Role.Code
                 }
             }
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
        public async void GetMeasures(List <string> QueryTypeIds)
        {
            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var resultMaterial      = await wcf.Invoke <IMeasureService>(c => c.GetMeasures(QueryTypeIds));

            if (resultMaterial.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MeasureModelFAdpt> >(resultMaterial.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

                ItemSource  = list;
                PersonsTemp = list;
            }
        }
        public async void GetEquipmentTypes()
        {
            var typeIds = QueryEquipmentTypeIds;

            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var result = await wcf.Invoke <IEquipmentService>(c => c.GetTypes(typeIds));

            if (result.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <EquipmentTypeModelFAdpt> >(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                EquipmentTypes = list;
            }
        }
        //public async void GetMaterialTypes()
        //{
        //    MDF.Framework.Db.HqlQuerySetting qs = new Framework.Db.HqlQuerySetting();
        //    string hql = "";

        //    if (MaterialTypeIdString == "All")
        //    {
        //        hql = string.Format("select r from SMES.FrameworkAdpt.MaterialChooseControl.MaterialTypeModelAdpt r where r.IsUsed = true");
        //    }
        //    else
        //    {
        //        hql = string.Format("select r from SMES.FrameworkAdpt.MaterialChooseControl.MaterialTypeModelAdpt r where r.IsUsed = true and id in ({0})", MaterialTypeIdString);
        //    }

        //    qs.QueryString = hql;

        //    MDF.Framework.Bus.SynInvokeWcfService wcf = new Framework.Bus.SynInvokeWcfService();
        //    var result = await wcf.Invoke<MDF.Framework.Db.IDatabaseService>(c => c.Query(qs));

        //    if (result.IsSuccess)
        //    {
        //        if (MaterialTypeIdString == "All")
        //        {
        //            var list = InfoExchange.DeConvert<List<MaterialTypeModelAdpt>>(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

        //            var firstLeaveNodes = list.Where(c => c.Parent == null).ToList();

        //            foreach (var item in firstLeaveNodes)
        //            {
        //                SetChilds(item, list);
        //            }

        //            MaterialTypes = firstLeaveNodes;
        //        }
        //        else
        //        {
        //            var list = InfoExchange.DeConvert<List<MaterialTypeModelAdpt>>(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
        //            MaterialTypes = list;
        //        }


        //    }
        //}

        public async void GetMaterialTypes()
        {
            var typeIds = QueryMaterialTypeIds;

            MDF.Framework.Bus.SynInvokeWcfService wcf = new Framework.Bus.SynInvokeWcfService();
            var result = await wcf.Invoke <IComMaterialTypeService>(c => c.GetMaterialTypes(typeIds));

            if (result.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MaterialTypeModelAdpt> >(result.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);
                MaterialTypes = list;
            }
        }
示例#21
0
 /// <summary>
 /// 获取衡器回调函数
 /// </summary>
 /// <param name="ar"></param>
 private void GetCarMeasuresCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult          = ComHelpClass.ResponseStr(asyc);
         var    SeatAttentionInfos = InfoExchange.DeConvert(typeof(List <SeatAttentionWeightModel>), strResult) as List <SeatAttentionWeightModel>;
         var    equs = (from r in SeatAttentionInfos
                        where r.isinseat == "是" &&
                        r.seatid == LoginUser.Role.Code &&
                        r.seattype == equType
                        select r).OrderBy(c => c.equcode).ToList();
         CarMeasures = new ObservableCollection <SeatAttentionWeightModel>(equs);
         if (CarMeasures.Count > 0)
         {
             this.SelectedCarMeasure = CarMeasures.First();
         }
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_重量日志窗体_获取衡器回调函数",
             Level           = LogConstParam.LogLevel_Info,
             Msg             = "获取衡器信息成功!",
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name,
             Data            = SeatAttentionInfos,
             IsDataValid     = "有效"
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
     catch (Exception ex)
     {
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "坐席_重量日志窗体_获取衡器回调函数",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "获取衡器信息失败!原因:" + ex.Message,
             Origin          = "汽车衡_" + LoginUser.Role.Name,
             OperateUserName = LoginUser.Name
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
     this.ShowBusy = false;
 }
示例#22
0
 /// <summary>
 /// 保存之后回调
 /// </summary>
 private void saveInfoCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult       = ComHelpClass.ResponseStr(asyc);
         var    getServiceModel = InfoExchange.DeConvert(typeof(MeasureServiceModel), strResult) as MeasureServiceModel;
         System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
         {
             if (getServiceModel.success)
             {
                 #region 日志
                 LogModel log = new LogModel()
                 {
                     CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     Direction       = LogConstParam.Directions_OutIn,
                     FunctionName    = "坐席_历史相似重量信息_保存信息",
                     Level           = LogConstParam.LogLevel_Info,
                     Msg             = "相似重量保存信息成功:用户备注:" + this.msgTxt.Text.Trim() + "  物流号集合:" + GetMatchidList(),
                     Origin          = LoginUser.Role.Name,
                     OperateUserName = LoginUser.Name,
                 };
                 Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
                 #endregion
                 this.Close();
             }
             else
             {
                 #region 日志
                 LogModel log = new LogModel()
                 {
                     CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     Direction       = LogConstParam.Directions_OutIn,
                     FunctionName    = "坐席_历史相似重量信息_保存信息",
                     Level           = LogConstParam.LogLevel_Warning,
                     Msg             = "相似重量保存信息失败,原因:" + getServiceModel.msg,
                     Origin          = LoginUser.Role.Name,
                     OperateUserName = LoginUser.Name,
                     Data            = getServiceModel
                 };
                 Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
                 #endregion
                 MessageBox.Show(getServiceModel.msg);
             }
         }));
     }
     catch
     {
     }
 }
        public override object Process(ServiceResponse response)
        {
            this.ServiceError = null;
            if (response.IsSuccess)
            {
                if (response.InfoMessage == null || response.InfoMessage.ToLower() == "null")
                {
                    this.DataSource = null;
                    return(null);
                }

                object current         = null;
                var    pageIndex       = 0;
                var    currentPosition = 0;
                if (this.DataSource != null && this.DataSource.CurrentItem != null)
                {
                    current         = this.DataSource.CurrentItem;
                    pageIndex       = this.DataSource.PageIndex;
                    currentPosition = this.DataSource.CurrentPosition;
                }
                var ds = new PagedCollectionView(InfoExchange.DeConvert <IList>(response.InfoMessage, InfoExchange.SetingsKonwnTypesBinder));
                if (current != null)
                {
                    var item = ds.OfType <object>().Where(c => c.Equals(current)).FirstOrDefault();
                    if (item != null)
                    {
                        ds.MoveCurrentTo(item);
                    }
                    else
                    {
                        try
                        {
                            ds.MoveToPage(pageIndex);
                            ds.MoveCurrentToPosition(currentPosition);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                this.DataSource = ds;
            }
            else
            {
                this.DataSource   = null;
                this.ServiceError = response.ExceptionMessage;
            }
            return(this.DataSource);
        }
        public async void GetInitPersons()
        {
            var typeIds = QueryAreaIds;

            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var resultMaterial      = await wcf.Invoke <IOrgInfoService>(c => c.GetPersons(typeIds.First()));

            if (resultMaterial.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <PersonModel> >(resultMaterial.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

                ItemSource  = list;
                PersonsTemp = list;
            }
        }
示例#25
0
        /// <summary>
        /// 调用服务保存图片信息
        /// <param name="pFile"> 文件名</param>
        /// </summary>
        private bool SaveImgInfo(string pFile, string pPath, string pClientCode)
        {
            try
            {
                string[] data = pFile.Split(new Char[] { '_' });
                if (data.Length < 2)
                {
                    return(false);
                }
                var temp = new
                {
                    matchid     = data[0],
                    photo       = pPath + "/" + pFile,
                    measuretype = data[1],
                    equcode     = pClientCode,
                    equname     = "",
                };

                string jsonStr = "[" + InfoExchange.ConvertToJsonIgnoreRef1(temp) + "]";

                string         serviceUrl = string.Format(_saveMeasurePhoto, jsonStr);
                HttpWebRequest request    = WebRequestCommon.GetHttpGetWebRequest(serviceUrl, 10);
                WebResponse    tResponse  = request.GetResponse();

                Encoding myEncode = Encoding.GetEncoding("UTF-8");

                string strResult;
                using (StreamReader sr = new StreamReader(tResponse.GetResponseStream(), myEncode))
                {
                    strResult = sr.ReadToEnd();
                }

                LoginServiceModel rtn = InfoExchange.DeConvert(typeof(LoginServiceModel), strResult) as LoginServiceModel;
                if (rtn != null && rtn.success == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                log.Error("写文件信息到服务失败,错误信息:" + ex.Message);
                return(false);
            }
        }
示例#26
0
        /// <summary>
        /// 下载配置文件
        /// </summary>
        /// <param name="configFileName">配置文件名称(带路径)</param>
        /// <param name="versionNum">版本号</param>
        /// <param name="clientCode">称点编号</param>
        /// <param name="ClientName">称点名称</param>
        private void ConfigFileDownLoad(string configFileName, string versionNum, string clientCode, string ClientName)
        {
            string serviceUrl = ConfigurationManager.AppSettings["getEquParamInfo"].ToString();
            var    param      = new
            {
                versionnum = -1,
                equcode    = clientCode,
                equname    = ""//ClientName
            };
            string         getUrl  = string.Format(serviceUrl, "[" + JsonConvert.SerializeObject(param) + "]");
            HttpWebRequest request = WebRequestCommon.GetHttpGetWebRequest(getUrl, 10);

            WebResponse  response  = request.GetResponse();
            StreamReader sr        = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
            String       strResult = sr.ReadToEnd();

            sr.Close();
            List <EquModel> equModels = InfoExchange.DeConvert(typeof(List <EquModel>), strResult) as List <EquModel>;

            if (equModels.Count > 0)
            {
                try
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(configFileName))
                    {
                        sw.WriteLine(equModels.First().paraminfos.Replace("GBK", "UTF-8"));
                        sw.Close();
                    }
                }
                catch (Exception ex)
                {
                    #region 写日志
                    LogModel log = new LogModel()
                    {
                        CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                        Direction       = LogConstParam.Directions_Out,
                        FunctionName    = "坐席_任务主窗体_ConfigFileDownLoad",
                        Level           = LogConstParam.LogLevel_Info,
                        Msg             = "关注完称点,下载称点配置,拿到服务反馈的配置信息生成配置文件时异常:" + ex.Message,
                        Origin          = "汽车衡_" + LoginUser.Role.Name,
                        OperateUserName = LoginUser.Name
                    };
                    Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
                    #endregion
                }
            }
        }
        public async void GetInitEquipments()
        {
            var typeIds = QueryEquipmentTypeIds;

            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var results             = await wcf.Invoke <IEquipmentService>(c => c.GetEquipments(typeIds));

            if (results.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <EquipmentModelFAdpt> >(results.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

                SetVisbleDatas(list);

                ItemSource     = list;
                EquipmentsTemp = list;
            }
        }
        public async void GetInitMaterials()
        {
            var typeIds = QueryMaterialTypeIds;

            SynInvokeWcfService wcf = new SynInvokeWcfService();
            var resultMaterial      = await wcf.Invoke <IComMaterialTypeService>(c => c.GetMaterials(typeIds));

            if (resultMaterial.IsSuccess)
            {
                var list = InfoExchange.DeConvert <List <MaterialModelAdpt> >(resultMaterial.InfoMessage, InfoExchange.SetingsKonwnTypesBinder);

                SetVisbleDatas(list);

                ItemSource    = list;
                MaterialsTemp = list;
            }
        }
示例#29
0
 /// <summary>
 /// 上传配置数据回调方法
 /// </summary>
 /// <param name="asyc"></param>
 private void UpLoadConfigDataCallback(IAsyncResult asyc)
 {
     try
     {
         string strResult      = ComHelpClass.ResponseStr(asyc);
         var    attionCallBack = InfoExchange.DeConvert(typeof(LoginServiceModel), strResult) as LoginServiceModel;
         if (!attionCallBack.success)
         {
             MessageBox.Show("数据保存失败!");
             return;
         }
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "配置管理窗体",
             Level           = LogConstParam.LogLevel_Info,
             Msg             = "上传配置信息成功!",
             Origin          = "配置管理",
             OperateUserName = "",
             Data            = attionCallBack,
             IsDataValid     = LogConstParam.DataValid_Ok
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
         MessageBox.Show("上传成功!");
     }
     catch (Exception ex)
     {
         MessageBox.Show("数据保存异常!原因:" + ex.Message);
         #region 日志
         LogModel log = new LogModel()
         {
             CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
             Direction       = LogConstParam.Directions_OutIn,
             FunctionName    = "配置管理窗体",
             Level           = LogConstParam.LogLevel_Error,
             Msg             = "上传配置信息失败!原因:" + ex.Message,
             Origin          = "配置管理",
             OperateUserName = ""
         };
         Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
         #endregion
     }
 }
示例#30
0
 /// <summary>
 /// 异步调用返回值
 /// </summary>
 /// <param name="asyc"></param>
 private void GetCarHistoryTare1Callback(IAsyncResult asyc)
 {
     try
     {
         MeasureServiceModel mServiceModel;
         string strResult = ComHelpClass.ResponseStr(asyc);
         mServiceModel = InfoExchange.DeConvert(typeof(MeasureServiceModel), strResult) as MeasureServiceModel;
         System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             ShowHistoryTareView view = new ShowHistoryTareView(mServiceModel.rows);
             view.ShowDialog();
         }));
     }
     catch //(Exception ex)
     {
     }
 }