| | |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | using iWare_SCADA_Model; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | |
| | | MessageBox.Show("异常:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void button4_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void btn_TongJi_Click(object sender, EventArgs e) |
| | | { |
| | | //统计 |
| | | |
| | | int store_FDJ = 0;//现有发动机数 |
| | | int store_EmptySalver = 0;//空托盘数量 |
| | | int store_EmptySalver_TS = 0;//空托盘托数 |
| | | |
| | | int count_In_FDJ = 0;//查询某天入库了多少发动机 |
| | | int count_In_EmptySalver = 0;//查询某天入库了多少 空托盘 |
| | | int count_In_EmptySalver_TS = 0;//查询某天入库了多少 空托盘托数 |
| | | |
| | | int count_Out_FDJ = 0;//查询某天出库了多少发动机 |
| | | int count_Out_EmptySalver = 0;//查询某天出库了多少 空托盘 |
| | | int count_Out_EmptySalver_TS = 0;//查询某天出库了多少 空托盘托数 |
| | | |
| | | int count_ZY_EmptySalver = 0;//查询某天转运了多少 空托盘 |
| | | int count_ZY_EmptySalver_TS = 0;//查询某天转运了多少 空托盘托数 |
| | | |
| | | //某段时间的统计 |
| | | var str_start = this.dateTimePicker_Start.Value.ToString("yyyy-MM-dd" + " " + "00:00:00"); |
| | | var str_end = this.dateTimePicker_End.Value.ToString("yyyy-MM-dd" + " " + "23:59:59"); |
| | | var start = Convert.ToDateTime(str_start); |
| | | var end = Convert.ToDateTime(str_end); |
| | | |
| | | int allPlacesCount = 0; |
| | | |
| | | List<string> strList = new List<string>() { |
| | | "OP05","OP10","OP20","OP30","OP35","OP40","OP50","OP60","OP70","OP80" |
| | | }; |
| | | var q_strList = string.Join(",", strList); |
| | | var str = ""; |
| | | str += "时间范围: " + str_start + "至" + str_end + " \r\n"; |
| | | using (DbModel edm = new DbModel()) |
| | | { |
| | | var allPlaces = edm.WorkPieceLog.Where(x => |
| | | (x.CreatedTime >= start && x.CreatedTime <= end)).ToList(); |
| | | |
| | | |
| | | |
| | | |
| | | var groups = allPlaces.GroupBy(x => x.WorkingProcedure).OrderBy(x => x.Key); |
| | | foreach (var gg in groups) |
| | | { |
| | | var _key = gg.Key; |
| | | var _list = gg.ToList(); |
| | | var emtype = " "; |
| | | var _list_youzhi = _list.Where(x => x.WorkPieceID.Length > 20 && x.WorkPieceID != emtype).ToList(); |
| | | var _list_empty = _list.Where(x => string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID == emtype).ToList(); |
| | | var _list_other = _list.Where(x => !((x.WorkPieceID.Length > 20 && x.WorkPieceID != emtype) || (string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID == emtype))).ToList(); |
| | | var _list_other_str_list = _list_other.Select(x => x.WorkPieceID).Distinct().ToList(); |
| | | var _list_other_str = string.Join("|", _list_other_str_list); |
| | | str += $"==================【{_key}】========================= \r\n"; |
| | | str += $"总量: {_list.Count()},正确二维码数:{_list_youzhi.Count()},空值:{_list_empty.Count},其他:{_list_other.Count},分别是{_list_other_str} \r\n"; |
| | | |
| | | //再进行分组,统计 二维码不对的数据 |
| | | var _list_qc_error = _list.Where(x => string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID.Length <= 20).ToList(); |
| | | var group_qc_error = _list_qc_error.GroupBy(x => new { x.WorkPieceID, x.CreatedUserName }); |
| | | str += $"二维码不对的数据,总量: {_list_qc_error.Count()} \r\n"; |
| | | foreach (var item in group_qc_error) |
| | | { |
| | | str += $"二维码不对的数据,WorkPieceID: {item.Key.WorkPieceID},CreatedUserName: {item.Key.CreatedUserName},数量:{item.ToList().Count()} \r\n"; |
| | | } |
| | | |
| | | |
| | | //再进行分组,统计 二维码对的数据 |
| | | var group_qc_ok = _list_youzhi.GroupBy(x => new { x.CreatedUserName }); |
| | | str += $"二维码正确的数据,总量: {_list_youzhi.Count()} \r\n"; |
| | | foreach (var item in group_qc_ok) |
| | | { |
| | | str += $"二维码正确的数据,CreatedUserName: {item.Key.CreatedUserName},数量:{item.ToList().Count()} \r\n"; |
| | | } |
| | | |
| | | //再进行分组,统计 二维码对的数据-去重 |
| | | var _list_youzhi_quchong = _list_youzhi.Select(x => new { x.CreatedUserName }).Distinct().ToList(); |
| | | var group_qc_ok_quchong = _list_youzhi_quchong.GroupBy(x => new { x.CreatedUserName }); |
| | | str += $"(去重后)二维码正确的数据,总量: {_list_youzhi_quchong.Count()} \r\n"; |
| | | foreach (var item in group_qc_ok_quchong) |
| | | { |
| | | str += $"(去重后)二维码正确的数据,CreatedUserName: {item.Key.CreatedUserName},数量:{item.ToList().Count()} \r\n"; |
| | | } |
| | | |
| | | |
| | | str += "\r\n"; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | str += "\r\n"; |
| | | |
| | | this.tb_TongJi.Text = str; |
| | | } |
| | | } |
| | | } |