diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml
index 1fb38dce..c306f333 100644
--- a/Admin.Core.Api/Admin.Core.Model.xml
+++ b/Admin.Core.Api/Admin.Core.Model.xml
@@ -3096,6 +3096,11 @@
打印名称
+
+
+ 是否打印 1=>打印
+
+
订单执行表
diff --git a/Admin.Core.Model/Model_New/PrintSuppleMentBarCode.cs b/Admin.Core.Model/Model_New/PrintSuppleMentBarCode.cs
index f8978cee..871b561a 100644
--- a/Admin.Core.Model/Model_New/PrintSuppleMentBarCode.cs
+++ b/Admin.Core.Model/Model_New/PrintSuppleMentBarCode.cs
@@ -53,5 +53,12 @@ namespace Admin.Core.Model
///
[SugarColumn(ColumnName = "PRINT_NAME")]
public string PrintName { get; set; }
+
+ ///
+ /// 是否打印 1=>打印
+ ///
+ [SugarColumn(ColumnName = "IS_PRINT")]
+ public int IsPrint { get; set; }
+
}
}
diff --git a/Admin.Core.Model/Model_New/ReportQualityInsPection.cs b/Admin.Core.Model/Model_New/ReportQualityInsPection.cs
index 7db11669..08dd1693 100644
--- a/Admin.Core.Model/Model_New/ReportQualityInsPection.cs
+++ b/Admin.Core.Model/Model_New/ReportQualityInsPection.cs
@@ -29,7 +29,7 @@ namespace Admin.Core.Model
///
/// 物料名称
///
- [SugarColumn(ColumnName = "MATERIAL_NAME")]
+ [SugarColumn(ColumnName = "MATERIAL_NAME", ColumnDataType = "NVARCHAR(128)")]
public string MaterialName { get; set; }
///
/// 工序编号
diff --git a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
index 7d0cc976..e2700128 100644
--- a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
+++ b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs
@@ -60,23 +60,12 @@ namespace Aucma.Core.BoxFoam.Business
/// 货到名称
public delegate void RefreshScanMateriaCode(string materialBarCode, string materialCode, string materialName, string spaceName, string msg);
public static event RefreshScanMateriaCode RefreshScanMateriaCodeEvent;
- ///
- /// 初始化入库任务
- ///
- ///
- public delegate void RefreshInStoreTask(RealTaskInfo taskInfos);
- public static event RefreshInStoreTask RefreshInStoreTaskEvent;
- ///
- /// 日志信息刷新
- ///
- ///
- public delegate void RefreshLogMessage(string message);
- public static event RefreshLogMessage RefreshLogMessageEvent;
+
///
/// 入库日志事件
///
///
- public delegate void LogDelegate(string msg);
+ public delegate void LogDelegate(string msg, string color);
public static event LogDelegate LogDelegateEvent;
///
@@ -141,7 +130,7 @@ namespace Aucma.Core.BoxFoam.Business
{
if (string.IsNullOrEmpty(materialBarCode))
{
- LogDelegateEvent?.Invoke("未扫到二维码信息!");
+ LogDelegateEvent?.Invoke("未扫到二维码信息!","Red");
Console.WriteLine($"【{DateTime.Now}】未扫到二维码信息,请重新扫码!");
return;
}
@@ -149,7 +138,7 @@ namespace Aucma.Core.BoxFoam.Business
//创建入库任务
Console.WriteLine($"【{DateTime.Now}】扫码成功,物料条码:{materialBarCode}");
logHelper.Info($"扫码成功,物料条码:{materialBarCode}");
- LogDelegateEvent?.Invoke($"扫码成功,物料条码:{materialBarCode}");
+ LogDelegateEvent?.Invoke($"扫码成功,物料条码:{materialBarCode}", "White");
#region 执行任务
string materialCode = SubString(materialBarCode);
@@ -163,17 +152,15 @@ namespace Aucma.Core.BoxFoam.Business
flag = false;
try
{
- LogDelegateEvent?.Invoke($"获取物料编码:{materialCode}");
- Console.WriteLine($"获取物料编码:{materialCode}");
+ LogDelegateEvent?.Invoke($"获取物料编码:{materialCode}", "White");
bool result= obj.plc.WriteString("DB200.132", materialCode);//写入物料号
- Console.WriteLine($"写入物料编码:{materialCode}");
if (result)
{
Thread.Sleep(2500);
int space = obj.plc.ReadInt16("DB200.438");//读取货道号,大约1.5s 可以获取
Console.WriteLine($"物料MES码:{materialBarCode},》入库货道:{space}");
logHelper.Info($"物料MES码:{materialBarCode},》入库货道:{space}");
- LogDelegateEvent?.Invoke($"物料MES码:{materialBarCode},》物料码:{materialCode}");
+ LogDelegateEvent?.Invoke($"物料MES码:{materialBarCode},》物料码:{materialCode}", "White");
//更新货道入库
await EnterStore(materialBarCode, space);
//更新过点数
@@ -189,7 +176,7 @@ namespace Aucma.Core.BoxFoam.Business
catch (Exception ex)
{
logHelper.Error($"入库业务异常:{ex}");
- LogDelegateEvent?.Invoke($"入库业务异常:{ex}");
+ LogDelegateEvent?.Invoke($"入库业务异常:{ex}", "Red");
Console.WriteLine($"入库业务异常:{ex.Message}");
}
finally
@@ -313,6 +300,7 @@ namespace Aucma.Core.BoxFoam.Business
public async Task EnterStore(string barCode,int space)
{
+ //有获取不到情况,需要一直获取
string spaceCode = string.Empty;
switch (space)
{
@@ -360,12 +348,12 @@ namespace Aucma.Core.BoxFoam.Business
{
string message = $"物料[{material.MaterialName}],入库成功!";
RefreshScanMateriaCodeEvent?.Invoke(material.MaterialCode, barCode, material.MaterialName, spaceCode, message); //刷新界面扫码信息
- LogDelegateEvent?.Invoke($"物料[{material.MaterialName}], 入库成功!");
+ LogDelegateEvent?.Invoke($"物料[{material.MaterialName}], 入库成功!","White");
RefreshDataGridDelegateEvent?.Invoke();
}
else
{
- LogDelegateEvent?.Invoke($"物料[{material.MaterialName}], 入库失败,任务回滚!");
+ LogDelegateEvent?.Invoke($"物料[{material.MaterialName}], 入库失败,任务回滚!", "Red");
logHelper.Error($"物料[{material.MaterialName}], 入库失败,任务回滚!");
}
}
diff --git a/Aucma.Core.BoxFoam/Models/ListBoxDataView.cs b/Aucma.Core.BoxFoam/Models/ListBoxDataView.cs
new file mode 100644
index 00000000..2c0f7013
--- /dev/null
+++ b/Aucma.Core.BoxFoam/Models/ListBoxDataView.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Aucma.Core.BoxFoam.Models
+{
+ public class ListBoxDataView
+ {
+ ///
+ /// 颜色
+ ///
+ public string Color { get; set; }
+ ///
+ /// 内容
+ ///
+ public string Content { get; set; }
+ }
+}
diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
index 89170185..bfd554c9 100644
--- a/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
+++ b/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs
@@ -218,7 +218,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
try
{
- System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
+ System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
LastShotRecordDataGrid.Clear();
diff --git a/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs
index f993e405..a286c410 100644
--- a/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs
+++ b/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs
@@ -14,6 +14,7 @@ using System.Threading;
using Aucma.Core.BoxFoam.Business;
using Admin.Core.Model;
using System.Collections.Generic;
+using Aucma.Core.BoxFoam.Models;
/*
* 首页信息
*/
@@ -21,8 +22,6 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
public partial class IndexPageViewModel : ObservableObject
{
-
-
private ObservableCollection listItems = new ObservableCollection();
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
public readonly IRecordInStoreServices? _recordInstoreServices;
@@ -160,14 +159,18 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// listBox绑定日志
///
///
- private void PrintMessageToListBox(string message)
+ private void PrintMessageToListBox(string message, string color)
{
try
{
- listItems.Add($"{DateTime.Now.ToString("HH:mm:ss")}==>{message}");
-
- LogInfoListBox = listItems.OrderByDescending(x => x);
-
+ System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
+ {
+ string content = $"{DateTime.Now.ToString("HH:mm:ss")}==>{message}";
+ ListBoxDataView view = new ListBoxDataView { Content = content, Color = color };
+ //listItems.Add(view);
+ listItems.Insert(0, view);
+ LogInfoListBox = listItems;
+ }));
}
catch (Exception ex)
{
diff --git a/Aucma.Core.BoxFoam/Views/FoamMonitorPageView.xaml b/Aucma.Core.BoxFoam/Views/FoamMonitorPageView.xaml
index 64ccd279..c50a5103 100644
--- a/Aucma.Core.BoxFoam/Views/FoamMonitorPageView.xaml
+++ b/Aucma.Core.BoxFoam/Views/FoamMonitorPageView.xaml
@@ -62,10 +62,10 @@
-
-
+
-
+
@@ -156,13 +156,13 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -234,97 +234,97 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/Aucma.Core.BoxFoam/Views/IndexPageView.xaml b/Aucma.Core.BoxFoam/Views/IndexPageView.xaml
index 86fc6c4c..5936a662 100644
--- a/Aucma.Core.BoxFoam/Views/IndexPageView.xaml
+++ b/Aucma.Core.BoxFoam/Views/IndexPageView.xaml
@@ -159,9 +159,27 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Aucma.Core.BoxFoam/appsettings.json b/Aucma.Core.BoxFoam/appsettings.json
index b7cede78..3097023e 100644
--- a/Aucma.Core.BoxFoam/appsettings.json
+++ b/Aucma.Core.BoxFoam/appsettings.json
@@ -217,7 +217,7 @@
"EquipName": "foamLine1Plc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "10.10.93.21",
+ "IP":"10.10.93.21",
"Port": 102
},
{
@@ -225,7 +225,7 @@
"EquipName": "foamLine2Plc",
"PlcType": "Siemens",
"Enabled": true,
- "IP": "10.10.93.1",
+ "IP":"10.10.93.1",
"Port": 102
},
{
@@ -234,7 +234,6 @@
"PlcType": "Siemens",
"Enabled": true,
"IP": "10.10.93.180",
- //"IP": "10.10.93.180",
"Port": 102
}
],
diff --git a/Aucma.Core.PrintTo/Report/MaterialBar.frx b/Aucma.Core.PrintTo/Report/MaterialBar.frx
index 8ea02772..b352b352 100644
--- a/Aucma.Core.PrintTo/Report/MaterialBar.frx
+++ b/Aucma.Core.PrintTo/Report/MaterialBar.frx
@@ -1,7 +1,7 @@
-
+
-
+
@@ -31,10 +31,10 @@
-
-
-
-
+
+
+
+
diff --git a/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs b/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs
index 5f10a40f..23881587 100644
--- a/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs
+++ b/Aucma.Core.PrintTo/ViewModels/IndexPageViewModel.cs
@@ -3,13 +3,11 @@ using Admin.Core.Model;
using Admin.Core.Model.ViewModels;
using Aucma.Core.PrintTo.Models;
using Aucma.Core.PrintTo.Views;
-using Castle.Core.Internal;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using log4net;
using Microsoft.Extensions.DependencyInjection;
-using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -165,11 +163,11 @@ namespace Aucma.Core.PrintTo.ViewModels
/// 打印
///
[RelayCommand]
- private async void Print(string obj)
+ private async void Print(string obj)
{
if (string.IsNullOrEmpty(obj))
{
- MessageBox.Show("请选中需要打印的产品!","系统提醒");
+ MessageBox.Show("请选中需要打印的产品!", "系统提醒");
return;
}
@@ -178,22 +176,24 @@ namespace Aucma.Core.PrintTo.ViewModels
MessageBox.Show("打印名称不可为空!", "系统提醒");
return;
}
- if (SelectedCells.PlanAmount == 0)
+ if (PrintAmount == 0)
{
MessageBox.Show("请输入打印数量!", "系统提醒");
return;
}
+
+ if (printType == 0)
+ {
+ MessageBox.Show("请选择打印类型!", "系统提醒");
+ return;
+ }
+
+
//if (SelectedCells.PlanAmount > PrintAmount)
//{
// MessageBox.Show("打印数量不能高于计划数量!", "系统提醒");
// return;
//}
- if (printType==0)
- {
- MessageBox.Show("请选择打印类型!", "系统提醒");
- return;
- }
-
try
{
@@ -214,22 +214,19 @@ namespace Aucma.Core.PrintTo.ViewModels
{
type = 1;
}
- var list= await _printBarCodeServices.QueryAsync(d => d.OrderCode == order_code&&d.PrintBarType== printType);
-
- if (list!=null||list.Count!= 0)
+ //查询当前数据库当前已经打印的数量
+ var printBarCodeList = await _printBarCodeServices.QueryAsync(d => d.OrderCode == order_code && d.PrintBarType == type);
+ if (printBarCodeList != null && printBarCodeList.Count != 0)
{
- int num= list.Count;//已经打印数量
- int residue= SelectedCells.PlanAmount - num;//剩余打印数量
- //if (residue > standard_amount)
- //{
- // MessageBox.Show("订单数量已经打印到规定订单数量!", "系统提醒");
- // return;
- //}
- //if ((residue- standard_amount)< 1)
- //{
- // MessageBox.Show("订单数量已经打印到规定订单数量!", "系统提醒");
- // return;
- //}
+ //计算剩余数量
+ int num = printBarCodeList.Count;//已经打印数量
+ int residue = SelectedCells.PlanAmount - num;//剩余打印数量
+ //判断当前打印数量是否在剩余数据之内
+ if ( residue< standard_amount|| residue < standard_amount)
+ {
+ MessageBox.Show("打印订单数量超过规定数量!", "系统提醒");
+ return;
+ }
}
//更新打印名称
@@ -239,7 +236,7 @@ namespace Aucma.Core.PrintTo.ViewModels
baseOrder.PrintName = printName;
_ = _baseOrderInfoServices.UpdatePrintName(baseOrder).Result;
}
- PrintToDevView printToDev = new PrintToDevView(order_code,product_code, product_name, standard_amount, printName,printType);
+ PrintToDevView printToDev = new PrintToDevView(order_code, product_code, product_name, standard_amount, printName, printType);
printToDev.ShowDialog();
}
catch (Exception ex)
diff --git a/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs b/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs
index 5bc40c99..598d0468 100644
--- a/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs
+++ b/Aucma.Core.PrintTo/ViewModels/SupplementPrintPageViewModel.cs
@@ -63,10 +63,11 @@ namespace Aucma.Core.PrintTo.ViewModels
///
/// 打印
///
+ /// 主键
[RelayCommand]
private async void Print(string obj)
{
- if (string.IsNullOrEmpty(obj))
+ if (obj== "0")
{
MessageBox.Show("请选中要补打的条码!", "系统提醒");
return;
@@ -79,7 +80,8 @@ namespace Aucma.Core.PrintTo.ViewModels
var baseOrderInfo=await _baseOrderInfoServices.FirstAsync(d => d.OrderCode == orderCode);
if (baseOrderInfo!=null)
{
- SupplementView printToDev = new SupplementView(orderCode, materialCode, materialName, printName, barCode);
+ int Id = Convert.ToInt32(obj);
+ SupplementView printToDev = new SupplementView(Id);
printToDev.ShowDialog();
}
@@ -149,6 +151,7 @@ namespace Aucma.Core.PrintTo.ViewModels
{
Datalist.Add(new BarCodeModel()
{
+ ID = item.ObjId,
OrderCode = item.OrderCode,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
diff --git a/Aucma.Core.PrintTo/ViewModels/SupplementViewModel.cs b/Aucma.Core.PrintTo/ViewModels/SupplementViewModel.cs
index 328bbddc..6998aa67 100644
--- a/Aucma.Core.PrintTo/ViewModels/SupplementViewModel.cs
+++ b/Aucma.Core.PrintTo/ViewModels/SupplementViewModel.cs
@@ -21,32 +21,41 @@ using System.Windows;
* */
namespace Aucma.Core.PrintTo.ViewModels
{
- public class SupplementViewModel : ObservableObject
+ public partial class SupplementViewModel : ObservableObject
{
private readonly IPrintSuppleMentBarCodeServices _printSuppleMentBarCodeServices;
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SupplementViewModel));
private PrintState printState { get; set; } = PrintState.Idle;//打印状态
-
- public SupplementViewModel(string orderCode,string materialCode,string materialName,string printName, string barCode)
+ PrintSuppleMentBarCode printSuppleMentBarCode = null;
+ ///
+ /// 构造函数
+ ///
+ /// 补打表主键
+ public SupplementViewModel(int Id)
{
_printSuppleMentBarCodeServices = App.ServiceProvider.GetService();
- _orderCode = orderCode;
- ProductCode = materialCode;
- ProductName = materialName;
- _barCode= barCode;
- PrintAmount = 1;
- PrintName = printName;
- Progress = 0;
- MaxProgress = 1;//最大数
- State = "Green";
- ErrorNum = 0;//异常
- SuspendEnabled = "False";//暂停打印
- OperateEnabled = "True";//打印
+ printSuppleMentBarCode = _printSuppleMentBarCodeServices.FirstAsync(d => d.ObjId == Id).Result;
+ if (printSuppleMentBarCode!=null)
+ {
+ _orderCode = printSuppleMentBarCode.OrderCode;
+ ProductCode = printSuppleMentBarCode.MaterialCode;
+ ProductName = printSuppleMentBarCode.MaterialName;
+ _barCode = printSuppleMentBarCode.MaterialBarCode;
+ PrintAmount = 1;
+ PrintName = printSuppleMentBarCode.PrintName;
+ Progress = 0;
+ MaxProgress = 1;//最大数
+ State = "Green";
+ ErrorNum = 0;//异常
+ SuspendEnabled = "False";//暂停打印
+ OperateEnabled = "True";//打印
+ }
+
}
#region 打印
-
- public void Print()
+ [RelayCommand]
+ public async Task StartOperate()
{
try
{
@@ -72,7 +81,10 @@ namespace Aucma.Core.PrintTo.ViewModels
barReport.Print();
#endregion
-
+ //打印完成 不可以再次打印
+ printSuppleMentBarCode.IsPrint = 1;
+ printSuppleMentBarCode.PrintTime = DateTime.Now;
+ await _printSuppleMentBarCodeServices.UpdateAsync(printSuppleMentBarCode);
//打印完成
SetCompletetd();
}
diff --git a/Aucma.Core.PrintTo/Views/IndexPageView.xaml b/Aucma.Core.PrintTo/Views/IndexPageView.xaml
index 176ee01d..8014b7d2 100644
--- a/Aucma.Core.PrintTo/Views/IndexPageView.xaml
+++ b/Aucma.Core.PrintTo/Views/IndexPageView.xaml
@@ -235,7 +235,7 @@
-
+
diff --git a/Aucma.Core.PrintTo/Views/SupplementPrintPageView.xaml b/Aucma.Core.PrintTo/Views/SupplementPrintPageView.xaml
index 35730079..aed0de17 100644
--- a/Aucma.Core.PrintTo/Views/SupplementPrintPageView.xaml
+++ b/Aucma.Core.PrintTo/Views/SupplementPrintPageView.xaml
@@ -104,6 +104,7 @@
+
@@ -125,6 +126,7 @@
+
@@ -153,10 +155,14 @@
-
+
+
+
+
+
+ Content="打印" Margin="0 0" Height="40" Command="{Binding PrintCommand}" CommandParameter="{Binding ElementName=PrimaryKey,Path=Text}"/>
diff --git a/Aucma.Core.PrintTo/Views/SupplementView.xaml.cs b/Aucma.Core.PrintTo/Views/SupplementView.xaml.cs
index 1c7639ac..39da1ad1 100644
--- a/Aucma.Core.PrintTo/Views/SupplementView.xaml.cs
+++ b/Aucma.Core.PrintTo/Views/SupplementView.xaml.cs
@@ -12,15 +12,11 @@ namespace Aucma.Core.PrintTo.Views
///
/// 构造函数
///
- /// 产品编码
- /// 物料编码
- /// 产品名称
- /// 打印数量
- ///
- public SupplementView(string orderCode, string materialCode, string materialName, string printName, string barCode)
+ /// 主键
+ public SupplementView(int Id)
{
InitializeComponent();
- this.DataContext = new SupplementViewModel(orderCode,materialCode,materialName,printName,barCode);
+ this.DataContext = new SupplementViewModel(Id);
}
#endregion
diff --git a/Aucma.Core.Tasks/AucamTaskService.cs b/Aucma.Core.Tasks/AucamTaskService.cs
index 1efd6196..64b8edfe 100644
--- a/Aucma.Core.Tasks/AucamTaskService.cs
+++ b/Aucma.Core.Tasks/AucamTaskService.cs
@@ -75,7 +75,6 @@ namespace Aucma.Core.Tasks
try
{
int signal = obj.plc.ReadInt16("DB55.84.0");
- Console.WriteLine($"【{DateTime.Now}】》当前灌注采集信号:{signal}");
if (signal == 0)
{
Thread.Sleep(1000);
@@ -92,58 +91,58 @@ namespace Aucma.Core.Tasks
continue;
}
Console.WriteLine($"【{DateTime.Now}】》灌注数据条码:{record.PerfusionBoxCode}》灌注结果:{record.PerfusionResult}》设定灌注量:{record.PerfusionSetVolume}》灌注量:{record.PerfusionActualVolume}");
- //var tempRecord = _perfusionRecordServices.FirstAsync(d => d.PerfusionBoxCode.Equals(record.PerfusionBoxCode) && d.PerfusionResult == record.PerfusionResult).Result;
- continue;
- //if (tempRecord != null)
- //{
- // Console.WriteLine($"【{DateTime.Now}】》灌注数据条码:[{record.PerfusionBoxCode}],灌注结果:[{record.PerfusionResult}],已存在系统中");
- // bool fw=obj.plc.WriteInt16("DB55.84.0", "0");//存盘成功写入bool
- // Console.WriteLine($"【{DateTime.Now}】》写入复位信号{fw}");
- // Thread.Sleep(1000);
- // continue;
- //}
- //#region 更新设备状态
- //Perfusion_DeviceStatus device = _perfusionDeviceStatusServices.FirstAsync().Result;
- //if (device == null)
- //{
- // _ = _perfusionDeviceStatusServices.AddAsync(perfusion_DeviceStatus).Result;
- //}
- //else
- //{
- // device.PerfusionStatus = perfusion_DeviceStatus.PerfusionStatus;
- // var rsult = _perfusionDeviceStatusServices.UpdateAsync(device).Result;
- //}
- //#endregion
-
- //#region 更新报警信息
- //if (perfusion_Alarm.PerfusionStatus > 0)
- //{
- // int a = _perfusionAlarmServices.AddAsync(perfusion_Alarm).Result;
- //}
- //#endregion
-
- //record.IsFlag = 0;
- ////充注结束
- //int result = _perfusionRecordServices.AddAsync(record).Result;
- //if (result == 0)
- //{
- // //添加过点数
- // Console.WriteLine($"【{DateTime.Now}】》灌注结果:{record.PerfusionResult}");
- // if (record.PerfusionResult == 8)
- // {
- // var insert= InsertToCompleteAndCheck(record);
- // if (insert)
- // {
- // Console.WriteLine($"【{DateTime.Now}】》保存过点数成功!");
- // }
- // }
- // ToMes();//灌注
- // Console.WriteLine(record.ToJson());
- //}
-
- //bool r = obj.plc.WriteInt16("DB55.84.0", "0");//存盘成功写入bool
- //Console.WriteLine($"【{DateTime.Now}】》写入复位信号{r}");
- //Console.WriteLine($"【{DateTime.Now}】》灌注数据采集结束");
+ var tempRecord = _perfusionRecordServices.FirstAsync(d => d.PerfusionBoxCode.Equals(record.PerfusionBoxCode) && d.PerfusionResult == record.PerfusionResult).Result;
+
+ if (tempRecord != null)
+ {
+ Console.WriteLine($"【{DateTime.Now}】》灌注数据条码:[{record.PerfusionBoxCode}],灌注结果:[{record.PerfusionResult}],已存在系统中");
+ bool fw = obj.plc.WriteInt16("DB55.84.0", "0");//存盘成功写入bool
+ Console.WriteLine($"【{DateTime.Now}】》写入复位信号{fw}");
+ Thread.Sleep(1000);
+ continue;
+ }
+ #region 更新设备状态
+ Perfusion_DeviceStatus device = _perfusionDeviceStatusServices.FirstAsync().Result;
+ if (device == null)
+ {
+ _ = _perfusionDeviceStatusServices.AddAsync(perfusion_DeviceStatus).Result;
+ }
+ else
+ {
+ device.PerfusionStatus = perfusion_DeviceStatus.PerfusionStatus;
+ var rsult = _perfusionDeviceStatusServices.UpdateAsync(device).Result;
+ }
+ #endregion
+
+ #region 更新报警信息
+ if (perfusion_Alarm.PerfusionStatus > 0)
+ {
+ int a = _perfusionAlarmServices.AddAsync(perfusion_Alarm).Result;
+ }
+ #endregion
+
+ record.IsFlag = 0;
+ //充注结束
+ int result = _perfusionRecordServices.AddAsync(record).Result;
+ if (result == 0)
+ {
+ //添加过点数
+ Console.WriteLine($"【{DateTime.Now}】》灌注结果:{record.PerfusionResult}");
+ if (record.PerfusionResult == 8)
+ {
+ var insert = InsertToCompleteAndCheck(record);
+ if (insert)
+ {
+ Console.WriteLine($"【{DateTime.Now}】》保存过点数成功!");
+ }
+ }
+ ToMes();//灌注
+ Console.WriteLine(record.ToJson());
+ }
+
+ bool r = obj.plc.WriteInt16("DB55.84.0", "0");//存盘成功写入bool
+ Console.WriteLine($"【{DateTime.Now}】》写入复位信号为{r}");
+ Console.WriteLine($"【{DateTime.Now}】》灌注数据采集结束");
}
catch (Exception ex)
{
@@ -405,10 +404,12 @@ namespace Aucma.Core.Tasks
if (check.TreatmentMeasure == "3")
{
report.FinishTime = null;
+ report.UpdatedTime = null;
}
else
{
report.FinishTime = check.FinishTime;
+ report.UpdatedTime = null;
}
report.BarCode = check.BarCode;