0801 临时提交

master
nodyang 2 years ago
parent 896c081d3b
commit a441d9ca59

@ -15,6 +15,12 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial
public string Name { get; set; } public string Name { get; set; }
} }
public class MyNameValueStr
{
public String Id { get; set; }
public string Name { get; set; }
}
public class MaterialInfoTypeHelp:DBHelp public class MaterialInfoTypeHelp:DBHelp
{ {

@ -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
{
/// <summary>
/// 获取所有的称量配方
/// </summary>
/// <returns></returns>
public static List<MyNameValueStr> GetMetageNmaValue()
{
List<MyNameValueStr> myNameValues = new List<MyNameValueStr>();
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;
}
}
}

@ -30,6 +30,25 @@ namespace Mesnac.Action.ChemicalWeighing.LjMetageFormula
} }
public static IList<MyNameValue> GetAllMyNameValues()
{
IList<MyNameValue> myNameValues = new List<MyNameValue>();
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) public static int AddOrUpdate(WeightFormulaView view)
{ {
string sql = $"select count(Id) as a from lj_metage where Id='{view.Id}'"; string sql = $"select count(Id) as a from lj_metage where Id='{view.Id}'";

@ -19,7 +19,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula
DbMCControl materialGridControl = DbMCControl materialGridControl =
this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_metage") this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_mix")
.FirstOrDefault(); //获取物料数据控件 .FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl; this._materialGridControl = materialGridControl;

@ -17,6 +17,13 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula
public FrmMixFormula(string id) : this() public FrmMixFormula(string id) : this()
{ {
_view = MixDb.GetById(id); _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)) if (!float.TryParse(txtTemperature.Text.Trim(), out float temperature))
{ {
txtTemperature.Focus(); txtTemperature.Focus();
MessageBox.Show("请输入正确的温度"); MessageBox.Show(@"请输入正确的温度");
return; return;
} }
@ -170,6 +177,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula
return; return;
} }
MixDb.Save(_view); MixDb.Save(_view);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
} }
} }
} }

@ -104,6 +104,29 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixFormula
} }
/// <summary>
/// 获取返回混合配方的下拉框
/// </summary>
/// <param name="deviceUnitId"></param>
/// <returns></returns>
public static List<MyNameValueStr> GetMyNameValueStrs(int deviceUnitId)
{
List<MyNameValueStr> myNameValues = new List<MyNameValueStr>();
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) public static void Save(LjMixView view)
{ {
string mixId = view.Id; 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) " + sql = "insert into lj_mix (Id, Name, CreateTime, UpdateTime, Remark, DeviceUnitId, DeviceUnitName,IsEnable) " +
$" values ('{mixId}','{view.Name}',getdate(),getdate(),'',{view.DeviceUnitId},'{view.DeviceUnitName}');"; $" values ('{mixId}','{view.Name}',getdate(),getdate(),'',{view.DeviceUnitId},'{view.DeviceUnitName}',1);";
ExecuteNonQuery(sql); ExecuteNonQuery(sql);
} }

@ -0,0 +1,339 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
{
partial class FrmPlanning
{
/// <summary>
/// Required designer variable.
/// </summary>
private IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

@ -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<ProductLineView> productLineViews;
// private List<MyNameValueStr> lsList;
private List<MyNameValueStr> lsAMixList;
private List<MyNameValueStr> lsBMixList;
private List<MyNameValueStr> 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<MyNameValueStr> 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);
}
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -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<string, object> dic = new Dictionary<string, object>();
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;
}
}
}

@ -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; }
}
}

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Mesnac.Action.ChemicalWeighing.LjMaterial; using Mesnac.Action.ChemicalWeighing.LjMaterial;
@ -39,6 +40,36 @@ namespace Mesnac.Action.ChemicalWeighing.LjProdcutLine
} }
/// <summary>
/// 返回所有的实体
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static List<ProductLineView> GetList()
{
List<ProductLineView> ls = new List<ProductLineView>();
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;
}
/// <summary> /// <summary>
/// 通过Id去更新设备 /// 通过Id去更新设备
/// </summary> /// </summary>

@ -272,6 +272,7 @@
<DependentUpon>FrmMetageFormula.cs</DependentUpon> <DependentUpon>FrmMetageFormula.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LjMetageFormula\InItDbAction.cs" /> <Compile Include="LjMetageFormula\InItDbAction.cs" />
<Compile Include="LjMetageFormula\MetageFormulaDb.cs" />
<Compile Include="LjMetageFormula\SelectRecipe.cs" /> <Compile Include="LjMetageFormula\SelectRecipe.cs" />
<Compile Include="LjMetageFormula\StockMaterialDb.cs" /> <Compile Include="LjMetageFormula\StockMaterialDb.cs" />
<Compile Include="LjMetageFormula\UpdateAction.cs" /> <Compile Include="LjMetageFormula\UpdateAction.cs" />
@ -302,6 +303,14 @@
<Compile Include="LjMixFormula\MixDb.cs" /> <Compile Include="LjMixFormula\MixDb.cs" />
<Compile Include="LjMixFormula\SelectRecipe.cs" /> <Compile Include="LjMixFormula\SelectRecipe.cs" />
<Compile Include="LjMixFormula\UpdateAction.cs" /> <Compile Include="LjMixFormula\UpdateAction.cs" />
<Compile Include="LjPlanning\FrmPlanning.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LjPlanning\FrmPlanning.Designer.cs">
<DependentUpon>FrmPlanning.cs</DependentUpon>
</Compile>
<Compile Include="LjPlanning\LjPlanningDb.cs" />
<Compile Include="LjPlanning\LjPlanningView.cs" />
<Compile Include="LjPressure\DownAction.cs" /> <Compile Include="LjPressure\DownAction.cs" />
<Compile Include="LjPressure\FrmPressureUpdate.cs"> <Compile Include="LjPressure\FrmPressureUpdate.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@ -620,6 +629,9 @@
<EmbeddedResource Include="LjMixFormula\FrmMixFormula.resx"> <EmbeddedResource Include="LjMixFormula\FrmMixFormula.resx">
<DependentUpon>FrmMixFormula.cs</DependentUpon> <DependentUpon>FrmMixFormula.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="LjPlanning\FrmPlanning.resx">
<DependentUpon>FrmPlanning.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LjPressure\FrmPressureUpdate.resx"> <EmbeddedResource Include="LjPressure\FrmPressureUpdate.resx">
<DependentUpon>FrmPressureUpdate.cs</DependentUpon> <DependentUpon>FrmPressureUpdate.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

@ -9,6 +9,7 @@ using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.LjMetageFormula; using Mesnac.Action.ChemicalWeighing.LjMetageFormula;
using Mesnac.Action.ChemicalWeighing.LjMixFormula; using Mesnac.Action.ChemicalWeighing.LjMixFormula;
using Mesnac.Action.ChemicalWeighing.LjPlanning;
using Mesnac.Action.ChemicalWeighing.LjProdcutLine; using Mesnac.Action.ChemicalWeighing.LjProdcutLine;
using Mesnac.Basic; using Mesnac.Basic;
using Mesnac.Codd.Session; using Mesnac.Codd.Session;
@ -36,7 +37,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
// dbHelper.CommandText = sql; // dbHelper.CommandText = sql;
FrmProductLine frmMetageFormula = new FrmProductLine(2); FrmPlanning frmMetageFormula = new FrmPlanning(2);
frmMetageFormula.Show(); frmMetageFormula.Show();

Loading…
Cancel
Save