diff --git a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs index 5cff2a4b..ba2043ee 100644 --- a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs +++ b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs @@ -118,9 +118,7 @@ namespace Aucma.Core.BoxFoam.Business { Thread.Sleep(5000); - test(); - - + // test(); // 获取任务下发plc StartPassDown(); // InStore("B23600083025024860011"); @@ -130,7 +128,7 @@ namespace Aucma.Core.BoxFoam.Business public async void test() { - InStoreFinish("PB01_001"); + // InStoreFinish("PB01_001"); } /// /// 入库出库完成信号定时器 @@ -194,11 +192,12 @@ namespace Aucma.Core.BoxFoam.Business if (taskInfo != null) { - - logHelper.Info($"下发泡后入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}"); + + logHelper.Info($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}"); + LogDelegateEvent?.Invoke($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}"); if (SendFoamTask_InStore(taskInfo)) { - logHelper.Info($"泡后入库任务:{taskInfo.TaskCode};下发成功,等待PLC执行反馈"); + logHelper.Info($"泡前入库任务:{taskInfo.TaskCode};下发成功,等待PLC执行反馈"); semaphore.Wait(); //一直堵塞直到信号量释放 logHelper.Info($"箱壳入库任务:{taskInfo.TaskCode};开始执行"); taskInfo.TaskStatus = 2; @@ -231,8 +230,6 @@ namespace Aucma.Core.BoxFoam.Business logHelper.Info("下发任务异常"); } - - } /// /// 获取待执行的入库任务 @@ -266,6 +263,7 @@ namespace Aucma.Core.BoxFoam.Business try { logHelper.Info($"扫码成功,物料条码:{materialBarCode}"); + LogDelegateEvent?.Invoke($"扫码成功,物料条码:{materialBarCode}"); var taskList = await _realTaskInfoService.QueryAsync(d => d.MaterialCode.Equals(materialBarCode) && d.StoreCode == storeCode); if (taskList.Count() > 0) { @@ -278,6 +276,7 @@ namespace Aucma.Core.BoxFoam.Business if (spaceInfo != null) { logHelper.Info($"匹配货道:{spaceInfo.ToJson()}"); + LogDelegateEvent?.Invoke($"匹配货道:{spaceInfo.ToJson()}"); string message = $"箱体码[{materialBarCode}], 入{spaceInfo.SpaceName},入库中...."; PrintBarCode print = await _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == materialBarCode); @@ -336,12 +335,14 @@ namespace Aucma.Core.BoxFoam.Business if (flag > 0) { logHelper.Info("入库任务创建成功"); + LogDelegateEvent?.Invoke($"[{materialCode}]入库任务创建成功"); RefreshInStoreTaskEvent?.Invoke(realTaskInfo);//刷新datagrid 列表 result = true; } else { logHelper.Info("入库任务创建失败"); + LogDelegateEvent?.Invoke($"[{materialCode}]入库任务创建失败"); result = false; } } @@ -617,6 +618,7 @@ namespace Aucma.Core.BoxFoam.Business /// private void InStoreAnswer(string taskCode) { + LogDelegateEvent?.Invoke($"泡前库应答成功,自动释放信号量,进行下发新任务"); logHelper.Info("泡前库应答成功,自动释放信号量,进行下发新任务"); // InStoreFinish(taskCode); semaphore.Release(); @@ -676,10 +678,13 @@ namespace Aucma.Core.BoxFoam.Business recordInstore.InStoreAmount = 1; recordInstore.InStoreTime = DateTime.Now; recordInstore.BarCodeCode = taskInfo.MaterialCode; - - bool result = await _recordInstoreServices.SaveRecordToDb(recordInstore, taskInfo, spaceInfo, spaceDetail); #endregion - + bool result = await _recordInstoreServices.SaveRecordToDb(recordInstore, taskInfo, spaceInfo, spaceDetail); + if (result) + { + LogDelegateEvent?.Invoke($"入库完成,更新数据库成功"); + } + LogDelegateEvent?.Invoke($"更新数据库异常"); } ////清除任务信息 //await _realTaskInfoService.DeleteTaskInfo(taskCode, storeCode); diff --git a/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs index 8edfb5aa..a894553c 100644 --- a/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/IndexPageViewModel.cs @@ -29,11 +29,13 @@ namespace Aucma.Core.BoxFoam.ViewModels { inStoreBusiness.init(); _recordInstoreServices = App.ServiceProvider.GetService(); - Job_BoxFoamInStoreTask_Quartz.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表 - // Job_TestTask_Quartz.DataGridDelegateEvent += ExecMethod;//刷新日志 - Job_BoxFoamInStoreTask_Quartz.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新 - Job_BoxFoamInStoreTask_Quartz.LogDelegateEvent += PrintMessageToListBox;//入库日志事件 - + //Job_BoxFoamInStoreTask_Quartz.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表 + InStoreBusiness.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表 + // Job_TestTask_Quartz.DataGridDelegateEvent += ExecMethod;//刷新日志 + // Job_BoxFoamInStoreTask_Quartz.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新 + InStoreBusiness.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新 + // Job_BoxFoamInStoreTask_Quartz.LogDelegateEvent += PrintMessageToListBox;//入库日志事件 + InStoreBusiness.LogDelegateEvent += PrintMessageToListBox;//入库日志事件 }