diff --git a/SlnMesnac.Business/ProdMgmtBusiness.cs b/SlnMesnac.Business/ProdMgmtBusiness.cs index f3ba5ea..537f9ca 100644 --- a/SlnMesnac.Business/ProdMgmtBusiness.cs +++ b/SlnMesnac.Business/ProdMgmtBusiness.cs @@ -85,7 +85,7 @@ namespace SlnMesnac.Business _configInfoBusiness = configInfoBusiness; - // TestTran(); + TestTran(); } @@ -93,23 +93,24 @@ namespace SlnMesnac.Business public void TestTran() { - try - { - sqlSugarClient.AsTenant().BeginTran(); - BaseRealTask localPlan = _baseRealTaskService.GetExeTask(); - localPlan.Status = 2; - sqlSugarClient.AsTenant().GetConnection("local").Updateable(localPlan).ExecuteCommand(); - GenerateBarcode(40); - // throw new Exception("事务测试"); - sqlSugarClient.AsTenant().CommitTran(); - Console.WriteLine("提交事务"); - - } - catch (Exception ex) - { - sqlSugarClient.AsTenant().RollbackTran(); - Console.WriteLine(ex.Message); - } + + //try + //{ + // sqlSugarClient.AsTenant().BeginTran(); + // BaseRealTask localPlan = _baseRealTaskService.GetExeTask(); + // localPlan.Status = 2; + // sqlSugarClient.AsTenant().GetConnection("local").Updateable(localPlan).ExecuteCommand(); + // GenerateBarcode(40); + // // throw new Exception("事务测试"); + // sqlSugarClient.AsTenant().CommitTran(); + // Console.WriteLine("提交事务"); + + //} + //catch (Exception ex) + //{ + // sqlSugarClient.AsTenant().RollbackTran(); + // Console.WriteLine(ex.Message); + //} } private async void testRFID() @@ -211,6 +212,7 @@ namespace SlnMesnac.Business continue; } + BaseRealTask task = _baseRealTaskService.GetExeTask(); if (task != null) { @@ -219,6 +221,7 @@ namespace SlnMesnac.Business Thread.Sleep(5000); continue; } + if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("设备叫料"))) { @@ -333,7 +336,6 @@ namespace SlnMesnac.Business continue; } - //TODO根据本地叫料计划查询对应的mes计划,完成 prodPlan = _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto); @@ -389,9 +391,18 @@ namespace SlnMesnac.Business //1.完成本地计划 if (localPlan != null) { - localPlan.Status = 2; - localPlan.UpdateTime = DateTime.Now; - sqlSugarClient.AsTenant().GetConnection("local").Updateable(localPlan).ExecuteCommand(); + List localList = _baseRealTaskService.Query(x => x.Status != 2); + foreach (var item in localList) + { + item.Status = 2; + item.UpdateTime = DateTime.Now; + } + sqlSugarClient.AsTenant().GetConnection("local").Updateable(localList).ExecuteCommand(); + //localPlan.Status = 2; + //localPlan.UpdateTime = DateTime.Now; + //sqlSugarClient.AsTenant().GetConnection("local").Updateable(localPlan).ExecuteCommand(); + + } //2.生成小包条码 GenerateBarcode(40); diff --git a/SlnMesnac.Model/domain/WcsAgvStatus.cs b/SlnMesnac.Model/domain/WcsAgvStatus.cs index 448d0da..d92f71d 100644 --- a/SlnMesnac.Model/domain/WcsAgvStatus.cs +++ b/SlnMesnac.Model/domain/WcsAgvStatus.cs @@ -31,6 +31,7 @@ namespace SlnMesnac.Model.domain /// [SugarColumn(ColumnName = "online")] public string Online { get; set; } + /// /// 路线 diff --git a/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs b/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs index daf7696..a87023f 100644 --- a/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/AgvAndTaskViewModel.cs @@ -121,6 +121,7 @@ namespace SlnMesnac.WPF.ViewModel WcsAgvStatusDataGrid.Clear(); foreach (var agv in agvList) { + agv.Online = agv.Online=="true"? "在线": "离线"; WcsAgvStatusDataGrid.Add(agv); } }));