Ejemplo n.º 1
0
        public void loaddata()
        {
            //初始化控制类型,是主控还是远控
            DataComponent.InitApplicationStartPath(Application.StartupPath);     //初始化应用程序根目录
            if (DataComponent.GetControlType() == ControlTypeEnum.RemoteControl) //判断主控还是远控
            {
                controlType = ControlTypeEnum.RemoteControl;                     //远控赋值
            }
            else
            {
                controlType = ControlTypeEnum.MainControl; //主控赋值
            }
            //数据组件初始化
            int rtn = dataComponent.Init();

            //用于遍历

            //获得所有台位
            testUnit = dataComponent.GetAllTestUnit();
            //获得录入条目
            prodInfoItem = dataComponent.GetProdInfoItem();
            //设置路径
            nameplateCoponent.setstartpath(Application.StartupPath);
            //遍历条目信息
            for (int i = 0; i < prodInfoItem.Length; i++)
            {
                //将条目信息赋值
                oneProdInfoItem = prodInfoItem[i];
                nameplateCoponent.setItemInfo(oneProdInfoItem.itemno, oneProdInfoItem.itemname, oneProdInfoItem.defaultcontent, oneProdInfoItem.inputmode, oneProdInfoItem.selectitem, oneProdInfoItem.changeable, oneProdInfoItem.datalength, oneProdInfoItem.itemtype, oneProdInfoItem.enitemname);
            }
            //  Console.WriteLine(prodInfoItem.Length);
            //遍历所有台位
            for (int j = 0; j < testUnit.Length; j++)
            {
                //台位赋值
                oneTestUnit = testUnit[j];
                nameplateCoponent.setMetaData(oneTestUnit.PrimaryKey, oneTestUnit.BelongedId, oneTestUnit.TestUnitNo, oneTestUnit.TestUnitName, oneTestUnit.TestNow, oneTestUnit.BeginDateTime, oneTestUnit.EndDateTime, ref oneTestUnit.ItemContent, oneTestUnit.ProjectMissionBookId);
            }
            //软件中文名称赋值
            nameplateCoponent.labname = dataComponent.GetSystemInfo().LabName;
            //软件英文名称赋值
            nameplateCoponent.EnlabName = dataComponent.GetSystemInfo().EnLabName;
            //将台位统称和labcode传到录入组件
            nameplateCoponent.SetTestUnitPrefix(dataComponent.GetSystemInfo().TestUnitNameConfig, dataComponent.GetSystemInfo().LabCode);
            //设置行列数
            nameplateCoponent.SetRowAndColumNum(2, 2);
            //控件填充方式,充满窗体
            nameplateCoponent.Dock = DockStyle.Fill;
            //当点击开测触发的事件
            nameplateCoponent.Open_Test += NameplateCoponent_Open_Test;
            //当点击停测触发的事件
            nameplateCoponent.Stop_Test += NameplateCoponent_Stop_Test;
            //当点击保存时触发的事件
            nameplateCoponent.Nameplate_Manage += NameplateCoponent_Nameplate_Manage;
            // 窗体添加上录入组件
            this.Controls.Add(nameplateCoponent);
        }
Ejemplo n.º 2
0
 public Form1()
 {
     //InitializeComponent();
     //NameplateCoponent = new NameplateManagement.NameplateManagement();
     //datamangeComponent = new DataComponent();
     //testUnit = new TestUnit[10];
     //prodInfoItem = new ProdInfoItem[10];
     InitializeComponent();
     dataComponent   = new DataComponent();
     oneProdInfoItem = new ProdInfoItem();
     oneTestUnit     = new DataComm.TestUnit();
 }