From 44e64eaf52d46e64db5e4a5e6504844358fbb64b Mon Sep 17 00:00:00 2001 From: wenjy Date: Sat, 18 Jun 2022 17:46:30 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E8=AE=A1=E5=88=92=E4=B8=8B?= =?UTF-8?q?=E4=BC=A0=E5=AE=8C=E6=88=90=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mesnac.Action.ChemicalWeighing.csproj | 14 ++--- .../Product/PptPlan/PlanDownloadAction.cs | 31 +++++++++- .../Product/PptPlan/PlanHelper.cs | 62 ++++++++++--------- Main/MCEdit/MCEdit.csproj | 11 ++-- Main/MCRun/MCRun.csproj | 2 +- SlnMix.VS2013.sln | 3 + 6 files changed, 81 insertions(+), 42 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index fdccc4f..d7dd97b 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -30,6 +30,9 @@ prompt 4 + + Always + False @@ -119,10 +122,6 @@ False ..\..\Mesnac.ActionService.dll - - False - ..\..\..\Main\Mesnac.Basic\bin\Debug\Mesnac.Basic.dll - False ..\..\..\Libraries\Mesnac.Codd.dll @@ -143,9 +142,6 @@ False ..\..\..\PlugInPlatform\Mesnac.Gui.dll - - ..\..\..\dll\Mesnac.Gui.Common.dll - False ..\..\..\Main\Mensac.Gui.Run.Global\bin\Debug\Mesnac.Gui.Run.Global.dll @@ -464,6 +460,10 @@ {f022c0e6-2819-4fb1-bb86-0f389f061a44} Mesnac.Controls.Default + + {28acacf1-9936-4e97-a866-f84366ec5286} + Mesnac.Basic + diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs index e13c676..4c75d5e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs @@ -65,16 +65,43 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan string reciprId = clientGridView.SelectedRows[0].Cells["recipe_id"].Value as string; writeToPlc(reciprId, this.selectedPlanId); - //判断下传是否成功 - //下传成功后下传RpFinished信号 + if (reciprId == readRecipeId()) + { + ICSharpCode.Core.LoggingService.Info("{生产计划-计划下传} 计划下传成功..."); + //下传成功后下传RpFinished信号 + } + else + { + MessageBox.Show("计划下传失败!!!"); + } //开启线程读取计划执行状态 //执行完成后判断下一计划执行方式,自动方式则继续执行下发流程 } + public string readRecipeId() + { + bool readResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_RecipeCode, out int[] res); + + string readRecipeId = ""; + + if (res.Length > 0) + { + for (int i = 0; i < res.Length; i++) + { + if (res[i] > 0) + { + readRecipeId = readRecipeId + res[i]; + } + } + } + + return readRecipeId; + } + /// /// 将配方数据写入PLC地址 /// diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs index d026976..8c9ec60 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs @@ -1447,7 +1447,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan dbHelper.CommandType = CommandType.Text; string strSql = @"select row_number() over (order by create_Time) as index_Id ,uid, plan_Id, recipe_Id, recipe_Name, plan_Team, plan_Amount, real_Amount, case run_Type when '0' then '自动运行' else '手动运行' end as 'run_Type', - case run_Type when '0' then '待执行' else '执行中' end as 'plan_State', + case plan_State when '0' then '待执行' else '执行中' end as 'plan_State', plan_beginTime, plan_endTime, create_By, create_Time, update_By, update_Time,plan_order from Base_PlanInfo order by plan_order asc"; dbHelper.CommandText = strSql; @@ -2707,39 +2707,45 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan /// 返回新加计划的计划号 public static string SaveBasePlanInfo(Base_PlanInfo base_PlanInfo) { - DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); - if (dbHelper == null) + try { - throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); - } - dbHelper.ClearParameter(); - dbHelper.CommandType = CommandType.Text; - - //添加计划的SQL语句 - string strSql3 = @"insert into Base_PlanInfo (uid, plan_Id, recipe_Id, recipe_Name, plan_Team, plan_Amount, run_Type, plan_State, plan_beginTime, + DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); + if (dbHelper == null) + { + throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); + } + dbHelper.ClearParameter(); + dbHelper.CommandType = CommandType.Text; + + //添加计划的SQL语句 + string strSql3 = @"insert into Base_PlanInfo (uid, plan_Id, recipe_Id, recipe_Name, plan_Team, plan_Amount, run_Type, plan_State, plan_beginTime, grid_Amount,line_Amount,car_Amount,create_By, create_Time,plan_order) VALUES (@uid, @plan_Id, @recipe_Id, @recipe_Name, @plan_Team, - @plan_Amount, @run_Type, @plan_State, @plan_beginTime,@grid_Amount,@line_Amount,@car_Amount @create_By, @create_Time,@plan_order)"; - dbHelper.CommandText = strSql3; + @plan_Amount, @run_Type, @plan_State, @plan_beginTime,@grid_Amount,@line_Amount,@car_Amount,@create_By, @create_Time,@plan_order)"; + dbHelper.CommandText = strSql3; - dbHelper.AddParameter("@uid", base_PlanInfo.uid); - dbHelper.AddParameter("@plan_Id", base_PlanInfo.plan_Id); - dbHelper.AddParameter("@recipe_Id", base_PlanInfo.recipe_Id); - dbHelper.AddParameter("@recipe_Name", base_PlanInfo.recipe_Name); - dbHelper.AddParameter("@plan_Team", base_PlanInfo.plan_Team); - dbHelper.AddParameter("@plan_Amount", base_PlanInfo.plan_Amount); - dbHelper.AddParameter("@run_Type", base_PlanInfo.run_Type); - dbHelper.AddParameter("@plan_State", 0); - dbHelper.AddParameter("@plan_beginTime", base_PlanInfo.plan_beginTime); + dbHelper.AddParameter("@uid", base_PlanInfo.uid); + dbHelper.AddParameter("@plan_Id", base_PlanInfo.plan_Id); + dbHelper.AddParameter("@recipe_Id", base_PlanInfo.recipe_Id); + dbHelper.AddParameter("@recipe_Name", base_PlanInfo.recipe_Name); + dbHelper.AddParameter("@plan_Team", base_PlanInfo.plan_Team); + dbHelper.AddParameter("@plan_Amount", base_PlanInfo.plan_Amount); + dbHelper.AddParameter("@run_Type", base_PlanInfo.run_Type); + dbHelper.AddParameter("@plan_State", 0); + dbHelper.AddParameter("@plan_beginTime", base_PlanInfo.plan_beginTime); - dbHelper.AddParameter("@car_Amount", base_PlanInfo.car_Amount); - dbHelper.AddParameter("@grid_Amount", base_PlanInfo.grid_Amount); - dbHelper.AddParameter("@line_Amount", base_PlanInfo.line_Amount); + dbHelper.AddParameter("@car_Amount", base_PlanInfo.car_Amount); + dbHelper.AddParameter("@grid_Amount", base_PlanInfo.grid_Amount); + dbHelper.AddParameter("@line_Amount", base_PlanInfo.line_Amount); - dbHelper.AddParameter("@create_By", base_PlanInfo.create_By); - dbHelper.AddParameter("@create_Time", base_PlanInfo.create_Time); - dbHelper.AddParameter("@plan_order", base_PlanInfo.plan_order); + dbHelper.AddParameter("@create_By", base_PlanInfo.create_By); + dbHelper.AddParameter("@create_Time", base_PlanInfo.create_Time); + dbHelper.AddParameter("@plan_order", base_PlanInfo.plan_order); - dbHelper.ExecuteNonQuery(); + dbHelper.ExecuteNonQuery(); + }catch(Exception e) + { + ICSharpCode.Core.LoggingService.Error("当班计划—添加计划失败"+e.Message); + } return base_PlanInfo.plan_Id; } diff --git a/Main/MCEdit/MCEdit.csproj b/Main/MCEdit/MCEdit.csproj index 7a43171..d16ebfd 100644 --- a/Main/MCEdit/MCEdit.csproj +++ b/Main/MCEdit/MCEdit.csproj @@ -39,7 +39,7 @@ true - AnyCPU + x86 true full false @@ -67,6 +67,9 @@ + + OnBuildSuccess + False @@ -662,7 +665,9 @@ Designer - + + Designer + @@ -1035,8 +1040,6 @@ XCOPY "$(SolutionDir)bin\*.*" /S/Y "$(TargetDir)" XCOPY "$(SolutionDir)packages\*.*" /S/Y "$(TargetDir)" -XCOPY "$(SolutionDir)Main\MCEdit\Data\EventConfig\*.*" /S/Y "$(TargetDir)Data\EventConfig\" -XCOPY "$(SolutionDir)Main\MCEdit\Data\MCProject\*.*" /S/Y "$(TargetDir)Data\MCProject\" XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentProperty.xml" /S/Y "$(TargetDir)Data\" XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentProperty.en-US.xml" /S/Y "$(TargetDir)Data\" XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentAction.xml" /S/Y "$(TargetDir)Data\" diff --git a/Main/MCRun/MCRun.csproj b/Main/MCRun/MCRun.csproj index 262620b..eddd546 100644 --- a/Main/MCRun/MCRun.csproj +++ b/Main/MCRun/MCRun.csproj @@ -241,7 +241,7 @@ Mesnac.Controls.ChemicalWeighing - {F022C0E6-2819-4FB1-BB86-0F389F061A44} + {f022c0e6-2819-4fb1-bb86-0f389f061a44} Mesnac.Controls.Default diff --git a/SlnMix.VS2013.sln b/SlnMix.VS2013.sln index 1b252ec..5a7ca67 100644 --- a/SlnMix.VS2013.sln +++ b/SlnMix.VS2013.sln @@ -119,6 +119,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCEdit", "Main\MCEdit\MCEdit.csproj", "{0C653BC3-0016-4CC8-BD75-3F961FED1FBC}" ProjectSection(ProjectDependencies) = postProject {B9B99759-8B95-4078-A5E9-A63E0E48384C} = {B9B99759-8B95-4078-A5E9-A63E0E48384C} + {90CC2D8A-DEC5-4D2A-82C9-F7A033060DC1} = {90CC2D8A-DEC5-4D2A-82C9-F7A033060DC1} + {6A2190C6-B530-4D5B-BD34-29EFB0431F67} = {6A2190C6-B530-4D5B-BD34-29EFB0431F67} + {E7FE3BD9-0D1D-497B-AA59-CE46159CEFBC} = {E7FE3BD9-0D1D-497B-AA59-CE46159CEFBC} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mesnac.Gui.Run.Global", "Main\Mensac.Gui.Run.Global\Mesnac.Gui.Run.Global.csproj", "{CC98CB3B-F532-4510-AC08-7DDBD520CB06}"