diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs index 7787b62..71bff69 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs @@ -14,8 +14,14 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial public int Id { get; set; } public string Name { get; set; } } - - + + public class MyNameValueStr + { + public String Id { get; set; } + public string Name { get; set; } + } + + public class MaterialInfoTypeHelp:DBHelp { diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/MetageFormulaDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/MetageFormulaDb.cs new file mode 100644 index 0000000..ec6763c --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/MetageFormulaDb.cs @@ -0,0 +1,39 @@ +using Mesnac.Action.ChemicalWeighing.LjMaterial; + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.LjMetageFormula +{ + internal class MetageFormulaDb: DBHelp + { + + /// + /// 获取所有的称量配方 + /// + /// + public static List GetMetageNmaValue() + { + List myNameValues = new List(); + + string sql = $"select Id,Name from lj_metage"; + var dataTable = GetTable(sql); + foreach (DataRow dataTableRow in dataTable.Rows) + { + myNameValues.Add(new MyNameValueStr() + { + Id = dataTableRow[0].ToString(), + Name = dataTableRow[1].ToString() + }); + } + + return myNameValues; + } + + + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/StockMaterialDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/StockMaterialDb.cs index 65ec1db..62ec751 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/StockMaterialDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMetageFormula/StockMaterialDb.cs @@ -28,8 +28,27 @@ namespace Mesnac.Action.ChemicalWeighing.LjMetageFormula return myNameValues; } - - + + + public static IList GetAllMyNameValues() + { + IList myNameValues = new List(); + + string sql = $"select Id,StockName from lj_stock_material "; + var dataTable = GetTable(sql); + foreach (DataRow dataTableRow in dataTable.Rows) + { + myNameValues.Add(new MyNameValue() + { + Id = Convert.ToInt32(dataTableRow[0]), + Name = dataTableRow[1].ToString() + }); + } + + return myNameValues; + } + + public static int AddOrUpdate(WeightFormulaView view) { string sql = $"select count(Id) as a from lj_metage where Id='{view.Id}'"; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/DelAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/DelAction.cs index 60e3764..980ba2f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/DelAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/DelAction.cs @@ -19,7 +19,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula DbMCControl materialGridControl = - this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_metage") + this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_mix") .FirstOrDefault(); //获取物料数据控件 this._materialGridControl = materialGridControl; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/FrmMixFormula.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/FrmMixFormula.cs index c1d8268..f9104c0 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/FrmMixFormula.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/FrmMixFormula.cs @@ -17,6 +17,13 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula public FrmMixFormula(string id) : this() { _view = MixDb.GetById(id); + + txtName.Text = _view.Name; + + this.dataGridView1.AutoGenerateColumns = false; + this.dataGridView1.DataSource = null; + this.dataGridView1.DataSource = _view.Data; + } @@ -102,7 +109,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula if (!float.TryParse(txtTemperature.Text.Trim(), out float temperature)) { txtTemperature.Focus(); - MessageBox.Show("请输入正确的温度"); + MessageBox.Show(@"请输入正确的温度"); return; } @@ -170,6 +177,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula return; } MixDb.Save(_view); + + this.DialogResult = System.Windows.Forms.DialogResult.OK; } } } \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/MixDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/MixDb.cs index 9cb30fd..922dbaa 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/MixDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixFormula/MixDb.cs @@ -104,6 +104,29 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula } + /// + /// 获取返回混合配方的下拉框 + /// + /// + /// + public static List GetMyNameValueStrs(int deviceUnitId) + { + List myNameValues = new List(); + + string sql = $"select Id,Name,DeviceUnitName from lj_mix where DeviceUnitId={deviceUnitId} and IsEnable=1"; + var dataTable = GetTable(sql); + foreach (DataRow dataTableRow in dataTable.Rows) + { + myNameValues.Add(new MyNameValueStr() + { + Id = dataTableRow[0].ToString(), + Name = dataTableRow[1].ToString() + }); + } + + return myNameValues; + } + public static void Save(LjMixView view) { string mixId = view.Id; @@ -115,8 +138,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula { //添加 - sql = "insert into lj_mix (Id, Name, CreateTime, UpdateTime, Remark, DeviceUnitId, DeviceUnitName) " + - $" values ('{mixId}','{view.Name}',getdate(),getdate(),'',{view.DeviceUnitId},'{view.DeviceUnitName}');"; + sql = "insert into lj_mix (Id, Name, CreateTime, UpdateTime, Remark, DeviceUnitId, DeviceUnitName,IsEnable) " + + $" values ('{mixId}','{view.Name}',getdate(),getdate(),'',{view.DeviceUnitId},'{view.DeviceUnitName}',1);"; ExecuteNonQuery(sql); } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.Designer.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.Designer.cs new file mode 100644 index 0000000..37f1d3e --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.Designer.cs @@ -0,0 +1,339 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace Mesnac.Action.ChemicalWeighing.LjPlanning +{ + partial class FrmPlanning + { + /// + /// Required designer variable. + /// + private IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label3 = new System.Windows.Forms.Label(); + this.DrpProductLine = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.txtCarNumber = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.DrpMixA = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.DrpMetageA = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.DrpMixB = new System.Windows.Forms.ComboBox(); + this.label8 = new System.Windows.Forms.Label(); + this.DrpMetageB2 = new System.Windows.Forms.ComboBox(); + this.label6 = new System.Windows.Forms.Label(); + this.DrpMetageB1 = new System.Windows.Forms.ComboBox(); + this.label7 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.DrpMixC = new System.Windows.Forms.ComboBox(); + this.label9 = new System.Windows.Forms.Label(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(30, 55); + this.label3.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(71, 18); + this.label3.TabIndex = 49; + this.label3.Text = "生产线:"; + // + // DrpProductLine + // + this.DrpProductLine.FormattingEnabled = true; + this.DrpProductLine.Location = new System.Drawing.Point(171, 52); + this.DrpProductLine.Margin = new System.Windows.Forms.Padding(4); + this.DrpProductLine.Name = "DrpProductLine"; + this.DrpProductLine.Size = new System.Drawing.Size(187, 26); + this.DrpProductLine.TabIndex = 52; + this.DrpProductLine.SelectedIndexChanged += new System.EventHandler(this.DrpProductLine_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(399, 60); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(62, 18); + this.label1.TabIndex = 53; + this.label1.Text = "label1"; + // + // txtCarNumber + // + this.txtCarNumber.Location = new System.Drawing.Point(164, 110); + this.txtCarNumber.Margin = new System.Windows.Forms.Padding(8); + this.txtCarNumber.Name = "txtCarNumber"; + this.txtCarNumber.Size = new System.Drawing.Size(192, 28); + this.txtCarNumber.TabIndex = 55; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(35, 112); + this.label2.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 18); + this.label2.TabIndex = 54; + this.label2.Text = "车次:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.DrpMixA); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.DrpMetageA); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Location = new System.Drawing.Point(49, 232); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(639, 191); + this.groupBox1.TabIndex = 56; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "干混机"; + // + // DrpMixA + // + this.DrpMixA.FormattingEnabled = true; + this.DrpMixA.Location = new System.Drawing.Point(181, 110); + this.DrpMixA.Margin = new System.Windows.Forms.Padding(4); + this.DrpMixA.Name = "DrpMixA"; + this.DrpMixA.Size = new System.Drawing.Size(187, 26); + this.DrpMixA.TabIndex = 52; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(40, 113); + this.label5.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(89, 18); + this.label5.TabIndex = 49; + this.label5.Text = "混合步骤:"; + // + // DrpMetageA + // + this.DrpMetageA.FormattingEnabled = true; + this.DrpMetageA.Location = new System.Drawing.Point(181, 59); + this.DrpMetageA.Margin = new System.Windows.Forms.Padding(4); + this.DrpMetageA.Name = "DrpMetageA"; + this.DrpMetageA.Size = new System.Drawing.Size(187, 26); + this.DrpMetageA.TabIndex = 52; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(40, 62); + this.label4.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(89, 18); + this.label4.TabIndex = 49; + this.label4.Text = "粉料称量:"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.DrpMixB); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.DrpMetageB2); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.DrpMetageB1); + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Location = new System.Drawing.Point(49, 469); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(639, 235); + this.groupBox2.TabIndex = 57; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "糊化机"; + // + // DrpMixB + // + this.DrpMixB.FormattingEnabled = true; + this.DrpMixB.Location = new System.Drawing.Point(181, 154); + this.DrpMixB.Margin = new System.Windows.Forms.Padding(4); + this.DrpMixB.Name = "DrpMixB"; + this.DrpMixB.Size = new System.Drawing.Size(187, 26); + this.DrpMixB.TabIndex = 52; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(40, 162); + this.label8.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(89, 18); + this.label8.TabIndex = 49; + this.label8.Text = "混合步骤:"; + // + // DrpMetageB2 + // + this.DrpMetageB2.FormattingEnabled = true; + this.DrpMetageB2.Location = new System.Drawing.Point(181, 110); + this.DrpMetageB2.Margin = new System.Windows.Forms.Padding(4); + this.DrpMetageB2.Name = "DrpMetageB2"; + this.DrpMetageB2.Size = new System.Drawing.Size(187, 26); + this.DrpMetageB2.TabIndex = 52; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(40, 113); + this.label6.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(71, 18); + this.label6.TabIndex = 49; + this.label6.Text = "水称量:"; + // + // DrpMetageB1 + // + this.DrpMetageB1.FormattingEnabled = true; + this.DrpMetageB1.Location = new System.Drawing.Point(181, 59); + this.DrpMetageB1.Margin = new System.Windows.Forms.Padding(4); + this.DrpMetageB1.Name = "DrpMetageB1"; + this.DrpMetageB1.Size = new System.Drawing.Size(187, 26); + this.DrpMetageB1.TabIndex = 52; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(40, 62); + this.label7.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(89, 18); + this.label7.TabIndex = 49; + this.label7.Text = "粉料称量:"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.DrpMixC); + this.groupBox3.Controls.Add(this.label9); + this.groupBox3.Location = new System.Drawing.Point(49, 752); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(639, 191); + this.groupBox3.TabIndex = 58; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "湿混机"; + // + // DrpMixC + // + this.DrpMixC.FormattingEnabled = true; + this.DrpMixC.Location = new System.Drawing.Point(181, 110); + this.DrpMixC.Margin = new System.Windows.Forms.Padding(4); + this.DrpMixC.Name = "DrpMixC"; + this.DrpMixC.Size = new System.Drawing.Size(187, 26); + this.DrpMixC.TabIndex = 52; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(40, 113); + this.label9.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(89, 18); + this.label9.TabIndex = 49; + this.label9.Text = "混合步骤:"; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(362, 1090); + this.btnCancel.Margin = new System.Windows.Forms.Padding(8); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(147, 68); + this.btnCancel.TabIndex = 60; + this.btnCancel.Text = "取消"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(103, 1090); + this.btnOK.Margin = new System.Windows.Forms.Padding(8); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(147, 68); + this.btnOK.TabIndex = 59; + this.btnOK.Text = "确认"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // FrmPlanning + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(777, 1228); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.txtCarNumber); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.DrpProductLine); + this.Controls.Add(this.label3); + this.Name = "FrmPlanning"; + this.Text = "计划管理"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label3; + private ComboBox DrpProductLine; + private Label label1; + private TextBox txtCarNumber; + private Label label2; + private GroupBox groupBox1; + private ComboBox DrpMetageA; + private Label label4; + private ComboBox DrpMixA; + private Label label5; + private GroupBox groupBox2; + private ComboBox DrpMetageB2; + private Label label6; + private ComboBox DrpMetageB1; + private Label label7; + private ComboBox DrpMixB; + private Label label8; + private GroupBox groupBox3; + private ComboBox DrpMixC; + private Label label9; + private Button btnCancel; + private Button btnOK; + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.cs new file mode 100644 index 0000000..456fb35 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Mesnac.Action.ChemicalWeighing.LjMaterial; +using Mesnac.Action.ChemicalWeighing.LjMetageFormula; +using Mesnac.Action.ChemicalWeighing.LjMixFormula; +using Mesnac.Action.ChemicalWeighing.LjProdcutLine; + +namespace Mesnac.Action.ChemicalWeighing.LjPlanning +{ + public partial class FrmPlanning : Form + { + public FrmPlanning() + { + InitializeComponent(); + FillController(); + } + + private int _id; + + private LjPlanningView view = new LjPlanningView(); + public FrmPlanning(int id) : this() + { + + } + + private List productLineViews; + + // private List lsList; + + private List lsAMixList; + private List lsBMixList; + private List lsCMixList; + + private void FillController() + { + productLineViews = ProductLineDb.GetList(); + DrpProductLine.DataSource=productLineViews; + FillComboBox(DrpProductLine); + + //var selectedIndex = DrpProductLine.SelectedIndex; + //var productLineView = productLineViews[selectedIndex]; + //this.label1.Text=productLineView.DryName; + + IEnumerable ien = MetageFormulaDb.GetMetageNmaValue(); + + var drpA = ien.ToList(); + var drpB = ien.ToList(); + var drpC = ien.ToList(); + + + FillComboBox(DrpMetageA); + DrpMetageA.DataSource = drpA; + + + FillComboBox(DrpMetageB1); + DrpMetageB1.DataSource = drpB; + + FillComboBox(DrpMetageB2); + DrpMetageB2.DataSource = drpC; + + + + lsAMixList = MixDb.GetMyNameValueStrs(2); + DrpMixA.DataSource = lsAMixList; + FillComboBox(DrpMixA); + lsBMixList= MixDb.GetMyNameValueStrs(1); + DrpMixB.DataSource = lsBMixList; + FillComboBox(DrpMixB); + lsCMixList = MixDb.GetMyNameValueStrs(3); + DrpMixC.DataSource = lsCMixList; + FillComboBox(DrpMixC); + + } + + + private void FillComboBox(ComboBox combo) + { + combo.ValueMember = "Id"; + combo.DisplayMember = "Name"; + } + + private void DrpProductLine_SelectedIndexChanged(object sender, System.EventArgs e) + { + var selectedIndex = DrpProductLine.SelectedIndex; + var productLineView = productLineViews[selectedIndex]; + this.label1.Text = productLineView.DryName; + } + + private void btnCancel_Click(object sender, System.EventArgs e) + { + this.Close(); + } + + private void btnOK_Click(object sender, System.EventArgs e) + { + string carNumber = txtCarNumber.Text.Trim(); + + if (string.IsNullOrEmpty(carNumber)) + { + MessageBox.Show(@"请输入车次"); + return; + } + + if (!int.TryParse(carNumber, out var carNo)) + { + MessageBox.Show(@"请输入正确的车次"); + return; + } + + view.CreateTime = DateTime.Now; + view.UpdateTime = DateTime.Now; + view.NumCar = carNo; + view.MetageAId = DrpMetageA.SelectedValue.ToString(); + view.MetageAName = DrpMetageA.Text; + + view.MixAId = DrpMetageA.SelectedValue.ToString(); + view.MixAName = DrpMetageA.Text; + + view.MetageB1Id = DrpMetageB1.SelectedValue.ToString(); + view.MetageB1Name= DrpMetageB1.Text; + + view.MetageB2Id = DrpMetageB2.SelectedValue.ToString(); + view.MetageB2Name= DrpMetageB2.Text; + + view.MixBId= DrpMixB.SelectedValue.ToString(); + view.MixBName=DrpMixB.Text; + + view.MixCId =DrpMixC.SelectedValue.ToString(); + view.MixCName=DrpMixC.Text; + + if (_id == 0) + { + LjPlanningDb.Add(view); + } + + } + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.resx b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/FrmPlanning.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs new file mode 100644 index 0000000..007589b --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Runtime.CompilerServices; +using System.Text; +using Mesnac.Action.ChemicalWeighing.LjMaterial; + +namespace Mesnac.Action.ChemicalWeighing.LjPlanning +{ + public class LjPlanningDb:DBHelp + { + + public static void Add(LjPlanningView view) + { + string sql = $"insert into lj_planning " + + $"values (@No,@Status,@CreateTime,@UpdateTime,@BegTime,@EndTime,@NumCar," + + $"@Share,@MetageAId,@MetageAName,@MixAId,@MixAName,@MetageB1Id,@MetageB1Name,@MetageB2Id,@MetageB2Name,@MixBId,@MixBName,@MixCId,@MixCName,@RecipeType,@Remark)"; + + + IDictionary dic = new Dictionary(); + dic["@No"] = view.No; + dic["@Status"] = view.Status; + dic["@CreateTime"] = view.CreateTime; + dic["@UpdateTime"] = view.UpdateTime; + dic["@BegTime"] = view.BegTime; + dic["@EndTime"] = view.EndTime; + dic["@NumCar"] = view.NumCar; + + dic["@Share"] = view.Share; + dic["@MetageAId"] = view.MetageAId; + dic["@MetageAName"] = view.MetageAName; + dic["@MixAId"] = view.MixAId; + dic["@MixAName"] = view.MixAName; + + dic["@MetageB1Id"] = view.MetageB1Id; + dic["@MetageB1Name"] = view.MetageB1Name; + dic["@MetageB2Id"] = view.MetageB2Id; + dic["@MetageB2Name"] = view.MetageB2Name; + dic["@MixBId"] = view.MixBId; + dic["@MixBName"] = view.MixBName; + + + dic["@MixCId"] = view.MixCId; + dic["@MixCName"] = view.MixCName; + dic["@RecipeType"] = view.RecipeType; + dic["@Remark"] = view.Remark; + ExecuteNonQuery(sql,dic); + + } + + public static void Update(LjPlanningView view) + { + StringBuilder sb = new StringBuilder(); + sb.Append(" update lj_planning "); + sb.Append($" set No='{view.No}', "); + sb.Append($" set Status='{view.Status}', "); + sb.Append($" set CreateTime='{view.CreateTime}', "); + sb.Append($" set UpdateTime='{view.UpdateTime}', "); + sb.Append($" set BegTime='{view.BegTime}', "); + sb.Append($" set EndTime='{view.EndTime}', "); + sb.Append($" set NumCar='{view.NumCar}', "); + sb.Append($" set Share='{view.Share}', "); + sb.Append($" set MetageAId='{view.MetageAId}', "); + sb.Append($" set MetageAName='{view.MetageAName}', "); + sb.Append($" set MixAId='{view.MixAId}', "); + sb.Append($" set MixAName='{view.MixAName}', "); + + sb.Append($" set MetageB1Id='{view.MetageB1Id}', "); + sb.Append($" set MetageB1Name='{view.MetageB1Name}', "); + sb.Append($" set MetageB2Id='{view.MetageB2Id}', "); + sb.Append($" set MetageB2Name='{view.MetageB2Name}', "); + sb.Append($" set MixBId='{view.MixBId}', "); + sb.Append($" set MixBName='{view.MixBName}', "); + + sb.Append($" set MixCId='{view.MixCId}', "); + sb.Append($" set MixCName='{view.MixCName}', "); + sb.Append($" set RecipeType='{view.RecipeType}', "); + + sb.Append($" set Remark='{view.Remark}' "); + + + sb.Append($" where id={view.Id}"); + + ExecuteNonQuery(sb.ToString()); + } + + public static LjPlanningView GetById(int id) + { + string sql = $"select Id, No, Status, CreateTime, UpdateTime, BegTime, EndTime, " + + $"NumCar, Share, MetageAId, MetageAName, MixAId, MixAName," + + $" MetageB1Id, MetageB1Name, MetageB2Id, MetageB2Name, MixBId, MixBName, " + + $"MixCId, MixCName, RecipeType, Remark from lj_planning where id={id}"; + + DataTable dt = GetTable(sql); + + LjPlanningView view = new LjPlanningView(); + + if (dt.Rows.Count == 1) + { + DataRow dr = dt.Rows[0]; + if (dr["No"] != null) + { + view.No = dr["No"].ToString(); + } + + if (dr["Status"] != null) + { + view.Status = dr["Status"].ToString(); + } + + if (dr["CreateTime"] != null) + { + view.CreateTime = Convert.ToDateTime(dr["CreateTime"]); + } + + if (dr["UpdateTime"] != null) + { + view.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]); + } + + + if (dr["BegTime"] != null) + { + view.BegTime = dr["BegTime"].ToString(); + } + + if (dr["EndTime"] != null) + { + view.EndTime = dr["EndTime"].ToString(); + } + + if (dr["NumCar"] != null) + { + view.NumCar = Convert.ToInt32(dr["NumCar"]); + } + + if (dr["Share"] != null) + { + view.Share = Convert.ToInt32(dr["Share"]); + } + + if (dr["MetageAId"] != null) + { + view.MetageAId = dr["MetageAId"].ToString(); + } + + if (dr["MetageAName"] != null) + { + view.MetageAName = dr["MetageAName"].ToString(); + } + + if (dr["MixAId"] != null) + { + view.MixAId = dr["MetageAId"].ToString(); + } + + if (dr["MixAName"] != null) + { + view.MixAName = dr["MixAName"].ToString(); + } + + + + if (dr["MetageB1Id"] != null) + { + view.MetageB1Id = dr["MetageB1Id"].ToString(); + } + + if (dr["MetageB1Name"] != null) + { + view.MetageB1Name = dr["MetageB1Name"].ToString(); + } + + if (dr["MetageB2Id"] != null) + { + view.MetageB2Id = dr["MetageB2Id"].ToString(); + } + + if (dr["MetageB2Name"] != null) + { + view.MetageB2Name = dr["MetageB2Name"].ToString(); + } + + if (dr["MixBId"] != null) + { + view.MixBId = dr["MixBId"].ToString(); + } + + if (dr["MixBName"] != null) + { + view.MixBName = dr["MixBName"].ToString(); + } + + + if (dr["MixBId"] != null) + { + view.MixBId = dr["MixBId"].ToString(); + } + + if (dr["MixBName"] != null) + { + view.MixBName = dr["MixBName"].ToString(); + } + + if (dr["MixCId"] != null) + { + view.MixCId = dr["MixCId"].ToString(); + } + + if (dr["MixCName"] != null) + { + view.MixCName = dr["MixCName"].ToString(); + } + + + if (dr["RecipeType"] != null) + { + view.RecipeType = Convert.ToInt32(dr["RecipeType"]); + } + + if (dr["Remark"] != null) + { + view.Remark = dr["Remark"].ToString(); + } + + } + + + return view; + } + + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningView.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningView.cs new file mode 100644 index 0000000..87aefe6 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningView.cs @@ -0,0 +1,53 @@ +using System; + +namespace Mesnac.Action.ChemicalWeighing.LjPlanning +{ + public class LjPlanningView + { + public int Id { get; set; } + + public string No { get; set; } + + public string Status { get; set; } + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } + + public string BegTime { get; set; } + + public string EndTime { get; set; } + + public int NumCar { get; set; } + + public int Share { get; set; } + + public string MetageAId { get; set; } + + public string MetageAName { get; set; } + + public string MixAId { get; set; } + + public string MixAName { get; set; } + + public string MetageB1Id { get; set; } + + public string MetageB1Name { get; set; } + + public string MetageB2Id { get; set; } + + public string MetageB2Name { get; set; } + + public string MixBId { get; set; } + + public string MixBName { get; set; } + + public string MixCId { get; set; } + + public string MixCName { get; set; } + + public int RecipeType { get; set; } + + public string Remark { get; set; } + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProdcutLine/ProductLineDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProdcutLine/ProductLineDb.cs index fe8f35b..237006b 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProdcutLine/ProductLineDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProdcutLine/ProductLineDb.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Runtime.CompilerServices; using Mesnac.Action.ChemicalWeighing.LjMaterial; @@ -39,6 +40,36 @@ namespace Mesnac.Action.ChemicalWeighing.LjProdcutLine } + + /// + /// 返回所有的实体 + /// + /// + /// + public static List GetList() + { + List ls = new List(); + + + string sql = $"select Id, Name, CreateTime, DryId, DryName from lj_product_line "; + DataTable dt = GetTable(sql); + + foreach (DataRow dtRow in dt.Rows) + { + var datarow = dtRow; + ProductLineView view = new ProductLineView(); + view.Id = Convert.ToInt32(datarow["Id"]); + view.Name = datarow["Name"].ToString(); + view.CreateTime = Convert.ToDateTime(datarow["CreateTime"]); + view.DryId = datarow["DryId"].ToString(); + view.DryName = datarow["DryName"].ToString(); + ls.Add(view); + } + + return ls; + + } + /// /// 通过Id去更新设备 /// diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index d2302df..d487c8e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -272,6 +272,7 @@ FrmMetageFormula.cs + @@ -302,6 +303,14 @@ + + Form + + + FrmPlanning.cs + + + Form @@ -620,6 +629,9 @@ FrmMixFormula.cs + + FrmPlanning.cs + FrmPressureUpdate.cs diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index 6ee60e9..15dad69 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -9,6 +9,7 @@ using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Action.ChemicalWeighing.LjMetageFormula; using Mesnac.Action.ChemicalWeighing.LjMixFormula; +using Mesnac.Action.ChemicalWeighing.LjPlanning; using Mesnac.Action.ChemicalWeighing.LjProdcutLine; using Mesnac.Basic; using Mesnac.Codd.Session; @@ -33,10 +34,10 @@ namespace Mesnac.Action.ChemicalWeighing.Test } // dbHelper.ClearParameter(); // dbHelper.CommandType = CommandType.Text; - // dbHelper.CommandText = sql; + // dbHelper.CommandText = sql; - FrmProductLine frmMetageFormula = new FrmProductLine(2); + FrmPlanning frmMetageFormula = new FrmPlanning(2); frmMetageFormula.Show();