private void CXButton_Click(object sender, RoutedEventArgs e) { BTLabel.Content = Convert.ToDateTime(sDate.SelectedDate).ToString("yyyy-MM-dd") + gwchoose.Text + scchoose.Text + "时" + SXSelect.Text + "小时逐日评分详情"; if (!(sDate.SelectedDate.ToString().Length == 0)) { zrpf.Clear(); tjClass tj = new tjClass(); zrpf = tj.zrpftj(scchoose.Text, Convert.ToDateTime(sDate.SelectedDate), gwchoose.Text, SXSelect.Text); ((this.FindName("GRPFList")) as DataGrid).ItemsSource = zrpf; } else { System.Windows.MessageBox.Show("请选择查询时间"); } }
private void CXButton_Click(object sender, RoutedEventArgs e) { if ((!(sDate.SelectedDate.ToString().Length == 0)) && (!(eDate.SelectedDate.ToString().Length == 0))) { BTLabel.Content = Convert.ToDateTime(sDate.SelectedDate).ToString("yyyy-MM-dd") + "至" + Convert.ToDateTime(eDate.SelectedDate).ToString("yyyy-MM-dd") + "个人评分"; tjClass tj = new tjClass(); grpf.Clear(); string peopleStr = tj.tjPeople(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate)); if (peopleStr.Length > 0) { string[] peoplesz = peopleStr.Split('\n'); string[,] GRPFSZ = new string[peoplesz.Length, 13];//数组保存个人评分信息 for (int i = 0; i < peoplesz.Length; i++) { GRPFSZ[i, 0] = peoplesz[i].Split(',')[0]; GRPFSZ[i, 2] = peoplesz[i].Split(',')[1]; float[] zqlFloat = tj.GRZQL(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GRPFSZ[i, 0]);//返回数组分别为三天预报的最高、最低温度、晴雨准确率以及缺报率 GRPFSZ[i, 5] = Convert.ToString(Math.Round((zqlFloat[2] * 10 + zqlFloat[5] * 8 + zqlFloat[8] * 6) / 24, 2)); GRPFSZ[i, 6] = Convert.ToString(Math.Round((zqlFloat[0] * 10 + zqlFloat[3] * 8 + zqlFloat[6] * 6) / 24, 2)); GRPFSZ[i, 7] = Convert.ToString(Math.Round((zqlFloat[1] * 10 + zqlFloat[4] * 8 + zqlFloat[7] * 6) / 24, 2)); GRPFSZ[i, 8] = Convert.ToString(Math.Round(Convert.ToSingle(0.4 * Convert.ToDouble(GRPFSZ[i, 5]) + 0.3 * Convert.ToDouble(GRPFSZ[i, 6]) + 0.3 * Convert.ToDouble(GRPFSZ[i, 7])), 2));//总评分 float[] GRJDWCSZ = tj.GRJDWC(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GRPFSZ[i, 0]); float[] ZDJDWCSZ = tj.GRZDJDWC(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GRPFSZ[i, 0]); float[] ZDzqlFloat = tj.GRZYZQL(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GRPFSZ[i, 0]); //返回数组分别为中央指导三天预报的最高、最低温度、晴雨准确率以及缺报率,主要计算技巧用晴雨准确率 float[] WDJQ = new float[6]; //保存三天的最高、最低温度技巧 try { for (int j = 0; j < 6; j++) { if (ZDJDWCSZ[j] == 0) { WDJQ[j] = 1.01F * 100; } else { WDJQ[j] = (ZDJDWCSZ[j] - GRJDWCSZ[j]) / ZDJDWCSZ[j]; WDJQ[j] = (float)Math.Round(WDJQ[j] * 100, 2); } } } catch (Exception ex) { } float[] QYJQ = new float[3]; try { for (int j = 0; j < 3; j++) { //if (ZDzqlFloat[2 + j * 3] == 100) //{ // QYJQ[j] = zqlFloat[2 + j * 3] - ZDzqlFloat[2 + j * 3]; // QYJQ[j] = (float)Math.Round(QYJQ[j], 2); //} //else if(zqlFloat[2 + j * 3]==100) //{ // zqlFloat[2 + j * 3] = 99.99F; // QYJQ[j] = (zqlFloat[2 + j * 3] - ZDzqlFloat[2 + j * 3]) / (100 - ZDzqlFloat[2 + j * 3]); // QYJQ[j] = (float)Math.Round(QYJQ[j] * 100, 2); //} //else //{ // QYJQ[j] = (zqlFloat[2 + j * 3] - ZDzqlFloat[2 + j * 3]) / (100 - ZDzqlFloat[2 + j * 3]); // QYJQ[j] = (float)Math.Round(QYJQ[j] * 100, 2); //} QYJQ[j] = zqlFloat[2 + j * 3] - ZDzqlFloat[2 + j * 3]; QYJQ[j] = (float)Math.Round(QYJQ[j], 2); } } catch (Exception ex) { } GRPFSZ[i, 9] = Convert.ToString(Math.Round((QYJQ[0] * 10 + QYJQ[1] * 8 + QYJQ[2] * 6) / 24, 2)); //晴雨技巧 GRPFSZ[i, 10] = Convert.ToString(Math.Round((WDJQ[0] * 10 + WDJQ[2] * 8 + WDJQ[4] * 6) / 24, 2)); //高温技巧 GRPFSZ[i, 11] = Convert.ToString(Math.Round((WDJQ[1] * 10 + WDJQ[3] * 8 + WDJQ[5] * 6) / 24, 2)); //低温技巧 GRPFSZ[i, 12] = Convert.ToString(Math.Round(Convert.ToSingle(0.4 * Convert.ToDouble(GRPFSZ[i, 9]) + 0.3 * Convert.ToDouble(GRPFSZ[i, 10]) + 0.3 * Convert.ToDouble(GRPFSZ[i, 11])), 2)); //总技巧 } Int16 ZBJS = 0; //值班基数 string[,] ZBSZ = tj.ZBXXTJ(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), ref ZBJS); for (int j = 0; j < ZBSZ.GetLength(0); j++) { for (int k = 0; k < peoplesz.GetLength(0); k++) { if (ZBSZ[j, 0] == GRPFSZ[k, 0]) { GRPFSZ[k, 3] = ZBSZ[j, 1]; //值班次数 GRPFSZ[k, 4] = ZBJS.ToString(); // } } } Int16 countInt = 0;//保存值班次数大于基数的人员的个数 for (int i = 0; i < peoplesz.GetLength(0); i++) { if (Convert.ToInt16(GRPFSZ[i, 3]) >= Convert.ToInt16(GRPFSZ[i, 4]))//如果值班次数大于值班基数 { countInt++; } else//如果值班次数小于值班基数 { } } double[] JQPJSZ = new double[countInt]; Int16 intLS = 0; for (int i = 0; i < peoplesz.GetLength(0); i++) { if (Convert.ToInt16(GRPFSZ[i, 3]) >= Convert.ToInt16(GRPFSZ[i, 4]))//如果值班次数大于值班基数 { JQPJSZ[intLS++] = Convert.ToDouble(GRPFSZ[i, 12]); } else//如果值班次数小于值班基数排名999 { GRPFSZ[i, 1] = "999"; } } Array.Sort(JQPJSZ); for (int i = 0; i < JQPJSZ.Length; i++) { for (int j = 0; j < peoplesz.GetLength(0); j++) { if (Convert.ToInt16(GRPFSZ[j, 3]) >= Convert.ToInt16(GRPFSZ[j, 4]))//如果值班次数大于值班基数 { if (JQPJSZ[i] == Convert.ToDouble(GRPFSZ[j, 12])) { GRPFSZ[j, 1] = (countInt - i).ToString(); } } else//如果值班次数小于值班基数排名999 { } } } for (int i = 0; i < peoplesz.GetLength(0); i++) { grpf.Add(new GRPF() { PeopleID = GRPFSZ[i, 0], PM = Convert.ToInt16(GRPFSZ[i, 1]), PeopleName = GRPFSZ[i, 2], ZBCS = Convert.ToInt16(GRPFSZ[i, 3]), ZBJS = Convert.ToInt16(GRPFSZ[i, 4]), QYPF = Convert.ToSingle(GRPFSZ[i, 5]), GWPF = Convert.ToSingle(GRPFSZ[i, 6]), DWPF = Convert.ToSingle(GRPFSZ[i, 7]), ZHPF = Convert.ToSingle(GRPFSZ[i, 8]), QYJQ = Convert.ToSingle(GRPFSZ[i, 9]), GWJQ = Convert.ToSingle(GRPFSZ[i, 10]), DWJQ = Convert.ToSingle(GRPFSZ[i, 11]), AllJQ = Convert.ToSingle(GRPFSZ[i, 12]), }); } var result = grpf.OrderBy(p => p.PM).ThenByDescending(p => p.AllJQ);//按照排名升序排列 ((this.FindName("GRPFList")) as DataGrid).ItemsSource = result; } else { MessageBox.Show("所选时间段没有登录记录,请重新选择起止时间"); } } else { MessageBox.Show("请选择起止时间"); } }