You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
853 lines
37 KiB
C#
853 lines
37 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Controls.Base;
|
|
using Mesnac.Codd.Session;
|
|
using System.Data;
|
|
using Mesnac.Controls.Default;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.Feeding.Qingquan.Report
|
|
{
|
|
#region 公用类
|
|
public class LotClass
|
|
{
|
|
public static bool IsFirstLoad = true;
|
|
public static Dictionary<string, string> dictonary = new Dictionary<string, string>();
|
|
public static int page = 0;
|
|
|
|
public static string GetDetailStr(string index)
|
|
{
|
|
StringBuilder sqlstrdetail = new StringBuilder();
|
|
sqlstrdetail.AppendLine(@"SELECT l.*,shift.ShiftName,class.ClassName,
|
|
Pmt_Recipe.mater_name , Pmt_Recipe.recipe_code,rstate.ItemName AS RecipeStateName,plan_num as SetNum
|
|
FROM PptLotData l
|
|
LEFT JOIN ppt_plan pptplan ON l.PLANID = pptplan.plan_id
|
|
LEFT JOIN PptShift shift ON l.ShiftID = shift.ObjID
|
|
LEFT JOIN PptClass class ON l.ClassID = class.ObjID
|
|
LEFT JOIN Pmt_Recipe Pmt_Recipe on Pmt_Recipe.equip_code=substring(l.EquipCode,4,2)
|
|
AND Pmt_Recipe.mater_code=l.MaterCode
|
|
AND Pmt_Recipe.edt_code=l.EdtCode
|
|
LEFT JOIN SysCode rstate ON Pmt_Recipe.Recipe_State = rstate.ItemCode AND rstate.TypeID='PmtState'
|
|
");
|
|
sqlstrdetail.AppendLine(@"WHERE 1=1");
|
|
sqlstrdetail.AppendLine(@"AND l.Barcode='" + index + "'");
|
|
return sqlstrdetail.ToString();
|
|
}
|
|
/// <summary>
|
|
/// 通过条码获取车信息
|
|
/// </summary>
|
|
/// <param name="dbType"></param>
|
|
/// <param name="barcode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetLotInfoByBarcode(Mesnac.Basic.DataSourceFactory.MCDbType dbType, string barcode)
|
|
{
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@"SELECT l.*,shift.ShiftName,class.ClassName,
|
|
Pmt_Recipe.mater_name , Pmt_Recipe.recipe_code,rstate.ItemName AS RecipeStateName,l.EquipCode as EquipName
|
|
FROM PptLotData l
|
|
LEFT JOIN PptShift shift ON l.ShiftID = shift.ObjID
|
|
LEFT JOIN PptClass class ON l.ClassID = class.ObjID
|
|
LEFT JOIN Pmt_Recipe Pmt_Recipe on Pmt_Recipe.equip_code=substring(l.EquipCode,4,2)
|
|
AND Pmt_Recipe.mater_code=l.MaterCode
|
|
AND Pmt_Recipe.edt_code=l.EdtCode
|
|
LEFT JOIN SysCode rstate ON Pmt_Recipe.Recipe_State = rstate.ItemCode AND rstate.TypeID='PmtState'
|
|
");
|
|
sqlstr.AppendLine(@"WHERE 1=1");
|
|
sqlstr.AppendLine(@"AND l.Barcode='" + barcode + "'");
|
|
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable table = dbHelper.ToDataTable();
|
|
return table;
|
|
}
|
|
/// <summary>
|
|
/// 通过条码获取混炼信息
|
|
/// </summary>
|
|
/// <param name="dbType"></param>
|
|
/// <param name="barCode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetMixDataByBarCode(Mesnac.Basic.DataSourceFactory.MCDbType dbType, string barCode)
|
|
{
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@" SELECT m.Barcode , m.Mix_ID as MixID, t.ShowName AS TermCode ,
|
|
m.Set_Time as SetTime, m.Set_Temp as SeTemp, m.Set_Ener as SetEner, m.Set_Power as SetPower,
|
|
m.Set_Pres as SetPres, m.Set_Rota as SetRota, a.ShowName AS ActCode , m.Save_Time
|
|
FROM PptMixData m
|
|
LEFT JOIN PmtTerm t ON m.Term_Code = t.TermAddress
|
|
LEFT JOIN PmtAction a ON m.Act_Code = a.ActionAddress ");
|
|
sqlstr.AppendLine(@" WHERE 1=1");
|
|
sqlstr.AppendLine(@" AND m.Barcode='" + barCode + "'");
|
|
sqlstr.AppendLine(@" Order by m.Mix_Id");
|
|
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable table = dbHelper.ToDataTable();
|
|
return table;
|
|
}
|
|
/// <summary>
|
|
/// 通过条码获取称重信息
|
|
/// </summary>
|
|
/// <param name="dbType"></param>
|
|
/// <param name="barCode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetPptWeigh(Mesnac.Basic.DataSourceFactory.MCDbType dbType, string barCode)
|
|
{
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@" select Set_Weight as SetWeight,case Weigh_Type when 0 then '炭黑' when 1 then '油1' when 2 then '胶料' when 3 then '粉料' when 4 then '小料' when 5 then '油2' else '' end as WeighType,Mater_Name as MaterName,Mater_Code as MaterCode,Set_Weight as SetWeight,Real_Weight as RealWeight,Error_Allow as ErrorAllow,Weigh_State as WeighState from PptWeigh ");
|
|
sqlstr.AppendLine(@" where Barcode='" + barCode + "'");
|
|
sqlstr.AppendLine(@" order by Weigh_Type");
|
|
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable table = dbHelper.ToDataTable();
|
|
return table;
|
|
}
|
|
/// <summary>
|
|
/// 通过条码获取报警信息
|
|
/// </summary>
|
|
/// <param name="dbType"></param>
|
|
/// <param name="barCode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetPptAlarm(Mesnac.Basic.DataSourceFactory.MCDbType dbType, string barCode)
|
|
{
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@" select acbz1 as AlarmStr,acbz2 as OperTime from PmtAlarmCode ");
|
|
sqlstr.AppendLine(@" where acdetail='" + barCode + "'");
|
|
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable table = dbHelper.ToDataTable();
|
|
return table;
|
|
}
|
|
/// <summary>
|
|
/// 通过条码获取曲线图
|
|
/// </summary>
|
|
/// <param name="dbType"></param>
|
|
/// <param name="barCode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetPptCurve(Mesnac.Basic.DataSourceFactory.MCDbType dbType, string barCode)
|
|
{
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@" select * from Ppt_CurveData ");
|
|
sqlstr.AppendLine(@" where Barcode='" + barCode + "'");
|
|
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable tableOne = dbHelper.ToDataTable();
|
|
DataTable table = new DataTable();
|
|
table.Columns.Add("MixingTemp", Type.GetType("System.String"));
|
|
table.Columns.Add("SecondSpan", Type.GetType("System.String"));
|
|
table.Columns.Add("MixingPower", Type.GetType("System.String"));
|
|
table.Columns.Add("MixingEnergy", Type.GetType("System.String"));
|
|
table.Columns.Add("MixingPress", Type.GetType("System.String"));
|
|
table.Columns.Add("MixingSpeed", Type.GetType("System.String"));
|
|
|
|
if (tableOne.Rows.Count > 0)
|
|
{
|
|
string[] MixingTemp = tableOne.Rows[0]["Mixing_Temp"].ToString().Split(':');
|
|
string[] SecondSpan = tableOne.Rows[0]["Mixing_Time"].ToString().Split(':');
|
|
string[] MixingPower = tableOne.Rows[0]["Mixing_Power"].ToString().Split(':');
|
|
string[] MixingEnergy = tableOne.Rows[0]["Mixing_Energy"].ToString().Split(':');
|
|
string[] MixingPress = tableOne.Rows[0]["Mixing_Press"].ToString().Split(':');
|
|
string[] MixingSpeed = tableOne.Rows[0]["Mixing_Speed"].ToString().Split(':');
|
|
DataRow newRow;
|
|
for (int i = 0; i < SecondSpan.Length; i++)
|
|
{
|
|
newRow = table.NewRow();
|
|
newRow["MixingTemp"] = MixingTemp[i];
|
|
newRow["SecondSpan"] = SecondSpan[i];
|
|
newRow["MixingPower"] = MixingPower[i];
|
|
newRow["MixingEnergy"] = MixingEnergy[i];
|
|
newRow["MixingPress"] = MixingPress[i];
|
|
newRow["MixingSpeed"] = MixingSpeed[i];
|
|
table.Rows.Add(newRow);
|
|
}
|
|
}
|
|
|
|
return table;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 刷新配方列表控件的数据
|
|
/// <summary>
|
|
/// 刷新配方列表控件的数据
|
|
/// </summary>
|
|
public class LotRefreshRecipeList : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
IBaseControl cbRecipe = this.GetMCControlByKey("Pmt_Recipe.ObjID").FirstOrDefault(); //获取配方列表控件
|
|
if (cbRecipe == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为Pmt_Recipe.ObjID的配方列表控件...");
|
|
runtime.IsReturn = true;
|
|
return;
|
|
}
|
|
|
|
DbHelper localHelper = base.NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
if (localHelper == null)
|
|
{
|
|
base.LogError(Language(13)); //尝试连接本地数据库失败
|
|
}
|
|
try
|
|
{
|
|
localHelper.CommandType = CommandType.Text;
|
|
string strSql = "select ObjID,mater_code,mater_name from pmt_recipe where equip_code=@EquipCode";
|
|
localHelper.CommandText = strSql;
|
|
localHelper.AddParameter("@EquipCode", base.CurrEquipCode.Substring(3, 2));
|
|
DataTable tblRecipe = localHelper.ToDataTable();
|
|
cbRecipe.BindDataSource = tblRecipe;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
base.LogError("车报表-刷新配方列表失败:" + ex.Message);
|
|
runtime.IsReturn = true;
|
|
return;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 车报表 加载
|
|
public class LotReportLoad : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
//if (!LotClass.IsFirstLoad)
|
|
// return;
|
|
//LotClass.IsFirstLoad = false;
|
|
base.RunIni(runtime);
|
|
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
|
|
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
|
|
IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
|
|
|
|
|
|
if (startdate != null && starttime != null)
|
|
{
|
|
startdate.MCValue = DateTime.Now;
|
|
starttime.MCValue = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00";
|
|
}
|
|
else
|
|
{
|
|
base.LogError("{车报表} 缺少key值为startdate或者starttime的时间查询条件...");
|
|
return;
|
|
}
|
|
IBaseControl enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
|
|
IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
|
|
if (enddate != null && endtime != null)
|
|
{
|
|
enddate.MCValue = DateTime.Now.AddDays(1).ToShortDateString(); ;
|
|
endtime.MCValue = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " 00:00";
|
|
}
|
|
else
|
|
{
|
|
base.LogError("{车报表} 缺少key值为enddate或者endtime的时间查询条件...");
|
|
return;
|
|
}
|
|
DbHelper dbHelper;
|
|
//base.CurrEquipCode;
|
|
#region 获取其他查询条件控件值
|
|
foreach (DbMCControl c in mcControllist)
|
|
{
|
|
if (c.BaseControl.MCKey == null)
|
|
continue;
|
|
if (c.DbMCSource != null && c.BaseControl is MCCombobox)
|
|
{
|
|
DbMCControl pptlotcontrol = this.GetDbMCControlByBaseControlKey(c.BaseControl.MCKey).FirstOrDefault();
|
|
if (pptlotcontrol != null)
|
|
{
|
|
dbHelper = NewDbHelper(pptlotcontrol.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string strsql = "select * from [" + pptlotcontrol.BaseControl.InitDataSource.ToLower().Trim() + "]";
|
|
if (pptlotcontrol.BaseControl.InitDataSource.ToLower().Trim().StartsWith("select"))
|
|
{
|
|
strsql = pptlotcontrol.BaseControl.InitDataSource.ToLower().Trim();
|
|
}
|
|
string sqlstr = strsql.ToString();
|
|
dbHelper.CommandText = sqlstr;
|
|
DataTable table = dbHelper.ToDataTable();
|
|
pptlotcontrol.BaseControl.BindDataSource = table;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 车报表 查询
|
|
/// <summary>
|
|
/// 车报表 查询
|
|
/// </summary>
|
|
public class LotReportSelect : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
DbMCControl pptlotButton = this.GetDbMCControlByBaseControlKey("mcbuttonSearch").FirstOrDefault();
|
|
IBaseControl lblInfo = this.GetMCControlByKey("ShowMsgControl").FirstOrDefault(); //信息提示控件
|
|
|
|
if (pptlotButton == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为mcbuttonSearch查询按钮...");
|
|
return;
|
|
}
|
|
StringBuilder sqlsb = new StringBuilder();
|
|
sqlsb.AppendLine(@"SELECT identity(int,1,1) as id, PptLotData.Barcode into #list FROM dbo.PptLotData
|
|
LEFT JOIN dbo.Pmt_Recipe
|
|
ON Pmt_Recipe.equip_code=substring(PptLotData.EquipCode,4,2)
|
|
AND Pmt_Recipe.mater_code=PptLotData.MaterCode
|
|
AND Pmt_Recipe.edt_code=PptLotData.EdtCode
|
|
");
|
|
sqlsb.AppendLine(@" WHERE 1=1");
|
|
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
|
|
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
|
|
IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
|
|
|
|
CheckBox checkDate = this.GetAllFormControlById("MCCheckBox1").FirstOrDefault() as CheckBox;
|
|
CheckBox checkClass = this.GetAllFormControlById("MCCheckBox2").FirstOrDefault() as CheckBox;
|
|
CheckBox checkShift = this.GetAllFormControlById("MCCheckBox3").FirstOrDefault() as CheckBox;
|
|
CheckBox checkSerialID = this.GetAllFormControlById("MCCheckBox4").FirstOrDefault() as CheckBox;
|
|
CheckBox checkRecipt = this.GetAllFormControlById("MCCheckBox5").FirstOrDefault() as CheckBox;
|
|
|
|
if (checkDate.Checked)//如果按日期查询选中
|
|
{
|
|
if (startdate != null && starttime != null)
|
|
{
|
|
sqlsb.AppendLine(@"AND PptLotData.StartDatetime>='" + Convert.ToDateTime(startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(starttime.MCValue).ToShortTimeString() + "' ");
|
|
}
|
|
else
|
|
{
|
|
base.LogError("{车报表} 缺少key值为startdate或者starttime的时间查询条件...");
|
|
return;
|
|
}
|
|
IBaseControl enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
|
|
IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
|
|
if (enddate != null && endtime != null)
|
|
{
|
|
sqlsb.AppendLine(@"AND PptLotData.StartDatetime<='" + Convert.ToDateTime(enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endtime.MCValue).ToShortTimeString() + "' ");
|
|
}
|
|
else
|
|
{
|
|
base.LogError("{车报表} 缺少key值为enddate或者endtime的时间查询条件...");
|
|
return;
|
|
}
|
|
}
|
|
if (checkSerialID.Checked)//如果按车次查询选中
|
|
{
|
|
IBaseControl startSerialID = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startserialid").FirstOrDefault().BaseControl;
|
|
IBaseControl endSerialID = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endserialid").FirstOrDefault().BaseControl;
|
|
if (startSerialID != null && endSerialID != null)
|
|
{
|
|
if (startSerialID.MCValue.ToString() != "" && endSerialID.MCValue.ToString() != "")
|
|
sqlsb.AppendLine(@"AND PptLotData.SerialID between " + startSerialID.MCValue + " and " + endSerialID.MCValue + " ");
|
|
}
|
|
}
|
|
foreach (DbMCControl c in mcControllist)
|
|
{
|
|
if (c.BaseControl.MCKey == null)
|
|
continue;
|
|
if (c.BaseControl.MCKey.ToLower() != "startdate" && c.BaseControl.MCKey.ToLower() != "starttime" && c.BaseControl.MCKey.ToLower() != "enddate" && c.BaseControl.MCKey.ToLower() != "endtime" && c.BaseControl.MCKey.ToLower() != "startserialid" && c.BaseControl.MCKey.ToLower() != "endserialid")
|
|
{
|
|
if (c.BaseControl.MCKey.ToLower() == "pptlotdata.classid" && checkClass.Checked)
|
|
sqlsb.AppendLine(@"AND " + c.BaseControl.MCKey + "='" + c.BaseControl.MCValue.ToString() + "' ");
|
|
if (c.BaseControl.MCKey.ToLower() == "pptlotdata.shiftid" && checkShift.Checked)
|
|
sqlsb.AppendLine(@"AND " + c.BaseControl.MCKey + "='" + c.BaseControl.MCValue.ToString() + "' ");
|
|
if (c.BaseControl.MCKey.ToLower() == "pmt_recipe.objid" && checkRecipt.Checked)
|
|
sqlsb.AppendLine(@"AND " + c.BaseControl.MCKey + "='" + c.BaseControl.MCValue.ToString() + "' ");
|
|
}
|
|
}
|
|
sqlsb.AppendLine(@" order by StartDatetime");
|
|
sqlsb.AppendLine(@" select * from #list");
|
|
DbHelper dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string sqlstr = sqlsb.ToString();
|
|
dbHelper.CommandText = sqlstr;
|
|
DataTable table = dbHelper.ToDataTable();
|
|
LotClass.dictonary.Clear();
|
|
LotClass.page = 0;
|
|
for (int i = 0; i < table.Rows.Count; i++)
|
|
{
|
|
LotClass.dictonary.Add(table.Rows[i]["id"].ToString(), table.Rows[i]["Barcode"].ToString());
|
|
}
|
|
|
|
///////////获取每车信息
|
|
dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
LotClass.page = 1;
|
|
string index = LotClass.dictonary.Count == 0 ? "0" : LotClass.dictonary["1"].ToString();
|
|
dbHelper.CommandText = LotClass.GetDetailStr(index);
|
|
DataTable detailtable = dbHelper.ToDataTable();
|
|
if (detailtable.Rows.Count == 0)
|
|
{
|
|
//string msg = "没有符合条件的数据!";
|
|
string msg = Language(302);
|
|
if (lblInfo == null)
|
|
{
|
|
Mesnac.Basic.MessageBoxTimeOut.Show(msg, Language(1), 2000);
|
|
}
|
|
else
|
|
{
|
|
lblInfo.MCValue = msg;
|
|
}
|
|
FormClear();
|
|
return;
|
|
}
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl in initText)
|
|
{
|
|
cl.MCValue = detailtable.Rows[0][cl.MCKey].ToString();
|
|
}
|
|
string msg1 = Language(301); //查询完成
|
|
if (lblInfo == null)
|
|
{
|
|
Mesnac.Basic.MessageBoxTimeOut.Show(msg1, Language(1), 2000);
|
|
}
|
|
else
|
|
{
|
|
lblInfo.MCValue = msg1;
|
|
}
|
|
}
|
|
|
|
public void FormClear()
|
|
{
|
|
Control cl = GetControlById("MultiCurveLine");
|
|
if (cl == null)
|
|
{
|
|
base.LogError("{车报表} 缺少折线图集合控件");
|
|
return;
|
|
}
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.Clear();
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl1 in initText)
|
|
{
|
|
cl1.MCValue = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 上一页
|
|
public class LotReportPrevious : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
{
|
|
MessageBox.Show(base.Language(302));
|
|
return;
|
|
}
|
|
LotClass.page -= 1;
|
|
if (LotClass.page == 0)
|
|
LotClass.page = 1;
|
|
DbMCControl pptlotButton = this.GetDbMCControlByBaseControlKey("mcbuttonSearch").FirstOrDefault();
|
|
if (pptlotButton == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为pptlot查询按钮...");
|
|
return;
|
|
}
|
|
DbHelper dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string index = LotClass.dictonary[LotClass.page.ToString()].ToString();
|
|
dbHelper.CommandText = LotClass.GetDetailStr(index);
|
|
DataTable detailtable = dbHelper.ToDataTable();
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl in initText)
|
|
{
|
|
cl.MCValue = detailtable.Rows[0][cl.MCKey].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 下一页
|
|
public class LotReportNext : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
{
|
|
MessageBox.Show(base.Language(302));
|
|
return;
|
|
}
|
|
LotClass.page += 1;
|
|
if (LotClass.page > LotClass.dictonary.Count)
|
|
LotClass.page = LotClass.dictonary.Count;
|
|
DbMCControl pptlotButton = this.GetDbMCControlByBaseControlKey("mcbuttonSearch").FirstOrDefault();
|
|
if (pptlotButton == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为pptlot查询按钮...");
|
|
return;
|
|
}
|
|
DbHelper dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string index = LotClass.dictonary[LotClass.page.ToString()].ToString();
|
|
dbHelper.CommandText = LotClass.GetDetailStr(index);
|
|
DataTable detailtable = dbHelper.ToDataTable();
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl in initText)
|
|
{
|
|
cl.MCValue = detailtable.Rows[0][cl.MCKey].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 首页
|
|
public class LotReportFirst : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
{
|
|
MessageBox.Show(base.Language(302));
|
|
return;
|
|
}
|
|
LotClass.page = 1;
|
|
DbMCControl pptlotButton = this.GetDbMCControlByBaseControlKey("mcbuttonSearch").FirstOrDefault();
|
|
if (pptlotButton == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为pptlot查询按钮...");
|
|
return;
|
|
}
|
|
DbHelper dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string index = LotClass.dictonary[LotClass.page.ToString()].ToString();
|
|
dbHelper.CommandText = LotClass.GetDetailStr(index);
|
|
DataTable detailtable = dbHelper.ToDataTable();
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl in initText)
|
|
{
|
|
cl.MCValue = detailtable.Rows[0][cl.MCKey].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 尾页
|
|
public class LotReportLast : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
{
|
|
MessageBox.Show(base.Language(302));
|
|
return;
|
|
}
|
|
LotClass.page = LotClass.dictonary.Count;
|
|
DbMCControl pptlotButton = this.GetDbMCControlByBaseControlKey("mcbuttonSearch").FirstOrDefault();
|
|
if (pptlotButton == null)
|
|
{
|
|
base.LogError("{车报表} 缺少key值为pptlot查询按钮...");
|
|
return;
|
|
}
|
|
DbHelper dbHelper = NewDbHelper(pptlotButton.DesignSource);
|
|
if (dbHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
string index = LotClass.dictonary[LotClass.page.ToString()].ToString();
|
|
dbHelper.CommandText = LotClass.GetDetailStr(index);
|
|
DataTable detailtable = dbHelper.ToDataTable();
|
|
List<IBaseControl> initText = GetAllMCControlsByOption(DbOptionTypes.InitData);//获取待初始化数据
|
|
foreach (IBaseControl cl in initText)
|
|
{
|
|
cl.MCValue = detailtable.Rows[0][cl.MCKey].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 画图
|
|
public class LotReportInitChart : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
return;
|
|
DbHelper curveHelper = new DatabaseAction().NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Curve);
|
|
if (curveHelper == null)
|
|
{
|
|
return;
|
|
}
|
|
curveHelper.ClearParameter();
|
|
curveHelper.CommandType = CommandType.Text;
|
|
curveHelper.CommandText = "select top 1 * from dbo.Ppt_CurveData where barcode='" + LotClass.dictonary[LotClass.page.ToString()].ToString() + "'";
|
|
DataTable chartdetail = curveHelper.ToDataTable();
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
|
|
if (chartdetail == null || chartdetail.Rows.Count == 0)
|
|
{
|
|
mc.Clear();
|
|
return;
|
|
}
|
|
if (cl == null)
|
|
{
|
|
base.LogError("{车报表} 缺少折线图集合控件");
|
|
return;
|
|
}
|
|
|
|
mc.Clear();
|
|
//mc.Num = 1000;
|
|
string[] mixing_Time = chartdetail.Rows[0]["Mixing_Time"].ToString().Split(':');
|
|
string[] mixing_Temps = chartdetail.Rows[0]["Mixing_Temp"].ToString().Split(':');
|
|
string[] mixing_Power = chartdetail.Rows[0]["Mixing_Power"].ToString().Split(':');
|
|
string[] mixing_Press = chartdetail.Rows[0]["Mixing_Press"].ToString().Split(':');
|
|
string[] mixing_Energy = chartdetail.Rows[0]["Mixing_Energy"].ToString().Split(':');
|
|
string[] mixing_Speed = chartdetail.Rows[0]["Mixing_Speed"].ToString().Split(':');
|
|
|
|
int beginIndex = 0;
|
|
bool flag = true;
|
|
double mixTime = 0;
|
|
double pointValue1 = 0.0;
|
|
double pointValue2 = 0.0;
|
|
double pointValue3 = 0.0;
|
|
double pointValue4 = 0.0;
|
|
double pointValue5 = 0.0;
|
|
for (int i = beginIndex; i < mixing_Time.Length - 1; i++)
|
|
{
|
|
if (!String.IsNullOrEmpty(mixing_Time[i]))
|
|
{
|
|
if (mixing_Time[i] != "0.00")
|
|
{
|
|
flag = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
mc.IsUseMixTime = !flag; //是否使用密炼时间作为横坐标
|
|
for (int i = beginIndex; i < mixing_Temps.Length; i++)
|
|
{
|
|
flag = true;
|
|
if (!double.TryParse(mixing_Time[i], out mixTime)) flag = false;
|
|
if (!double.TryParse(mixing_Temps[i], out pointValue1)) flag = false;
|
|
if (!double.TryParse(mixing_Power[i], out pointValue2)) flag = false;
|
|
if (!double.TryParse(mixing_Press[i], out pointValue3)) flag = false;
|
|
if (!double.TryParse(mixing_Energy[i], out pointValue4)) flag = false;
|
|
if (!double.TryParse(mixing_Speed[i], out pointValue5)) flag = false;
|
|
|
|
if (flag == true)
|
|
{
|
|
if (mc.IsUseMixTime)
|
|
{
|
|
if (mixTime > 0)
|
|
{
|
|
mc.MixTime = (int)mixTime;
|
|
mc.PointValue1 = pointValue1;
|
|
mc.PointValue2 = pointValue2;
|
|
mc.PointValue3 = pointValue3;
|
|
mc.PointValue4 = pointValue4;
|
|
mc.PointValue5 = pointValue5;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mc.PointValue1 = pointValue1;
|
|
mc.PointValue2 = pointValue2;
|
|
mc.PointValue3 = pointValue3;
|
|
mc.PointValue4 = pointValue4;
|
|
mc.PointValue5 = pointValue5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 报表明细
|
|
public class PptLotFastReport : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
if (LotClass.dictonary.Count == 0)
|
|
{
|
|
MessageBox.Show(base.Language(303));
|
|
return;
|
|
}
|
|
string Barcode = LotClass.dictonary[LotClass.page.ToString()].ToString();
|
|
PptLotDetail pd = new PptLotDetail();
|
|
pd.BarCode = Barcode;
|
|
pd.ReprotStart();
|
|
//pd.Show();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 曲线复位操作
|
|
/// </summary>
|
|
public class ChartReset : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.Reset();
|
|
}
|
|
}
|
|
|
|
public class ChartLeftScroll : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.AxesScroll("Left");
|
|
}
|
|
}
|
|
public class ChartRightScroll : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.AxesScroll("Right");
|
|
//mc.Tzoom("-");
|
|
}
|
|
}
|
|
public class ChartTopScroll : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.AxesScroll("Top");
|
|
}
|
|
}
|
|
public class ChartBottomScroll : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.AxesScroll("Bottom");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 放大
|
|
/// </summary>
|
|
public class ChartAmplify : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.Tzoom("+");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 缩小
|
|
/// </summary>
|
|
public class ChartNarrow : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
Control cl = GetControlById("MultiCurveLine");//声明曲线控件
|
|
MultiCurve mc = cl as MultiCurve;
|
|
mc.Tzoom("-");
|
|
}
|
|
}
|
|
}
|