|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工艺管理辅助类
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class TechnicalHelper
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 数据获取
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取RT_Parameter数据实体
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回RT_Parameter数据实体</returns>
|
|
|
|
|
public static RT_Parameter GetRT_ParameterEntity(int binNum)
|
|
|
|
|
{
|
|
|
|
|
int _binNum = binNum;
|
|
|
|
|
DataRow rT_ParameterDr = GetRT_ParameterDataRow(_binNum);
|
|
|
|
|
return ConvertDataToRT_Parameter(rT_ParameterDr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从数据库获取料仓参数设置数据(首行)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回仓参数设置数据行</returns>
|
|
|
|
|
public static DataRow GetRT_ParameterDataRow(int binNum)
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string sqlstr = "select top 1 * from RT_Parameter where Bin_Serial = '"+ binNum +"'";
|
|
|
|
|
DataTable dt = dbHelper.GetDataTableBySql(sqlstr);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return dt.Rows[0];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 把数据行对象转换为下校秤配方数据实体对象
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dr">要转换的数据行</param>
|
|
|
|
|
/// <returns>返回转换后的实体对象</returns>
|
|
|
|
|
public static RT_Parameter ConvertDataToRT_Parameter(DataRow dr)
|
|
|
|
|
{
|
|
|
|
|
if (dr != null)
|
|
|
|
|
{
|
|
|
|
|
RT_Parameter entity = new RT_Parameter();
|
|
|
|
|
entity.Equip_Code = Mesnac.Basic.DataProcessor.RowValue(dr, "Equip_Code", String.Empty);
|
|
|
|
|
entity.Bin_Serial = Mesnac.Basic.DataProcessor.RowValue(dr, "Bin_Serial", 0);
|
|
|
|
|
entity.SetWeight = Mesnac.Basic.DataProcessor.RowValue(dr, "SetWeight", 0);
|
|
|
|
|
entity.High_Speed = Mesnac.Basic.DataProcessor.RowValue(dr, "HighSpeed", 0);
|
|
|
|
|
entity.Middle_Speed = Mesnac.Basic.DataProcessor.RowValue(dr, "MiddleSpeed", 0);
|
|
|
|
|
entity.Low_Speed = Mesnac.Basic.DataProcessor.RowValue(dr, "LowSpeed", 0);
|
|
|
|
|
entity.High2Mid_Value = Mesnac.Basic.DataProcessor.RowValue(dr, "High2Mid_Value", 0);
|
|
|
|
|
entity.Mid2Low_Value = Mesnac.Basic.DataProcessor.RowValue(dr, "Mid2Low_Value", 0);
|
|
|
|
|
entity.PreCLoseDoor_Value = Mesnac.Basic.DataProcessor.RowValue(dr, "PreCloseDoor_Value", 0);
|
|
|
|
|
entity.Big_MaxSpeed = Mesnac.Basic.DataProcessor.RowValue(dr, "Big_MaxSpeed",0);
|
|
|
|
|
entity.Big_MinSpeed = Mesnac.Basic.DataProcessor.RowValue(dr, "MinSpeed",0);
|
|
|
|
|
entity.Big_Delay = Mesnac.Basic.DataProcessor.RowValue(dr, "DefautHighSpeed",0);
|
|
|
|
|
entity.Big_Gain = Mesnac.Basic.DataProcessor.RowValue(dr, "DefautMiddleSpeed",0);
|
|
|
|
|
entity.Big_F = Mesnac.Basic.DataProcessor.RowValue(dr, "DefautLowSpeed",0);
|
|
|
|
|
entity.Small_MaxSpeed = Mesnac.Basic.DataProcessor.RowValue(dr, "HighSpeedUpperLimit",0);
|
|
|
|
|
entity.Small_MinSpeed = Mesnac.Basic.DataProcessor.RowValue(dr, "HighSpeedLowerLimit",0);
|
|
|
|
|
entity.Small_Delay = Mesnac.Basic.DataProcessor.RowValue(dr, "MidSpeedUpperLimit",0);
|
|
|
|
|
entity.Small_Gain = Mesnac.Basic.DataProcessor.RowValue(dr, "MidSpeedLowerLimit",0);
|
|
|
|
|
entity.Small_F = Mesnac.Basic.DataProcessor.RowValue(dr, "LowSpeedUpperLimit",0);
|
|
|
|
|
entity.LowSpeedLowerlimit = Mesnac.Basic.DataProcessor.RowValue(dr, "LowSpeedLowLimit",0);
|
|
|
|
|
entity.Arch_Breaking = Mesnac.Basic.DataProcessor.RowValue(dr, "Arch_breaking", 0);
|
|
|
|
|
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当天所有计划
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<RT_Plan> GetRT_PlanList()
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
|
|
|
|
|
string sqlstr = "select * from RT_plan where Start_Date >=convert(varchar(10),Getdate(),120)";
|
|
|
|
|
sqlstr = String.Format(sqlstr, Mesnac.Basic.LanguageHelper.PleaseSelect);
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
List<RT_Plan> lst = new List<RT_Plan>();
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
RT_Plan rtplan = new RT_Plan();
|
|
|
|
|
|
|
|
|
|
rtplan.Dosing_Id = Mesnac.Basic.DataProcessor.RowValue(row, "Dosing_Id", 0);
|
|
|
|
|
rtplan.Plan_Id = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Id", String.Empty);
|
|
|
|
|
rtplan.Equip_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Equip_Code", String.Empty);
|
|
|
|
|
rtplan.Plan_Serial = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Serial",0);
|
|
|
|
|
rtplan.Recipe_ID = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_ID", String.Empty);
|
|
|
|
|
rtplan.Recipe_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Code", String.Empty);
|
|
|
|
|
rtplan.Recipe_Name = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Name", String.Empty);
|
|
|
|
|
rtplan.Version = Mesnac.Basic.DataProcessor.RowValue(row, "Version", String.Empty);
|
|
|
|
|
rtplan.Mixer_Line = Mesnac.Basic.DataProcessor.RowValue(row, "Mixer_Line", String.Empty);
|
|
|
|
|
rtplan.Recipe_Type = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Type", 0);
|
|
|
|
|
rtplan.Shift_Id = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_Id", String.Empty);
|
|
|
|
|
rtplan.Shift_Class = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_Class", String.Empty);
|
|
|
|
|
rtplan.Plan_Num = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Num", 0);
|
|
|
|
|
rtplan.Real_Num = Mesnac.Basic.DataProcessor.RowValue(row, "Real_Num", 0);
|
|
|
|
|
rtplan.Duration_Time = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Id", 0);
|
|
|
|
|
rtplan.Start_Date = Mesnac.Basic.DataProcessor.RowValue(row, "Start_Date", String.Empty);
|
|
|
|
|
rtplan.End_Date = Mesnac.Basic.DataProcessor.RowValue(row, "End_Date", String.Empty);
|
|
|
|
|
rtplan.Weight_Man = Mesnac.Basic.DataProcessor.RowValue(row, "Weight_Man", String.Empty);
|
|
|
|
|
rtplan.Stock_Man = Mesnac.Basic.DataProcessor.RowValue(row, "Stock_Man", String.Empty);
|
|
|
|
|
rtplan.Plan_Batch = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Batch", String.Empty);
|
|
|
|
|
rtplan.Plan_State = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_State", 0);
|
|
|
|
|
rtplan.Plan_StateText = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_StateText", String.Empty);
|
|
|
|
|
rtplan.Plan_Date = Mesnac.Basic.DataProcessor.RowValue(row, "Plan_Date", String.Empty);
|
|
|
|
|
rtplan.IF_FLAG = Mesnac.Basic.DataProcessor.RowValue(row, "IF_FLAG", 0);
|
|
|
|
|
|
|
|
|
|
lst.Add(rtplan);
|
|
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取所有的配方数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<Pmt_recipe> GetPmt_recipeList()
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
|
|
|
|
|
string sqlstr = "select * from Pmt_recipe";
|
|
|
|
|
sqlstr = String.Format(sqlstr, Mesnac.Basic.LanguageHelper.PleaseSelect);
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
List<Pmt_recipe> lst = new List<Pmt_recipe>();
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
Pmt_recipe pmtRecipe = new Pmt_recipe();
|
|
|
|
|
|
|
|
|
|
pmtRecipe.ID = Mesnac.Basic.DataProcessor.RowValue(row, "ID", String.Empty);
|
|
|
|
|
pmtRecipe.Equip_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Equip_Code", String.Empty);
|
|
|
|
|
pmtRecipe.Recipe_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Code", String.Empty);
|
|
|
|
|
pmtRecipe.Version = Mesnac.Basic.DataProcessor.RowValue(row, "Version", String.Empty);
|
|
|
|
|
pmtRecipe.Recipe_Name = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Name", String.Empty);
|
|
|
|
|
pmtRecipe.Mixer_line = Mesnac.Basic.DataProcessor.RowValue(row, "Mixer_line", String.Empty);
|
|
|
|
|
pmtRecipe.Recipe_type = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_type", 0);
|
|
|
|
|
pmtRecipe.Recipe_Used = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Used", 0);
|
|
|
|
|
pmtRecipe.Recipe_Verify = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Verify", 0);
|
|
|
|
|
pmtRecipe.Total_Weight = Mesnac.Basic.DataProcessor.RowValue(row, "Total_Weight", 0.0M);
|
|
|
|
|
pmtRecipe.Total_Error = Mesnac.Basic.DataProcessor.RowValue(row, "Total_Error", 0.0M);
|
|
|
|
|
pmtRecipe.End_datetime = Mesnac.Basic.DataProcessor.RowValue(row, "End_datetime", String.Empty);
|
|
|
|
|
pmtRecipe.Remark = Mesnac.Basic.DataProcessor.RowValue(row, "Remark", String.Empty);
|
|
|
|
|
pmtRecipe.Attach_User = Mesnac.Basic.DataProcessor.RowValue(row, "Attach_User", 0);
|
|
|
|
|
pmtRecipe.GroupBags = Mesnac.Basic.DataProcessor.RowValue(row, "GroupBags", 0);
|
|
|
|
|
pmtRecipe.IF_FLAG = Mesnac.Basic.DataProcessor.RowValue(row, "IF_FLAG", 0);
|
|
|
|
|
pmtRecipe.Validity = Mesnac.Basic.DataProcessor.RowValue(row, "Validity", 0);
|
|
|
|
|
|
|
|
|
|
lst.Add(pmtRecipe);
|
|
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取所有的班次数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<Pmt_Shiftime> GetPmt_ShiftimeList()
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
|
|
|
|
|
string sqlstr = "select * from Pmt_Shiftime";
|
|
|
|
|
sqlstr = String.Format(sqlstr, Mesnac.Basic.LanguageHelper.PleaseSelect);
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
List<Pmt_Shiftime> lst = new List<Pmt_Shiftime>();
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
Pmt_Shiftime pmtShiftime = new Pmt_Shiftime();
|
|
|
|
|
|
|
|
|
|
pmtShiftime.Shift_id = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_id", 0);
|
|
|
|
|
pmtShiftime.Shift_name = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_name", String.Empty);
|
|
|
|
|
pmtShiftime.Shift_st = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_st", String.Empty);
|
|
|
|
|
pmtShiftime.Shift_et = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_et", String.Empty);
|
|
|
|
|
pmtShiftime.Shift_class = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_class", 0);
|
|
|
|
|
|
|
|
|
|
lst.Add(pmtShiftime);
|
|
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前班次id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static int GetCurrentShiftime()
|
|
|
|
|
{
|
|
|
|
|
int reShiftId = 0;
|
|
|
|
|
List<Pmt_Shiftime> lst = TechnicalHelper.GetPmt_ShiftimeList();
|
|
|
|
|
if (lst != null && lst.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (Pmt_Shiftime pmtShiftime in lst)
|
|
|
|
|
{
|
|
|
|
|
DateTime startTime = Convert.ToDateTime(pmtShiftime.Shift_st);
|
|
|
|
|
DateTime endTime = Convert.ToDateTime(pmtShiftime.Shift_et);
|
|
|
|
|
if (DateTime.Now > startTime && DateTime.Now < endTime)
|
|
|
|
|
{
|
|
|
|
|
reShiftId = (int)pmtShiftime.Shift_id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return reShiftId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 拼音检索配方物料列表
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 拼音检索配方物料列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回配方列表</returns>
|
|
|
|
|
public static List<SimplePmtRecipe> GetRecipeMaterialListPY()
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string sqlstr = "SELECT distinct ID, Recipe_Name FROM Pmt_recipe where Recipe_Verify = 1";
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
List<SimplePmtRecipe> lst = new List<SimplePmtRecipe>();
|
|
|
|
|
SimplePmtRecipe recipe = null;
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
recipe = new SimplePmtRecipe();
|
|
|
|
|
recipe.ID = Mesnac.Basic.DataProcessor.RowValue(row, "ID", String.Empty);
|
|
|
|
|
//recipe.MaterialGUID = Mesnac.Basic.DataProcessor.RowValue(row, "MaterialGUID", String.Empty);
|
|
|
|
|
//recipe.RecipeMaterialCode = Mesnac.Basic.DataProcessor.RowValue(row, "RecipeMaterialCode", String.Empty);
|
|
|
|
|
//recipe.RecipeMaterialName = Mesnac.Basic.DataProcessor.RowValue(row, "RecipeMaterialName", String.Empty);
|
|
|
|
|
//recipe.Recipe_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Code", String.Empty);
|
|
|
|
|
recipe.Recipe_Name = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Name", String.Empty);
|
|
|
|
|
//recipe.Recipe_type = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_type", String.Empty);
|
|
|
|
|
//recipe.Version = Mesnac.Basic.DataProcessor.RowValue(row, "Version", String.Empty);
|
|
|
|
|
//recipe.Content = Mesnac.Basic.DataProcessor.RowValue(row, "ShowName", String.Empty);
|
|
|
|
|
lst.Add(recipe);
|
|
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 拼音检索配方物料列表-小料
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 拼音检索配方物料列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回配方列表</returns>
|
|
|
|
|
public static List<SimplePmtRecipe> GetXlRecipeMaterialListPY()
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string sqlstr = "SELECT distinct Recipe_Name FROM xl_recipe where Recipe_Verify = 1";
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
List<SimplePmtRecipe> lst = new List<SimplePmtRecipe>();
|
|
|
|
|
SimplePmtRecipe recipe = null;
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
recipe = new SimplePmtRecipe();
|
|
|
|
|
recipe.ID = Mesnac.Basic.DataProcessor.RowValue(row, "ID", String.Empty);
|
|
|
|
|
//recipe.MaterialGUID = Mesnac.Basic.DataProcessor.RowValue(row, "MaterialGUID", String.Empty);
|
|
|
|
|
//recipe.RecipeMaterialCode = Mesnac.Basic.DataProcessor.RowValue(row, "RecipeMaterialCode", String.Empty);
|
|
|
|
|
//recipe.RecipeMaterialName = Mesnac.Basic.DataProcessor.RowValue(row, "RecipeMaterialName", String.Empty);
|
|
|
|
|
//recipe.Recipe_Code = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Code", String.Empty);
|
|
|
|
|
recipe.Recipe_Name = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_Name", String.Empty);
|
|
|
|
|
//recipe.Recipe_type = Mesnac.Basic.DataProcessor.RowValue(row, "Recipe_type", String.Empty);
|
|
|
|
|
//recipe.Version = Mesnac.Basic.DataProcessor.RowValue(row, "Version", String.Empty);
|
|
|
|
|
//recipe.Content = Mesnac.Basic.DataProcessor.RowValue(row, "ShowName", String.Empty);
|
|
|
|
|
lst.Add(recipe);
|
|
|
|
|
}
|
|
|
|
|
return lst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取某种配方的版本列表
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取某种配方的版本列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="recipeMaterialGUID">ID</param>
|
|
|
|
|
/// <returns>返回对应的版本列表</returns>
|
|
|
|
|
public static List<string> GetRecipeVersionList(string Recipe_Name)
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string sqlstr = "select Version from Pmt_recipe where Recipe_Verify = 1 and Recipe_Name = @Recipe_Name order by Version desc";
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.AddParameter("@Recipe_Name", Recipe_Name);
|
|
|
|
|
DataTable dt = dbHelper.ToDataTable();
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
list.Add(Mesnac.Basic.DataProcessor.RowValue(dr, "Version", String.Empty));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取某种配方的版本列表-小料
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取某种配方的版本列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="recipeMaterialGUID">ID</param>
|
|
|
|
|
/// <returns>返回对应的版本列表</returns>
|
|
|
|
|
public static List<string> GetXlRecipeVersionList(string Recipe_Name)
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string sqlstr = "select Version from xl_recipe where Recipe_Verify = 1 and Recipe_Name = @Recipe_Name order by Version desc";
|
|
|
|
|
dbHelper.CommandText = sqlstr;
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.AddParameter("@Recipe_Name", Recipe_Name);
|
|
|
|
|
DataTable dt = dbHelper.ToDataTable();
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
list.Add(Mesnac.Basic.DataProcessor.RowValue(dr, "Version", String.Empty));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 数据插入更新处理
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入料仓号数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="binNum">要插入计划号</param>
|
|
|
|
|
public static void InsertNewRT_Parameter(int binNum)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string strSql = @"INSERT INTO RT_Parameter(Equip_Code,Bin_Serial,SetWeight,HighSpeed,MiddleSpeed,LowSpeed,High2Mid_Value,Mid2Low_Value,PreCloseDoor_Value,Big_MaxSpeed,Big_MinSpeed,Big_Delay,Big_Gain,Big_F,Small_MaxSpeed,Small_MinSpeed,Small_Delay,Small_Gain,Small_F,LowSpeedLowerlimit,Arch_breaking) VALUES(@Equip_Code,@Bin_Serial,@SetWeight,@HighSpeed,@MiddleSpeed,@LowSpeed,@High2Mid_Value,@Mid2Low_Value,@PreCloseDoor_Value,@Big_MaxSpeed,@Big_MinSpeed,@Big_Delay,@Big_Gain,@Big_F,@Small_MaxSpeed,@Small_MinSpeed,@Small_Delay,@Small_Gain,@Small_F,@LowSpeedLowerlimit,@Arch_breaking)";
|
|
|
|
|
dbHelper.CommandText = strSql;
|
|
|
|
|
dbHelper.AddParameter("@Equip_Code", "小料称量" + binNum);
|
|
|
|
|
dbHelper.AddParameter("@Bin_Serial", binNum);
|
|
|
|
|
dbHelper.AddParameter("@SetWeight", 0);
|
|
|
|
|
dbHelper.AddParameter("@HighSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@MiddleSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@LowSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@High2Mid_Value", 0);
|
|
|
|
|
dbHelper.AddParameter("@Mid2Low_Value", 0);
|
|
|
|
|
dbHelper.AddParameter("@PreCloseDoor_Value", 0);
|
|
|
|
|
dbHelper.AddParameter("@Big_MaxSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@Big_MinSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@Big_Delay", 0);
|
|
|
|
|
dbHelper.AddParameter("@Big_Gain", 0);
|
|
|
|
|
dbHelper.AddParameter("@Big_F", 0);
|
|
|
|
|
dbHelper.AddParameter("@Small_MaxSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@Small_MinSpeed", 0);
|
|
|
|
|
dbHelper.AddParameter("@Small_Delay", 0);
|
|
|
|
|
dbHelper.AddParameter("@Small_Gain", 0);
|
|
|
|
|
dbHelper.AddParameter("@Small_F", 0);
|
|
|
|
|
dbHelper.AddParameter("@LowSpeedLowerlimit", 0);
|
|
|
|
|
dbHelper.AddParameter("@Arch_breaking", 0);
|
|
|
|
|
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<TechnicalHelper>.Error("料仓参数设置没有读取到相关数据,向数据库表写入时出现错误:" + ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据料仓号更新料仓
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="binNum">要更新的料仓号</param>
|
|
|
|
|
/// <param name="entity">要更新的数据</param>
|
|
|
|
|
public static void UpdateRT_Parameter(int binNum, Entity.RT_Parameter entity)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
|
|
}
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
string strSql = "update RT_Parameter set Big_MaxSpeed = @Big_MaxSpeed, Big_MinSpeed = @Big_MinSpeed, Big_Delay = @Big_Delay, Big_Gain = @Big_Gain, Big_F = @Big_F,Small_MaxSpeed = @Small_MaxSpeed, Small_MinSpeed = @Small_MinSpeed,Small_Delay = @Small_Delay, Small_Gain = @Small_Gain, Small_F = @Small_F where Bin_Serial = @Bin_Serial";
|
|
|
|
|
dbHelper.CommandText = strSql;
|
|
|
|
|
dbHelper.AddParameter("@Big_MaxSpeed",entity.Big_MaxSpeed );
|
|
|
|
|
dbHelper.AddParameter("@Big_MinSpeed",entity.Big_MinSpeed );
|
|
|
|
|
dbHelper.AddParameter("@Big_Delay", entity.Big_Delay);
|
|
|
|
|
dbHelper.AddParameter("@Big_Gain", entity.Big_Gain);
|
|
|
|
|
dbHelper.AddParameter("@Big_F", entity.Big_F);
|
|
|
|
|
dbHelper.AddParameter("@Small_MaxSpeed", entity.Small_MaxSpeed);
|
|
|
|
|
dbHelper.AddParameter("@Small_MinSpeed", entity.Small_MinSpeed);
|
|
|
|
|
dbHelper.AddParameter("@Small_Delay", entity.Small_Delay);
|
|
|
|
|
dbHelper.AddParameter("@Small_Gain", entity.Small_Gain);
|
|
|
|
|
dbHelper.AddParameter("@Small_F", entity.Small_F);
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<TechnicalHelper>.Error("更新数据库料仓参数异常:" + ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|