/// <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 } }
/// <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 } }
/// <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) { } }
/// <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 } }
/// <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; }
/// <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 } }
/// <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 } }
/// <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) { } }
/// <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 } }
/// <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; }
/// <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 { } }
/// <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) { } }
/// <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 } }
/// <summary> /// 绑定计量员 /// </summary> /// <param name="asyc"></param> private void BindAllTaskDoResultAvgTime(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); List <SummaryStatisticsModel> ssms = InfoExchange.DeConvert(typeof(List <SummaryStatisticsModel>), strResult) as List <SummaryStatisticsModel>; if (ssms != null && ssms.Count > 0) { SummaryStatisticsModelList = new ObservableCollection <SummaryStatisticsModel>(ssms.OrderBy(r => r.opname).ToList()); } else { SummaryStatisticsModelList = new ObservableCollection <SummaryStatisticsModel>(); } SumChartSelectedIndex = 0; } catch //(Exception ex) { } }
/// <summary> /// 保存坐席关注的称点信息回调方法 /// </summary> /// <param name="asyc"></param> private void SaveAttentionClientCallback(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); var attionCallBack = InfoExchange.DeConvert(typeof(LoginServiceModel), strResult) as LoginServiceModel; if (!attionCallBack.success) { MessageBox.Show("数据保存失败!"); } else { System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => { this.Close(); })); } } catch (Exception ex) { MessageBox.Show("数据保存失败!原因:" + ex.Message); } }
/// <summary> /// 加载默认开始结束时间 /// </summary> private void LoadDefaultTime() { try { string serviceUrl = ConfigurationManager.AppSettings["querytimeBymatchid"].ToString().Replace('$', '&'); string getUrl = string.Format(serviceUrl, weightModel.matchid); HttpWebRequest request = WebRequestCommon.GetHttpGetWebRequest(getUrl, 10); string strResult = ComHelpClass.ResponseSynStr(request); var serviceModel = InfoExchange.DeConvert(typeof(WeightRealServiceModel), strResult) as WeightRealServiceModel; DateTime tareStartTime = DateTime.Now.AddSeconds(-30); DateTime tareEndTime = DateTime.Now.AddSeconds(30); DateTime grossStartTime = DateTime.Now.AddSeconds(-30); DateTime grossEndTime = DateTime.Now.AddSeconds(30); GetDefaultTime(serviceModel, ref tareStartTime, ref tareEndTime, ref grossStartTime, ref grossEndTime); dptPZPlayStartTime.Value = tareStartTime; dptPZPlayEndTime.Value = tareEndTime; dptMZPlayStartTime.Value = grossStartTime; dptMZPlayEndTime.Value = grossEndTime; } catch //(Exception ex) { } }
/// <summary> /// 绑定计量员 /// </summary> /// <param name="asyc"></param> private void BindCarWeightTaskCount(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); WeighingApparatusStatisticsModelList = InfoExchange.DeConvert(typeof(ObservableCollection <WeighingApparatusStatisticsModel>), strResult) as ObservableCollection <WeighingApparatusStatisticsModel>; //构造统计图信息 var chartData = from r in WeighingApparatusStatisticsModelList select new ChartClass() { Name = r.equname, Value = int.Parse(r.TotalCount) }; List <ChartClass> tempList = chartData.ToList <ChartClass>(); ChartClassList3 = new ObservableCollection <ChartClass>(); tempList.ForEach(m => { ChartClassList3.Add(m); }); } catch //(Exception ex) { } }
public bool SetRenderMainUI() { #region 计量业务信息控制 if (gridReader != null && gridReader.Children != null) { gridReader.Children.Clear(); } for (int i = gridReader.RowDefinitions.Count - 1; i > -1; i--) { gridReader.RowDefinitions.RemoveAt(i); } for (int i = gridReader.ColumnDefinitions.Count - 1; i > -1; i--) { gridReader.ColumnDefinitions.RemoveAt(i); } //增加判断 供方毛皮净 以及扣重 不再在动态列表显示……lt 2016-2-3 08:58:51…… List <RenderUI> getBullInfo = ReaderInfoList.Where(p => p.aboutweight == 0 && p.isdisplay == 1 && p.fieldname != "tareb" && p.fieldname != "grossb" && p.fieldname != "suttleb" && p.fieldname != "deduction").OrderBy(o => o.orderno).ToList <RenderUI>(); ColumnDefinition cd1 = new ColumnDefinition(); cd1.Width = new System.Windows.GridLength(70); ColumnDefinition cd2 = new ColumnDefinition(); ColumnDefinition cd3 = new ColumnDefinition(); cd3.Width = new System.Windows.GridLength(70); ColumnDefinition cd4 = new ColumnDefinition(); gridReader.ColumnDefinitions.Add(cd1); gridReader.ColumnDefinitions.Add(cd2); gridReader.ColumnDefinitions.Add(cd3); gridReader.ColumnDefinitions.Add(cd4); int columnNum = 0; int rowNum = 0;//控件添加在哪一行 lt 2016-2-3 09:36:46…… Color color = (Color)ColorConverter.ConvertFromString("#636363"); for (int i = 0; i <= getBullInfo.Count - 1; i++) { RowDefinition rd = new RowDefinition(); if (getBullInfo.Count > 12) { rd.Height = new System.Windows.GridLength(45); } else { rd.Height = new System.Windows.GridLength(50); } gridReader.RowDefinitions.Add(rd); TextBlock tb1 = getLableTB(); tb1.Text = getBullInfo[i].displayname; tb1.SetValue(Grid.RowProperty, rowNum); tb1.SetValue(Grid.ColumnProperty, columnNum);//0 tb1.Foreground = new SolidColorBrush(color); gridReader.Children.Add(tb1); columnNum = columnNum + 1; bool isBold = ComHelpClass.CheckIsFontWeightBold(getBullInfo[i].fieldname); TextBox tb2 = (i == 0 ? getInputTB(true) : getInputTB(false)); if (getBullInfo[i].quicksuggest == 1) { tb2.KeyDown += tb2_KeyDown; } tb2.TextWrapping = System.Windows.TextWrapping.Wrap; tb2.Name = getBullInfo[i].fieldname; tb2.VerticalContentAlignment = VerticalAlignment.Center; tb2.IsReadOnly = getBullInfo[i].writeable == 0?true:false;//0只读 1 可编辑 tb2.SetBinding(TextBox.TextProperty, new Binding(getBullInfo[i].fieldname) { Source = BindObject, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); tb2.SetValue(Grid.RowProperty, rowNum); tb2.SetValue(Grid.ColumnProperty, columnNum);//1 if (isBold) { tb2.FontWeight = FontWeights.Bold; } gridReader.Children.Add(tb2); columnNum = columnNum + 1; bool checkIsOneRow = ComHelpClass.CheckIsOneRow(getBullInfo[i].fieldname);//文本框 是不是一行显示出来……lt 2016-2-3 09:17:49…… if (checkIsOneRow) { tb2.SetValue(Grid.ColumnSpanProperty, 3); columnNum = 0; rowNum = rowNum + 1; continue; } //todo: lt 2016-1-27 19:10:44…… 两个一组 奇数时 不存在第二个 错误:大于索引退出 …… if (i + 1 >= getBullInfo.Count) { break; } checkIsOneRow = ComHelpClass.CheckIsOneRow(getBullInfo[i + 1].fieldname);//如果第一个不是 第二个是 则直接换行…… 2016-2-3 09:57:12 if (checkIsOneRow) { columnNum = 0; rowNum = rowNum + 1; continue; } isBold = ComHelpClass.CheckIsFontWeightBold(getBullInfo[i + 1].fieldname); TextBlock tb3 = getLableTB(); tb3.Text = getBullInfo[i + 1].displayname; tb3.SetValue(Grid.RowProperty, rowNum); tb3.SetValue(Grid.ColumnProperty, columnNum);//2 tb3.Foreground = new SolidColorBrush(color); gridReader.Children.Add(tb3); columnNum = columnNum + 1; TextBox tb4 = (i == 0 ? getInputTB(true) : getInputTB(false)); if (getBullInfo[i + 1].quicksuggest == 1) { tb4.KeyDown += tb2_KeyDown; } tb4.TextWrapping = System.Windows.TextWrapping.Wrap; tb4.Name = getBullInfo[i + 1].fieldname; tb4.VerticalContentAlignment = VerticalAlignment.Center; tb4.IsReadOnly = getBullInfo[i + 1].writeable == 0 ? true : false;//0只读 1 可编辑 tb4.SetBinding(TextBox.TextProperty, new Binding(getBullInfo[i + 1].fieldname) { Source = BindObject, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); //tb4.Text = "测试测试测试测试测试测试"; tb4.SetValue(Grid.RowProperty, rowNum); tb4.SetValue(Grid.ColumnProperty, columnNum);//3 if (isBold) { tb4.FontWeight = FontWeights.Bold; } gridReader.Children.Add(tb4); columnNum = 0; rowNum = rowNum + 1; i++; } #endregion int isDisplay = 0; #region 供方信息控制 //增加异常抛出 解决若不存在 供方信息时 则报 未将对象引用到实例的错误…… lt 2016-1-28 10:41:54 try { int tareBDis = ReaderInfoList.Where(p => p.fieldname == "tareb").FirstOrDefault().isdisplay; int grossbDis = ReaderInfoList.Where(p => p.fieldname == "grossb").FirstOrDefault().isdisplay; int suttlebDis = ReaderInfoList.Where(p => p.fieldname == "suttleb").FirstOrDefault().isdisplay; isDisplay = tareBDis * grossbDis * suttlebDis; //int isDisplay = ReaderInfoList.Where(p => p.fieldname == "tareb").FirstOrDefault().isdisplay * ReaderInfoList.Where(p => p.fieldname == "grossb").FirstOrDefault().isdisplay * ReaderInfoList.Where(p => p.fieldname == "suttleb").FirstOrDefault().isdisplay; if (isDisplay == 0) { gridSupplier.Visibility = Visibility.Collapsed; } else { gridSupplier.Visibility = Visibility.Visible; } } catch //(Exception ex) { } #endregion #region 称量信息控制 //解决扣重未配置时的错误…… lt 2016-1-28 10:43:26 try { isDisplay = 0; isDisplay = ReaderInfoList.Where(p => p.fieldname == "deduction").FirstOrDefault().isdisplay; //扣重是否显示 } catch //(Exception ex) { } //isDisplay = ReaderInfoList.Where(p => p.fieldname == "deduction").FirstOrDefault().isdisplay;//扣重是否显示 var getMinusDeduction = gridMeasureWeight.FindName("minusdeduction") as Border; var getTxtDeduction = gridMeasureWeight.FindName("txtdeduction") as TextBox; var getlblDeduction = gridMeasure.FindName("lbldeduction") as Label; if (isDisplay == 0) { if (getMinusDeduction != null) { getMinusDeduction.Visibility = Visibility.Hidden; } if (getTxtDeduction != null) { getTxtDeduction.Visibility = Visibility.Hidden; } if (getlblDeduction != null) { getlblDeduction.Visibility = Visibility.Hidden; } } else { if (getMinusDeduction != null) { getMinusDeduction.Visibility = Visibility.Visible; } if (getTxtDeduction != null) { getTxtDeduction.Visibility = Visibility.Visible; } if (getlblDeduction != null) { getlblDeduction.Visibility = Visibility.Visible; } } #endregion return(true); }
/// <summary> /// 查询毛重回调方法 /// </summary> /// <param name="asyc"></param> private void GetMaoRecordsCallback(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); this.MaoRecords = InfoExchange.DeConvert(typeof(List <WeightRecord>), strResult) as List <WeightRecord>; #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 = "获取毛重反馈的结果", Data = strResult, Origin = "汽车衡_" + LoginUser.Role.Name, OperateUserName = LoginUser.Name }; 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, ParamList = new List <DataParam>() { new DataParam() { ParamName = "matchid", ParamValue = this.BusinessId }, new DataParam() { ParamName = "carno", ParamValue = this.CarNum }, new DataParam() { ParamName = "begintime", ParamValue = this.StartDateTime.ToString() }, new DataParam() { ParamName = "endtime", ParamValue = this.EndDateTime.ToString() }, new DataParam() { ParamName = "mrecord", ParamValue = "G" }, new DataParam() { ParamName = "tareweighid", ParamValue = this.SelectedCarMeasure.equcode }, new DataParam() { ParamName = "selecttime", ParamValue = "grosstime" } } }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion } this.ShowBusy = false; }
/// <summary> /// 通过服务获取业务信息的回调方法 /// </summary> /// <param name="asyc"></param> public void getMeasureInfoCallback(IAsyncResult asyc) { try { LoginServiceModel mServiceModel; string strResult = ComHelpClass.ResponseStr(asyc); #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 = strResult }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion mServiceModel = GetLoginServiceModel(strResult); //mServiceModel = InfoExchange.DeConvert(typeof(LoginServiceModel), strResult) as LoginServiceModel; System.Threading.Thread.Sleep(3000);//时间太短,动画出不来,故而延迟4秒 if (mServiceModel.success) { InitLoginUserInfo(mServiceModel); GetWeighterClientInfos(); //logH.SaveLog("登录成功"); #region 日志 LogModel log1 = 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 = mServiceModel, IsDataValid = LogConstParam.DataValid_Ok, ParamList = new List <DataParam>() { new DataParam() { ParamName = "userName", ParamValue = UserName }, new DataParam() { ParamName = "password", ParamValue = CommonTranslationHelper.MD5(UserName + Password) } } }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1)); #endregion } else { System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => { StoryBoardEnable = false; this.ErrMsg = mServiceModel.msg; isLogin = false; return; })); } } catch (Exception ex) { System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => { StoryBoardEnable = false; this.ErrMsg = ex.Message; isLogin = false; return; })); #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 } }
/// <summary> /// 下载图片 /// </summary> /// <param name="list"></param> private void DownloadImags(List <PictureModel> list) { ComHelpClass cHelp = new ComHelpClass(); cHelp.DownloadImags(list); }
/// <summary> /// 获取图片信息回调方法 /// </summary> /// <param name="asyc"></param> private void GetMeasurePhotoCallback(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); List <PictureModel> pms = InfoExchange.DeConvert(typeof(List <PictureModel>), strResult) as List <PictureModel>; if (pms == null || pms.Count == 0) { this.ShowBusy = false; this.ShowMessage("信息提示", "未获取到图片信息!", true, false); SetCurTabScrollViewer(Visibility.Collapsed); return; } if (this.measureType == "G") { System.Windows.Application.Current.Dispatcher.Invoke( new System.Threading.ThreadStart(() => { this.MaoPictures = (from r in pms where r.measuretype == "G" select r).ToList(); DownloadImags(this.MaoPictures); } )); } else if (this.measureType == "T") { System.Windows.Application.Current.Dispatcher.Invoke( new System.Threading.ThreadStart(() => { this.PiPictures = (from r in pms where r.measuretype == "T" select r).ToList(); DownloadImags(this.PiPictures); } )); } else if (this.measureType == "")//类型为空字符串,净重查询图片的结果(皮、毛图片都有) { System.Windows.Application.Current.Dispatcher.Invoke( new System.Threading.ThreadStart(() => { this.PiPictures = (from r in pms where r.measuretype == "T" select r).ToList(); this.MaoPictures = (from r in pms where r.measuretype == "G" select r).ToList(); DownloadImags(this.PiPictures); DownloadImags(this.MaoPictures); } )); } this.ShowBusy = false; } catch (Exception ex) { this.ShowBusy = false; this.ShowMessage("系统提示", "获取图片失败,原因:" + ex.Message, true, false); #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 } this.measureType = "-1"; }
private void GetUpdatePasswordCallback(IAsyncResult asyc) { try { string strResult = ComHelpClass.ResponseStr(asyc); MeasureServiceModel mServiceModel = InfoExchange.DeConvert(typeof(MeasureServiceModel), strResult) as MeasureServiceModel; #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 = strResult, IsDataValid = LogConstParam.DataValid_Ok }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { this.ErrMsgLabel.Content = mServiceModel.msg; })); if (mServiceModel.success) { //logH.SaveLog("修改密码成功"); #region 日志 LogModel sLog = 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 }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(sLog)); #endregion System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { this.Close(); })); } else { //logH.SaveLog("修改密码失败:" + mServiceModel.msg); #region 日志 LogModel sLog = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_OutIn, FunctionName = "坐席_修改密码_保存用户新密码信息", Level = LogConstParam.LogLevel_Warning, Msg = "修改密码失败:" + mServiceModel.msg, Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(sLog)); #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 } }