Пример #1
0
        private void DataFill()
        {
            var       tuple       = new Tuple <string, string>("扫码下线", "A_fa_cube");
            FontIcons icon1       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple.Item2);
            var       pictureBox1 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(40, 40),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon1, 40, Color.FromArgb(255, 77, 59)),
                Location  = new Point(this.Size.Width / 2 - 20, 15)
            };

            panel3.Controls.Add(pictureBox1);

            using (var context = new Model())
            {
                var cProductProcessing = context.C_ProductProcessing.First(s => s.ProductBornCode == _productBornCode);
                BeginInvoke(new Action(() =>
                {
                    ProductIDTxt.Text       = _productBornCode;
                    ProductIDTxt.ReadOnly   = true;
                    ProductNameTxt.Text     = cProductProcessing.ProductName;
                    ProductNameTxt.ReadOnly = true;
                }));
            }
        }
Пример #2
0
        private void DataFill()
        {
            var       tuple       = new Tuple <string, string>("工量具", "E_icon_tools");
            var       tuple1      = new Tuple <string, string>("货架", "E_icon_house");
            FontIcons icon1       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple1.Item2);
            FontIcons icon2       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple.Item2);
            var       pictureBox1 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(40, 40),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon1, 40, Color.FromArgb(255, 77, 59)),
                Location  = new Point(this.Size.Width / 4 - 20, 15)
            };

            panel3.Controls.Add(pictureBox1);

            var pictureBox2 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(40, 40),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon2, 36, Color.FromArgb(255, 77, 59)),
                Location  = new Point(this.Size.Width / 4 * 3 - 20, 15)
            };

            panel3.Controls.Add(pictureBox2);
        }
Пример #3
0
        private void ThridTitle_Load(object sender, EventArgs e)
        {
            string strIcon = "E_icon_star";

            pictureBox1.ForeColor = Color.FromArgb(255, 77, 59);
            FontIcons icon1 = (FontIcons)Enum.Parse(typeof(FontIcons), strIcon);

            pictureBox1.Image = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
            pictureBox2.Image = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
            pictureBox3.Image = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
            pictureBox4.Image = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
        }
 public void SetBindSource(object obj)
 {
     if (obj is TestGridModel)
     {
         m_object = (TestGridModel)obj;
         string strIcon = "E_icon_star";
         ForeColor = Color.FromArgb(255, 77, 59);
         FontIcons icon1 = (FontIcons)Enum.Parse(typeof(FontIcons), strIcon);
         // Image = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
         this.BackgroundImage = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59));
         // this.BackgroundImage = Properties.Resources.rowicon;
     }
 }
Пример #5
0
        private void ScanOnline_Load(object sender, EventArgs e)
        {
            var addXmlFile = new ConfigurationBuilder().SetBasePath("E:\\project\\visual Studio Project\\ManualCheck")
                             .AddXmlFile("config.xml");
            var configuration = addXmlFile.Build();

            _workshopId    = configuration["WorkshopID"];
            _workshopCode  = configuration["WorkshopCode"];
            _workshopName  = configuration["WorkshopName"];
            _equipmentId   = configuration["EquipmentID"];
            _equipmentCode = configuration["EquipmentCode"];
            _equipmentName = configuration["EquipmentName"];

            var tuple       = new Tuple <string, string>("扫码上线", "A_fa_cube");
            var icon1       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple.Item2);
            var pictureBox1 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(40, 40),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon1, 40, Color.FromArgb(255, 77, 59)),
                Location  = new Point(this.Size.Width / 2 - 20, 30)
            };

            panel3.Controls.Add(pictureBox1);

            if (serialPortTest.IsOpen)
            {
                serialPortTest.Close();
            }
            string portName = ConfigAppSettingsHelper.ReadSetting("PortName");
            string baudRate = ConfigAppSettingsHelper.ReadSetting("BaudRate");

            serialPortTest.Dispose();//释放扫描枪所有资源
            serialPortTest.PortName = portName;
            serialPortTest.BaudRate = int.Parse(baudRate);
            try
            {
                if (!serialPortTest.IsOpen)
                {
                    serialPortTest.Open();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
Пример #6
0
    private void ShowPanel(string sentence, FontImages fontDictionary)
    {
        ClearSentence();
        for (int i = 0; i < sentence.Length; i++)
        {
            Image  img    = Instantiate(letterPrefab, lettersParent);
            Sprite sprite = fontDictionary.GetSprite(sentence[i]);

            if (sprite == null)
            {
                Debug.LogError("Could not fill panel sentence, did not find " + sentence[i] + " on dictionary");
                ClearSentence();
                return;
            }
            img.sprite = sprite;
        }

        lettersParent.gameObject.SetActive(true);
    }
Пример #7
0
        private Label GenerateLabel()
        {
            var icon  = (FontIcons)Enum.Parse(typeof(FontIcons), MuneList[_tupleI].Item2);
            var label = new Label
            {
                AutoSize   = false,
                Size       = new Size(90, 60),
                ForeColor  = Color.White,
                TextAlign  = ContentAlignment.BottomCenter,
                ImageAlign = ContentAlignment.TopCenter,
                Margin     = new Padding(5),
                Text       = MuneList[_tupleI].Item1,
                Image      = FontImages.GetImage(icon, 32, Color.White),
                Location   = new Point(_widthX, 0),
                Font       = new Font("微软雅黑", 12, FontStyle.Bold)
            };

            FirstTitlePanel.Controls.Add(label);
            _widthX += 90;
            _tupleI++;
            return(label);
        }
Пример #8
0
        private async Task <Label> GenerateLabel()
        {
            var label = new Label();
            await Task.Run((() =>
            {
                var icon = (FontIcons)Enum.Parse(typeof(FontIcons), MuneList[_tupleI].Item2);
                label.AutoSize = false;
                label.Size = new Size(90, 60);
                label.ForeColor = Color.White;
                label.TextAlign = ContentAlignment.BottomCenter;
                label.ImageAlign = ContentAlignment.TopCenter;
                label.Margin = new Padding(5);
                label.Text = MuneList[_tupleI].Item1;
                label.Image = FontImages.GetImage(icon, 32, Color.White);
                label.Location = new Point(_widthX, 0);
                label.Font = new Font("微软雅黑", 12, FontStyle.Bold);
                _widthX += 90;
                _tupleI++;
            }));

            return(label);
        }
Пример #9
0
        private void MainPanel_Load(object sender, EventArgs e)
        {
            var addXmlFile = new ConfigurationBuilder().SetBasePath("E:\\project\\visual Studio Project\\ManualCheck")
                             .AddXmlFile("config.xml");
            var configuration = addXmlFile.Build();

            _workshopId    = configuration["WorkshopID"];
            _workshopCode  = configuration["WorkshopCode"];
            _workshopName  = configuration["WorkshopName"];
            _equipmentId   = configuration["EquipmentID"];
            _equipmentCode = configuration["EquipmentCode"];
            _equipmentName = configuration["EquipmentName"];

            //使用hzh控件自带的图标库 tuple
            //解析tuple 加载顶部菜单栏 绑定事件
            var switchAccountLabel = GenerateLabel();

            switchAccountLabel.Click += OpenLoginForm;

            var exitLabel = GenerateLabel();

            exitLabel.Click += CloseForms;

            // 加载人员信息图标
            var tuple1      = new Tuple <string, string>("人员信息", "A_fa_address_card_o");
            var icon1       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple1.Item2);
            var pictureBox1 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(240, 160),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon1, 64, Color.FromArgb(255, 77, 59)),
                Location  = new Point(110, 20)
            };

            PersonnelInfoPanel.Controls.Add(pictureBox1);

            // 加载箭头图标
            var tuple2 = new Tuple <string, string>("Arrow", "A_fa_arrow_down");
            var icon2  = (FontIcons)Enum.Parse(typeof(FontIcons), tuple2.Item2);
            int localY = 72;

            for (var i = 0; i < 2; i++)
            {
                ProductionStatusInfoPanel.Controls.Add(new PictureBox()
                {
                    AutoSize  = false,
                    Size      = new Size(40, 40),
                    ForeColor = Color.FromArgb(255, 77, 59),
                    Image     = FontImages.GetImage(icon2, 40, Color.FromArgb(255, 77, 59)),
                    Location  = new Point(270, localY)
                });
                localY += 98;
            }

            //修改自定义控件label.text文本
            CompletedTask1.label1.Text       = " 已完成任务";
            ProductionTaskQueue1.label1.Text = "手检任务队列";

            InitialDidTasks();

            ucSignalLamp1.LampColor = new Color[] { Color.Green };
            ucSignalLamp2.LampColor = new Color[] { Color.Red };

            InialToDoTasks();

            //初始化生产状态信息面板
            using (var context = new Model())
            {
                //这里需要配置修改xml
                var cBBdbRCntlPntBases = context.C_BBdbR_CntlPntBase.Where(s =>
                                                                           s.CntlPntTyp == 2.ToString() && s.Enabled == 1.ToString())
                                         .OrderBy(s => s.CntlPntSort).ToList();

                int localLblY = 25;
                foreach (var cBBdbRCntlPntBase in cBBdbRCntlPntBases)
                {
                    var label = new Label()
                    {
                        Location  = new Point(239, localLblY),
                        Size      = new Size(112, 39),
                        Name      = cBBdbRCntlPntBase.CntlPntCd,
                        BackColor = Color.LightSlateGray,
                        Font      = new Font("微软雅黑", 10.8F, FontStyle.Bold,
                                             GraphicsUnit.Point, ((byte)(134))),
                        Text      = cBBdbRCntlPntBase.CntlPntNm,
                        TextAlign = ContentAlignment.MiddleCenter,
                    };
                    if (label.Name.Equals("control001"))
                    {
                        label.Click += BeginQcEvent;
                    }
                    else if (label.Name.Equals("control002"))
                    {
                        label.Click += UpLoadReportEvent;
                    }
                    else if (label.Name.Equals("control003"))
                    {
                        label.Click += EndQcEvent;
                    }
                    ProductionStatusInfoPanel.Controls.Add(label);
                    localLblY += 96;
                }
            }

            //获取当前质检中心的质检任务(已上线)
            using (var context = new Model())
            {
                var cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.EquipmentID == _equipmentId && s.OnlineTime != null);
                if (cCheckProcessing != null)
                {
                    ProductIDTxt.Text          = cCheckProcessing.ProductBornCode;
                    ProductIDTxt.ReadOnly      = true;
                    ProductNameTxt.Text        = cCheckProcessing.ProductName;
                    ProductNameTxt.ReadOnly    = true;
                    CurrentProcessTxt.Text     = "手动检验";
                    CurrentProcessTxt.ReadOnly = true;
                    QCTimeTxt.Text             = cCheckProcessing.OnlineTime.ToString();
                    QCTimeTxt.ReadOnly         = true;
                    ProductionStatusInfoPanel.Controls.Find("control001", false).First().BackColor =
                        Color.MediumSeaGreen;
                }
                if (!string.IsNullOrEmpty(ProductIDTxt.Text))
                {
                    //在质检过程表中根据产品出生证  获取元数据
                    _cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim());
                }
            }

            //初始化判断质检文件上传完成与否
            ReportUploadJudge();

            timer1.Enabled = true;
        }
Пример #10
0
        private void MainPanel_Load(object sender, EventArgs e)
        {
            var addXmlFile = new ConfigurationBuilder().SetBasePath("E:\\project\\visual Studio Project\\HotPressing")
                             .AddXmlFile("config.xml");
            var configuration = addXmlFile.Build();

            _workshopId    = configuration["WorkshopID"];
            _workshopCode  = configuration["WorkshopCode"];
            _workshopName  = configuration["WorkshopName"];
            _equipmentId   = configuration["EquipmentID"];
            _equipmentCode = configuration["EquipmentCode"];
            _equipmentName = configuration["EquipmentName"];

            //使用hzh控件自带的图标库 tuple

            //解析tuple 加载顶部菜单栏 绑定事件
            var workersGaugeLabel = GenerateLabel();

            workersGaugeLabel.Click += lbl_DoubleClick;

            var scanGunStateLabel = GenerateLabel();

            scanGunStateLabel.DoubleClick += lbl_DoubleClick;

            // var onlineLabel = GenerateLabel();
            // onlineLabel.Click += OpenScanOnlineForm;

            var programFilesLabel = GenerateLabel();

            programFilesLabel.Click += OpenProgramFile;

            var workInstructionLabel = GenerateLabel();

            workInstructionLabel.Click += OpenWorkInstruction;

            // var selfCheckItemInputLabel = GenerateLabel();
            // selfCheckItemInputLabel.Click += OpenSelfCheckItemForm;

            // var offlineLabel = GenerateLabel();
            // offlineLabel.Click += OpenScanOfflineForm;

            var forceOfflineLabel = GenerateLabel();

            forceOfflineLabel.Click += OpenForceOfflineForm;

            var forceOfflineLabel1 = GenerateLabel();

            forceOfflineLabel1.Click += OpenForceOfflineForm;

            var switchAccountLabel = GenerateLabel();

            switchAccountLabel.Click += OpenLoginForm;

            var exitLabel = GenerateLabel();

            exitLabel.Click += CloseForms;

            // 加载人员信息图标
            var tuple1      = new Tuple <string, string>("人员信息", "A_fa_address_card_o");
            var icon1       = (FontIcons)Enum.Parse(typeof(FontIcons), tuple1.Item2);
            var pictureBox1 = new PictureBox
            {
                AutoSize  = false,
                Size      = new Size(240, 160),
                ForeColor = Color.FromArgb(255, 77, 59),
                Image     = FontImages.GetImage(icon1, 32, Color.FromArgb(255, 77, 59)),
                Location  = new Point(110, 20)
            };

            PersonnelInfoPanel.Controls.Add(pictureBox1);

            // 加载箭头图标
            var tuple2 = new Tuple <string, string>("Arrow", "A_fa_arrow_down");
            var icon2  = (FontIcons)Enum.Parse(typeof(FontIcons), tuple2.Item2);
            int localY = 72;

            for (var i = 0; i < 1; i++)
            {
                ProductionStatusInfoPanel.Controls.Add(new PictureBox()
                {
                    AutoSize  = false,
                    Size      = new Size(40, 40),
                    ForeColor = Color.FromArgb(255, 77, 59),
                    Image     = FontImages.GetImage(icon2, 40, Color.FromArgb(255, 77, 59)),
                    Location  = new Point(270, localY)
                });
                localY += 98;
            }

            //修改自定义控件label.text文本
            CompletedTask.label1.Text       = " 已完成任务";
            ProductionTaskQueue.label1.Text = "热压任务队列";

            InitialDidTasks();

            ucSignalLamp1.LampColor = new Color[] { Color.Green };
            ucSignalLamp2.LampColor = new Color[] { Color.Red };

            InialToDoTasks();

            //初始化生产状态信息面板
            using (var context = new Model())
            {
                //这里需要配置修改xml
                var cBBdbRCntlPntBases = context.C_BBdbR_CntlPntBase.Where(s =>
                                                                           s.CntlPntTyp == "3" && s.Enabled == 1.ToString())
                                         .OrderBy(s => s.CntlPntSort).ToList();

                int localLblY = 25;
                foreach (var cBBdbRCntlPntBase in cBBdbRCntlPntBases)
                {
                    var label = new Label()
                    {
                        Location  = new Point(239, localLblY),
                        Size      = new Size(112, 39),
                        Name      = cBBdbRCntlPntBase.CntlPntCd,
                        BackColor = Color.LightSlateGray,
                        Font      = new Font("微软雅黑", 10.8F, FontStyle.Bold,
                                             GraphicsUnit.Point, ((byte)(134))),
                        Text      = cBBdbRCntlPntBase.CntlPntNm,
                        TextAlign = ContentAlignment.MiddleCenter,
                    };
                    if (label.Name.Equals("control001"))
                    {
                        label.Click += ProductOnlineEvent;
                    }
                    // else if (label.Name.Equals("control002"))
                    // {
                    // label.Click += SelfCheckItemEvent;
                    // }
                    else if (label.Name.Equals("control002"))
                    {
                        label.Click += ProductOfflineEvent;
                    }
                    ProductionStatusInfoPanel.Controls.Add(label);
                    localLblY += 96;
                }
            }

            //获取当前加工中心的生产任务(已上线)
            using (var context = new Model())
            {
                var cProductProcessing = context.C_ProductProcessing
                                         .FirstOrDefault(s => s.WorkshopCode == _workshopCode && s.OnlineTime != null);
                if (cProductProcessing != null)
                {
                    ProductIDTxt.Text          = cProductProcessing.ProductBornCode;
                    ProductIDTxt.ReadOnly      = true;
                    ProductNameTxt.Text        = cProductProcessing.ProductName;
                    ProductNameTxt.ReadOnly    = true;
                    CurrentProcessTxt.Text     = cProductProcessing.ProcedureName;
                    CurrentProcessTxt.ReadOnly = true;
                    OnlineTimeTxt.Text         = cProductProcessing.OnlineTime.ToString();
                    OnlineTimeTxt.ReadOnly     = true;
                    // ProductOnlineLbl.BackColor = Color.MediumSeaGreen;
                    ProductionStatusInfoPanel.Controls.Find("control001", false).First().BackColor =
                        Color.MediumSeaGreen;
                }

                if (!string.IsNullOrEmpty(ProductIDTxt.Text))
                {
                    //在产品加工过程表中根据产品出生证  获取元数据
                    _cProductProcessing = context.C_ProductProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim());
                }
            }

            timer1.Enabled = true;
        }