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()) { //在检验过程表中根据产品出生证获取元数据 _cCheckProcessing = context.C_CheckProcessing.First(s => s.ProductBornCode == _productBornCode); BeginInvoke(new Action(() => { ProductIDTxt.Text = _productBornCode; ProductIDTxt.ReadOnly = true; ProductNameTxt.Text = _cCheckProcessing.ProductName; ProductNameTxt.ReadOnly = true; })); } }
private void ReportUploadJudge() { using (var context = new Model()) { //在质检过程表中根据产品出生证 获取元数据 _cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim()); if (_cCheckProcessing != null) { var any = context.C_CheckProcessing.Any(s => s.ProductBornCode == ProductIDTxt.Text.Trim() && s.ProcedureName == "" && s.CheckType == (decimal?)CheckType.Manual && s.CheckReportPath != null); if (any) { ProductionStatusInfoPanel.Controls.Find("control002", false).First().BackColor = Color.MediumSeaGreen; } } } }
private void UpLoadReportEvent(object sender, EventArgs e) { panel10.Controls.Clear(); if (string.IsNullOrEmpty(ProductIDTxt.Text)) { FrmDialog.ShowDialog(this, "未检测到上线质检产品", "警告"); return; } using (var context = new Model()) { //在质检加工过程表中根据产品出生证 获取元数据 _cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim()); } if (_cCheckProcessing != null) { AddUploadCntLogic("手检"); var selectUploadFile = SelectUploadFile(out string filePath); if (selectUploadFile == DialogResult.OK) { UploadFilePath(filePath); //由于服务器炸裂 所以上传不了呜呜呜 // connectState("\\192.168.1.22", "administrator", "hfutIE100310#"); // var upLoadFile2 = UpLoadFile2(filePath, "ftp://[email protected]/ljsdemo/", "ZLR", "SA123", 1); // if (!upLoadFile2) // { // return; // } ProductionStatusInfoPanel.Controls.Find("control002", false).First().BackColor = Color.MediumSeaGreen; FrmDialog.ShowDialog(this, "质检报告上传成功"); } } else { FrmDialog.ShowDialog(this, "未检测到上线质检产品", "警告"); } }
private void UpLoadReportEvent(object sender, EventArgs e) { panel10.Controls.Clear(); if (string.IsNullOrEmpty(ProductIDTxt.Text)) { FrmDialog.ShowDialog(this, "未检测到上线质检产品", "警告"); return; } using (var context = new Model()) { //在质检加工过程表中根据产品出生证 获取元数据 _cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim()); } if (_cCheckProcessing != null) { AddUploadCntLogic(); var selectUploadFile = SelectUploadFile(out string filePath); if (selectUploadFile == DialogResult.OK) { //文件夹命名规则: 订单号-项目号-产品出生证 string directoryName = _cCheckProcessing.PlanID.ToString() + '-' + _cCheckProcessing.ProjectID + '-' + _cCheckProcessing.ProductBornCode; // var upLoadFile2 = UpLoadFile2(filePath, urlPath, "ZLR", "SA123", 1); var upLoadFile2 = UpLoadFile2(filePath, $"ftp://[email protected]/{directoryName}/", "ZLR", "SA123", 1, out var remoteFileAddress); if (!upLoadFile2) { return; } UploadFilePath(remoteFileAddress); ProductionStatusInfoPanel.Controls.Find("control002", false).First().BackColor = Color.MediumSeaGreen; FrmDialog.ShowDialog(this, "质检报告上传成功"); } } else { FrmDialog.ShowDialog(this, "未检测到上线质检产品", "警告"); } }
private void ReportUploadJudge() { using (var context = new Model()) { //在质检过程表中根据产品出生证 获取元数据 _cCheckProcessing = context.C_CheckProcessing.FirstOrDefault(s => s.ProductBornCode == ProductIDTxt.Text.Trim()); if (_cCheckProcessing != null) { //前提是 工序编号里没有空格这样的特殊字符 var strings = CurrentProcessTxt.Text.Trim().Split(' ')[0]; var any = context.C_CheckProcessing.Any(s => s.ProductBornCode == ProductIDTxt.Text.Trim() && s.ProcedureName == strings && s.CheckType == (decimal?)CheckType.ThreeCoordinate && s.CheckReportPath != null && s.OfflineStaffID == null); if (any) { ProductionStatusInfoPanel.Controls.Find("control002", false).First().BackColor = Color.MediumSeaGreen; } } } }
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; }