|
|
|
@ -71,6 +71,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<StopAction>.Info("{生产计划-计划下传} 计划下传成功...");
|
|
|
|
|
//下传成功后下传RpFinished信号
|
|
|
|
|
bool writeRpFinished = BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ChemicalWeighing_PC_RpFinished, new object[] { true });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -82,24 +83,40 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
|
|
|
|
|
//执行完成后判断下一计划执行方式,自动方式则继续执行下发流程
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取PLC执行的配方编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string readRecipeId()
|
|
|
|
|
{
|
|
|
|
|
bool readResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_RecipeCode, out int[] res);
|
|
|
|
|
|
|
|
|
|
string readRecipeId = "";
|
|
|
|
|
string readRecipeId = intArrayToStr(res);
|
|
|
|
|
|
|
|
|
|
if (res.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < res.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (res[i] > 0)
|
|
|
|
|
{
|
|
|
|
|
readRecipeId = readRecipeId + res[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return readRecipeId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return readRecipeId;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取plc计划执行状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void readPlanState()
|
|
|
|
|
{
|
|
|
|
|
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 planNoResult = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.ChemicalWeighing_PC_PlanNo, out int[] planNo);
|
|
|
|
|
|
|
|
|
|
string planNoStr = intArrayToStr(planNo);
|
|
|
|
|
|
|
|
|
|
//根据计划编号修改计划状态、完成数量
|
|
|
|
|
Base_PlanInfo planInfo = PlanHelper.getPlanInfoByPlanId(planNoStr);
|
|
|
|
|
planInfo.real_Amount = Convert.ToInt32(intArrayToStr(res));
|
|
|
|
|
planInfo.plan_State = 1;
|
|
|
|
|
string updateResult = PlanHelper.UpdateBasePlanInfo(planInfo);
|
|
|
|
|
|
|
|
|
|
//读取完成信号
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -196,5 +213,21 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string intArrayToStr(int[] array)
|
|
|
|
|
{
|
|
|
|
|
string str = "";
|
|
|
|
|
if (array.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < array.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (array[i] > 0)
|
|
|
|
|
{
|
|
|
|
|
str = str + array[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|