songjun
2025-09-15 15e82c0dd4200a332b30e2fcd458ad84e2e3d428
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text;
 
namespace sbcLabSystem.Import
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
 
            byte[] buf = new byte[] { 0xA8, 0x01, 0x00, 0x00 };
            float data = BitConverter.ToSingle(buf,0);
 
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                sbcLabSystemEntities current_db = new sbcLabSystemEntities();
                using (hds1230001_dbEntities ori_db = new hds1230001_dbEntities())
                {
                    var regList = ori_db.EQAParticipant.OrderBy(p => p.LabID).ToList();
                    regList.ForEach(x =>
                    {
                        QCDistributionRegisterInfoes regInfo = new QCDistributionRegisterInfoes();
                        regInfo.ProjectId = x.ProjectID;
                        regInfo.ModifyTime = DateTime.Now;
                        regInfo.IsCharged = x.IsCharged;
                        regInfo.IsSendEMS = x.IsExpressSended;
                        regInfo.SampleNo = x.SampleSNO;
                        regInfo.EMSNo = x.ExpressBillCode;
                        regInfo.PacketContent = x.ExpressContent;
                        regInfo.IsModified = x.IsDataChanged;
                        regInfo.IsSubmit = x.IsDataSubmitted;
                        regInfo.SubmitTime = x.DateSubmitted;
                        regInfo.AnswerJSON = x.DataProject;
                        regInfo.LetterNo = x.RegisteredLetter;
 
                        var distInfo = ori_db.EQADistribution.FirstOrDefault(p => p.ID == x.DistributionID);
                        var labInfo = ori_db.Lab.FirstOrDefault(p => p.ID == x.LabID);
 
                        var distInfo2 = current_db.QCDistributions.FirstOrDefault(p => p.DistNo == distInfo.DistNo);
                        var labInfo2 = current_db.UserRequestInfoes.FirstOrDefault(p => p.LabCode == labInfo.LabCode);
 
                        regInfo.QCDistributionId = distInfo2.Id;
                        regInfo.LabId = labInfo2.Id;
 
                        current_db.QCDistributionRegisterInfoes.Add(regInfo);
                        current_db.SaveChanges();
                    });
                }
                current_db.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
    }
}