diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
index 8a9a8b7a..93d7a6ce 100644
--- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
+++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
@@ -101,16 +101,16 @@ namespace Aucma.Core.ProductOffLine.Business
#endregion
- public async void test()
+ public void test()
{
-
+
// string result = await _productOffLineServices.QueryChecked("1531000AP0098DCU0481");
// Console.WriteLine(result);
// string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000004899@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
Task.Run(() =>
{
- Thread.Sleep(5000);
+ Thread.Sleep(6000);
MaterialBarScan("32160030000000910780", "192.168.1.19");
// Thread.Sleep(1000);
// MaterialBarScanEvent("33160030000000910780", "192.168.1.20");
@@ -140,9 +140,30 @@ namespace Aucma.Core.ProductOffLine.Business
}
// 2.更新mes数据库
BackResult = updateMesData(TempOffLineInfo1);
- log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
+ // 3.plc放行
+ if (BackResult)
+ {
+ bool plcResult =SendAndWaitSignal(ScannerNo, materialType);
+ if (plcResult)
+ {
+ TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "plc放行成功";
+ TempOffLineInfo1.MsgAlarmFlag = true;
+ //界面刷新
+ TempOffLineInfo1.ProductRefreshFlag = true;
+ }
+ else
+ {
+ TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "plc放行异常";
+ TempOffLineInfo1.MsgAlarmFlag = true;
+ //界面刷新
+ TempOffLineInfo1.ProductRefreshFlag = true;
+ }
+ log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
+ }
+
}
- else
+ // 扫码器2
+ else if (ScannerNo == 2)
{
BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo2); //扫码器2
materialType = TempOffLineInfo2.ProductCode;
@@ -152,26 +173,47 @@ namespace Aucma.Core.ProductOffLine.Business
}
// 2.更新mes数据库
BackResult = updateMesData(TempOffLineInfo2);
- log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
- }
- if (BackResult == true)
- {
- // 先查询分垛方向A或者B
- string direction = getDirectioneEvent?.Invoke(materialType);
- if (direction == "")
+ // 3.plc放行
+ if (BackResult)
{
- //未设置方向处理
- }
- bool plcResult = DownLoadPassFlag(ScannerNo, direction); //下发plc放行信号,分垛AB库
- if (plcResult == false)
- {
- sendPlcError();
+ bool plcResult = SendAndWaitSignal(ScannerNo, materialType);
+ if (plcResult)
+ {
+ TempOffLineInfo2.MsgInfo = TempOffLineInfo2.MsgInfo + "plc放行成功";
+ TempOffLineInfo2.MsgAlarmFlag = true;
+ //界面刷新
+ TempOffLineInfo2.ProductRefreshFlag = true;
+ }
+ else
+ {
+ TempOffLineInfo2.MsgInfo = TempOffLineInfo2.MsgInfo + "plc放行异常";
+ TempOffLineInfo2.MsgAlarmFlag = true;
+ //界面刷新
+ TempOffLineInfo2.ProductRefreshFlag = true;
+ }
+ log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
}
- log.Info("plc放行反馈成功");
- }
+ }
+
}
-
+ ///
+ /// 下发plc放行并等待反馈信号
+ ///
+ private bool SendAndWaitSignal(int ScannerNo, string materialType)
+ {
+ bool plcResult = false;
+ // 先查询分垛方向A或者B
+ string direction = getDirectioneEvent?.Invoke(materialType);
+ if (direction == "")
+ {
+ //未设置方向处理,默认去A
+ direction = "A";
+ }
+ plcResult = DownLoadPassFlag(ScannerNo, direction); //下发plc放行信号,分垛AB库
+ return plcResult;
+ }
+
///
/// 条码验证成功后,更新mes数据库 成品下线表,订单表等等
///
@@ -242,7 +284,7 @@ namespace Aucma.Core.ProductOffLine.Business
{
TempOffLineInfo.QualityResult = "成功";
- Thread.Sleep(10000);
+
TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
@@ -454,7 +496,7 @@ namespace Aucma.Core.ProductOffLine.Business
// 往plc写入放行信号
obj.plc.WriteInt32("D202", 1);
}
- DateTime targetTime = DateTime.Now.AddSeconds(60);
+ DateTime targetTime = DateTime.Now.AddSeconds(5);
// 等待plc反馈信号
while (true)
{
diff --git a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs
index 63add936..8b205496 100644
--- a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs
+++ b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs
@@ -52,21 +52,21 @@ namespace Aucma.Core.ProductOffLine.ViewModels
// 成品下线操作mes数据
private readonly IOffLineInfoServices? _offLineInfoServices = App.ServiceProvider.GetService();
- System.Timers.Timer timer = new System.Timers.Timer(1000 * 1);//界面刷新定时器
+ System.Timers.Timer timer = new System.Timers.Timer(500);//界面刷新定时器
private readonly IBaseBomInfoServices? _baseBomInfoServices;
private OffLineBusiness offLineBusiness = OffLineBusiness.Instance;
private static double aaa = 100.0;
int a = 0;
public IndexPageViewModel()
{
- offLineBusiness.test();
+
_offLineInfoServices = App.ServiceProvider.GetService();
_baseBomInfoServices = App.ServiceProvider.GetService();
InitEveryDayMethod();
- // 刷新界面信息
+ // 刷新界面扫码信息
RefreshPageListen();
LoadData();
-
+ offLineBusiness.test();
}
#region 参数定义
@@ -273,8 +273,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
///
public void RefreshPage(object source, System.Timers.ElapsedEventArgs e)
{
- InitEveryDayMethod();
-
+
if (OffLineBusiness.TempOffLineInfo1.ProductRefreshFlag == true)
{