|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using Mesnac.Action.Base;
|
|
|
using Mesnac.Action.Feeding.Qingquan.BasicInfo;
|
|
|
using Mesnac.Codd.Session;
|
|
|
using System.Data;
|
|
|
using Mesnac.Action.Feeding.Qingquan.FeedingPlc;
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
namespace Mesnac.Action.Feeding.Qingquan.ProducingPlan
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 拆分计划业务类
|
|
|
/// 将A计划剩余车数生成一个B计划
|
|
|
/// </summary>
|
|
|
public class SplitPlanAction : FeedingAction, IAction
|
|
|
{
|
|
|
#region 事件定义
|
|
|
|
|
|
/// <summary>
|
|
|
/// 刷新计划事件
|
|
|
/// </summary>
|
|
|
public static event EventHandler OnRefreshPlan;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
{
|
|
|
base.RunIni(runtime);
|
|
|
|
|
|
if (runtime.Sender != null && runtime.Sender is Control)
|
|
|
{
|
|
|
(runtime.Sender as Control).Enabled = false;
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//是否允许选择班组
|
|
|
if (base.GetConfigValue("IsAllowSelectShiftClass", "0") == "1")
|
|
|
{
|
|
|
FrmShiftClass frmShiftClass = new FrmShiftClass();
|
|
|
DialogResult result = frmShiftClass.ShowDialog();
|
|
|
if (result == DialogResult.OK)
|
|
|
{
|
|
|
int shiftClass = frmShiftClass.ShiftClass;
|
|
|
|
|
|
if (!this.SplitPlan(runtime, shiftClass))
|
|
|
{
|
|
|
runtime.IsReturn = false;
|
|
|
}
|
|
|
}
|
|
|
frmShiftClass.Dispose();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!this.SplitPlan(runtime))
|
|
|
{
|
|
|
runtime.IsReturn = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch { }
|
|
|
finally
|
|
|
{
|
|
|
if (runtime.Sender != null && runtime.Sender is Control)
|
|
|
{
|
|
|
(runtime.Sender as Control).Enabled = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 拆分计划主业务方法
|
|
|
|
|
|
/// <summary>
|
|
|
/// 拆分计划
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool SplitPlan()
|
|
|
{
|
|
|
return this.SplitPlan(null);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 拆分计划
|
|
|
/// </summary>
|
|
|
/// <param name="shiftClass">指定新计划的班组</param>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool SplitPlan(int shiftClass)
|
|
|
{
|
|
|
return this.SplitPlan(null, shiftClass);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 拆分计划
|
|
|
/// </summary>
|
|
|
/// <param name="runtime">运行时参数</param>
|
|
|
/// <param name="shiftClass">拆分计划时显示指定班组</param>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool SplitPlan(RuntimeParameter runtime, params int[] shiftClass)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
#region 变量定义
|
|
|
|
|
|
List<string> errorList = new List<string>(); //保存错误信息
|
|
|
DateTime shift_DT = DateTime.Now; //保存计划日期
|
|
|
int shift_id = 0; //保存班次
|
|
|
int shift_class = 0; //保存班组
|
|
|
string recipeObjId = ""; //当前配方编码
|
|
|
int recipeVersionId = 0; //当前配方版本号
|
|
|
int AplanNum = 0; //当前计划数
|
|
|
int ArealNum = 0; //当前计划完成数
|
|
|
int BplanNum = 0; //新计划完成数
|
|
|
|
|
|
int currMixingFisishedCount = 0; //当前密炼完成数
|
|
|
int G_PloyFinishedCount = 0; //新计划的胶料完成数
|
|
|
int G_CarbonFinishedCount = 0; //新计划的炭黑完成数
|
|
|
int G_oilFinishedCount = 0; //新计划的油1完成数
|
|
|
int G_oil2FinishedCount = 0; //新计划的油2完成数
|
|
|
int G_powderFinishedCount = 0; //新计划的粉料完成数
|
|
|
int G_xiaoLiaoFinishedCount = 0; //新计划的小料完成数
|
|
|
|
|
|
int planState = 0; //保存计划状态
|
|
|
string planID = String.Empty; //保存计划号
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 验证部分
|
|
|
|
|
|
if (PlcData.Instance.FinishedBatch.LastValue.ToInt() == 1)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Debug("正在存盘不允许换班");
|
|
|
errorList.Add("正在存盘不允许换班");
|
|
|
}
|
|
|
|
|
|
//单机版终止执行
|
|
|
if (base.NetType == 0)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (String.IsNullOrEmpty(PlanCommon.PlanLog.LastPlanID))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
DbHelper serverHelper = base.NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Server);
|
|
|
if (serverHelper == null)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error("换班拆分计划失败:获取网络库连接失败...");
|
|
|
errorList.Add("换班拆分计划失败:获取网络库连接失败...");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
DataRow row = PlanCommon.GetServerShiftTimeRow();
|
|
|
if (row == null)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error("换班拆分计划失败:从网络库获取工厂日历数据失败...");
|
|
|
errorList.Add("换班拆分计划失败:从网络库获取工厂日历数据失败...");
|
|
|
return false;
|
|
|
}
|
|
|
shift_DT = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_dt", DateTime.Now);
|
|
|
shift_id = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_id", 0);
|
|
|
shift_class = Mesnac.Basic.DataProcessor.RowValue(row, "Shift_class", 0);
|
|
|
|
|
|
if (shiftClass.Length > 0)
|
|
|
{
|
|
|
shift_class = shiftClass[0]; //如果指定了班组参数,则使用指定的班组
|
|
|
}
|
|
|
|
|
|
if (String.Format("{0:yyyyMMdd}", PlanCommon.PlanLog.LastSelectDate) == String.Format("{0:yyyyMMdd}", shift_DT) && PlanCommon.PlanLog.LastSelectShiftID == shift_id)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Debug(String.Format("当前班次:{0};班次相同,不换班!", PlanCommon.PlanLog.LastSelectShiftID));
|
|
|
errorList.Add("班次相同,不换班");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 业务数据处理部分
|
|
|
|
|
|
ICSharpCode.Core.LoggingService.Debug(String.Format("换班日期:{0:yyyy-MM-dd},班次:{1}", shift_DT, shift_id));
|
|
|
|
|
|
DataRow planRow = PlanCommon.GetPlanData(Basic.DataSourceFactory.MCDbType.Local, PlanCommon.PlanLog.LastPlanID);
|
|
|
if (planRow == null)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error("换班拆分计划失败:获取当前计划失败...");
|
|
|
return false;
|
|
|
}
|
|
|
planState = Mesnac.Basic.DataProcessor.RowValue(planRow, "PlanState", 0);
|
|
|
recipeObjId = Mesnac.Basic.DataProcessor.RowValue(planRow, "RecipeMaterialCode", String.Empty);
|
|
|
recipeVersionId = Mesnac.Basic.DataProcessor.RowValue(planRow, "RecipeVersionID", 0);
|
|
|
AplanNum = Mesnac.Basic.DataProcessor.RowValue(planRow, "PlanNum", 0);
|
|
|
ArealNum = Mesnac.Basic.DataProcessor.RowValue(planRow, "RealNum", 0);
|
|
|
BplanNum = AplanNum - ArealNum;
|
|
|
|
|
|
if (planState != 5)
|
|
|
{
|
|
|
if (BplanNum <= 0)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Debug("剩余数量为0");
|
|
|
errorList.Add("剩余数量为0");
|
|
|
}
|
|
|
//把原始计划的计划状态改为完成,原始计划数更新计划完成数
|
|
|
PlanCommon.UpdatedPlanStateAndRealEndTime(Basic.DataSourceFactory.MCDbType.Server, PlanCommon.PlanLog.LastPlanID, 5, DateTime.Now, ArealNum);
|
|
|
PlanCommon.UpdatedPlanStateAndRealEndTime(Basic.DataSourceFactory.MCDbType.Local, PlanCommon.PlanLog.LastPlanID, 5, DateTime.Now, ArealNum);
|
|
|
if (BplanNum > 0)
|
|
|
{
|
|
|
//在网络数据库中添加计划
|
|
|
planID = PlanCommon.AddPlan(Mesnac.Basic.DataSourceFactory.MCDbType.Server, base.CurrEquipCode, shift_DT, shift_id, shift_class, recipeObjId.ToString(), recipeVersionId, BplanNum, out errorList);
|
|
|
//接收新添加的计划到本地库
|
|
|
PlanCommon.RecivePlan(planID, base.CurrEquipCode, shift_DT, shift_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//更新计划日志
|
|
|
|
|
|
PlanLog planLog = new PlanLog();
|
|
|
planLog.LastSelectDate = shift_DT;
|
|
|
planLog.LastSelectShiftID = shift_id;
|
|
|
planLog.LastClassID = shift_class;
|
|
|
planLog.LastPlanID = planID;
|
|
|
|
|
|
PlanCommon.PlanLog = planLog;
|
|
|
|
|
|
//更新计划缓存
|
|
|
RecipeData recipeData = new RecipeData();
|
|
|
RecipeCache.Instance.CachePlanInfo(recipeData.GetCurrentPptPlanInfo());
|
|
|
string xmlRecipeCache_PlanInfo = Mesnac.Basic.SerializeHandler.SerializeObject<RecipeData.PptPlanInfo>(RecipeCache.Instance.PlanInfo);
|
|
|
base.UpdateSysValue("RecipeCache_PlanInfo", xmlRecipeCache_PlanInfo);
|
|
|
|
|
|
|
|
|
//更改计划状态为正在执行
|
|
|
PlanCommon.UpdatedPlanStateAndRealStartTime(Basic.DataSourceFactory.MCDbType.Server, planID, 4, DateTime.Now);
|
|
|
PlanCommon.UpdatedPlanStateAndRealStartTime(Basic.DataSourceFactory.MCDbType.Local, planID, 4, DateTime.Now);
|
|
|
|
|
|
//更新总重
|
|
|
double totalweight = PlanCommon.GetTotalWeightByPlanID(planID);
|
|
|
PlanCommon.UpdateTotalWeight(planID, totalweight);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region PLC操作部分
|
|
|
|
|
|
currMixingFisishedCount = PlcData.Instance.MixingFinishedCount.LastValue.ToInt(); //当前密炼完成数
|
|
|
|
|
|
#region 密炼
|
|
|
|
|
|
//下传密炼完成数为0
|
|
|
this.DownloadFinishNumer(0);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 胶料
|
|
|
|
|
|
if (PlcData.Instance.PloyFinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_PloyFinishedCount = PlcData.Instance.PloyFinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_PloyFinishedCount = 0;
|
|
|
}
|
|
|
//下传胶料完成数
|
|
|
this.DownLoadRubWeightNum(G_PloyFinishedCount);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 炭黑
|
|
|
|
|
|
if (PlcData.Instance.CarbonFinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_CarbonFinishedCount = PlcData.Instance.CarbonFinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_CarbonFinishedCount = 0;
|
|
|
}
|
|
|
//下传炭黑完成数
|
|
|
this.DownLoadCBWeightNum(G_CarbonFinishedCount);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 油1
|
|
|
|
|
|
if (PlcData.Instance.OilFinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_oilFinishedCount = PlcData.Instance.OilFinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_oilFinishedCount = 0;
|
|
|
}
|
|
|
//下传油1完成数
|
|
|
this.DownLoadOil1WeightNum(G_oilFinishedCount);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 油2
|
|
|
|
|
|
if (PlcData.Instance.Oil2FinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_oil2FinishedCount = PlcData.Instance.Oil2FinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_oil2FinishedCount = 0;
|
|
|
}
|
|
|
//下传油2完成数
|
|
|
this.DownLoadOil2WeightNum(G_oil2FinishedCount);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 粉料
|
|
|
|
|
|
if (PlcData.Instance.PowderFinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_powderFinishedCount = PlcData.Instance.PowderFinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_powderFinishedCount = 0;
|
|
|
}
|
|
|
//下传粉料完成数
|
|
|
this.DownLoadPowderWeightNum(G_powderFinishedCount);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 小料
|
|
|
|
|
|
if (PlanCommon.IsHaveXiaoliao())
|
|
|
{
|
|
|
if (PlcData.Instance.XiaoLiaoFinishedCount.LastValue.ToInt() - currMixingFisishedCount >= 0)
|
|
|
{
|
|
|
G_xiaoLiaoFinishedCount = PlcData.Instance.XiaoLiaoFinishedCount.LastValue.ToInt() - currMixingFisishedCount;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
G_xiaoLiaoFinishedCount = 0;
|
|
|
}
|
|
|
//下传小料完成数
|
|
|
this.DownLoadXiaoLiaoWeightNum(G_xiaoLiaoFinishedCount);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 下传修改密炼完成次数标志 换班标识1023
|
|
|
|
|
|
this.DownloadMixDoneNumFlag(1023);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 刷新计划
|
|
|
|
|
|
//修改新计划的设定数
|
|
|
ModifyPlanNum mpn = new ModifyPlanNum();
|
|
|
mpn.SimpleModifyPlanNum(planID, BplanNum, true);
|
|
|
|
|
|
Dictionary<string, object> paras = new Dictionary<string, object>();
|
|
|
paras.Add("@planID", planID);
|
|
|
paras.Add("@planNum", BplanNum);
|
|
|
base.ExecuteProcedure(Basic.DataSourceFactory.MCDbType.Server, "proc_PlanToYFS", paras);
|
|
|
|
|
|
//刷新计划界面
|
|
|
if (OnRefreshPlan != null)
|
|
|
{
|
|
|
if (runtime != null)
|
|
|
{
|
|
|
OnRefreshPlan(runtime.Sender, System.EventArgs.Empty);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
OnRefreshPlan(null, System.EventArgs.Empty);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ICSharpCode.Core.LoggingService.Debug("计划拆分完成");
|
|
|
base.DBLog("基本操作", "换班", "计划拆分完成"); //增加数据操作日志
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 把当前计划列表发送给客户端
|
|
|
|
|
|
if (PlanCommon.PlanLog != null)
|
|
|
{
|
|
|
PlanCommon.SendInit(base.CurrEquipCode, PlanCommon.PlanLog.LastSelectDate, PlanCommon.PlanLog.LastSelectShiftID, PlanCommon.PlanLog.LastClassID, base.GetConfigValue("LastUserID", "0"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string sbNetMsg = Global.ProtocalHeader.ReceivePlanIpNumber + ":/";
|
|
|
Mesnac.Communication.TcpService.Instance.NetSendMsg(sbNetMsg.ToString()); //发送网络消息
|
|
|
ICSharpCode.Core.LoggingService.Debug(String.Format("[{0}]没有计划日志!", planID));
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error("拆分计划错误:" + ex.Message);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region PLC写入辅助方法定义
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传密炼完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownloadFinishNumer(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.MixingFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyMixDoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传密炼完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传胶料完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadRubWeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.PloyFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyPloyDoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传胶料完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传炭黑完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadCBWeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.CarbonFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyCBDoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传炭黑完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传油1完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadOil1WeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.OilFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyOil1DoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传油1完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传油2完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadOil2WeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.Oil2FinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyOil2DoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传油1完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传粉料完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadPowderWeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.PowderFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyPowderDoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传粉料完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下传小料完成次数到PLC
|
|
|
/// </summary>
|
|
|
/// <returns>成功返回true,失败返回false</returns>
|
|
|
public bool DownLoadXiaoLiaoWeightNum(int nNumber)
|
|
|
{
|
|
|
//bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.XiaoLiaoFinishedCount, new object[] { nNumber });
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyDrugDoneNum, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传小料完成次数到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 下传修改密炼完成次数标志
|
|
|
/// </summary>
|
|
|
/// <param name="nNumber"></param>
|
|
|
/// <returns></returns>
|
|
|
public bool DownloadMixDoneNumFlag(int nNumber)
|
|
|
{
|
|
|
bool result = PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.ModifyMixDoneNumFlag, new object[] { nNumber });
|
|
|
if (result == false)
|
|
|
{
|
|
|
base.LogError("PLC通讯故障:[下传修改密炼完成次数标志到PLC]");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 是否有小料
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
//private bool IsHaveXiaoliao()
|
|
|
//{
|
|
|
// //List<RecipeData.RecipeWeightInfo> lst = new RecipeData().GetCurrentRecipeWeightInfo();
|
|
|
// List<RecipeData.RecipeWeightInfo> lst = RecipeCache.Instance.AllWeightInfo;
|
|
|
// foreach (RecipeData.RecipeWeightInfo item in lst)
|
|
|
// {
|
|
|
// if (item.WeightType == (int)RecipeData.WeightType.小料)
|
|
|
// {
|
|
|
// return true;
|
|
|
// }
|
|
|
// }
|
|
|
// return false;
|
|
|
//}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|