diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs
new file mode 100644
index 0000000..d2b868e
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs
@@ -0,0 +1,60 @@
+using System.Collections.Generic;
+using System.Linq;
+using FreeSql.DataAnnotations;
+using Mesnac.Action.ChemicalWeighing.FreeDb;
+
+namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
+{
+ public class DeviceMaterrial
+ {
+ [Column(IsPrimary = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+
+ ///
+ /// 设备编号
+ ///
+ public int DeviceId { get; set; }
+
+ ///
+ /// 对应物料的Id
+ ///
+
+ public int MaterrialId { get; set; }
+
+ ///
+ /// 1 干混机 2 糊化机
+ ///
+
+ public int Type { get; set; }
+
+ }
+
+
+ public class DeviceMaterrialService
+ {
+
+
+ public void Save(List materrials)
+ {
+ var deviceMaterrial = materrials.First();
+
+ FreeSqlUnit.Instance.Delete()
+ .Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId)
+ .ExecuteDeleted();
+
+ FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows();
+ }
+
+
+ public List GetByTypeId(int type, int deviceId)
+ {
+ return FreeSqlUnit.Instance.Select()
+ .Where(x => x.Type == type && x.DeviceId == deviceId)
+ .ToList();
+ }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs
new file mode 100644
index 0000000..1b4b57b
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using Mesnac.Action.ChemicalWeighing.LjMaterial;
+
+namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB
+{
+ public class StockMaterrialDbHelp
+ {
+
+
+
+ ///
+ /// 获取干混机物料
+ ///
+ ///
+ public List GetDryerMaterrial()
+ {
+ var list = GetStockMaterrial(1);
+ list.RemoveAll(x => x.Id == 5);
+ list.RemoveAll(x => x.Id == 6);
+ return list;
+ }
+
+ ///
+ /// 获取糊化机物料
+ ///
+ ///
+ public List GetSiloMaterrial()
+ {
+ var list1 = GetStockMaterrial(1);
+ list1 = list1.Where(x => x.Id == 5 || x.Id == 6).ToList();
+ return list1;
+ }
+
+ ///
+ /// 根据物料获取罐号
+ ///
+ ///
+ ///
+
+ public int GetCodeById(int id)
+ {
+ string sql = $"select Code from lj_stock_material where Id={id}";
+ var dataTable = DBHelp.GetTable(sql);
+ return Convert.ToInt16(dataTable.Rows[0][0]);
+ }
+
+
+
+
+ private List GetStockMaterrial(int mtypId)
+ {
+ string sql = "select Id, Code, StockName, MTypeId, MTypeName, MId, MName, Remark from lj_stock_material";
+
+ var dataTable = DBHelp.GetTable(sql);
+ List ls = new List();
+ ls.Add(new MyNameValue()
+ {
+ Id = -1,
+ Name = "请选择"
+ });
+ foreach (DataRow o in dataTable.Rows)
+ {
+ int tableMTypeId = Convert.ToInt32(o["MTypeId"]);
+ if (mtypId != 0)
+ {
+ if (tableMTypeId == mtypId)
+ {
+ ls.Add(new MyNameValue()
+ {
+ Id = (int)o["Id"],
+ Name = o["StockName"].ToString() + $"({o["MName"]})"
+ });
+ }
+ }
+ }
+ return ls;
+ }
+
+ }
+}
\ No newline at end of file