Пример #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);
        }
Пример #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();
 }
Пример #3
0
        /// <summary>
        /// 录入条目信息
        /// 对应testProdInfoItem表
        /// </summary>
        public void prodInfoItemMsgInit()
        {
            ///只示范加入两个录入条目信息配置数据,
            prodInfoItem = new ProdInfoItem[5];

            prodInfoItem[0]            = new ProdInfoItem();
            prodInfoItem[0].itemno     = importantId;
            prodInfoItem[0].itemname   = "试品编号";
            prodInfoItem[0].enitemname = "Product Name";
            prodInfoItem[0].itemtype   = 1;
            prodInfoItem[0].inputmode  = 1;

            prodInfoItem[1]            = new ProdInfoItem();
            prodInfoItem[1].itemno     = importantId + 1;
            prodInfoItem[1].itemname   = "产品型号";
            prodInfoItem[1].enitemname = "Product Model";
            prodInfoItem[1].itemtype   = 1;
            prodInfoItem[1].inputmode  = 1;

            prodInfoItem[2]            = new ProdInfoItem();
            prodInfoItem[2].itemno     = importantId + 2;
            prodInfoItem[2].itemname   = "测试项目";
            prodInfoItem[2].enitemname = "Test Items";
            prodInfoItem[2].itemtype   = 1;
            prodInfoItem[2].inputmode  = 2;

            prodInfoItem[3]            = new ProdInfoItem();
            prodInfoItem[3].itemno     = importantId + 3;
            prodInfoItem[3].itemname   = "测试时间";
            prodInfoItem[3].enitemname = "Test Time";
            prodInfoItem[3].itemtype   = 1;
            prodInfoItem[3].inputmode  = 4;


            prodInfoItem[4]            = new ProdInfoItem();
            prodInfoItem[4].itemno     = importantId + 4;
            prodInfoItem[4].itemname   = "测试人";
            prodInfoItem[4].enitemname = "Test Person";
            prodInfoItem[4].itemtype   = 1;
            prodInfoItem[4].inputmode  = 1;


            int flag = 1;

            for (int i = 0; i < prodInfoItem.Length; i++)
            {
                string prodInfoUrl = "http://115.28.236.114/RestInterfaceSystem/testProdInfoItemController/addTestProdInfoItem";
                string proInfoData =
                    "&itemNo=" + prodInfoItem[i].itemno +
                    "&itemName=" + prodInfoItem[i].itemname +
                    "&defaultContent=/" +
                    "&inputMode=" + prodInfoItem[i].inputmode +
                    "&queryCondition=1" +
                    "&selectItem=耗电量测试@冷却速度测试@/" +
                    "&print=1" +
                    "&display=1" +
                    "&changeable=1" +
                    "&englishName=" + prodInfoItem[i].enitemname +
                    "&englishSelectItem=21321" +
                    "&statusBar=1" +
                    "&englishDefaultContent=dasdas" +
                    "&itemType=1" +
                    "&versionNo=1.1.0" +
                    "&keyItem=dsada" +
                    "&labCode=" + sysInfo.LabCode;

                string prodRus = PostData(prodInfoUrl, proInfoData);
                string rus     = prodRus.Substring(prodRus.IndexOf(":") + 1, 3);
                if (!rus.Equals("200"))
                {
                    flag = 0;
                    MessageBox.Show("第:" + i.ToString() + "个录入条目信息配置失败,失败编码: " + rus + "\n");
                }
            }
            if (flag == 1)
            {
                MessageBox.Show("录入条目信息配置成功\n");
            }
        }