using DocumentFormat.OpenXml.Office2010.ExcelAc; using Models; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace LeatherApp.Page { public partial class CuttingFrm : Form { public string[] Cut_info; public CuttingFrm(List DefectInfoList) { InitializeComponent(); this.comboBox2.SelectedIndex = 0; //加载分卷信息 List DefectTotal = null; List liststr = new List(); if (Config.DownGradeReason != null && Config.DownGradeReason.Count > 0) { foreach (var item in Config.DownGradeReason) { liststr.Add($"{item.Key}{item.Value}"); } } else { liststr.Add("无瑕疵人工裁切"); { if (DefectInfoList != null && DefectInfoList.Count > 0) { var deflist = DefectInfoList; DefectTotal = deflist.GroupBy(x => x.Name).Select(g => new JDefectTotal { Name = g.Key, Count = g.Count() }).ToList(); } if (DefectTotal != null && DefectTotal.Count > 0) foreach (var item in DefectTotal) { liststr.Add($"{item.Name}{item.Count}个"); } } } comboBox1.DataSource = liststr; } private void skinButton2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } private void skinButton1_Click(object sender, EventArgs e) { if(numericUpDown1.Value == 0) { MessageBox.Show("请输入裁切米数!"); return; } if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("请裁切原因!"); return; } Cut_info = new string[3]; Cut_info[0] = numericUpDown1.Value.ToString(); Cut_info[1] = textBox1.Text; Cut_info[2] = comboBox2.Text; this.DialogResult = DialogResult.OK; } private void skinButton3_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) textBox1.Text += comboBox1.Text; else textBox1.Text += $",{comboBox1.Text}"; } public class JDefectTotal { [Description("疵点名")] public string Name { get; set; } [Description("疵点数")] public int Count { get; set; } } } }