diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/ActionType.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/ActionType.cs
index c14981f..6dd3ae9 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/ActionType.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/ActionType.cs
@@ -21,6 +21,10 @@ namespace Mesnac.Action.ChemicalWeighing.Entity
///
/// 查询
///
- Query = 2
+ Query = 2,
+ ///
+ /// 另存
+ ///
+ SaveAs = 3
}
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
index 4902a70..fdccc4f 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -268,6 +268,7 @@
+
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/FrmRecipe.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/FrmRecipe.cs
index 60277da..14b6034 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/FrmRecipe.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/FrmRecipe.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
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/ModifyRecipeAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/ModifyRecipeAction.cs
index 5374a3a..9abd1ed 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/ModifyRecipeAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/ModifyRecipeAction.cs
@@ -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
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/RefreshAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/RefreshAction.cs
index 9b7778f..0fda547 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/RefreshAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/RefreshAction.cs
@@ -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;
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/SaveRecipe.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/SaveRecipe.cs
new file mode 100644
index 0000000..af478bc
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Technical/PmtRecipe/SaveRecipe.cs
@@ -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.Debug("配方管理-另存配方...");
+
+ string selectRecipeName = null;
+ Base_RecipeInfo pmt_Recipe = null;
+
+ try
+ {
+ List 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.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.Error("配方另存失败:" + ex.Message, ex);
+ MessageBox.Show(ex.Message, Mesnac.Basic.LanguageHelper.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ }
+ }
+}
diff --git a/Main/MCBackView/MCBackView.csproj b/Main/MCBackView/MCBackView.csproj
index d164794..c125e8b 100644
--- a/Main/MCBackView/MCBackView.csproj
+++ b/Main/MCBackView/MCBackView.csproj
@@ -273,8 +273,12 @@
-
-
+ 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\"