Ver a proveniência

模拟版本发布

样式分支
pry há 2 anos
ascendente
cometimento
12b79e4476
12 ficheiros alterados com 129 adições e 79 eliminações
  1. +16
    -5
      BPASmartClient.Business/Plugin/ConfigMgr.cs
  2. +3
    -3
      BPASmartClient.Device/BaseDevice.cs
  3. +2
    -2
      BPASmartClient.IoT/DataVClient.cs
  4. +0
    -31
      BPASmartClient.MorkS/Control.cs
  5. +34
    -19
      BPASmartClient.ViewModel/OrderStatusViewModel.cs
  6. +10
    -3
      BPASmartClient/App.config
  7. +1
    -0
      BPASmartClient/App.xaml.cs
  8. +8
    -2
      BPASmartClient/Control/OrderStatusView.xaml
  9. +1
    -5
      BPASmartClient/DeviceInfo.xml
  10. +12
    -0
      BPASmartClient/MainWindow.xaml
  11. +33
    -0
      BPASmartClient/MainWindow.xaml.cs
  12. +9
    -9
      BPASmartClient/OrderListDialogView.xaml

+ 16
- 5
BPASmartClient.Business/Plugin/ConfigMgr.cs Ver ficheiro

@@ -147,12 +147,23 @@ namespace BPASmartClient.Business
private void InitMQTT()
{
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory());

//测试版本
//configurationBuilder.AddApolloConfiguration(p =>
// {
// p.AppId = "dev1_order";
// p.MetaServer = apolloUri;
// p.Namespaces = new List<string>() { "DEV.Config" };
// });

//正式版本
configurationBuilder.AddApolloConfiguration(p =>
{
p.AppId = "dev1_order";
p.MetaServer = apolloUri;
p.Namespaces = new List<string>() { "DEV.Config" };
});
{
p.AppId = "order";
p.MetaServer = apolloUri;
p.Namespaces = new List<string>() { "TEST1.Config" };
});

IConfiguration config = configurationBuilder.Build();
var mqttBroker = config.GetSection("BrokerHostSettings");
MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>();


+ 3
- 3
BPASmartClient.Device/BaseDevice.cs Ver ficheiro

@@ -242,9 +242,9 @@ namespace BPASmartClient.Device
{
if (RTrig.GetInstance($"ResetProgram:{DeviceId}").Start(Initing))
{
ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>
ThreadManage.GetInstance().StopTask($"MainTask:{DeviceId}", new Action(() =>
{
ThreadManage.GetInstance().StopTask("ReadPLCData", new Action(() =>
ThreadManage.GetInstance().StopTask($"ReadData:{DeviceId}", new Action(() =>
{
ResetProgram();
InitTask();
@@ -271,7 +271,7 @@ namespace BPASmartClient.Device
{
MainTask();
Thread.Sleep(10);
}), $"ResetProgram:{DeviceId}");
}), $"MainTask:{DeviceId}");
#endregion

}


+ 2
- 2
BPASmartClient.IoT/DataVClient.cs Ver ficheiro

@@ -185,7 +185,7 @@ namespace BPASmartClient.IoT
}
#endregion

}

//命令实体类
@@ -219,5 +219,5 @@ namespace BPASmartClient.IoT
}
}

}

+ 0
- 31
BPASmartClient.MorkS/Control.cs Ver ficheiro

@@ -27,26 +27,6 @@ namespace BPASmartClient.MorkS
{
ServerInit();
DataParse();
//ReadPLCData();
//Main();

//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// if (RTrig.GetInstance("ResetProgram").Start(Initing))
// {
// ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>
// {
// ThreadManage.GetInstance().StopTask("ReadPLCData", new Action(() =>
// {
// mORKS = null;
// mORKS = new GVL_MORKS();
// ReadPLCData();
// Main();
// }));
// }));
// }
// Thread.Sleep(10);
//}), "ResetProgram");
}

public override void ResetProgram()
@@ -110,9 +90,6 @@ namespace BPASmartClient.MorkS

public override void ReadData()
{
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{

GetStatus("M550.0", new Action<bool[]>((bools) =>
{
alarm.MachineLeftLowTemperature = bools[0];
@@ -189,9 +166,6 @@ namespace BPASmartClient.MorkS
mORKS.TurntableFeedbackloc = value;
}
});

// Thread.Sleep(500);
//}), "ReadPLCData", true);
}

/// <summary>
@@ -245,8 +219,6 @@ namespace BPASmartClient.MorkS

public override void MainTask()
{
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
mORKS.AllowRun = mORKS.InitComplete;
//IsHealth = mORKS.Error && mORKS.InitComplete;
IsHealth = true;
@@ -260,9 +232,6 @@ namespace BPASmartClient.MorkS

TurntableControl();

// Thread.Sleep(100);

//}), "MainTask");
}




+ 34
- 19
BPASmartClient.ViewModel/OrderStatusViewModel.cs Ver ficheiro

@@ -56,24 +56,34 @@ namespace BPASmartClient.ViewModel
if (o[0] is MorkOrderPush morkOrderpush && o[1] is IDevice device)
{
ObservableCollection<MorkOrder> observableCollection = new ObservableCollection<MorkOrder>();
observableCollection.Add(new MorkOrder()
MorkOrder morkOrder = new MorkOrder()
{
OrderPush = morkOrderpush,
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
});
};
observableCollection.Add(morkOrder);
//var res = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.DeviceId == device.ToString());
//if (res == null)
//{
Application.Current?.Dispatcher.BeginInvoke((Action)delegate
{
Json<KeepDataBase>.Data.orderLists.Add(new OrderData()
int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString());
if (index < 0)
{
DeviceId = device.ToString(),
IsAllSelect = true,
morkOrderPushes = observableCollection,
Json<KeepDataBase>.Data.orderLists.Add(new OrderData()
{
DeviceId = device.DeviceId.ToString(),
IsAllSelect = true,
morkOrderPushes = observableCollection,

});
}
else
{
Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder);
}

});
orderStatusLists.Add(new MorkOrder()
{
OrderPush = morkOrderpush,
@@ -113,23 +123,28 @@ namespace BPASmartClient.ViewModel
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);

//压力测试时注释,正常使用需要取消注释
//WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
//orderStatusLists.RemoveAt(index);
});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释
//var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
//if (re != null)
//{
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// WaitTakeMeal.Remove(re);
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
// });
//}
break;
default:
break;


+ 10
- 3
BPASmartClient/App.config Ver ficheiro

@@ -11,17 +11,24 @@

<!--客户端ID-->
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺-->
<add key="ClientId" value="10"/>
<add key="ClientId" value="2"/>
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/>
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/>
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>-->

<!--<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/>-->
<add key="ApolloUri" value="http://10.2.1.21:28080"/>

<!--开发环境-->
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/>
<add key="OrderServiceUri" value="https://bpa.black-pa.com:21527/order/"/>
<add key="StockServiceUri" value="https://bpa.black-pa.com:21527/stock/"/>
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>-->

<!--正式环境-->
<add key="ApolloUri" value="http://47.108.65.220:28080"/>
<add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/>
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/>
<add key="DataVServiceUri" value="https://witt.black-pa.com/datav"/>


<add key="COM_Coffee" value="COM3"/>


+ 1
- 0
BPASmartClient/App.xaml.cs Ver ficheiro

@@ -125,5 +125,6 @@ namespace BPASmartClient
}



}
}

+ 8
- 2
BPASmartClient/Control/OrderStatusView.xaml Ver ficheiro

@@ -12,7 +12,7 @@
mc:Ignorable="d">

<UserControl.DataContext>
<vm:OrderStatusViewModel/>
<vm:OrderStatusViewModel />
</UserControl.DataContext>

<UserControl.Resources>
@@ -136,7 +136,7 @@

<TextBlock
Grid.Column="0"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.SortNum}" />

@@ -203,7 +203,9 @@
<RowDefinition />
</Grid.RowDefinitions>


<!--#region 表格标题栏设置-->

<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
@@ -270,9 +272,11 @@
Text="完成时间" />

</Grid>

<!--#endregion-->

<!--#region 表格数据显示-->

<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
@@ -349,7 +353,9 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

<!--#endregion-->

</Grid>
<!--#endregion-->



+ 1
- 5
BPASmartClient/DeviceInfo.xml Ver ficheiro

@@ -25,22 +25,18 @@
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</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>
</Peripherals>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="3">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="1">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</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,M550.0,16;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>


+ 12
- 0
BPASmartClient/MainWindow.xaml Ver ficheiro

@@ -249,6 +249,18 @@
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}" />

<Button
Name="save"
Grid.Row="0"
Width="100"
Margin="230,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="Button_Click_2"
Content="保存订单数据"
Cursor="Hand"
Style="{DynamicResource CommonBtn_返回}" />

<TextBlock
x:Name="Title"
HorizontalAlignment="Center"


+ 33
- 0
BPASmartClient/MainWindow.xaml.cs Ver ficheiro

@@ -152,8 +152,41 @@ namespace BPASmartClient
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, this, "我是标题", "我是消息内容!我是消息内容!我是消息内容!我是消息内容!");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, this, "我是标题", "我是消息内容!我是消息内容!我是消息内容!我是消息内容!");
}

#endregion

private void Button_Click_2(object sender, RoutedEventArgs e)
{
this.save.IsEnabled = false;
Task.Run(new Action(() =>
{
var res = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.DeviceId == "2")?.morkOrderPushes;
if (res != null)
{
string info = string.Empty;
int count = 0;
foreach (var item in res)
{
info = $"SuborderId:= {item.OrderPush.SuborderId},SortNum:= {item.OrderPush.SortNum},GoodsName:= {item.OrderPush.GoodsName} \r\n {info}";
count++;
if (count >= 1000)
{
TextHelper.GetInstance.WriteTextInfo(info, $"订单信息-{DateTime.Now.ToString("HH-mm-ss")}-{count}", "Morks");
info = string.Empty;
count = 0;
}
}
if (info != string.Empty)
{
TextHelper.GetInstance.WriteTextInfo(info, $"订单信息-{DateTime.Now.ToString("HH-mm-ss")}-{count}", "Morks");
info = string.Empty;
count = 0;
}
}
App.Current.Dispatcher.Invoke(new Action(() => { this.save.IsEnabled = true; }));
}));


}
}
}

+ 9
- 9
BPASmartClient/OrderListDialogView.xaml Ver ficheiro

@@ -205,14 +205,12 @@
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<StackPanel Margin="0 0 0 15">
<StackPanel Margin="0,0,0,15">
<CheckBox
Height="20"
HorizontalAlignment="Left"
@@ -225,7 +223,7 @@
Template="{StaticResource CbTemplate}" />

<!--#region 表格标题栏设置-->
<Grid Margin="23 5 0 0">
<Grid Height="30" Margin="23,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.068*" />
<ColumnDefinition Width="0.3*" />
@@ -233,7 +231,7 @@
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>

<CheckBox
<!--<CheckBox
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
@@ -242,7 +240,7 @@
FontSize="14"
Foreground="#ddd"
IsChecked="{Binding AllSelected}"
Template="{StaticResource CbTemplate}" />
Template="{StaticResource CbTemplate}" />-->

<!--<Border
Grid.Column="1"
@@ -280,7 +278,7 @@
<Border
Grid.Column="1"
Grid.ColumnSpan="3"
Background="#882AB2E7"
Background="#882AB2E7"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1,0,1,1" />
</Grid>
@@ -289,7 +287,7 @@
<ItemsControl ItemsSource="{Binding morkOrderPushes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="23 0 0 0" Height="30">
<Grid Height="30" Margin="23,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.068*" />
<ColumnDefinition Width="0.3*" />
@@ -318,6 +316,8 @@

<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />


Carregando…
Cancelar
Guardar