change - 配方另存

master
wenjy 2 years ago
parent cac7cddaa3
commit 3580a27deb

@ -21,6 +21,10 @@ namespace Mesnac.Action.ChemicalWeighing.Entity
/// <summary>
/// 查询
/// </summary>
Query = 2
Query = 2,
/// <summary>
/// 另存
/// </summary>
SaveAs = 3
}
}

@ -268,6 +268,7 @@
</Compile>
<Compile Include="Technical\PmtRecipe\InitFormAction.cs" />
<Compile Include="Technical\PmtRecipe\InsertAction.cs" />
<Compile Include="Technical\PmtRecipe\SaveRecipe.cs" />
<Compile Include="Technical\PmtRecipe\SelectRecipe.cs" />
<Compile Include="Technical\PmtRecipe\ModifyRecipeAction.cs" />
<Compile Include="Technical\PmtRecipe\RefreshAction.cs" />

@ -111,6 +111,15 @@ namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
txtRecipeWeight.Text = modifyRecipeInfo.recipeWeight.ToString();
txtRemark.Text = modifyRecipeInfo.remark;
}
else if (this._actionType == ActionType.SaveAs)
{
this.Text = "另存配方";
//txtRecipeName.Text = modifyRecipeInfo.recipeName;
//txtRecipeId.Text = modifyRecipeInfo.recipeId;
txtRecipeType.Text = modifyRecipeInfo.recipeType;
txtRecipeWeight.Text = modifyRecipeInfo.recipeWeight.ToString();
txtRemark.Text = modifyRecipeInfo.remark;
}
this.btnOk.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnOK"));
this.btnCancel.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnCancel"));
}
@ -124,7 +133,7 @@ namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
{
this.DGVMaterialSet.Rows.Add();
}
if (this._actionType == ActionType.Modify)
if (this._actionType == ActionType.Modify || this._actionType == ActionType.SaveAs)
{
//根据配方编号获取关联物料信息
@ -430,6 +439,11 @@ namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
this.WeighDelByRecipeID(txtRecipeId.Text); //清空配方对应的物料信息
this.NewWeighAdd(); //配方对应的物料信息重新插入数据库
}
else if(_actionType == ActionType.SaveAs)
{
this.NewRecipeAdd(); //新配方数据插入数据库
this.NewWeighAdd(); //配方对应的物料信息插入数据库
}
#endregion

@ -47,10 +47,6 @@ namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
string selectRecipeName = null;
Base_RecipeInfo pmt_Recipe = null;
string _recipeName = null;
int? _mixerLine;
string _groupBags = null;
string _remark = null;
#endregion

@ -68,6 +68,9 @@ namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
SetCratParam.OnSetCratParam -= SetCartPrarm_Event;
SetCratParam.OnSetCratParam += SetCartPrarm_Event;
SaveRecipe.SaveAsRecipe -= Process_Event;
SaveRecipe.SaveAsRecipe += Process_Event;
IsFirstRun = false;
}

@ -0,0 +1,92 @@
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe
{
public class SaveRecipe : ChemicalWeighingAction, IAction
{
public static event EventHandler SaveAsRecipe;
private RuntimeParameter _runtime;
private DbMCControl _clientGridControl = null;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
this._runtime = runtime;
ICSharpCode.Core.LoggingService<ModifyRecipeAction>.Debug("配方管理-另存配方...");
string selectRecipeName = null;
Base_RecipeInfo pmt_Recipe = null;
try
{
List<DbMCControl> recipeControlList = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Base_RecipeInfo");
DbMCControl clientGridControl = recipeControlList.Where(x => x.BaseControl is TreeView).FirstOrDefault();
if (clientGridControl == null || !(clientGridControl.BaseControl is TreeView))
{
ICSharpCode.Core.LoggingService<RefreshAction>.Error("{配方管理—另存配方}缺少配方管理控件...");
return;
}
this._clientGridControl = clientGridControl;
this._runtime = runtime;
TreeView clientGridView = this._clientGridControl.BaseControl as TreeView;
selectRecipeName = clientGridView.SelectedNode.Name as string;
//判断是否选择了已有配方
if (clientGridView.SelectedNode.Name == null || selectRecipeName == "全部")
{
MessageBox.Show("请选择一条要另存为的配方", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
this._runtime.IsReturn = true;
return;
}
//获取配方实体
pmt_Recipe = RecipeHelper.GetRecipeById(selectRecipeName);
if (pmt_Recipe != null)
{
FrmRecipe frmUpdateRecipe = new FrmRecipe(ActionType.SaveAs, pmt_Recipe);
frmUpdateRecipe.ShowDialog(this._runtime.BaseControl.MCRoot as Control);
if (frmUpdateRecipe.DialogResult == DialogResult.OK)
{
#region 触发事件
if (SaveAsRecipe != null)
{
SaveAsRecipe(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
}
#endregion
frmUpdateRecipe.Dispose();
MessageBox.Show("配方信息另存成功!");
}
else
{
frmUpdateRecipe.Dispose();
}
}
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService<ModifyRecipeAction>.Error("配方另存失败:" + ex.Message, ex);
MessageBox.Show(ex.Message, Mesnac.Basic.LanguageHelper.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}

@ -273,8 +273,12 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>XCOPY "$(SolutionDir)bin\*.*" /S/Y "$(TargetDir)"
XCOPY "$(SolutionDir)packages\*.*" /S/Y "$(TargetDir)"
XCOPY "$(SolutionDir)Main\MCEdit\Data\DeviceConfig\*.*" /S/Y "$(TargetDir)Data\DeviceConfig\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentAction.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentEvent.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentProperty.xml" /S/Y "$(TargetDir)Data\"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -18,6 +18,10 @@
<Caption>修改配方</Caption>
<Remark>修改配方</Remark>
</Action>
<Action action="AFA6CD1B73844DC09060D27C257E6267">
<Caption>另存配方</Caption>
<Remark>另存配方</Remark>
</Action>
<Action action="8FF87B6FA3D04608A940F069B4057B46">
<Caption>删除配方</Caption>
<Remark>删除配方</Remark>
@ -63,11 +67,13 @@
<Runtime action="3F8DF6947B9544EC9B4D2E5F632758A8"/>
</Design>
<Design action="26B9CE9C368B447DA2C0F744916F2000">
<Runtime action="F499D95930AD4B2E87DD829E1A9E2281"/>
</Design>
<Design action="26B9CE9C368B447DA2C0F744916F2000">
<Runtime action="F499D95930AD4B2E87DD829E1A9E2281"/>
</Design>
<Design action="AFA6CD1B73844DC09060D27C257E6267">
<Runtime action="DB849E76062E4B2787A2E1147A70E9CE"/>
</Design>
</DesignToRuntime>
<Runtime>
@ -80,6 +86,7 @@
<Action action="F6FDDA1EF9DB4A239BD1C125BA9D5B60" class="Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.SelectRecipe"/>
<Action action="3F8DF6947B9544EC9B4D2E5F632758A8" class="Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.CheckRecipeTree"/>
<Action action="F499D95930AD4B2E87DD829E1A9E2281" class="Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.SetCratParam"/>
<Action action="DB849E76062E4B2787A2E1147A70E9CE" class="Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.SaveRecipe"/>
</Import>
</Runtime>
</ActionService>

@ -183,6 +183,31 @@
<Property name="Size">1253, 728</Property>
</Object>
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton6" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAIAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIEFGQTZDRDFCNzM4NDREQzA5MDYwRDI3QzI1N0U2MjY3BgYAAAAM5Y+m5a2Y6YWN5pa5BgcAAAAM5Y+m5a2Y6YWN5pa5Cw==</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">另存</Property>
<Property name="Font">宋体, 14.25pt, style=Bold</Property>
<Property name="Location">488, 5</Property>
<Property name="Name">MCButton6</Property>
<Property name="Size">100, 30</Property>
<Property name="TabIndex">15</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton5" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAACAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIEYxMDkxMzc2RDExQjQ0NDNCMTA1QjU5MjBFOUEyRTI4BgYAAAAS6YWN5pa5566h55CG5Yi35pawBgcAAAAS6YWN5pa5566h55CG5Yi35pawCw==</Binary>

@ -1033,8 +1033,16 @@
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>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\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentAction.en-US.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentEvent.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentEvent.en-US.xml" /S/Y "$(TargetDir)Data\"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -345,8 +345,16 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>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\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentAction.en-US.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentEvent.xml" /S/Y "$(TargetDir)Data\"
XCOPY "$(SolutionDir)Main\MCEdit\Data\ComponentEvent.en-US.xml" /S/Y "$(TargetDir)Data\"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>

Loading…
Cancel
Save