Browse Source

修改分拣重复扫码问题

陈子杰 3 months ago
parent
commit
df71a20d71

+ 1 - 1
SCADA_DAQ/Customer/Models/LabelModel.cs

@@ -345,7 +345,7 @@ namespace SCADA_DAQ.Customer.Models
         /// <summary>
         /// 
         /// </summary>
-        [EnumDisplay("None")]
+        [EnumDisplay("未执行")]
         None,
 
         /// <summary>

+ 7 - 2
SCADA_DAQ/Customer/Service/ScannerService.cs

@@ -109,13 +109,18 @@ namespace SCADA_DAQ.Customer.Service
         private void Sbr1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
         {
             var barcode = e.Barcode;
-            Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(0);
 
             var barcodeTask = BoardTasks.Where(t => t.BoardID == barcode).FirstOrDefault();
+            if (barcodeTask == null)
+            {
+                barcodeTask = Env.DAL.App_Hold_BoardInfo.GetData<BoardTaskModel>(t=>t.BoardID == barcode).FirstOrDefault();
+            }
             //var barcodeTask = Env.DAL.App_Hold_BoardInfo.GetData<BoardTaskModel>(t=>t.BoardID == barcode).FirstOrDefault();
             var api = new WebApiHelper(_ScannerServiceConfig.Url);
             if ((DateTime.Now - LastScanTime).TotalSeconds > 3)
             {
+                Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(0);
+
                 if (barcode != "NoRead" && barcodeTask != null)
                 {
                     var MinProportion = Math.Min(barcodeTask.Width, barcodeTask.Height) / Math.Max(barcodeTask.Width, barcodeTask.Height);
@@ -174,7 +179,7 @@ namespace SCADA_DAQ.Customer.Service
                 {
                     Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(2);
                     //Plc1.GetListenReg(SortingDeliveryMachine.Tag_IsLeftovers).WriteReg(1);
-                    Plc1.LeftLoversOrAbnormal.Enqueue(1);
+                    Plc1.LeftLoversOrAbnormal.Enqueue(1); 
 
                     Log.Info($"没有获取到条码");
                 }

+ 6 - 2
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingMain.xaml.cs

@@ -224,9 +224,12 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             if (plc.BaseDevice.Simulated)
             {
                     Btn_Sim.IsEnabled = false;
+                plc.GetListenReg(SortMachine.Tag_XMaxLimitPos).WriteReg(2000);
+                plc.GetListenReg(SortMachine.Tag_CameraEnable).WriteReg(1);
 
-                    //plc.Labels = new ObservableCollection<LabelModel>(plc.GetLabes(plc.File.FilePath));
-                    Task.Run(async () =>
+
+                //plc.Labels = new ObservableCollection<LabelModel>(plc.GetLabes(plc.File.FilePath));
+                Task.Run(async () =>
                     {
                         plc.GetListenReg(SortMachine.Tag_SortFinish).ResetBit();
                         plc.GetListenReg(SortMachine.Tag_StartSort).SetBit();
@@ -320,6 +323,7 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
         private void RestartBtn_Click(object sender, RoutedEventArgs e)
         {
             //plc.GetListenReg(SortMachine.Tag_StartSort).SetBit();
+            plc.Labels.Where(t=>t.Status == Models.TaskStatus.Excuting).ToList().ForEach(t=>t.Status = Models.TaskStatus.None);
             if (plc.Labels.Where(t => Math.Min(t.ActualWidth, t.ActualLength) < CustomerEnv.SortingMacConfigValue.ShortMinLength ||
                                                                 Math.Max(t.ActualWidth, t.ActualLength) < CustomerEnv.SortingMacConfigValue.LongMinLength).FirstOrDefault() != null)
             {

+ 1 - 1
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingManual.xaml

@@ -173,7 +173,7 @@
                 <WrapPanel x:Name="ManualSettingPanel" HorizontalAlignment="Center"/>
             </GroupBox>
         </Grid>
-        <uct:UctAlarmBar Grid.Row="1" x:Name="AlarmRoller" Grid.ColumnSpan="2"/>
+        <uct:UctAlarmBar Grid.Row="2" x:Name="AlarmRoller" Grid.ColumnSpan="2"/>
         <StackPanel Grid.Column="1" Grid.Row="1" x:Name="OriginSettingSp">
             <StackPanel.Resources>
                 <Style TargetType="wpfcontrol:IconButton">

+ 1 - 1
SCADA_DAQ/Customer/Views/Uct/UctAlarmBar.xaml

@@ -7,7 +7,7 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>
-        <wpfcontrol:SmartTextBlock Grid.Row="2" Text="{Binding AlarmStr}" FontSize="24" Duration="10" Background="Yellow" Foreground="Red" FontWeight="Bold">
+        <wpfcontrol:SmartTextBlock Grid.Row="2"  Text="{Binding AlarmStr}" FontSize="24" Duration="10" Background="Yellow" Foreground="Red" FontWeight="Bold">
             <wpfcontrol:SmartTextBlock.Style>
                 <Style TargetType="wpfcontrol:SmartTextBlock">
                     <Setter Property="Visibility" Value="Collapsed"/>