Explorar el Código

代码提交

master
pengliangyang hace 1 año
padre
commit
104afbded2
Se han modificado 11 ficheros con 107 adiciones y 66 borrados
  1. +1
    -1
      BPASmartClient.JXJFoodBigStation/App.config
  2. +4
    -1
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  3. +20
    -15
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  4. +35
    -33
      BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs
  5. +2
    -0
      BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
  6. +1
    -1
      BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs
  7. +14
    -0
      BPASmartClient.MorkT_BarCounter/SavePar.cs
  8. +15
    -0
      BPASmartClient.MorkT_BarCounter/SaveParModel.cs
  9. +1
    -7
      BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
  10. +10
    -4
      BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
  11. +4
    -4
      BPASmartClient/App.config

+ 1
- 1
BPASmartClient.JXJFoodBigStation/App.config Ver fichero

@@ -3,7 +3,7 @@
<appSettings>
<add key="HKPlc_IP" value="107.107.2.17"/>
<add key="Siemens_IP" value="107.107.2.200"/>
<add key="HKPlc_Connect" value="false"/>
<add key="HKPlc_Connect" value="true"/>
<add key="Siemens_Connect" value="false"/>
</appSettings>
</configuration>

+ 4
- 1
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs Ver fichero

@@ -103,24 +103,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
switch (barrel)
{
case 1:
string address = "DB99.DBD" + (6 + 4 * (loc - 1));
HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
break;
case 2:
string address1 = "DB99.DBD" + (62 + 4 * (loc - 1));
HK_PLC_S7.Write(address1, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
break;
case 4:
string address2 = "DB99.DBD" + (118 + 4 * (loc - 1));
HK_PLC_S7.Write(address2, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
break;
case 5:
string address3 = "DB99.DBD" + (174 + 4 * (loc - 1));
HK_PLC_S7.Write(address3, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
break;
default:
break;


+ 20
- 15
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Ver fichero

@@ -91,20 +91,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterials.Clear();
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++)
{
int index = RawMaterialsNamePos.Values.ToList().IndexOf(recipe.Material[i].Material_Name);
if (index >= 0)
if (string.IsNullOrEmpty(recipe.Material[i].Material_Name))
{
RawMaterials.Add(new RawMaterial()
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = RawMaterialsNamePos.Keys.ToList()[index]
});

}
else
else
{
MessageNotify.GetInstance.ShowAlarmLog($"本地缺少原料{recipe.Material[i].Material_Name},和西门子下发的原料名称无法对应,");
int index = RawMaterialsNamePos.Values.ToList().IndexOf(recipe.Material[i].Material_Name);
if (index >= 0)
{
RawMaterials.Add(new RawMaterial()
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = RawMaterialsNamePos.Keys.ToList()[index]
});
}
else
{
MessageNotify.GetInstance.ShowAlarmLog($"本地缺少原料{recipe.Material[i].Material_Name},和西门子下发的原料名称无法对应,");
}
}
}
App.Current.Dispatcher.Invoke(() =>
@@ -1287,7 +1294,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{

if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
@@ -1311,7 +1317,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成");
}

}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
@@ -1349,7 +1354,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds;
@@ -1462,7 +1467,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds;


+ 35
- 33
BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs Ver fichero

@@ -15,6 +15,41 @@ namespace BPASmartClient.MilkTeaCube
public override void Init()
{
modbus.ModbusTcpConnect(communicationPar.IPAddress);
EventBus.EventBus.GetInstance().Subscribe<MilkTea_MakeMilkTeaEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
var par = @event as MilkTea_MakeMilkTeaEvent;
switch (par?.TagName)
{
case "Start":
modbus.Write("LB14", true);
Thread.Sleep(200);
modbus.Write("LB14", false);

break;
case "ParameterSet":
modbus.Write("LB14", false);
Thread.Sleep(500);
modbus.Write("LW1001", par.MilkTeaKind[0]);
modbus.Write("LW1003", par.MilkTeaKind[1]);
modbus.Write("LW1004", par.MilkTeaKind[2]);
modbus.Write("LW1005", par.MilkTeaKind[3]);
modbus.Write("LW1006", par.MilkTeaKind[4]);
modbus.Write("LW1007", par.MilkTeaKind[5]);
modbus.Write("LW1008", par.MilkTeaKind[6]);
modbus.Write("LW1009", par.MilkTeaKind[7]);
modbus.Write("LW1010", par.MilkTeaKind[8]);
modbus.Write("LW1011", par.MilkTeaKind[9]);
modbus.Write("LW1012", par.MilkTeaKind[10]);
modbus.Write("LW1013", par.MilkTeaKind[11]);
break;
case "StartSignReset":
modbus.Write("LB14", false);
break;
default:
break;
}
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = modbus.Connected;
@@ -36,39 +71,6 @@ namespace BPASmartClient.MilkTeaCube
}
Thread.Sleep(1000);
}), $"Ä̲èζħ·½É豸Á¬½Ó", true);
EventBus.EventBus.GetInstance().Subscribe<MilkTea_MakeMilkTeaEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
var par = @event as MilkTea_MakeMilkTeaEvent;
switch (par?.TagName)
{
case "Start":
modbus.Write("LB14",true);
break;
case "ParameterSet":
modbus.Write("LB14", false);
Thread.Sleep(500);
modbus.Write("LW1002", par.MilkTeaKind[0]);
modbus.Write("LW1006", par.MilkTeaKind[1]);
modbus.Write("LW1008", par.MilkTeaKind[2]);
modbus.Write("LW1010", par.MilkTeaKind[3]);
modbus.Write("LW1012", par.MilkTeaKind[4]);
modbus.Write("LW1014", par.MilkTeaKind[5]);
modbus.Write("LW1016", par.MilkTeaKind[6]);
modbus.Write("LW1018", par.MilkTeaKind[7]);
modbus.Write("LW1020", par.MilkTeaKind[8]);
modbus.Write("LW1022", par.MilkTeaKind[9]);
modbus.Write("LW1024", par.MilkTeaKind[10]);
modbus.Write("LW1026", par.MilkTeaKind[11]);
break;
case "StartSignReset":
modbus.Write("LB14", false);
break;
default:
break;
}
});
}
public override void Start()
{


+ 2
- 0
BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs Ver fichero

@@ -60,6 +60,8 @@ namespace BPASmartClient.MorkT_BarCounter
{
IsHealth = true;
}
Json<SaveParModel>.Read();
GVL_MorkT.MilkTeaCHValue = Json<SaveParModel>.Data.parData;
IsHealth = true;
serverInit();
DataParse();


+ 1
- 1
BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs Ver fichero

@@ -108,7 +108,7 @@ namespace BPASmartClient.MorkT_BarCounter
/// <summary>
/// 出果汁完成,是否去取果汁
/// </summary>
public static ushort[] MilkTeaCHValue = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
public static ushort[] MilkTeaCHValue { get; set; } = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
/// <summary>
/// 做茶订单队列
/// </summary>


+ 14
- 0
BPASmartClient.MorkT_BarCounter/SavePar.cs Ver fichero

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkT_BarCounter
{
public class SavePar
{
public string Name { get; set; }
public string Value { get; set; }
}
}

+ 15
- 0
BPASmartClient.MorkT_BarCounter/SaveParModel.cs Ver fichero

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkT_BarCounter
{
public class SaveParModel
{
public ObservableCollection<SavePar> parSets { get; set; } = new ObservableCollection<SavePar>();
public ushort[] parData { get; set; }
}
}

+ 1
- 7
BPASmartClient.MorkT_BarCounter/View/DebugView.xaml Ver fichero

@@ -102,16 +102,10 @@
</WrapPanel>
<WrapPanel Grid.Row="6" Grid.ColumnSpan="2" >
<TextBlock Height="22" Width="100" FontSize="14">味魔方执行程序:</TextBlock>
<TextBox Margin="2" Width="80" Text="{Binding MilkTeaCub}"></TextBox>
<Button Margin="2" Content="启动" Width="50" Command="{Binding MikeTeaCupControlCommand}"></Button>
<Button Margin="2" Content="设置参数" Width="60" Command="{Binding MikeTeaCupSetParCommand}"></Button>
<Button Margin="2" Content="保存参数" Width="60" Command="{Binding MikeTeaCupSetParCommand}"></Button>
</WrapPanel>
</Grid>

<WrapPanel Grid.Row="1">
<TextBlock Grid.Column="0" Height="22" Width="100" FontSize="14">电爪执行程序:</TextBlock>
<TextBox Margin="10" Width="80" Text="{Binding GripperProgam}"></TextBox>
<Button Margin="10" Content="启动" Width="50" Command="{Binding GripperControlCommand}"></Button>
</WrapPanel>
</Grid>
</UserControl>

+ 10
- 4
BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs Ver fichero

@@ -25,6 +25,10 @@ public class DebugViewModel : ObservableObject
{
public DebugViewModel()
{
if (Json<SaveParModel>.Data.parData != null)
{
CH_Value = Json<SaveParModel>.Data.parData;
}
RobotControlCommand = new RelayCommand(() =>
{
new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();
@@ -36,7 +40,6 @@ public class DebugViewModel : ObservableObject
});
MikeTeaCupControlCommand = new RelayCommand(() =>
{
new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
});
GripperControlCommand = new RelayCommand(() =>
@@ -64,8 +67,11 @@ public class DebugViewModel : ObservableObject
{
for (int i = 0; i < 12; i++)
{
GVL_MorkT.MilkTeaCHValue[i] = (ushort)CH_Value[i];
GVL_MorkT.MilkTeaCHValue[i] = CH_Value[i];
}
Json<SaveParModel>.Data.parData = GVL_MorkT.MilkTeaCHValue;
Json<SaveParModel>.Save();
new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
});
}
public int JakaRobotProgram { get { return _JakaRobotProgram; } set { _JakaRobotProgram = value; OnPropertyChanged(); } }
@@ -82,8 +88,8 @@ public class DebugViewModel : ObservableObject
public int GripperProgam { get { return _GripperProgam; } set { _GripperProgam = value; OnPropertyChanged(); } }
private int _GripperProgam { get; set; }

public int[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
private int[] _CH_Value { get; set; } = new int[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
public ushort[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
private ushort[] _CH_Value { get; set; } = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };

public RelayCommand GripperControlCommand { get; set; }
}


+ 4
- 4
BPASmartClient/App.config Ver fichero

@@ -7,9 +7,9 @@
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="test1_HostComputer"/>
<add key ="Namespaces" value="DEV.test1.Config"/>
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
@@ -17,9 +17,9 @@
<add key ="Namespaces" value="DEV.Config"/>-->

<!--正式环境-->
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="appid" value="hostcomputer"/>
<add key ="namespaces" value="test1.config"/>-->
<add key ="namespaces" value="test1.config"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


Cargando…
Cancelar
Guardar