|
|
@ -9,113 +9,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
public class LjPlanningPlcHelp
|
|
|
|
public class LjPlanningPlcHelp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
private static void Dowd(int start, RecipePlcView view)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int bin = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{bin}.0", view.Bin);
|
|
|
|
|
|
|
|
int set = start+2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{set}.0",view.Set);
|
|
|
|
|
|
|
|
int tolerance = start+6;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{tolerance}.0", view.TolErance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DowSteps(int start, Step step)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int mixCode = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode);
|
|
|
|
|
|
|
|
int mixTime = start + 2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mixTemp = start + 4;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp);
|
|
|
|
|
|
|
|
int mixSpeed = start + 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DowMSteps(int start, MixStep step)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int mixCode = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode);
|
|
|
|
|
|
|
|
int mixTime = start + 2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mixTemp = start + 4;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp);
|
|
|
|
|
|
|
|
int mixSpeed = start + 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int setValue = start + 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{setValue}.0", step.SetValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int tolerance = start + 16;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{tolerance}.0", step.SetTolerance);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<RecipePlcView> GetClean(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new RecipePlcView()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Bin = 0,
|
|
|
|
|
|
|
|
TolErance = 0,
|
|
|
|
|
|
|
|
Set = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<Step> GetCleanStep(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<Step> ls = new List<Step>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new Step()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = 0,
|
|
|
|
|
|
|
|
MixSpeed = 0,
|
|
|
|
|
|
|
|
MixTemp = 0,
|
|
|
|
|
|
|
|
MixTime = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<MixStep> GetCleanMixStep(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<MixStep> ls = new List<MixStep>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new MixStep()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = 0,
|
|
|
|
|
|
|
|
MixSpeed = 0,
|
|
|
|
|
|
|
|
MixTemp = 0,
|
|
|
|
|
|
|
|
MixTime = 0,
|
|
|
|
|
|
|
|
SetTolerance =0,
|
|
|
|
|
|
|
|
SetValue = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 干混机1
|
|
|
|
/// 干混机1
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="recipePlcViews"></param>
|
|
|
|
/// <param name="recipePlcViews"></param>
|
|
|
@ -144,68 +38,6 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
PlcConnect.Instance.Write($"DB2104.53.6",true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.53.6",true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void DownCleanD1Recipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> recipePlcViews = GetClean(12);
|
|
|
|
|
|
|
|
List<Step> recipeSteps = GetCleanStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipePlcViews.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipePlcViews[i];
|
|
|
|
|
|
|
|
Dowd(begin, view);
|
|
|
|
|
|
|
|
begin += 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin +=120;
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DownCleanG1Recipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> recipePlcViews = GetClean(2);
|
|
|
|
|
|
|
|
List<Step> recipeSteps = GetCleanStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipePlcViews.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipePlcViews[i];
|
|
|
|
|
|
|
|
Dowd(begin, view);
|
|
|
|
|
|
|
|
begin += 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin +=20;
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DownM1CleanRecipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MixStep> recipeSteps = GetCleanMixStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowMSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -317,8 +149,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void DownG2Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG2Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int begin = 1158;
|
|
|
|
int begin = 1158;
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
@ -344,8 +175,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.2", true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.2", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void DownG3Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG3Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int begin = 1298;
|
|
|
|
int begin = 1298;
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
@ -370,8 +200,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.53.7", true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.53.7", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void DownG4Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG4Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int begin = 1438;
|
|
|
|
int begin = 1438;
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
@ -397,8 +226,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void DownG5Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG5Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int begin = 1578;
|
|
|
|
int begin = 1578;
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
|
DownCleanG1Recipe(begin);
|
|
|
@ -423,8 +251,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.6", true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.6", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void DownG6Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG6Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int begin =1718;
|
|
|
|
int begin =1718;
|
|
|
@ -451,8 +278,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.7", true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.54.7", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void DownG7Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG7Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int begin =1858;
|
|
|
|
int begin =1858;
|
|
|
@ -478,8 +304,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
PlcConnect.Instance.Write($"DB2104.55.0", true);
|
|
|
|
PlcConnect.Instance.Write($"DB2104.55.0", true);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void DownG8Recipe(List<RecipePlcView> recipePlcViews,
|
|
|
|
public static void DownG8Recipe(List<RecipePlcView> recipePlcViews, List<Step> recipeSteps)
|
|
|
|
List<Step> recipeSteps)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -622,161 +447,332 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 辅助方法
|
|
|
|
|
|
|
|
|
|
|
|
public static DryerView GetDryerD1 => GetDryerView(58);
|
|
|
|
public static DryerView GetDryerD1 => GetDryerView(58);
|
|
|
|
public static DryerView GetDryerD2 => GetDryerView(298);
|
|
|
|
public static DryerView GetDryerD2 => GetDryerView(298);
|
|
|
|
public static DryerView GetDryerD3 => GetDryerView(538);
|
|
|
|
public static DryerView GetDryerD3 => GetDryerView(538);
|
|
|
|
public static DryerView GetDryerD4 => GetDryerView(778);
|
|
|
|
public static DryerView GetDryerD4 => GetDryerView(778);
|
|
|
|
|
|
|
|
|
|
|
|
public static DryerView GetGelatG1 => GetGelatView(1018);
|
|
|
|
public static DryerView GetGelatG1 => GetGelatView(1018);
|
|
|
|
public static DryerView GetGelatG2 => GetGelatView(1158);
|
|
|
|
public static DryerView GetGelatG2 => GetGelatView(1158);
|
|
|
|
public static DryerView GetGelatG3 => GetGelatView(1298);
|
|
|
|
public static DryerView GetGelatG3 => GetGelatView(1298);
|
|
|
|
public static DryerView GetGelatG4 => GetGelatView(1438);
|
|
|
|
public static DryerView GetGelatG4 => GetGelatView(1438);
|
|
|
|
public static DryerView GetGelatG5 => GetGelatView(1578);
|
|
|
|
public static DryerView GetGelatG5 => GetGelatView(1578);
|
|
|
|
public static DryerView GetGelatG6 => GetGelatView(1718);
|
|
|
|
public static DryerView GetGelatG6 => GetGelatView(1718);
|
|
|
|
public static DryerView GetGelatG7 => GetGelatView(1858);
|
|
|
|
public static DryerView GetGelatG7 => GetGelatView(1858);
|
|
|
|
public static DryerView GetGelatG8 => GetGelatView(1998);
|
|
|
|
public static DryerView GetGelatG8 => GetGelatView(1998);
|
|
|
|
|
|
|
|
|
|
|
|
public static List<MixStep> GetWeterM1 = GetWeterView(2138);
|
|
|
|
public static List<MixStep> GetWeterM1 = GetWeterView(2138);
|
|
|
|
public static List<MixStep> GetWeterM2 = GetWeterView(2338);
|
|
|
|
public static List<MixStep> GetWeterM2 = GetWeterView(2338);
|
|
|
|
public static List<MixStep> GetWeterM3 = GetWeterView(2538);
|
|
|
|
public static List<MixStep> GetWeterM3 = GetWeterView(2538);
|
|
|
|
public static List<MixStep> GetWeterM4 = GetWeterView(2738);
|
|
|
|
public static List<MixStep> GetWeterM4 = GetWeterView(2738);
|
|
|
|
public static List<MixStep> GetWeterM5 = GetWeterView(2938);
|
|
|
|
public static List<MixStep> GetWeterM5 = GetWeterView(2938);
|
|
|
|
public static List<MixStep> GetWeterM6 = GetWeterView(3138);
|
|
|
|
public static List<MixStep> GetWeterM6 = GetWeterView(3138);
|
|
|
|
public static List<MixStep> GetWeterM7 = GetWeterView(3338);
|
|
|
|
public static List<MixStep> GetWeterM7 = GetWeterView(3338);
|
|
|
|
public static List<MixStep> GetWeterM8 = GetWeterView(3538);
|
|
|
|
public static List<MixStep> GetWeterM8 = GetWeterView(3538);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DryerView GetDryerView(int start)
|
|
|
|
private static DryerView GetDryerView(int start)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
DryerView view = new DryerView();
|
|
|
|
DryerView view = new DryerView();
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 240);
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 240);
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>();
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>();
|
|
|
|
var convert = operateResult.Content;
|
|
|
|
var convert = operateResult.Content;
|
|
|
|
var data = convert.Skip(0).Take(120);
|
|
|
|
var data = convert.Skip(0).Take(120);
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var bytes = data.Skip(i * 10).Take(10).ToArray();
|
|
|
|
var bytes = data.Skip(i * 10).Take(10).ToArray();
|
|
|
|
RecipePlcView plcView = new RecipePlcView
|
|
|
|
RecipePlcView plcView = new RecipePlcView
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Bin = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
Bin = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
Set = byteTransform.TransSingle(bytes, 2),
|
|
|
|
Set = byteTransform.TransSingle(bytes, 2),
|
|
|
|
TolErance = byteTransform.TransSingle(bytes, 6)
|
|
|
|
TolErance = byteTransform.TransSingle(bytes, 6)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ls.Add(plcView);
|
|
|
|
ls.Add(plcView);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
view.RecipePlcViews = ls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = convert.Skip(120).Take(120);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Step> lsSteps = new List<Step>();
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(12).ToArray();
|
|
|
|
|
|
|
|
Step step = new Step()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed =byteTransform.TransSingle(bytes,8)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.RecipeSteps = lsSteps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
view.RecipePlcViews = ls;
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
data = convert.Skip(120).Take(120);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Step> lsSteps = new List<Step>();
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(12).ToArray();
|
|
|
|
|
|
|
|
Step step = new Step()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed = byteTransform.TransSingle(bytes, 8)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static DryerView GetGelatView(int start)
|
|
|
|
view.RecipeSteps = lsSteps;
|
|
|
|
{
|
|
|
|
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
|
|
|
|
DryerView view = new DryerView();
|
|
|
|
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 140);
|
|
|
|
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
var convert = operateResult.Content;
|
|
|
|
|
|
|
|
var data = convert.Skip(0).Take(20);
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(10).ToArray();
|
|
|
|
|
|
|
|
RecipePlcView plcView = new RecipePlcView
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Bin = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
Set = byteTransform.TransSingle(bytes, 2),
|
|
|
|
|
|
|
|
TolErance = byteTransform.TransSingle(bytes, 6)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
ls.Add(plcView);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.RecipePlcViews = ls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = convert.Skip(20).Take(120);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Step> lsSteps = new List<Step>();
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(12).ToArray();
|
|
|
|
|
|
|
|
Step step = new Step()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed =byteTransform.TransSingle(bytes,8)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.RecipeSteps = lsSteps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DryerView GetGelatView(int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
|
|
|
|
DryerView view = new DryerView();
|
|
|
|
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 140);
|
|
|
|
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
var convert = operateResult.Content;
|
|
|
|
|
|
|
|
var data = convert.Skip(0).Take(20);
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(10).ToArray();
|
|
|
|
|
|
|
|
RecipePlcView plcView = new RecipePlcView
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Bin = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
Set = byteTransform.TransSingle(bytes, 2),
|
|
|
|
|
|
|
|
TolErance = byteTransform.TransSingle(bytes, 6)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
ls.Add(plcView);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.RecipePlcViews = ls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = convert.Skip(20).Take(120);
|
|
|
|
|
|
|
|
|
|
|
|
private static List<MixStep> GetWeterView(int start)
|
|
|
|
List<Step> lsSteps = new List<Step>();
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
{
|
|
|
|
List<MixStep> ls = new List<MixStep>();
|
|
|
|
var bytes = data.Skip(i * 10).Take(12).ToArray();
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 200);
|
|
|
|
Step step = new Step()
|
|
|
|
List<MixStep> lsSteps = new List<MixStep>();
|
|
|
|
{
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
{
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed = byteTransform.TransSingle(bytes, 8)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var data = operateResult.Content;
|
|
|
|
view.RecipeSteps = lsSteps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<MixStep> GetWeterView(int start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var byteTransform = PlcConnect.Instance.ByteTransform;
|
|
|
|
|
|
|
|
List<MixStep> ls = new List<MixStep>();
|
|
|
|
|
|
|
|
var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 200);
|
|
|
|
|
|
|
|
List<MixStep> lsSteps = new List<MixStep>();
|
|
|
|
|
|
|
|
if (operateResult.IsSuccess)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var data = operateResult.Content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(20).ToArray();
|
|
|
|
|
|
|
|
MixStep step = new MixStep()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed = byteTransform.TransSingle(bytes, 8),
|
|
|
|
|
|
|
|
SetValue = byteTransform.TransSingle(bytes, 12),
|
|
|
|
|
|
|
|
SetTolerance = byteTransform.TransSingle(bytes, 16)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return lsSteps;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void DownCleanD1Recipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> recipePlcViews = GetClean(12);
|
|
|
|
|
|
|
|
List<Step> recipeSteps = GetCleanStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipePlcViews.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipePlcViews[i];
|
|
|
|
|
|
|
|
Dowd(begin, view);
|
|
|
|
|
|
|
|
begin += 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin += 120;
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DownCleanG1Recipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> recipePlcViews = GetClean(2);
|
|
|
|
|
|
|
|
List<Step> recipeSteps = GetCleanStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipePlcViews.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipePlcViews[i];
|
|
|
|
|
|
|
|
Dowd(begin, view);
|
|
|
|
|
|
|
|
begin += 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin += 20;
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DownM1CleanRecipe(int begin)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MixStep> recipeSteps = GetCleanMixStep(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < recipeSteps.Count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var view = recipeSteps[i];
|
|
|
|
|
|
|
|
DowMSteps(begin, view);
|
|
|
|
|
|
|
|
begin += 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void Dowd(int start, RecipePlcView view)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int bin = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{bin}.0", view.Bin);
|
|
|
|
|
|
|
|
int set = start + 2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{set}.0", view.Set);
|
|
|
|
|
|
|
|
int tolerance = start + 6;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{tolerance}.0", view.TolErance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DowSteps(int start, Step step)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int mixCode = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode);
|
|
|
|
|
|
|
|
int mixTime = start + 2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mixTemp = start + 4;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp);
|
|
|
|
|
|
|
|
int mixSpeed = start + 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DowMSteps(int start, MixStep step)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int mixCode = start;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode);
|
|
|
|
|
|
|
|
int mixTime = start + 2;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mixTemp = start + 4;
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp);
|
|
|
|
|
|
|
|
int mixSpeed = start + 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int setValue = start + 12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{setValue}.0", step.SetValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int tolerance = start + 16;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlcConnect.Instance.Write($"DB2104.{tolerance}.0", step.SetTolerance);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<RecipePlcView> GetClean(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<RecipePlcView> ls = new List<RecipePlcView>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new RecipePlcView()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Bin = 0,
|
|
|
|
|
|
|
|
TolErance = 0,
|
|
|
|
|
|
|
|
Set = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<Step> GetCleanStep(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<Step> ls = new List<Step>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new Step()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = 0,
|
|
|
|
|
|
|
|
MixSpeed = 0,
|
|
|
|
|
|
|
|
MixTemp = 0,
|
|
|
|
|
|
|
|
MixTime = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static List<MixStep> GetCleanMixStep(int num)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<MixStep> ls = new List<MixStep>(num);
|
|
|
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ls.Add(new MixStep()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = 0,
|
|
|
|
|
|
|
|
MixSpeed = 0,
|
|
|
|
|
|
|
|
MixTemp = 0,
|
|
|
|
|
|
|
|
MixTime = 0,
|
|
|
|
|
|
|
|
SetTolerance = 0,
|
|
|
|
|
|
|
|
SetValue = 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ls;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bytes = data.Skip(i * 10).Take(20).ToArray();
|
|
|
|
|
|
|
|
MixStep step = new MixStep()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MixCode = byteTransform.TransUInt16(bytes, 0),
|
|
|
|
|
|
|
|
MixTime = byteTransform.TransUInt16(bytes, 2),
|
|
|
|
|
|
|
|
MixTemp = byteTransform.TransSingle(bytes, 4),
|
|
|
|
|
|
|
|
MixSpeed =byteTransform.TransSingle(bytes,8),
|
|
|
|
|
|
|
|
SetValue = byteTransform.TransSingle(bytes,12),
|
|
|
|
|
|
|
|
SetTolerance = byteTransform.TransSingle(bytes,16)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
lsSteps.Add(step);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return lsSteps;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|