Quellcode durchsuchen

手动打印小票

刘彬 vor 1 Woche
Ursprung
Commit
c8e8b07d7d
3 geänderte Dateien mit 24 neuen und 19 gelöschten Zeilen
  1. 22 18
      Core/Management.cs
  2. 1 0
      Views/MainWindow.xaml
  3. 1 1
      Views/WorkRunView.xaml

+ 22 - 18
Core/Management.cs

@@ -40,8 +40,8 @@ namespace DefaultEdit.Core
 
         public event Action ProduceDataToChangeEvent;
 
-        private List<RfidInfo> _RfIDList=new List<RfidInfo>();
-        public List<RfidInfo> RfIDList { get => _RfIDList; set => _RfIDList = value; }
+        private ObservableCollection<RfidInfo> _RfIDList=new ObservableCollection<RfidInfo>();
+        public ObservableCollection<RfidInfo> RfIDList { get => _RfIDList; set { SetProperty(ref _RfIDList, value); } }
 
       //  private ObservableCollection<RfidInfo> _RuningData=new ObservableCollection<RfidInfo>();
       //  public ObservableCollection<RfidInfo> RuningData { get => _RuningData; set => _RuningData = value; }
@@ -133,11 +133,12 @@ namespace DefaultEdit.Core
                         stopwatchs[ 0 ].Restart();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index= RfIDList.FindIndex(x => x.StationId == 1);
+                            int index= RfIDList.ToList().FindIndex(x => x.StationId == 1);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 2;
                                 CurrStationRfid[ 1 ] = RfIDList[ index ].Rfid;
+                                RfIDList[index].State = "离心中";
                                 LogHelper.Info(RfIDList[ index ].Rfid + " 1工位离心开始");
                             }
                             else
@@ -145,11 +146,12 @@ namespace DefaultEdit.Core
 
                                 LogHelper.Info(" 1工位离心开始");
                             }
-                            index = RfIDList.FindIndex(x => x.StationId == 1);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 1);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 2;
                                 CurrStationRfid[ 2 ] = RfIDList[ index ].Rfid;
+                                RfIDList[index].State = "离心中";
                                 LogHelper.Info(RfIDList[ index ].Rfid + " 1工位离心开始");
                             }
                             else
@@ -176,10 +178,11 @@ namespace DefaultEdit.Core
                         stopwatchs[ 0 ].Stop();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index= RfIDList.FindIndex(x => x.StationId == 2);
+                            int index= RfIDList.ToList().FindIndex(x => x.StationId == 2);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 3;
+                                RfIDList[index].State = "离心完成";
                                 LogHelper.Info(CurrStationRfid[ 1 ] + " 1工位离心完成");
                             }
                             else
@@ -188,10 +191,11 @@ namespace DefaultEdit.Core
 
                             }
 
-                            index = RfIDList.FindIndex(x => x.StationId == 2);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 2);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 3;
+                                RfIDList[index].State = "离心完成";
                                 LogHelper.Info(CurrStationRfid[ 2 ] + " 1工位离心完成");
                             }
                             else
@@ -220,7 +224,7 @@ namespace DefaultEdit.Core
                         stopwatchs[ 1 ].Restart();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index = RfIDList.FindIndex(x => x.StationId == 3);
+                            int index = RfIDList.ToList().FindIndex(x => x.StationId == 3);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 4;
@@ -232,7 +236,7 @@ namespace DefaultEdit.Core
                             {
                                 LogHelper.Info(" 2工位离心开始");
                             }
-                            index = RfIDList.FindIndex(x => x.StationId == 1);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 1);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 4;
@@ -262,7 +266,7 @@ namespace DefaultEdit.Core
                         stopwatchs[ 1 ].Stop();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index= RfIDList.FindIndex(x => x.StationId == 4);
+                            int index= RfIDList.ToList().FindIndex(x => x.StationId == 4);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 5;
@@ -273,7 +277,7 @@ namespace DefaultEdit.Core
                             {
                                 LogHelper.Info(" 2工位离心完成");
                             }
-                            index = RfIDList.FindIndex(x => x.StationId == 4);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 4);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 5;
@@ -334,7 +338,7 @@ namespace DefaultEdit.Core
                         stopwatchs[ 2 ].Restart();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index= RfIDList.FindIndex(x => x.StationId ==5 );
+                            int index= RfIDList.ToList().FindIndex(x => x.StationId ==5 );
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 6;
@@ -347,7 +351,7 @@ namespace DefaultEdit.Core
                                 LogHelper.Info(" 固化开始");
                             }
 
-                            index = RfIDList.FindIndex(x => x.StationId == 5);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 5);
                             if ( index != -1 )
                             {
                                 RfIDList[ index ].StationId = 6;
@@ -377,7 +381,7 @@ namespace DefaultEdit.Core
                         stopwatchs[ 2 ].Stop();
                         if ( RfIDList.Count != 0 )
                         {
-                            int index= RfIDList.FindIndex(x => x.StationId ==6 );
+                            int index= RfIDList.ToList().FindIndex(x => x.StationId ==6 );
                             if ( index != -1 )
                             {
                                 RfIDList.RemoveAt(index);
@@ -388,10 +392,10 @@ namespace DefaultEdit.Core
                                 LogHelper.Info(" 固化完成");
                             }
 
-                            index = RfIDList.FindIndex(x => x.StationId == 6);
+                            index = RfIDList.ToList().FindIndex(x => x.StationId == 6);
                             if ( index != -1 )
                             {
-                                RfIDList.RemoveAt(index);
+                                RfIDList[index].StationId=100;
                                 LogHelper.Info(RfIDList[ index ].Rfid + " 固化完成");
                             }
                             else
@@ -567,8 +571,8 @@ namespace DefaultEdit.Core
                                 groupdata = _httpService.GetGroupItems(boardId, CurentApplicationSettings.DeviceId);
                                 if ( !groupdata.Success )
                                 {
-
-                                    if ( groupdata.RawText.Contains("未点检") )
+                                   
+                                    if (groupdata.RawText!=null&&groupdata.RawText.Contains("未点检") )
                                     {
                                         var s = MessageBox.Show("设备未点检,请点检后确认!", "提示", MessageBoxButton.OK);
 
@@ -704,7 +708,7 @@ namespace DefaultEdit.Core
                                     processDataModels.RemoveAt(0);
                                 }
                                 RfidInfo rfidInfo=   new RfidInfo() { Rfid = value, StationId = 1, ModelsInfo=modelsinfo, State="入料中", StartTime=DateTime.Now };
-                                if ( RfIDList.Find(x => x.Rfid == value) == null )
+                                if ( RfIDList.ToList().Find(x => x.Rfid == value) == null )
                                 {
                                     RfIDList.Add(rfidInfo);
                                    // RuningData.Add(rfidInfo);

+ 1 - 0
Views/MainWindow.xaml

@@ -11,6 +11,7 @@
         WindowStyle="None"
         Title="EA时代天使"
         Height="450"
+        WindowState="Maximized"
         FontWeight="Bold"
         FontFamily="微软雅黑"
         MouseDoubleClick="Grid_MouseDown"

+ 1 - 1
Views/WorkRunView.xaml

@@ -405,7 +405,7 @@
                                     <GridViewColumn.CellTemplate>
                                         <DataTemplate>
                                             <Button Content="打印小票"
-                                                    Command="{Binding ManualPrintCommand}"
+                                                    Command="{Binding DataContext.ManualPrintCommand,RelativeSource={RelativeSource AncestorType=ListView}}"
                                                     CommandParameter="{Binding Rfid}"/>
                                         </DataTemplate>
                                     </GridViewColumn.CellTemplate>