diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
index 0cb8f2e..ab59ebe 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
@@ -876,6 +876,9 @@ namespace Mesnac.Action.ChemicalWeighing
//计划编号PlanNo
public DataKeyValue ChemicalWeighing_PC_PlanNo = new DataKeyValue("PlanNo");
+ //计划终止
+ public DataKeyValue ChemicalWeighing_PC_RpCancel = new DataKeyValue("RpCancel");
+
#endregion
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs
index 36a14ac..ac9d15f 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -39,7 +40,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
if (clientGridView.SelectedRows.Count != 1)
{
- string msg1_1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_ModifyPlanNumAction_msg1_1")); //请选择一条要修改计划数的计划!
+ string msg1_1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_ModifyPlanNumAction_msg1_1")); //请选择
MessageBox.Show(msg1_1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
this._runtime.IsReturn = true;
return;
@@ -51,7 +52,19 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
if(this.selectedPlanState != "待执行")
{
- MessageBox.Show("计划正在执行中,是否要重传该计划!!!");
+ if (this.selectedPlanState == "已完成")
+ {
+ MessageBox.Show("计划已执行完成请勿重复下传", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ return;
+ }
+
+ DialogResult res = MessageBox.Show("计划正在执行中,是否要重传该计划!!!");
+
+ if(res != DialogResult.OK)
+ {
+ MessageBox.Show("取消重传!!!", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ return;
+ }
}
//判断下位机准备好信号
@@ -79,8 +92,8 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
}
//开启线程读取计划执行状态
-
- //执行完成后判断下一计划执行方式,自动方式则继续执行下发流程
+ Thread t = new Thread(readPlanState);
+ t.Start();
}
///
@@ -101,22 +114,72 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
///
public void readPlanState()
{
- var writeResult1 = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_SetCarNumber, out int[] setAmount );
+ while (true)
+ {
+ var writeResult1 = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_SetCarNumber, out int[] setAmount);
- bool finishAmount = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_RecipeNum, out int[] res);
+ //读取完成数量,测试采用设定数量
+ //bool finishAmount = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_RecipeNum, out int[] res);
- bool planNoResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_PlanNo, out int[] planNo);
+ bool finishAmount = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_SetCarNumber, out int[] res);
- string planNoStr = intArrayToStr(planNo);
+ bool planNoResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_PlanNo, out int[] planNo);
+
+ bool confirmRunResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_ConfirmRun, out int[] confirmRun);
- //根据计划编号修改计划状态、完成数量
- Base_PlanInfo planInfo = PlanHelper.getPlanInfoByPlanId(planNoStr);
- planInfo.real_Amount = Convert.ToInt32(intArrayToStr(res));
- planInfo.plan_State = 1;
- string updateResult = PlanHelper.UpdateBasePlanInfo(planInfo);
+ string planNoStr = intArrayToStr(planNo) == "" ? "030aabf32dbe4f4e8f9eb8bb65b59b69" : intArrayToStr(planNo);
- //读取完成信号
+ if (planNoStr != "")
+ {
+ //根据计划编号修改计划状态、完成数量
+ Base_PlanInfo planInfo = PlanHelper.getPlanInfoByPlanId(planNoStr);
+ planInfo.real_Amount = Convert.ToInt32(intArrayToStr(res));
+
+ if (planInfo.plan_Amount == planInfo.real_Amount)
+ {
+ planInfo.plan_State = 2;
+ PlanHelper.UpdateBasePlanInfo(planInfo);
+
+ //判断完成信号,正式环境需要判断完成状态
+ /*if (confirmRun[1] == 1)
+ {
+ ICSharpCode.Core.LoggingService.Info("{生产计划-计划下传} 计划" + planNoStr + "执行完成...");
+ //判断下一计划的运行方式
+ Base_PlanInfo nextPlanInfo = PlanHelper.getNextPlanInfoByOrder(planInfo.plan_order);
+
+ if (nextPlanInfo.run_Type == 0)
+ {
+ writeToPlc(nextPlanInfo.recipe_Id, nextPlanInfo.plan_Id);
+ }
+ else
+ {
+ return;
+ }
+ }*/
+
+ ICSharpCode.Core.LoggingService.Info("{生产计划-计划下传} 计划" + planNoStr + "执行完成...");
+ //判断下一计划的运行方式
+ Base_PlanInfo nextPlanInfo = PlanHelper.getNextPlanInfoByPlanOrder(planInfo.plan_order);
+
+ if (nextPlanInfo.run_Type == 0)
+ {
+ writeToPlc(nextPlanInfo.recipe_Id, nextPlanInfo.plan_Id);
+ }
+ else
+ {
+ return;
+ }
+
+ }
+ else
+ {
+ planInfo.plan_State = 1;
+ PlanHelper.UpdateBasePlanInfo(planInfo);
+ }
+ }
+ Thread.Sleep(1000 * 3);
+ }
}
///
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanHelper.cs
index 8c9ec60..25f6f31 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 plan_State when '0' then '待执行' else '执行中' end as 'plan_State',
+ case plan_State when '0' then '待执行' when '1' then '执行中' when '2' then '已完成' when '3' 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;
@@ -2782,7 +2782,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
return planInfo;
}
- public static Base_PlanInfo getPlanInfoByPlanOrder(int plan_order)
+ public static Base_PlanInfo getNextPlanInfoByOrder(int plan_order)
{
Base_PlanInfo planInfo = new Base_PlanInfo();
@@ -2792,7 +2792,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
}
dbHelper.CommandType = CommandType.Text;
- string strSql = "SELECT top 1 * FROM Base_PlanInfo WHERE plan_order = @plan_order";
+ string strSql = "SELECT top 1 * FROM Base_PlanInfo WHERE plan_order > @plan_order";
dbHelper.CommandText = strSql;
dbHelper.AddParameter("@plan_order", plan_order);
DataTable table = dbHelper.ToDataTable();
@@ -2821,7 +2821,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
}
dbHelper.CommandType = CommandType.Text;
- string sqlstr = @"update Base_PlanInfo set recipe_Id = @recipe_Id, recipe_Name = @recipe_Name, plan_Amount = @plan_Amount,
+ string sqlstr = @"update Base_PlanInfo set recipe_Id = @recipe_Id, recipe_Name = @recipe_Name, plan_Amount = @plan_Amount, real_Amount = @real_Amount,
run_Type = @run_Type, plan_State = @plan_State,car_Amount = @car_Amount,grid_Amount = @grid_Amount,line_Amount = @line_Amount where uid = @uid";
dbHelper.ClearParameter();
@@ -2830,11 +2830,14 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
dbHelper.AddParameter("@recipe_Id", base_PlanInfo.recipe_Id);
dbHelper.AddParameter("@recipe_Name", base_PlanInfo.recipe_Name);
dbHelper.AddParameter("@plan_Amount", base_PlanInfo.plan_Amount);
+
+ dbHelper.AddParameter("@real_Amount", base_PlanInfo.real_Amount);
+
dbHelper.AddParameter("@run_Type", base_PlanInfo.run_Type);
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("@plan_State", 0);
+ dbHelper.AddParameter("@plan_State", base_PlanInfo.plan_State);
//dbHelper.AddParameter("@plan_beginTime", base_PlanInfo.plan_beginTime);
dbHelper.ExecuteNonQuery();
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/StopAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/StopAction.cs
index c0bce01..98d8d61 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/StopAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/StopAction.cs
@@ -9,6 +9,7 @@ using Mesnac.Controls.Base;
using Mesnac.Action.Base;
using Mesnac.Codd.Session;
using Mesnac.Action.ChemicalWeighing.Entity;
+using Mesnac.Action.ChemicalWeighing.Product.PptPlan.entity;
namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
{
@@ -85,7 +86,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
#region 获取界面控件
- DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "RT_plan").FirstOrDefault();
+ DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Base_PlanInfo").FirstOrDefault();
if (clientGridControl == null)
{
ICSharpCode.Core.LoggingService.Error("{生产计划-终止计划} 缺少计划列表网格控件...");
@@ -109,9 +110,9 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
}
selectedPlanId = clientGridView.SelectedRows[0].Cells["Plan_Id"].Value as string; //获取选中的计划号
- selectedPlanSerial = Convert.ToInt32(clientGridView.SelectedRows[0].Cells["Plan_Serial"].Value); //获取选中的计划序号
- selectedPlanNum = Convert.ToInt32(clientGridView.SelectedRows[0].Cells["Plan_Num"].Value); //获取选中的计划数
- selectedPlanUnfinished = selectedPlanNum - Convert.ToInt32(clientGridView.SelectedRows[0].Cells["Real_Num"].Value); //获取选中的剩余数
+ selectedPlanSerial = Convert.ToInt32(clientGridView.SelectedRows[0].Cells["plan_order"].Value); //获取选中的计划序号
+ selectedPlanNum = Convert.ToInt32(clientGridView.SelectedRows[0].Cells["plan_amount"].Value); //获取选中的计划数
+ selectedPlanUnfinished = selectedPlanNum - Convert.ToInt32(clientGridView.SelectedRows[0].Cells["real_amount"].Value); //获取选中的剩余数
//int.TryParse(clientGridView.SelectedRows[0].Cells["PlanNum"].Value.ToString(), out selectedPlanNum);
#endregion
@@ -119,16 +120,16 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
#region 判断计划状态是否合法
//PlanState planState = (PlanState)Convert.ToInt32(clientGridView.SelectedRows[0].Cells["Plan_State"].Value);
- PlanState planState = (PlanState)PlanHelper.StateToValue(clientGridView.SelectedRows[0].Cells["Plan_StateText"].Value.ToString());
+ string planState = clientGridView.SelectedRows[0].Cells["plan_state"].Value.ToString();
- if (planState == PlanState.Terminated)
+ if (planState == "待执行")
{
string msg7 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_StopAction_msg7_2")); //当前计划已终止,不能执行此操作!
- MessageBox.Show(msg7, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show("当前计划未执行,不能执行终止操作!!!", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
- if (planState == PlanState.Completed)
+ if (planState == "已完成")
{
string msg7 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_StopAction_msg7_3")); //当前计划已完成,不能执行此操作!
MessageBox.Show(msg7, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
@@ -139,9 +140,9 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
#endregion
- #region 终止计划业务
+ #region 原平台终止计划业务
- string msg8 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_StopAction_msg8")); //当前计划序号{0}设定{1}车,{2}您确认暂停?
+ /*string msg8 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Product_PptPlan_StopAction_msg8")); //当前计划序号{0}设定{1}车,{2}您确认暂停?
msg8 = String.Format(msg8, selectedPlanSerial, selectedPlanNum, "\r\n");
DialogResult result = MessageBox.Show(msg8, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
@@ -195,9 +196,27 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
string logContent = Mesnac.Basic.DataProcessor.CombineMsgList(msgList);
//base.DBLog(logContent);
}
- }
+ }*/
+
+
+
#endregion
+
+ //下传终止信号
+ bool writeRpCancel = BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ChemicalWeighing_PC_RpCancel, new object[] { true });
+
+ if (!writeRpCancel)
+ {
+ Base_PlanInfo planInfo = PlanHelper.getPlanInfoByPlanId(selectedPlanId);
+ planInfo.plan_State = 3;
+ PlanHelper.UpdateBasePlanInfo(planInfo);
+ MessageBox.Show("终止信号下传成功", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("终止信号下传失败", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
}
catch (Exception ex)
{
diff --git a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
index 9327bf7..240325b 100644
--- a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
+++ b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
@@ -14,6 +14,7 @@
+
diff --git a/Main/MCEdit/Data/MCProject/nodeForm/HRUser.xml b/Main/MCEdit/Data/MCProject/nodeForm/HRUser.xml
new file mode 100644
index 0000000..e93dbda
--- /dev/null
+++ b/Main/MCEdit/Data/MCProject/nodeForm/HRUser.xml
@@ -0,0 +1,489 @@
+
+
+
+ [DataSource1].[BasUser]
+
diff --git a/Main/MCRun/MCRun.csproj b/Main/MCRun/MCRun.csproj
index eddd546..1f5371b 100644
--- a/Main/MCRun/MCRun.csproj
+++ b/Main/MCRun/MCRun.csproj
@@ -108,6 +108,9 @@
False
..\..\PlugInPlatform\Mesnac.Core.dll
+
+ ..\..\dll\Mesnac.Docking.dll
+
False
..\..\Equips\Mesnac.Equips.dll
diff --git a/dll/Mesnac.Docking.dll b/dll/Mesnac.Docking.dll
new file mode 100644
index 0000000..97eb708
Binary files /dev/null and b/dll/Mesnac.Docking.dll differ