Пример #1
0
        public BaseResultCommunication DealCommWritePLC(ParCommWritePLC par, Hashtable htResult)
        {
            BaseResultCommunication result = new BaseResultCommunication();

            try
            {
                for (int i = 0; i < par.ResultforWritePLC_L.Count; i++)
                {
                    string nameCell   = par.ResultforWritePLC_L[i].NameCell;
                    string nameResult = par.ResultforWritePLC_L[i].NameResult;

                    GetReusltValueFromResultcs fun = new GetReusltValueFromResultcs();
                    double value = fun.GetResultValue(nameCell, nameResult, htResult);
                    par.ResultforWritePLC_L[i].Result = value;
                }

                //写入PLC
                bool blResult = LogicPLC.L_I.WriteData(par.ResultforWritePLC_L);
                if (!blResult)
                {
                    result.LevelError_e = LevelError_enum.Error;
                    result.Annotation   = "";
                }
                return(result);
            }
            catch (Exception ex)
            {
                result.LevelError_e = LevelError_enum.Error;
                result.Annotation   = par.NameCell.ToString() + "写入PLC:" + ex.Message;
                LogError(NameClass, par, ex);
                return(result);
            }
        }
Пример #2
0
        public void Init(ParCommWritePLC par, List <CellReference> cellExe_L, List <CellHObjectReference> cellHObject_L, List <CellReference> cellData_L, Hashtable htResult)
        {
            try
            {
                NameClass = "WinCommWritePLC" + par.NameCell;

                //参数赋值
                g_ParCommWritePLC     = par;
                g_ParCommWritePLC_Old = (ParCommWritePLC)par.Clone();

                //权限设置
                g_AuthorityCtr_L = par.g_AuthorityCtr_L;

                g_HtResult = htResult;        //结果

                g_CellData_L    = cellData_L; //数据单元格名称
                g_CellExecute_L = cellExe_L;  //可执行单元格名称

                uCCellDataReference.Init(cellData_L, htResult);
                //显示参数
                ShowPar_Invoke();
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }