Browse Source

测试

样式分支
pry 2 years ago
parent
commit
6b3f07cc63
8 changed files with 63 additions and 56 deletions
  1. +18
    -18
      BPASmartClient.CustomResource/Themes/Generic.xaml
  2. +3
    -3
      BPASmartClient.Device/BaseDevice.cs
  3. +3
    -3
      BPASmartClient.Helper/ThreadManage.cs
  4. +14
    -8
      BPASmartClient.MorkF/Control_MorkF.cs
  5. +1
    -1
      BPASmartClient/App.xaml
  6. +1
    -0
      BPASmartClient/BPASmartClient.csproj
  7. +21
    -21
      BPASmartClient/DeviceInfo.xml
  8. +2
    -2
      BPASmartClient/MainWindow.xaml.cs

+ 18
- 18
BPASmartClient.CustomResource/Themes/Generic.xaml View File

@@ -10,31 +10,31 @@
<ControlTemplate TargetType="{x:Type local:IcoButton}"> <ControlTemplate TargetType="{x:Type local:IcoButton}">
<Grid Name="PART_gr"> <Grid Name="PART_gr">
<Border <Border
Name="PART_br"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
Name="PART_br"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock <TextBlock
Name="PART_icoText"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
Name="PART_icoText"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
<TextBlock <TextBlock
Name="PART_content"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
Name="PART_content"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
</Grid> </Grid>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>


+ 3
- 3
BPASmartClient.Device/BaseDevice.cs View File

@@ -60,7 +60,7 @@ namespace BPASmartClient.Device
{ {
p.DeviceId = this.DeviceId; p.DeviceId = this.DeviceId;
p.Init(); p.Init();
}); });
this.peripherals = peripherals; this.peripherals = peripherals;
} }
@@ -71,13 +71,13 @@ namespace BPASmartClient.Device
{ {
foreach (var peripheral in peripherals) foreach (var peripheral in peripherals)
{ {
string TypeName = peripheral.GetType().FullName.Replace("BPASmartClient.","");
string TypeName = peripheral.GetType().FullName.Replace("BPASmartClient.", "");
Status.Update($"{TypeName}.IsConnected", peripheral.IsConnected); Status.Update($"{TypeName}.IsConnected", peripheral.IsConnected);
Status.Update($"{TypeName}.IsWork", peripheral.IsWork); Status.Update($"{TypeName}.IsWork", peripheral.IsWork);
foreach (var key in peripheral.GetAllStatus().Keys) foreach (var key in peripheral.GetAllStatus().Keys)
{ {
peripheralStatus[key] = peripheral.GetAllStatus()[key]; peripheralStatus[key] = peripheral.GetAllStatus()[key];
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]);
Status.Update(key, peripheral.GetAllStatus()[key]);
} }
} }
Thread.Sleep(100); Thread.Sleep(100);


+ 3
- 3
BPASmartClient.Helper/ThreadManage.cs View File

@@ -84,7 +84,7 @@ namespace BPASmartClient.Helper
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="key"></param> /// <param name="key"></param>
public void Start(Action action, string key, bool isRestart = true)
public void Start(Action action, string key, bool isRestart = false)
{ {
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
@@ -103,9 +103,9 @@ namespace BPASmartClient.Helper
Threads.TryRemove(guid + key, out Task item2); Threads.TryRemove(guid + key, out Task item2);
Start(action, key, isRestart); Start(action, key, isRestart);
} }
else
else
{ {
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常");
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常");
} }
} }
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) => }), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) =>


+ 14
- 8
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -12,7 +12,7 @@ namespace BPASmartClient.MorkF
{ {
public class Control_MorkF : BaseDevice public class Control_MorkF : BaseDevice
{ {
public override DeviceClientType DeviceType => throw new NotImplementedException();
public override DeviceClientType DeviceType => DeviceClientType.MORKSF;


GVL_MorkF morkF = new GVL_MorkF();//全局对象声明 GVL_MorkF morkF = new GVL_MorkF();//全局对象声明
private OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery(); private OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery();
@@ -36,27 +36,33 @@ namespace BPASmartClient.MorkF
{ {
ThreadManage.GetInstance().StartLong(new Action(() => ThreadManage.GetInstance().StartLong(new Action(() =>
{ {
GetStatus("M0.1", new Action<bool[]>((bools) => {
GetStatus("M0.1", new Action<bool[]>((bools) =>
{
morkF.InitialComplete = bools[0]; morkF.InitialComplete = bools[0];
})); }));
GetStatus("M1.0", new Action<bool[]>((bools) => {
GetStatus("M1.0", new Action<bool[]>((bools) =>
{
morkF.ProvidePlateModule = bools[0]; morkF.ProvidePlateModule = bools[0];
morkF.ProvidePlateComplete = bools[2]; morkF.ProvidePlateComplete = bools[2];
morkF.CleanModule = bools[3]; morkF.CleanModule = bools[3];
morkF.CleanComplete = bools[5]; morkF.CleanComplete = bools[5];
})); }));
GetStatus("M2.0", new Action<bool[]>((bools) => {
GetStatus("M2.0", new Action<bool[]>((bools) =>
{
morkF.KitchenOneStatus = bools[1]; morkF.KitchenOneStatus = bools[1];
morkF.FallOilComplete = bools[8]; morkF.FallOilComplete = bools[8];
})); }));
GetStatus("M8.0", new Action<bool[]>((bools) => {
GetStatus("M8.0", new Action<bool[]>((bools) =>
{
morkF.TurnMachineUpComplete = bools[1]; morkF.TurnMachineUpComplete = bools[1];
morkF.TurnMachineDownComplete = bools[3]; morkF.TurnMachineDownComplete = bools[3];
})); }));
GetStatus("M13.5", new Action<bool[]>((bools) => {
GetStatus("M13.5", new Action<bool[]>((bools) =>
{
morkF.MaterialArriveComplete = bools[0]; morkF.MaterialArriveComplete = bools[0];
})); }));
GetStatus("M16.0", new Action<bool[]>((bools) => {
GetStatus("M16.0", new Action<bool[]>((bools) =>
{
morkF.PutPotToKitchenComlete = bools[1]; morkF.PutPotToKitchenComlete = bools[1];
morkF.TakeMaterialComplete = bools[2]; morkF.TakeMaterialComplete = bools[2];
morkF.PlaceRinseTableComplete = bools[5]; morkF.PlaceRinseTableComplete = bools[5];
@@ -371,7 +377,7 @@ namespace BPASmartClient.MorkF
TurnDownStatusDetect();//翻转机下降及检测 TurnDownStatusDetect();//翻转机下降及检测
KitchenAdjustGears(3);//灶台3挡 KitchenAdjustGears(3);//灶台3挡
TurnMachineGearsControl(3);//翻炒机3挡 TurnMachineGearsControl(3);//翻炒机3挡
Task.Delay(2000);//葱姜蒜断生
Task.Delay(2000).Wait();//葱姜蒜断生
KitchenAdjustGears(1);//灶台1挡 KitchenAdjustGears(1);//灶台1挡
TurnMachineGearsControl(0);//关闭翻炒机 TurnMachineGearsControl(0);//关闭翻炒机
TurnUpStatusDetect();//翻转机上升及检测 TurnUpStatusDetect();//翻转机上升及检测


+ 1
- 1
BPASmartClient/App.xaml View File

@@ -12,7 +12,7 @@
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" /> <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" /> <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" /> <ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> <!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>--> <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>-->




+ 1
- 0
BPASmartClient/BPASmartClient.csproj View File

@@ -25,6 +25,7 @@
<ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" /> <ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> <ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" /> <ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" /> <ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" /> <ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" /> <ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />


+ 21
- 21
BPASmartClient/DeviceInfo.xml View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<BPADevices> <BPADevices>
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Peripherals> <Peripherals>
--><!--<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters> <Parameters>
<IpAddress>127.0.0.1</IpAddress> <IpAddress>127.0.0.1</IpAddress>
<HandSensor>1</HandSensor> <HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue> <OutputSingalValue>0</OutputSingalValue>
</Parameters> </Parameters>
</Peripheral>--><!--
</Peripheral>
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine"> <Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters> <Parameters>
<PortName>COM5</PortName> <PortName>COM5</PortName>
@@ -17,39 +17,39 @@
</Parameters> </Parameters>
</Peripheral> </Peripheral>
</Peripherals> </Peripherals>
</Device>-->
</Device>


<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
<!--<Parameters>
<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
<!--<Parameters>
<IpAddress>127.0.10.1</IpAddress> <IpAddress>127.0.10.1</IpAddress>
<Port>11</Port> <Port>11</Port>
</Parameters>--> </Parameters>-->
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>
<IpAddress>192.168.1.11</IpAddress>
<Port>508</Port>
<!--<PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>-->
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
<!--<Peripheral Module="BPASmartClient.MORKSM.BK.PLC.MorksMachine">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>
<IpAddress>192.168.1.11</IpAddress>
<Port>508</Port>
<!--<PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>-->
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
<!--<Peripheral Module="BPASmartClient.MORKSM.BK.PLC.MorksMachine">
<Parameters> <Parameters>
<IpAddress>127.0.10.1</IpAddress> <IpAddress>127.0.10.1</IpAddress>
<Port>11</Port> <Port>11</Port>
</Parameters> </Parameters>
</Peripheral>--> </Peripheral>-->


<!--<Peripheral Module="BPASmartClient.KLMCoffee.CoffeeMachine">
<!--<Peripheral Module="BPASmartClient.KLMCoffee.CoffeeMachine">
<Parameters> <Parameters>
<PortName>COM8</PortName> <PortName>COM8</PortName>
<BaudRate>38400</BaudRate> <BaudRate>38400</BaudRate>
</Parameters> </Parameters>
</Peripheral>--> </Peripheral>-->


</Peripherals>
</Device>
</Peripherals>
</Device>








+ 2
- 2
BPASmartClient/MainWindow.xaml.cs View File

@@ -61,9 +61,9 @@ namespace BPASmartClient


ThreadManage.GetInstance().Start(new Action(() => ThreadManage.GetInstance().Start(new Action(() =>
{ {
DataVClient.GetInstance().Start();
//DataVClient.GetInstance().Start();
new MainConsole().Start(); new MainConsole().Start();
}), "启动主控制台");
}), "启动主控制台", false);
} }
#endregion #endregion




Loading…
Cancel
Save