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.

2655 lines
196 KiB
C#

1 year ago
using DevExpress.Office.Utils;
using ICSharpCode.Core;
using Mesnac.Action.ChemicalWeighing.BinManage;
using Mesnac.Action.ChemicalWeighing.ChemicalWeighingPlc;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.Entity.PptPlan;
using Mesnac.Action.ChemicalWeighing.Product.XlPlan;
using Mesnac.Action.ChemicalWeighing.Report;
using Steema.TeeChart.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.XlPlcHelper
{
public class PlcPlanHelper
{
public static object sender = null;
public static event EventHandler AutoDownloadPlan;
#region 自动下传计划列表至小料PLC
/// <summary>
/// 自动下传计划列表至小料PLC
/// </summary>
/// <param name="list">计划列表</param>
/// <param name="msgList">输出的消息列表</param>
/// <returns>成功返回true失败返回flase</returns>
public static bool AutoDownloadPlanData()
{
bool result = true;
string planNo ;//计划号
int batch=0;
#region 获取当前计划号,判断当前计划状态
//读取配方编码获取配方物料所在的工位,根据工位查询状态
//当PLC将状态位置"1"时计划完成
//存盘完成后上位机需要将PLC点位置为2
try
{
planNo = BasePlcHelper.Instance.plt_Set_PlanNo.NowValue.ToString();//执行序号
batch = BasePlcHelper.Instance.plt_Batch.NowValue.ToInt();//计划执行册数
bool IsExec = Product.XlPlan.PlanHelper.GetXlPlanState(planNo, batch);//检查当前任务是否还处于执行中
if (!IsExec) return true;
string nowPlanId = PlcPlanHelper.DownLoadNextXlPlan();//下发一个任务计划
if (!string.IsNullOrEmpty(nowPlanId))
{
//回写计划任务状态
PlanHelper.UpdatePlanState(nowPlanId, 3);
result = true;
}
else
{
//记录异常
result = false;
}
return result;
}
catch (Exception)
{
return result;
}
#endregion
}
#endregion
/// <summary>
/// 更新任务状态
/// </summary>
/// <returns></returns>
public static void ExecPlanState()
{
bool result = true;
string planId = string.Empty;
#region 获取当前计划号,判断当前计划状态
//读取配方编码获取配方物料所在的工位,根据工位查询状态
//当PLC状态未"1" PLC准备好 上位机读取数据
//存盘完成后上位机需要将PLC点位置为2
//点位DBW0 设定PLC需要执行次数点位DBW212 为计量秤称量批次,可以此判断计划是否完成
if (result)
{
try
{
result = false;
SavePlcData();
}
catch (Exception)
{
}
finally { result = true; }
}
#endregion
}
#region 小料
#region 设置配方 PLC点位信息
/// <summary>
/// 设置配方 PLC点位信息
/// </summary>
/// <param name="listMaterial">计划列表</param>
/// <returns>是否设置成功</returns>
public static string DownLoadNextXlPlan()
{
try
{
int i = 0;
string planId = string.Empty;
List<Xl_DowLoadPlan> materialList = Product.XlPlan.PlanHelper.GetNextXlPlan();//获取下一个任务计划
foreach (var item in materialList)
{
double total = 0;
decimal set_station_weight = 0;
decimal set_station_error = 0;
try
{
planId = item.Plan_Id;
if (item.Station == 0) continue;
total = item.Total_Weight;
//setWeight = item.Station_SetWeight;
//setError = item.Station_SetError;
set_station_weight = item.Set_Weight*100;
set_station_error = item.Set_Error * 100;
if (i == 0)
{
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_PlanNo, new object[] { item.Plan_Id }); //计划号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeNo, new object[] { item.RecipeID }); //配方号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeName, new object[] { item.Recipe_Name }); //配方名称
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Batch, new object[] { item.Plan_Num });//设定执行数量
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Plan_Serial, new object[] { item.Plan_Serial }); //计划序号
}
switch (item.Station.ToString())
{
case "1":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight1, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error1, new object[] { set_station_error });
break;
case "2":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight2, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error2, new object[] { set_station_error });
break;
case "3":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight3, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error3, new object[] { set_station_error });
break;
case "4":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight4, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error4, new object[] { set_station_error });
break;
case "5":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight5, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error5, new object[] { set_station_error });
break;
case "6":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight6, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error6, new object[] { set_station_error });
break;
case "7":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight7, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error7, new object[] { set_station_error });
break;
case "8":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight8, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error8, new object[] { set_station_error });
break;
case "9":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight9, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error9, new object[] { set_station_error });
break;
case "10":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight10, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error10, new object[] { set_station_error });
break;
case "11":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight11, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error11, new object[] { set_station_error });
break;
case "12":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight12, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error12, new object[] { set_station_error });
break;
case "13":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight13, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error13, new object[] { set_station_error });
break;
case "14":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight14, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error14, new object[] { set_station_error });
break;
case "15":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight15, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error15, new object[] { set_station_error });
break;
case "16":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight16, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error16, new object[] { set_station_error });
break;
case "17":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight17, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error17, new object[] { set_station_error });
break;
case "18":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight18, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error18, new object[] { set_station_error });
break;
case "19":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight19, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error19, new object[] { set_station_error });
break;
case "20":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight20, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error20, new object[] { set_station_error });
break;
case "21":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight21, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error21, new object[] { set_station_error });
break;
case "22":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight22, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error22, new object[] { set_station_error });
break;
case "23":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight23, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error23, new object[] { set_station_error });
break;
case "24":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight24, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error24, new object[] { set_station_error });
break;
case "25":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight25, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error25, new object[] { set_station_error });
break;
case "26":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight26, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error26, new object[] { set_station_error });
break;
case "27":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight27, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error27, new object[] { set_station_error });
break;
case "28":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight28, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error28, new object[] { set_station_error });
break;
default:
break;
}
i++;
}
catch (Exception)
{
ICSharpCode.Core.LoggingService<PlcPlanHelper>.Debug(String.Format("[{0}]计划信息下传失败...", item.Plan_Id));
}
}
return planId;
}
catch (Exception ex)
{
return null;
}
}
#endregion
#region 设置配方 PLC点位信息
/// <summary>
/// 设置配方 PLC点位信息
/// </summary>
/// <param name="listMaterial">计划列表</param>
/// <returns>是否设置成功</returns>
public static bool ManualXlPlanToPlc(List<Xl_DowLoadPlan> materialList)
{
try
{
int i = 0;
string planId = string.Empty;
int j = 0;
foreach (var item in materialList)
{
int set_station_weight = 0;
int set_station_error = 0;
try
{
planId = item.Plan_Id;
if (item.Station==0) continue;
set_station_weight =Convert.ToInt32(item.Set_Weight * 100);
set_station_error = Convert.ToInt32(item.Set_Error* 100);
if (!string.IsNullOrEmpty(item.Plan_Id))
{
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_PlanNo, new object[] { item.Plan_Id }); //计划号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeNo, new object[] { item.RecipeID }); //配方号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeName, new object[] { item.Recipe_Name }); //配方名称
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Batch, new object[] { item.Plan_Num });//设定执行数量
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Plan_Serial, new object[] { item.Plan_Serial }); //计划号
}
switch (item.Station)
{
case 1:
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Batch, new object[] { item.Plan_Num });//设定执行数量
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Plan_Serial, new object[] { item.Plan_Serial }); //计划号
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight1, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error1, new object[] { set_station_error });
j++;
break;
case 2:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight2, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error2, new object[] { set_station_error });
j++;
break;
case 3:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight3, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error3, new object[] { set_station_error });
j++;
break;
case 4:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight4, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error4, new object[] { set_station_error });
j++;
break;
case 5:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight5, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error5, new object[] { set_station_error });
j++;
break;
case 6:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight6, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error6, new object[] { set_station_error });
j++;
break;
case 7:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight7, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error7, new object[] { set_station_error });
j++;
break;
case 8:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight8, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error8, new object[] { set_station_error });
j++;
break;
case 9:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight9, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error9, new object[] { set_station_error });
j++;
break;
case 10:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight10, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error10, new object[] { set_station_error });
j++;
break;
case 11:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight11, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error11, new object[] { set_station_error });
j++;
break;
case 12:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight12, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error12, new object[] { set_station_error });
j++;
break;
case 13:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight13, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error13, new object[] { set_station_error });
j++;
break;
case 14:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight14, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error14, new object[] { set_station_error });
j++;
break;
case 15:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight15, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error15, new object[] { set_station_error });
j++;
break;
case 16:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight16, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error16, new object[] { set_station_error });
j++;
break;
case 17:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight17, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error17, new object[] { set_station_error });
j++;
break;
case 18:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight18, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error18, new object[] { set_station_error });
j++;
break;
case 19:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight19, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error19, new object[] { set_station_error });
j++;
break;
case 20:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight20, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error20, new object[] { set_station_error });
j++;
break;
case 21:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight21, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error21, new object[] { set_station_error });
j++;
break;
case 22:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight22, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error22, new object[] { set_station_error });
j++;
break;
case 23:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight23, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error23, new object[] { set_station_error });
j++;
break;
case 24:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight24, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error24, new object[] { set_station_error });
j++;
j++;
break;
case 25:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight25, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error25, new object[] { set_station_error });
j++;
break;
case 26:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight26, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error26, new object[] { set_station_error });
j++;
break;
case 27:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight27, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error27, new object[] { set_station_error });
j++;
break;
case 28:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight28, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error28, new object[] { set_station_error });
j++;
break;
default:
break;
}
i++;
}
catch (Exception)
{
ICSharpCode.Core.LoggingService<PlcPlanHelper>.Debug(String.Format("[{0}]计划信息下传失败...", item.Plan_Id));
}
}
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_plc_Start, new object[] { 1 });//设定启动信号
return true;
}
catch (Exception ex)
{
return false;
}
}
#endregion
#region 设置配方 PLC点位信息
/// <summary>
/// 重传配方设置数量
/// </summary>
/// <param name="listMaterial">计划列表</param>
/// <returns>是否设置成功</returns>
public static bool RetransmissionXlPlanToPlc(int num)
{
string msg = string.Empty;
try
{
if (BasePlcHelper.Instance.plt_Station1_Batch.NowValue.ToInt() < num)
{
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Batch, new object[] { num });//设定执行数量
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
}
#endregion
#region 保存数据
/// <summary>
/// 保存数据 PLC点位信息
/// </summary>
/// <param name="listMaterial">计划列表</param>
/// <returns>是否设置成功</returns>
public static void SavePlcData()
{
try
{
int plt_Set_Plan_Serial = BasePlcHelper.Instance.plt_Set_Plan_Serial.NowValue.ToInt();//执行序号 Plan_Serial
List<Xl_DowLoadPlan> materialList = PlanHelper.GetExecPlan(plt_Set_Plan_Serial);//正在执行的任务
if (materialList == null|| materialList.Count==0) { return ; }
foreach (var item in materialList)
{
switch (item.Station)
{
case 1:
//if (BasePlcHelper.Instance.plt_Station1_WorkState.NowValue.ToInt()==100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read11_PlcState.NowValue.ToInt() == 1)//1工位A
{
int batch = BasePlcHelper.Instance.plt_Station1_Batch.NowValue.ToInt();//工位批次
decimal real_Weight =Convert.ToDecimal(BasePlcHelper.Instance.plt_Station1_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, real_Weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read11_PlcState, new object[] { 2 });
}
}
break;
case 2:
//if (BasePlcHelper.Instance.plt_Station1_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read12_PlcState.NowValue.ToInt() == 1)//1工位B
{
int batch = BasePlcHelper.Instance.plt_Station1_Batch.NowValue.ToInt();//工位批次
decimal weight =Convert.ToDecimal(BasePlcHelper.Instance.plt_Station1_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read12_PlcState, new object[] { 2 });
}
}
break;
case 3:
// if (BasePlcHelper.Instance.plt_Station2_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read21_PlcState.NowValue.ToInt() == 1)//2工位A
{
int batch = BasePlcHelper.Instance.plt_Station2_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station2_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read21_PlcState, new object[] { 2 });
}
}
break;
case 4:
//if (BasePlcHelper.Instance.plt_Station2_WorkState.NowValue.ToInt() ==200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read22_PlcState.NowValue.ToInt() == 1)//2工位B
{
int batch = BasePlcHelper.Instance.plt_Station2_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station2_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read22_PlcState, new object[] { 2 });
}
}
break;
case 5:
// if (BasePlcHelper.Instance.plt_Station3_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read31_PlcState.NowValue.ToInt() == 1)//3工位A
{
int batch = BasePlcHelper.Instance.plt_Station3_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station3_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read31_PlcState, new object[] { 2 });
}
}
break;
case 6:
// if (BasePlcHelper.Instance.plt_Station3_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read32_PlcState.NowValue.ToInt() == 1)//3工位B
{
int batch = BasePlcHelper.Instance.plt_Station3_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station3_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read32_PlcState, new object[] { 2 });
}
}
break;
case 7:
// if (BasePlcHelper.Instance.plt_Station4_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read41_PlcState.NowValue.ToInt() == 1)//4工位A
{
int batch = BasePlcHelper.Instance.plt_Station4_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station4_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read41_PlcState, new object[] { 2 });
}
}
break;
case 8:
// if (BasePlcHelper.Instance.plt_Station4_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read42_PlcState.NowValue.ToInt() == 1)//4工位B
{
int batch = BasePlcHelper.Instance.plt_Station4_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station4_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read42_PlcState, new object[] { 2 });
}
}
break;
case 9:
//if (BasePlcHelper.Instance.plt_Station5_WorkState.NowValue.ToInt() == 100) break;//称量中返回
var r = BasePlcHelper.Instance.plt_Read51_PlcState.NowValue.ToInt();
if (BasePlcHelper.Instance.plt_Read51_PlcState.NowValue.ToInt() == 1)//5工位A
{
int batch = BasePlcHelper.Instance.plt_Station5_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station5_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read51_PlcState, new object[] { 2 });
}
}
break;
case 10:
// if (BasePlcHelper.Instance.plt_Station5_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read52_PlcState.NowValue.ToInt() == 1)//5工位B
{
int batch = BasePlcHelper.Instance.plt_Station5_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station5_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read52_PlcState, new object[] { 2 });
}
}
break;
case 11:
//if (BasePlcHelper.Instance.plt_Station6_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read61_PlcState.NowValue.ToInt() == 1)//6工位A
{
int batch = BasePlcHelper.Instance.plt_Station6_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station6_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read61_PlcState, new object[] { 2 });
}
}
break;
case 12:
//if (BasePlcHelper.Instance.plt_Station6_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read62_PlcState.NowValue.ToInt() == 1)//6工位B
{
int batch = BasePlcHelper.Instance.plt_Station6_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station6_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read62_PlcState, new object[] { 2 });
}
}
break;
case 13:
//if (BasePlcHelper.Instance.plt_Station7_WorkState.NowValue.ToInt() == 100) break;//称量中返回
var t = BasePlcHelper.Instance.plt_Read71_PlcState.NowValue.ToString();
if (BasePlcHelper.Instance.plt_Read71_PlcState.NowValue.ToInt() == 1)//7工位A
{
int batch = BasePlcHelper.Instance.plt_Station7_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station7_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read71_PlcState, new object[] { 2 });
}
}
break;
case 14:
//if (BasePlcHelper.Instance.plt_Station7_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read72_PlcState.NowValue.ToInt() == 1)//7工位B
{
int batch = BasePlcHelper.Instance.plt_Station7_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station7_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read72_PlcState, new object[] { 2 });
}
}
break;
case 15:
//if (BasePlcHelper.Instance.plt_Station8_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read81_PlcState.NowValue.ToInt() == 1)//7工位B
{
int batch = BasePlcHelper.Instance.plt_Station8_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station8_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read81_PlcState, new object[] { 2 });
}
}
break;
case 16:
// if (BasePlcHelper.Instance.plt_Station8_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read82_PlcState.NowValue.ToInt() == 1)//8工位A
{
int batch = BasePlcHelper.Instance.plt_Station8_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station8_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read82_PlcState, new object[] { 2 });
}
}
break;
case 17:
// if (BasePlcHelper.Instance.plt_Station9_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read91_PlcState.NowValue.ToInt() == 1)//9工位A
{
int batch = BasePlcHelper.Instance.plt_Station9_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station9_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read91_PlcState, new object[] { 2 });
}
}
break;
case 18:
//if (BasePlcHelper.Instance.plt_Station9_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read91_PlcState.NowValue.ToInt() == 1)//9工位B
{
int batch = BasePlcHelper.Instance.plt_Station9_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station9_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read92_PlcState, new object[] { 2 });
}
}
break;
case 19:
//if (BasePlcHelper.Instance.plt_Station10_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read101_PlcState.NowValue.ToInt() == 1)//10工位A
{
int batch = BasePlcHelper.Instance.plt_Station10_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station10_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read101_PlcState, new object[] { 2 });
}
}
break;
case 20:
//if (BasePlcHelper.Instance.plt_Station10_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read102_PlcState.NowValue.ToInt() == 1)//10工位B
{
int batch = BasePlcHelper.Instance.plt_Station10_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station10_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read102_PlcState, new object[] { 2 });
}
}
break;
case 21:
// if (BasePlcHelper.Instance.plt_Station11_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read111_PlcState.NowValue.ToInt() == 1)//11工位A
{
int batch = BasePlcHelper.Instance.plt_Station11_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station11_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read111_PlcState, new object[] { 2 });
}
}
break;
case 22:
// if (BasePlcHelper.Instance.plt_Station11_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read112_PlcState.NowValue.ToInt() == 1)//11工位B
{
int batch = BasePlcHelper.Instance.plt_Station11_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station11_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read112_PlcState, new object[] { 2 });
}
}
break;
case 23:
// if (BasePlcHelper.Instance.plt_Station12_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read121_PlcState.NowValue.ToInt() == 1)//12工位A
{
int batch = BasePlcHelper.Instance.plt_Station12_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station12_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read121_PlcState, new object[] { 2 });
}
}
break;
case 24:
//if (BasePlcHelper.Instance.plt_Station12_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read122_PlcState.NowValue.ToInt() == 1)//12工位B
{
int batch = BasePlcHelper.Instance.plt_Station12_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station12_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read122_PlcState, new object[] { 2 });
}
}
break;
case 25:
// if (BasePlcHelper.Instance.plt_Station13_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read131_PlcState.NowValue.ToInt() == 1)//13工位A
{
int batch = BasePlcHelper.Instance.plt_Station13_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station13_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read131_PlcState, new object[] { 2 });
}
}
break;
case 26:
// if (BasePlcHelper.Instance.plt_Station13_WorkState.NowValue.ToInt() ==200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read132_PlcState.NowValue.ToInt() == 1)//13工位B
{
int batch = BasePlcHelper.Instance.plt_Station13_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station13_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read132_PlcState, new object[] { 2 });
}
}
break;
case 27:
// if (BasePlcHelper.Instance.plt_Station14_WorkState.NowValue.ToInt() == 200) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read141_PlcState.NowValue.ToInt() == 1)//14工位B
{
int batch = BasePlcHelper.Instance.plt_Station14_Batch.NowValue.ToInt();//工位批次
decimal weight = Convert.ToDecimal(BasePlcHelper.Instance.plt_Station14_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read141_PlcState, new object[] { 2 });
}
}
break;
case 28:
//if (BasePlcHelper.Instance.plt_Station14_WorkState.NowValue.ToInt() == 100) break;//称量中返回
if (BasePlcHelper.Instance.plt_Read142_PlcState.NowValue.ToInt() == 1)//14工位B
{
int batch = BasePlcHelper.Instance.plt_Station14_Batch.NowValue.ToInt();//工位批次
decimal weight =Convert.ToDecimal(BasePlcHelper.Instance.plt_Station14_Weight.NowValue.ToString()) / 100;//实际重量
bool result = SaveToData(item, batch, weight);
if (result)
{
//存盘成功上位机完成置为2
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read142_PlcState, new object[] { 2 });
}
}
break;
default:
break;
}
}
//检量秤
//Xl_DowLoadPlan down = materialList.Take(1).SingleOrDefault();
//if (BasePlcHelper.Instance.plt_Read1Jc.NowValue.ToInt() == 1 )
//{
// double tcheckWeight = BasePlcHelper.Instance.plt_TCheck_Weight.NowValue.ToInt();//检量秤重量
// int tcheckBatch = BasePlcHelper.Instance.plt_Batch.NowValue.ToInt();//当前执行的批次
// int plan_Serial = down.Plan_Num;//计划的批次
// double totalError = down.Total_Error;//当前批次设定总误差
// int batch = down.Plan_Num - tcheckBatch;//剩余批次
// double error = tcheckWeight - down.Total_Weight;//实际误差
// double total_Weight =down.Total_Weight + tcheckWeight;//重量累加
// double total_Error = down.Total_Error + error;//误差累加
// if (-totalError<=error && error <= totalError)//在误差之内
// {
// total_Weight = total_Weight / 1000;
// total_Error = total_Error / 1000;
// if (batch == 0) //完成
// {
// PlanHelper.UpdatePlanCompletedQuantity(down.Plan_Id, tcheckBatch,8,DateTime.Now, total_Weight, total_Error);
// //判断上位机判断当前值与配方总重满足要求时置“2”
// BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read1Jc, new object[] { 2 });
// }
// else
// {
// PlanHelper.UpdatePlanCompletedQuantity(down.Plan_Id, tcheckBatch, total_Weight, total_Error);
// //判断上位机判断当前值与配方总重满足要求时置“2”
// BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read1Jc, new object[] { 2 });
// }
// }
// else
// {
// total_Weight = total_Weight / 1000;
// total_Error = total_Error / 1000;
// if (batch == 0)//完成
// {
// PlanHelper.UpdatePlanCompletedQuantity(down.Plan_Id, tcheckBatch, 8, DateTime.Now, total_Weight, total_Error);
// //PlanHelper.AddPlanReport(down, 0, tcheckBatch, tcheckWeight, error);
// }
// else
// {
// PlanHelper.UpdatePlanCompletedQuantity(down.Plan_Id, tcheckBatch, total_Weight, total_Error);
// //PlanHelper.AddPlanReport(down, 0, tcheckBatch, tcheckWeight, error);
// }
// //6检量超差记录
// BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Read1Jc, new object[] { 6 });
// }
//}
}
catch (Exception ex)
{
}
}
#endregion
/// <summary>
/// 设定设备参数
/// </summary>
/// <param name="item"></param>
public static void WriteDeviceParam(xl_station_sub item)
{
int set_station_Weight_Medium = Convert.ToInt32(item.Station_Weight_Medium)*100;
int set_station_Weight_Low = Convert.ToInt32(item.Station_Weight_Low) * 100;
int set_station_Weight_Advance = Convert.ToInt32(item.Station_Weight_Advance) * 100;
int set_station_speed_hight = Convert.ToInt32(item.Station_Speed_Hight);
int set_station_speed_medium = Convert.ToInt32(item.Station_Speed_Medium);
int set_station_speed_low = Convert.ToInt32(item.Station_Speed_Low);
switch (item.StationSubName)
{
case "1":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium1, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low1, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance1, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight1, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium1,new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Low1, new object[] { set_station_speed_low });
break;
case "2":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium2, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low2, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance2, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight2, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium2, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Low2, new object[] { set_station_speed_low });
break;
case "3":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium3, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low3, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance3, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight3, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium3, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Low3, new object[] { set_station_speed_low });
break;
case "4":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium4, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low4, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance4, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight4, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium4, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Low4, new object[] { set_station_speed_low });
break;
case "5":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium5, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low5, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance5, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight5, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium5, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Low5, new object[] { set_station_speed_low });
break;
case "6":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium6, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low6, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance6, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight6, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium6, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Low6, new object[] { set_station_speed_low });
break;
case "7":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium7, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low7, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance7, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight7, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium7, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Low7, new object[] { set_station_speed_low });
break;
case "8":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium8, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low8, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance8, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight8, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium8, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Low8, new object[] { set_station_speed_low });
break;
case "9":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium9, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low9, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance9, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight9, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium9, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Low9, new object[] { set_station_speed_low });
break;
case "10":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium10, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low10, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance10, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight10, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium10, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Low10, new object[] { set_station_speed_low });
break;
case "11":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium11, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low11, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance11, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight11, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium11, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Low11, new object[] { set_station_speed_low });
break;
case "12":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium12, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low12, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance12, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight12, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium12, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Low12, new object[] { set_station_speed_low });
break;
case "13":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium13, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low13, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance13, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight13, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium13, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Low13, new object[] { set_station_speed_low });
break;
case "14":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium14, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low14, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance14, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight14, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium14, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Low14, new object[] { set_station_speed_low });
break;
case "15":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium15, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low15, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance15, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16, new object[] { set_station_speed_low });
break;
case "16":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium16, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low16, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance16, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16, new object[] { set_station_speed_low });
break;
case "17":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium17, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low17, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance17, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight17, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium17, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Low17, new object[] { set_station_speed_low });
break;
case "18":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium18, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low18, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance18, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight18, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium18, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Low18, new object[] { set_station_speed_low });
break;
case "19":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium19, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low19, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance19, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight19, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium19, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Low19, new object[] { set_station_speed_low });
break;
case "20":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium20, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low20, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance20, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight20, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium20, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Low20, new object[] { set_station_speed_low });
break;
case "21":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium21, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low21, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance21, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight21, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium21, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Low21, new object[] { set_station_speed_low });
break;
case "22":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium22, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low22, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance22, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight22, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium22, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Low22, new object[] { set_station_speed_low });
break;
case "23":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium23, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low23, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance23, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight23, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium23, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Low23, new object[] { set_station_speed_low });
break;
case "24":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium24, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low24, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance24, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight24, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium24, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Low24, new object[] { set_station_speed_low });
break;
case "25":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium25, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low25, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance25, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight25, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium25, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Low25, new object[] { set_station_speed_low });
break;
case "26":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium26, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low26, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance26, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight26, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium26, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Low26, new object[] { set_station_speed_low });
break;
case "27":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium27, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low27, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance27, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight27, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium27, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Low27, new object[] { set_station_speed_low });
break;
case "28":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium28, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low28, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance28, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight28, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium28, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Low28, new object[] { set_station_speed_low });
break;
case "29":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Medium29, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Low29, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Advance29, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Hight29, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Medium29, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Low29, new object[] { set_station_speed_low });
break;
case "30":
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Medium30, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Low30, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Advance30, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Hight30, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Medium30, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Low30, new object[] { set_station_speed_low });
break;
default:
break;
}
}
#endregion
/// <summary>
/// 设定设备参数
/// </summary>
/// <param name="item"></param>
public static bool WriteBinParam(Pmt_Bin item)
{
int set_station_Weight_Medium =Convert.ToInt32(item.Station_Weight_Medium * 100);
int set_station_Weight_Low = Convert.ToInt32(item.Station_Weight_Low * 100);
int set_station_Weight_Advance = Convert.ToInt32(item.Station_Weight_Advance * 100);
int set_station_speed_hight = Convert.ToInt32(item.Station_Speed_Hight)*10;
int set_station_speed_medium = Convert.ToInt32(item.Station_Speed_Medium) * 10;
int set_station_speed_low = Convert.ToInt32(item.Station_Speed_Low) * 10;
int i = 0;
switch (item.Bin_Serial)
{
case 1:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium1, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low1, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance1, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight1, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium1, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Low1, new object[] { set_station_speed_low });
i++;
break;
case 2:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium2, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low2, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance2, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight2, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium2, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Speed_Low2, new object[] { set_station_speed_low });
i++;
break;
case 3:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium3, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low3, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance3, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight3, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium3, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Low3, new object[] { set_station_speed_low });
i++;
break;
case 4:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium4, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low4, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance4, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight4, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium4, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Speed_Low4, new object[] { set_station_speed_low });
i++;
break;
case 5:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium5, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low5, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance5, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight5, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium5, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Low5, new object[] { set_station_speed_low });
i++;
break;
case 6:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium6, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low6, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance6, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight6, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium6, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Speed_Low6, new object[] { set_station_speed_low });
i++;
break;
case 7:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium7, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low7, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance7, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight7, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium7, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Low7, new object[] { set_station_speed_low });
i++;
break;
case 8:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium8, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low8, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance8, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight8, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium8, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Speed_Low8, new object[] { set_station_speed_low });
i++;
break;
case 9:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium9, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low9, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance9, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight9, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium9, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Low9, new object[] { set_station_speed_low });
i++;
break;
case 10:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium10, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low10, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance10, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight10, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium10, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Speed_Low10, new object[] { set_station_speed_low });
i++;
break;
case 11:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium11, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low11, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance11, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight11, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium11, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Low11, new object[] { set_station_speed_low });
i++;
break;
case 12:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium12, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low12, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance12, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight12, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium12, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Speed_Low12, new object[] { set_station_speed_low });
i++;
break;
case 13:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium13, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low13, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance13, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight13, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium13, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Low13, new object[] { set_station_speed_low });
i++;
break;
case 14:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium14, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low14, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance14, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight14, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium14, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Speed_Low14, new object[] { set_station_speed_low });
i++;
break;
case 15:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium15, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low15, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance15, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16, new object[] { set_station_speed_low });
i++;
break;
case 16:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium16, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low16, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance16, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16, new object[] { set_station_speed_low });
i++;
break;
case 17:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium17, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low17, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance17, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight17, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium17, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Low17, new object[] { set_station_speed_low });
i++;
break;
case 18:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium18, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low18, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance18, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight18, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium18, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Speed_Low18, new object[] { set_station_speed_low });
i++;
break;
case 19:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium19, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low19, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance19, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight19, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium19, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Low19, new object[] { set_station_speed_low });
i++;
break;
case 20:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium20, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low20, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance20, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight20, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium20, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Speed_Low20, new object[] { set_station_speed_low });
i++;
break;
case 21:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium21, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low21, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance21, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight21, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium21, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Low21, new object[] { set_station_speed_low });
i++;
break;
case 22:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium22, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low22, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance22, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight22, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium22, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Speed_Low22, new object[] { set_station_speed_low });
i++;
break;
case 23:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium23, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low23, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance23, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight23, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium23, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Low23, new object[] { set_station_speed_low });
i++;
break;
case 24:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium24, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low24, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance24, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight24, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium24, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Speed_Low24, new object[] { set_station_speed_low });
i++;
break;
case 25:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium25, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low25, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance25, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight25, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium25, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Low25, new object[] { set_station_speed_low });
i++;
break;
case 26:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium26, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low26, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance26, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight26, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium26, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Speed_Low26, new object[] { set_station_speed_low });
i++;
break;
case 27:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium27, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low27, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance27, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight27, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium27, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Low27, new object[] { set_station_speed_low });
i++;
break;
case 28:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium28, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low28, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance28, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight28, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium28, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Speed_Low28, new object[] { set_station_speed_low });
i++;
break;
case 29:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Medium29, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Low29, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Advance29, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Hight29, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Medium29, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Low29, new object[] { set_station_speed_low });
i++;
break;
case 30:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Medium30, new object[] { set_station_Weight_Medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Low30, new object[] { set_station_Weight_Low });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Weight_Advance30, new object[] { set_station_Weight_Advance });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Hight30, new object[] { set_station_speed_hight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Medium30, new object[] { set_station_speed_medium });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station15_Speed_Low30, new object[] { set_station_speed_low });
i++;
break;
default:
break;
}
if (i > 0) return true;
return false;
}
/// <summary>
/// 读取设备参数
/// </summary>
/// <param name="item"></param>
public static bool ReadBinParam(Pmt_Bin item)
{
decimal weight_Medium = 0.000M;
decimal weight_Low = 0.000M;
decimal weight_Advance = 0.000M;
int i = 0;
switch (item.Bin_Serial)
{
case 1:
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium1.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium1.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Low1.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low1.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance1.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance1.NowValue.ToInt()) / 100;
var speed1_Hight = BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight1.NowValue.ToString();
var speed1_Medium = BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium1.NowValue.ToString();
var speed1_Low = BasePlcHelper.Instance.plt_Set_Station1_Speed_Low1.NowValue.ToString();
item.Station_Weight_Medium =decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed1_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed1_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed1_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 2:
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium2.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Medium2.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Low2.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Low2.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance2.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station1_Weight_Advance2.NowValue.ToInt()) / 100;
var speed2_Hight = BasePlcHelper.Instance.plt_Set_Station1_Speed_Hight2.NowValue.ToDouble();
var speed2_Medium = BasePlcHelper.Instance.plt_Set_Station1_Speed_Medium2.NowValue.ToDouble();
var speed2_Low = BasePlcHelper.Instance.plt_Set_Station1_Speed_Low2.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed2_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed2_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed2_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 3:
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium3.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium3.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Low3.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low3.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance3.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance3.NowValue.ToInt()) / 100;
var speed3_Hight = BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight3.NowValue.ToDouble();
var speed3_Medium = BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium3.NowValue.ToDouble();
var speed3_Low = BasePlcHelper.Instance.plt_Set_Station2_Speed_Low3.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed3_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed3_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed3_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 4:
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium4.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Medium4.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Low4.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Low4.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance4.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station2_Weight_Advance4.NowValue.ToInt()) / 100;
var speed4_Hight = BasePlcHelper.Instance.plt_Set_Station2_Speed_Hight4.NowValue.ToDouble();
var speed4_Medium = BasePlcHelper.Instance.plt_Set_Station2_Speed_Medium4.NowValue.ToDouble();
var speed4_Low = BasePlcHelper.Instance.plt_Set_Station2_Speed_Low4.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed4_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed4_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed4_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 5:
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium5.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium5.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Low5.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low5.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance5.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance5.NowValue.ToInt()) / 100;
var speed5_Hight = BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight5.NowValue.ToDouble();
var speed5_Medium = BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium5.NowValue.ToDouble();
var speed5_Low = BasePlcHelper.Instance.plt_Set_Station3_Speed_Low5.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed5_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed5_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed5_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 6:
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium6.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Medium6.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Low6.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Low6.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance6.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station3_Weight_Advance6.NowValue.ToInt()) / 100;
var speed6_Hight = BasePlcHelper.Instance.plt_Set_Station3_Speed_Hight6.NowValue.ToDouble();
var speed6_Medium = BasePlcHelper.Instance.plt_Set_Station3_Speed_Medium6.NowValue.ToDouble();
var speed6_Low = BasePlcHelper.Instance.plt_Set_Station3_Speed_Low6.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed6_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed6_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed6_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 7:
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium7.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium7.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Low7.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low7.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance7.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance7.NowValue.ToInt()) / 100;
var speed7_Hight = BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight7.NowValue.ToDouble();
var speed7_Medium = BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium7.NowValue.ToDouble();
var speed7_Low = BasePlcHelper.Instance.plt_Set_Station4_Speed_Low7.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed7_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed7_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed7_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 8:
var t =Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance8.NowValue.ToInt() ) / 100;
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium8.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Medium8.NowValue.ToInt() / 100);
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Low8.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Low8.NowValue.ToInt() / 100);
if (BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance8.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station4_Weight_Advance8.NowValue.ToInt() / 100);
var speed8_Hight = BasePlcHelper.Instance.plt_Set_Station4_Speed_Hight8.NowValue.ToString();
var speed8_Medium = BasePlcHelper.Instance.plt_Set_Station4_Speed_Medium8.NowValue.ToString();
var speed8_Low = BasePlcHelper.Instance.plt_Set_Station4_Speed_Low8.NowValue.ToString();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed8_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed8_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed8_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 9:
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium9.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium9.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Low9.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low9.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance9.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance9.NowValue.ToInt()) / 100;
var speed9_Hight = BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight9.NowValue.ToDouble();
var speed9_Medium = BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium9.NowValue.ToDouble();
var speed9_Low = BasePlcHelper.Instance.plt_Set_Station5_Speed_Low9.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed9_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed9_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed9_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 10:
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium10.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Medium10.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Low10.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Low10.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance10.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station5_Weight_Advance10.NowValue.ToInt()) / 100;
var speed10_Hight = BasePlcHelper.Instance.plt_Set_Station5_Speed_Hight10.NowValue.ToDouble();
var speed10_Medium = BasePlcHelper.Instance.plt_Set_Station5_Speed_Medium10.NowValue.ToDouble();
var speed10_Low = BasePlcHelper.Instance.plt_Set_Station5_Speed_Low10.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed10_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed10_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed10_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 11:
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium11.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium11.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Low11.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low11.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance11.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance11.NowValue.ToInt()) / 100;
var speed11_Hight = BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight11.NowValue.ToDouble();
var speed11_Medium = BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium11.NowValue.ToDouble();
var speed11_Low = BasePlcHelper.Instance.plt_Set_Station6_Speed_Low11.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed11_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed11_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed11_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 12:
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium12.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Medium12.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Low12.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Low12.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance12.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station6_Weight_Advance12.NowValue.ToInt()) / 100;
var speed12_Hight = BasePlcHelper.Instance.plt_Set_Station6_Speed_Hight12.NowValue.ToDouble();
var speed12_Medium = BasePlcHelper.Instance.plt_Set_Station6_Speed_Medium12.NowValue.ToDouble();
var speed12_Low = BasePlcHelper.Instance.plt_Set_Station6_Speed_Low12.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed12_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed12_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed12_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 13:
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium13.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium13.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Low13.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low13.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance13.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance13.NowValue.ToInt()) / 100;
var speed13_Hight = BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight13.NowValue.ToDouble();
var speed13_Medium = BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium13.NowValue.ToDouble();
var speed13_Low = BasePlcHelper.Instance.plt_Set_Station7_Speed_Low13.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed13_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed13_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed13_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 14:
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium14.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Medium14.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Low14.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Low14.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance14.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station7_Weight_Advance14.NowValue.ToInt()) / 100;
var speed14_Hight = BasePlcHelper.Instance.plt_Set_Station7_Speed_Hight14.NowValue.ToDouble();
var speed14_Medium = BasePlcHelper.Instance.plt_Set_Station7_Speed_Medium14.NowValue.ToDouble();
var speed14_Low = BasePlcHelper.Instance.plt_Set_Station7_Speed_Low14.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed14_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed14_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed14_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 15:
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium15.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium15.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Low15.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low15.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance15.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance15.NowValue.ToInt()) / 100;
var speed15_Hight = BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16.NowValue.ToDouble();
var speed15_Medium = BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16.NowValue.ToDouble();
var speed15_Low = BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed15_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed15_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed15_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 16:
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium16.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Medium16.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Low16.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Low16.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance16.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station8_Weight_Advance16.NowValue.ToInt()) / 100;
var speed16_Hight = BasePlcHelper.Instance.plt_Set_Station8_Speed_Hight16.NowValue.ToDouble();
var speed16_Medium = BasePlcHelper.Instance.plt_Set_Station8_Speed_Medium16.NowValue.ToDouble();
var speed16_Low = BasePlcHelper.Instance.plt_Set_Station8_Speed_Low16.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed16_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed16_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed16_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 17:
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium17.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium17.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Low17.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low17.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance17.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance17.NowValue.ToInt()) / 100;
var speed17_Hight = BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight17.NowValue.ToDouble();
var speed17_Medium = BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium17.NowValue.ToDouble();
var speed17_Low = BasePlcHelper.Instance.plt_Set_Station9_Speed_Low17.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed17_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed17_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed17_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 18:
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium18.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Medium18.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Low18.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Low18.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance18.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station9_Weight_Advance18.NowValue.ToInt()) / 100;
var speed18_Hight = BasePlcHelper.Instance.plt_Set_Station9_Speed_Hight18.NowValue.ToDouble();
var speed18_Medium = BasePlcHelper.Instance.plt_Set_Station9_Speed_Medium18.NowValue.ToDouble();
var speed18_Low = BasePlcHelper.Instance.plt_Set_Station9_Speed_Low18.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed18_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed18_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed18_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 19:
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium19.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium19.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Low19.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low19.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance19.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance19.NowValue.ToInt()) / 100;
var speed19_Hight = BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight19.NowValue.ToDouble();
var speed19_Medium = BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium19.NowValue.ToDouble();
var speed19_Low = BasePlcHelper.Instance.plt_Set_Station10_Speed_Low19.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed19_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed19_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed19_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 20:
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium20.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Medium20.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Low20.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Low20.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance20.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station10_Weight_Advance20.NowValue.ToInt()) / 100;
var speed20_Hight = BasePlcHelper.Instance.plt_Set_Station10_Speed_Hight20.NowValue.ToDouble();
var speed20_Medium = BasePlcHelper.Instance.plt_Set_Station10_Speed_Medium20.NowValue.ToDouble();
var speed20_Low = BasePlcHelper.Instance.plt_Set_Station10_Speed_Low20.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed20_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed20_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed20_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 21:
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium21.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium21.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Low21.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low21.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance21.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance21.NowValue.ToInt()) / 100;
var speed21_Hight = BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight21.NowValue.ToDouble();
var speed21_Medium = BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium21.NowValue.ToDouble();
var speed21_Low = BasePlcHelper.Instance.plt_Set_Station11_Speed_Low21.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed21_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed21_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed21_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 22:
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium22.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Medium22.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Low22.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Low22.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance22.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station11_Weight_Advance22.NowValue.ToInt()) / 100;
var speed22_Hight = BasePlcHelper.Instance.plt_Set_Station11_Speed_Hight22.NowValue.ToDouble();
var speed22_Medium = BasePlcHelper.Instance.plt_Set_Station11_Speed_Medium22.NowValue.ToDouble();
var speed22_Low = BasePlcHelper.Instance.plt_Set_Station11_Speed_Low22.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed22_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed22_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed22_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 23:
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium23.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium23.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Low23.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low23.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance23.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance23.NowValue.ToInt()) / 100;
var speed23_Hight = BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight23.NowValue.ToDouble();
var speed23_Medium = BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium23.NowValue.ToDouble();
var speed23_Low = BasePlcHelper.Instance.plt_Set_Station12_Speed_Low23.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed23_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed23_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed23_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 24:
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium24.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Medium24.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Low24.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Low24.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance24.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station12_Weight_Advance24.NowValue.ToInt()) / 100;
var speed24_Hight = BasePlcHelper.Instance.plt_Set_Station12_Speed_Hight24.NowValue.ToDouble();
var speed24_Medium = BasePlcHelper.Instance.plt_Set_Station12_Speed_Medium24.NowValue.ToDouble();
var speed24_Low = BasePlcHelper.Instance.plt_Set_Station12_Speed_Low24.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed24_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed24_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed24_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 25:
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium25.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium25.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Low25.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low25.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance25.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance25.NowValue.ToInt()) / 100;
var speed25_Hight = BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight25.NowValue.ToDouble();
var speed25_Medium = BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium25.NowValue.ToDouble();
var speed25_Low = BasePlcHelper.Instance.plt_Set_Station13_Speed_Low25.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed25_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed25_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed25_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 26:
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium26.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Medium26.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Low26.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Low26.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance26.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station13_Weight_Advance26.NowValue.ToInt()) / 100;
var speed26_Hight = BasePlcHelper.Instance.plt_Set_Station13_Speed_Hight26.NowValue.ToDouble();
var speed26_Medium = BasePlcHelper.Instance.plt_Set_Station13_Speed_Medium26.NowValue.ToDouble();
var speed26_Low = BasePlcHelper.Instance.plt_Set_Station13_Speed_Low26.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed26_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed26_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed26_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 27:
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium27.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium27.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Low27.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low27.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance27.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance27.NowValue.ToInt()) / 100;
var speed27_Hight = BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight27.NowValue.ToDouble();
var speed27_Medium = BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium27.NowValue.ToDouble();
var speed27_Low = BasePlcHelper.Instance.plt_Set_Station14_Speed_Low27.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed27_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed27_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed27_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
case 28:
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium28.NowValue.ToInt() > 0)
weight_Medium = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Medium28.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Low28.NowValue.ToInt() > 0)
weight_Low = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Low28.NowValue.ToInt()) / 100;
if (BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance28.NowValue.ToInt() > 0)
weight_Advance = Convert.ToDecimal(BasePlcHelper.Instance.plt_Set_Station14_Weight_Advance28.NowValue.ToInt()) / 100;
var speed28_Hight = BasePlcHelper.Instance.plt_Set_Station14_Speed_Hight28.NowValue.ToDouble();
var speed28_Medium = BasePlcHelper.Instance.plt_Set_Station14_Speed_Medium28.NowValue.ToDouble();
var speed28_Low = BasePlcHelper.Instance.plt_Set_Station14_Speed_Low28.NowValue.ToDouble();
item.Station_Weight_Medium = decimal.Parse(weight_Medium.ToString());
item.Station_Weight_Low = decimal.Parse(weight_Low.ToString());
item.Station_Weight_Advance = decimal.Parse(weight_Advance.ToString());
item.Station_Speed_Hight = decimal.Parse(speed28_Hight.ToString());
item.Station_Speed_Medium = decimal.Parse(speed28_Medium.ToString());
item.Station_Speed_Low = decimal.Parse(speed28_Low.ToString());
BinHelper.updateBin(item);
i++;
break;
default:
break;
}
if (i > 0) return true;
return false;
}
public static bool SaveToData(Xl_DowLoadPlan item,int batch, decimal real_Weight)
{
try
{
bool addPlan = false;
bool addWeigh = false;
decimal error = real_Weight - item.Set_Weight;
LR_plan lrPlan = XlDbHelper.GetLrPlan(item.Plan_Id, batch);
if (lrPlan != null)
{
decimal totalWeight = lrPlan.Total_Weight + real_Weight;
decimal totalError = lrPlan.Total_Error+error;
//保存物料
LR_weigh weigh = new LR_weigh();
weigh.Dosing_ID = lrPlan.Dosing_Id;
weigh.Plan_ID = item.Plan_Id;
weigh.Recipe_ID = item.Recipe_ID;
weigh.Material_ID = item.MaterialID;
weigh.Material_Name = item.Material_name;
weigh.Set_Weight = item.Set_Weight;
weigh.Set_Error = item.Set_Error;
weigh.Real_Weight = real_Weight;
weigh.Real_Error = error;
addPlan = XlDbHelper.UpdateLrPlan(item.Plan_Id, totalWeight, totalError);
addWeigh = XlDbHelper.LRAddWeigh(weigh);
if (addPlan && addWeigh)
{
return true;
}
else
{
return false;
}
}
else
{
//保存计划
LR_plan plan = new LR_plan();
plan.Plan_Id = item.Plan_Id;
plan.Plan_Serial = item.Plan_Serial;
plan.Recipe_ID = item.Recipe_ID;
plan.Recipe_Name = item.Recipe_Name;
plan.Version = item.Version;
plan.Plan_Num = item.Plan_Num;
plan.Real_Num = BasePlcHelper.Instance.plt_Station1_Batch.NowValue.ToInt();
plan.Shift_Id = item.Shift_Id;
plan.Shift_Class = item.Shift_Class;
plan.Total_Weight = real_Weight;
plan.Total_Error = error;
plan.IsRetransmission = item.IsRetransmission;
plan.Retransmission_Num = item.Retransmission_Num;
//保存物料
LR_weigh weigh = new LR_weigh();
weigh.Plan_ID = item.Plan_Id;
weigh.Recipe_ID = item.Recipe_ID;
weigh.Material_ID = item.MaterialID;
weigh.Material_Name = item.Material_name;
weigh.Set_Weight = item.Set_Weight;
weigh.Set_Error = item.Set_Error;
weigh.Real_Weight = real_Weight;
weigh.Real_Error = error;
addPlan = XlDbHelper.LRAddPlan(plan);
addWeigh = XlDbHelper.LRAddWeigh(weigh);
if (addPlan && addWeigh)
{
return true;
}
else
{
return false;
}
}
}
catch (Exception)
{
return false;
}
}
#region 设置配方 PLC点位信息
/// <summary>
/// 设置配方 PLC点位信息
/// </summary>
/// <param name="listMaterial">计划列表</param>
/// <returns>是否设置成功</returns>
public static string ManualXlPlanToPlc2(List<Xl_DowLoadPlan> materialList)
{
try
{
int i = 0;
string planId = string.Empty;
int j = 0;
foreach (var item in materialList)
{
int set_station_weight = 0;
int set_station_error = 0;
try
{
planId = item.Plan_Id;
if (item.Station == 0) continue;
set_station_weight = Convert.ToInt32(item.Set_Weight * 100);
set_station_error = Convert.ToInt32(item.Set_Error * 100);
if (i == 0)
{
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_PlanNo, new object[] { item.Plan_Id }); //计划号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeNo, new object[] { item.RecipeID }); //配方号
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_RecipeName, new object[] { item.Recipe_Name }); //配方名称
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Batch, new object[] { item.Plan_Num });//设定执行数量
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Plan_Serial, new object[] { item.Plan_Serial }); //计划号
}
switch (item.Station)
{
case 1:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight1, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error1, new object[] { set_station_error });
j++;
break;
case 2:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Weight2, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station1_Error2, new object[] { set_station_error });
j++;
break;
case 3:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight3, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error3, new object[] { set_station_error });
j++;
break;
case 4:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Weight4, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station2_Error4, new object[] { set_station_error });
j++;
break;
case 5:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight5, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error5, new object[] { set_station_error });
j++;
break;
case 6:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Weight6, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station3_Error6, new object[] { set_station_error });
j++;
break;
case 7:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight7, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error7, new object[] { set_station_error });
j++;
break;
case 8:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Weight8, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station4_Error8, new object[] { set_station_error });
j++;
break;
case 9:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight9, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error9, new object[] { set_station_error });
j++;
break;
case 10:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Weight10, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station5_Error10, new object[] { set_station_error });
j++;
break;
case 11:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight11, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error11, new object[] { set_station_error });
j++;
break;
case 12:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Weight12, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station6_Error12, new object[] { set_station_error });
j++;
break;
case 13:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight13, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error13, new object[] { set_station_error });
j++;
break;
case 14:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Weight14, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station7_Error14, new object[] { set_station_error });
j++;
break;
case 15:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight15, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error15, new object[] { set_station_error });
j++;
break;
case 16:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Weight16, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station8_Error16, new object[] { set_station_error });
j++;
break;
case 17:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight17, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error17, new object[] { set_station_error });
j++;
break;
case 18:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Weight18, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station9_Error18, new object[] { set_station_error });
j++;
break;
case 19:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight19, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error19, new object[] { set_station_error });
j++;
break;
case 20:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Weight20, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station10_Error20, new object[] { set_station_error });
j++;
break;
case 21:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight21, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error21, new object[] { set_station_error });
j++;
break;
case 22:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Weight22, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station11_Error22, new object[] { set_station_error });
j++;
break;
case 23:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight23, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error23, new object[] { set_station_error });
j++;
break;
case 24:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Weight24, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station12_Error24, new object[] { set_station_error });
j++;
j++;
break;
case 25:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight25, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error25, new object[] { set_station_error });
j++;
break;
case 26:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Weight26, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station13_Error26, new object[] { set_station_error });
j++;
break;
case 27:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight27, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error27, new object[] { set_station_error });
j++;
break;
case 28:
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Weight28, new object[] { set_station_weight });
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_Set_Station14_Error28, new object[] { set_station_error });
j++;
break;
default:
break;
}
i++;
}
catch (Exception)
{
ICSharpCode.Core.LoggingService<PlcPlanHelper>.Debug(String.Format("[{0}]计划信息下传失败...", item.Plan_Id));
}
}
BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.plt_plc_Start, new object[] { 1 });//设定启动信号
return planId;
}
catch (Exception ex)
{
return null;
}
}
#endregion
}
}