예제 #1
0
        void ReportPrint(CurveData cd)
        {
            byte pp = (byte)(cd.exWorkTepy & 0x1a);

            switch (pp)
            {
            case 0x1a:    //全部打印
                ReportPrint_PLK_GQ_VA(cd);
                break;

            case 0x10:    //plk
                ReportPrint_PLK(cd);
                break;

            case 0x08:    //GQ
                ReportPrint_GQ(cd);
                break;

            case 0x02:    //VA
                ReportPrint_VA(cd);
                break;

            case 0x0a:    //GQ VA
                ReportPrint_VA_GQ(cd);
                break;

            case 0x12:    //PLK VA
                ReportPrint_VA_PLK(cd);
                break;

            case 0x18:    //PLK GQ
                ReportPrint_PLK_GQ(cd);
                break;
            }
        }
예제 #2
0
        void ReportPrint_VA_GQ(CurveData cd)
        {
            LocalReport report = new LocalReport();

            report.ReportPath = "reportGDXY4.rdlc";
            DataTable dt = reportDataSet1.Student.Clone();

            GetInfoTable(cd, dt);
            report.DataSources.Add(new ReportDataSource("DataSet1", dt));
            DataTable dt1 = reportDataSet1.Curve.Clone();

            GetVATable(cd, dt1);
            report.DataSources.Add(new ReportDataSource("DataSet2", dt1));

            DataTable dt2 = reportDataSet1.Curve1.Clone();

            GetGQTable(cd, dt2);
            report.DataSources.Add(new ReportDataSource("DataSet3", dt2));
//             if (cd.bPLKExist)
//             {
//                 DataTable dt3 = reportDataSet1.Curve2.Clone();
//                 GetPLKTable(cd, dt3);
//                 report.DataSources.Add(new ReportDataSource("DataSet4", dt3));
//             }
            ReportPrintProc(report);
            //report.Refresh();
        }
예제 #3
0
        void ReportPrint_PLK_GQ_VA(CurveData cd)
        {
            LocalReport report = new LocalReport();

            report.ReportPath = "reportGDXY6.rdlc";
            DataTable dt = reportDataSet1.Student.Clone();

            GetInfoTable(cd, dt);
            report.DataSources.Add(new ReportDataSource("DataSet1", dt));
            DataTable dt1 = reportDataSet1.Curve.Clone();

            GetVATable(cd, dt1);
            report.DataSources.Add(new ReportDataSource("DataSet2", dt1));

            DataTable dt2 = reportDataSet1.Curve1.Clone();

            GetGQTable(cd, dt2);
            report.DataSources.Add(new ReportDataSource("DataSet3", dt2));
            if (cd.bPLKExist)
            {
                DataTable dt3 = reportDataSet1.Curve2.Clone();
                GetPLKTable(cd, dt3);
                report.DataSources.Add(new ReportDataSource("DataSet4", dt3));
            }
            else
            {
                DataTable dt3 = reportDataSet1.Curve2.Clone();
                DataRow   dr  = dt3.NewRow();
                dr["Line"] = "";
                dt3.Rows.Add(dr);
                report.DataSources.Add(new ReportDataSource("DataSet4", dt3));
            }
            ReportPrintProc(report);
            //report.Refresh();
        }
예제 #4
0
        void GetGQTable(CurveData cd, DataTable dt)
        {
            DataRow dr = dt.NewRow();

            for (int i = 0; i < 101; i++)
            {
                dr = dt.NewRow();
                if (BytesOP.GetBit(cd.exWorkTepy, 2))//自动,则0.5V
                {
                    if (i % 2 == 1)
                    {
                        continue;
                    }
                    dr["GQ"] = ((float)i) / 2;
                }
                else
                {
                    dr["GQ"] = i;
                }
                //dr["BC"] = "L1=" + (10 + 5.23).ToString();
                if (cd.bGQExist[0] && i < cd.GQDataCount[0])
                {
                    dr["工作电流1mA"] = cd.GQData[0, i];
                }
                if (cd.bGQExist[1] && i < cd.GQDataCount[1])
                {
                    dr["工作电流2mA"] = cd.GQData[1, i];
                }
                if (cd.bGQExist[2] && i < cd.GQDataCount[2])
                {
                    dr["工作电流4mA"] = cd.GQData[2, i];
                }
                if (cd.bGQExist[3] && i < cd.GQDataCount[3])
                {
                    dr["工作电流5mA"] = cd.GQData[3, i];
                }


                if (cd.bGQExist[0] && ((i + 1) == cd.GQDataCount[0]))
                {
                    dr["L1"] = cd.GQData[0, i];
                }
                if (cd.bGQExist[1] && ((i + 1) == cd.GQDataCount[1]))
                {
                    dr["L2"] = cd.GQData[1, i];
                }
                if (cd.bGQExist[2] && ((i + 1) == cd.GQDataCount[2]))
                {
                    dr["L3"] = cd.GQData[2, i];
                }
                if (cd.bGQExist[3] && ((i + 1) == cd.GQDataCount[3]))
                {
                    dr["L4"] = cd.GQData[3, i];
                }
                dt.Rows.Add(dr);
            }
        }
예제 #5
0
        void GetInfoTable(CurveData cd, DataTable dt)
        {
            DataRow dr = dt.NewRow();

            dr["Class"]  = cd.BanJi;
            dr["SteNum"] = cd.XueHao;
            XueHao       = cd.XueHao;
            dr["ExNum"]  = cd.ZuoWeiHao;
            dr["DT"]     = DateTime.Now.ToString();
            dt.Rows.Add(dr);
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            CurveData cd = new CurveData();

            cd.XueHao      = "111";
            cd.exWorkTepy  = 0x08;
            cd.bGQExist[0] = true;
            ReportPrint(cd);
            //ProgramPrint();
            //ReportPrint();
        }
예제 #7
0
        void GetPLKTable(CurveData cd, DataTable dt)
        {
            DataRow dr = dt.NewRow();

            float[] f = new float[6] {
                7.5f, 6.5f, 5.8f, 5.2f, 5.0f, 4.8f
            };
            for (int i = 5; i > -1; i--)
            {
                dr           = dt.NewRow();
                dr["f"]      = f[i];
                dr["Us"]     = cd.PLKData[i];
                dr["UsLine"] = cd.PLKData[6] * f[i] + cd.PLKData[7];
                if (cd.PLKData[7] > 0)
                {
                    dr["Line"] = string.Format("曲线方程Us={0}v+{1},计算出的普朗克常数为h={2} E-34 J·S", cd.PLKData[6], cd.PLKData[7], cd.PLKData[8]);
                }
                else
                {
                    dr["Line"] = string.Format("曲线方程Us={0}v{1},计算出的普朗克常数为h={2} E-34 J·S", cd.PLKData[6], cd.PLKData[7], cd.PLKData[8]);
                }
                dt.Rows.Add(dr);
            }
        }
예제 #8
0
        void GetVATable(CurveData cd, DataTable dt)
        {
            DataRow dr = dt.NewRow();

            for (int i = 0; i < 101; i++)
            {
                dr = dt.NewRow();
                if (BytesOP.GetBit(cd.exWorkTepy, 0))//自动,则0.5V
                {
                    if (i % 2 == 1)
                    {
                        continue;
                    }
                    dr["GQ"] = ((float)i) / 2;
                }
                else
                {
                    dr["GQ"] = i;
                }
                //dr["BC"] = "L1=" + (10 + 5.23).ToString();
                if (cd.bVAExist[0] && i < cd.VADataCount[0])
                {
                    dr["紫光400nm"] = cd.VAData[0, i];
                }
                if (cd.bVAExist[1] && i < cd.VADataCount[1])
                {
                    dr["蓝光460nm"] = cd.VAData[1, i];
                }
                if (cd.bVAExist[2] && i < cd.VADataCount[2])
                {
                    dr["绿光520nm"] = cd.VAData[2, i];
                }
                if (cd.bVAExist[3] && i < cd.VADataCount[3])
                {
                    dr["黄光590nm"] = cd.VAData[3, i];
                }
                if (cd.bVAExist[4] && i < cd.VADataCount[4])
                {
                    dr["橙光603nm"] = cd.VAData[4, i];
                }
                if (cd.bVAExist[5] && i < cd.VADataCount[5])
                {
                    dr["红光625nm"] = cd.VAData[5, i];
                }

                if (cd.bVAExist[0] && ((i + 1) == cd.VADataCount[0]))
                {
                    dr["L1"] = cd.VAData[0, i];
                }
                if (cd.bVAExist[1] && ((i + 1) == cd.VADataCount[1]))
                {
                    dr["L2"] = cd.VAData[1, i];
                }
                if (cd.bVAExist[2] && ((i + 1) == cd.VADataCount[2]))
                {
                    dr["L3"] = cd.VAData[2, i];
                }
                if (cd.bVAExist[3] && ((i + 1) == cd.VADataCount[3]))
                {
                    dr["L4"] = cd.VAData[3, i];
                }
                if (cd.bVAExist[4] && ((i + 1) == cd.VADataCount[4]))
                {
                    dr["L5"] = cd.VAData[4, i];
                }
                if (cd.bVAExist[5] && ((i + 1) == cd.VADataCount[5]))
                {
                    dr["L6"] = cd.VAData[5, i];
                }
                dt.Rows.Add(dr);
            }
        }
예제 #9
0
        private void tcpAsyncServer_ReceiveServerEvent(object sender, ReceiveServerEventArgs e)
        {
            this.Invoke((EventHandler)(delegate
            {
                string strRx = (string)e.netPacket;
                string[] rxList = strRx.Split(',');
                string key = e.Client.ClientSocket.RemoteEndPoint.ToString();
                //if(rxList.Length==2)
                {
                    int index = int.Parse(rxList[0]);
                    if (index == 1)//学号等信息
                    {
                        textBox1.AppendText(strRx + "\r\n");
                        CurveData cd = new CurveData();
                        string[] infoList = rxList[1].Split('|');
                        if (infoList.Length == 4)
                        {
                            cd.ZuoWeiHao = infoList[0];
                            cd.BanJi = infoList[1];
                            cd.XueHao = infoList[2];
                            cd.exWorkTepy = byte.Parse(infoList[3]);
                            CurveDataTable[key] = cd;
                            WFGlobal.WaitMS(1000);
                            textBox1.AppendText("学号信息\r\n");
                            tcpAsyncServer.Send(e.Client, easyStringPacket.MakePacket("01,OK"));
                        }
                    }
                    else if (index <= 7 && index >= 2)
                    {
                        CurveData cd = (CurveData)CurveDataTable[key];
                        if (cd != null)
                        {
                            int nCount = int.Parse(rxList[1]);
                            string[] infoList = rxList[2].Split('|');
                            if (infoList.Length == nCount)
                            {
                                cd.VADataCount[index - 2] = nCount;
                                for (int i = 0; i < nCount; i++)
                                {
                                    cd.VAData[index - 2, i] = (float)(float.Parse(infoList[i]) * 0.000763);
                                }
                                cd.bVAExist[index - 2] = true;
                                CurveDataTable[key] = cd;
                                WFGlobal.WaitMS(1000);
                                textBox1.AppendText("实验数据\r\n");
                                tcpAsyncServer.Send(e.Client, easyStringPacket.MakePacket(index.ToString("d2") + ",OK"));
//                                 if (index == 7)
//                                 {
//                                     ReportPrint(cd);
//                                 }
                            }
                        }
                    }
                    else if (index <= 11 && index >= 8)
                    {
                        CurveData cd = (CurveData)CurveDataTable[key];
                        int gqIndex = index - 8;
                        if (cd != null)
                        {
                            int nCount = int.Parse(rxList[1]);
                            string[] infoList = rxList[2].Split('|');
                            if (infoList.Length == nCount)
                            {
                                cd.GQDataCount[gqIndex] = nCount;
                                for (int i = 0; i < nCount; i++)
                                {
                                    cd.GQData[gqIndex, i] = (float)(float.Parse(infoList[i]) * 0.000763);
                                }
                                cd.bGQExist[gqIndex] = true;
                                CurveDataTable[key] = cd;
                                WFGlobal.WaitMS(1000);
                                textBox1.AppendText("实验数据\r\n");
                                tcpAsyncServer.Send(e.Client, easyStringPacket.MakePacket(index.ToString("d2") + ",OK"));
                                //                                 if (index == 7)
                                //                                 {
                                //                                     ReportPrint(cd);
                                //                                 }
                            }
                        }
                    }
                    else if (index == 12)
                    {
                        CurveData cd = (CurveData)CurveDataTable[key];
                        if (cd != null)
                        {
                            string[] infoList = rxList[1].Split('|');
                            if (infoList.Length == 9)
                            {
                                for (int i = 0; i < 9; i++)
                                {
                                    cd.PLKData[i] = float.Parse(infoList[i]);
                                }
                                cd.bPLKExist = true;
                                CurveDataTable[key] = cd;
                                WFGlobal.WaitMS(1000);
                                textBox1.AppendText("实验数据\r\n");
                                tcpAsyncServer.Send(e.Client, easyStringPacket.MakePacket(index.ToString("d2") + ",OK"));
                                //                                 if (index == 7)
                                //                                 {
                                //                                     ReportPrint(cd);
                                //                                 }
                            }
                        }
                    }
                    else if (index == 99)//请求打印帧
                    {
                        CurveData cd = (CurveData)CurveDataTable[key];
                        if (cd != null)
                        {
                            WFGlobal.WaitMS(1000);
                            textBox1.AppendText("开始打印\r\n");
                            tcpAsyncServer.Send(e.Client, easyStringPacket.MakePacket(index.ToString("d2") + ",OK"));
                            ReportPrint(cd);
                        }
                    }
                }
                //textBox1.AppendText(strRx + "\r\n");
//                 NetPacket np = (NetPacket)e.netPacket;
//                 switch (np.PacketHead.PType)
//                 {
//                     case NetPacket.NetPacketType.STRING:
//                         textBox1.AppendText("收到字符串" + np.Data.ToString() + "\r\n");
//                         tcpAsyncServer.Send(e.Client, NetPacket.MakeStringPacket("服务器收到数据" + np.Data.ToString()));
//                         break;
//                     case NetPacket.NetPacketType.BINARY:
//                         NetFile nf = (NetFile)np.Data;
//                         textBox1.AppendText("收到文件" + nf.FileName + ",正在后台生成.....\r\n");
//                         string file = System.Windows.Forms.Application.StartupPath + "\\收到的文件\\" + nf.FileName;
//                         FileInfo f = new FileInfo(file);
//                         if (!Directory.Exists(f.DirectoryName))
//                             Directory.CreateDirectory(f.DirectoryName);
//                         FileStream fs = null;
//                         fs = new FileStream(file, FileMode.Create);
//                         fs.BeginWrite(nf.Content, 0, nf.Content.Length, NetFileWriteOK, fs);
//                         break;
//                     case NetPacket.NetPacketType.COMPLEX:
//                         NetObject no = (NetObject)np.Data;
//                         textBox1.AppendText("收到序列对象" + no.TypeName + ",正在后台生成.....\r\n");
//                         break;
//                 }
            }));
        }