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(Records model) { InitializeComponent(); //加载分卷信息 List DefectTotal = null; List liststr = new List(); liststr.Add("无瑕疵人工裁切"); if (model != null) { if (model.DefectInfoList != null && model.DefectInfoList.Count > 0) { var deflist = model.DefectInfoList.FindAll(x => x.Y < ((model.Len - Config.CutDis) * 100)); foreach (var item in deflist) { item.Name = Config.getDefectName(model.ProductInfo.ModelName, item.Code); } //foreach (var item in deflist) //{ // item.Name = SysMgr.Instance.GetDefectName(model.ProductInfo.ModelName, item.Code); //} 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] = textBox2.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; } } } }