Esempio n. 1
0
        private bool SetModPalletNum(ref string restr)
        {
            int modPallet = 0;

            foreach (Control ctl in this.flowLayoutPanel2.Controls)
            {
                PLProcessModel.ParamCfgBase.ParamCfgItemCtl paramCtl = ctl as PLProcessModel.ParamCfgBase.ParamCfgItemCtl;
                paramCtl.ParamApply();
                modPallet = int.Parse(paramCtl.GetParamObj().ParamVal);
                break;
            }
            if (this.devList == null)
            {
                return(false);
            }

            CtlDevBaseModel screw1 = GetDev("C线1号绝缘板锁螺丝机");

            if (screw1 == null)
            {
                restr = "C线绝缘板锁螺丝机1,设备对象为空!";
                return(false);
            }
            bool status1 = screw1.PlcRW.WriteDB("D8500", modPallet);

            if (status1 == false)
            {
                restr = "C线绝缘板锁螺丝机1,发送模块数量失败!";
                return(false);
            }

            CtlDevBaseModel screw2 = GetDev("C线2号绝缘板锁螺丝机");

            if (screw2 == null)
            {
                restr = "C线绝缘板锁螺丝机2,设备对象为空!";
                return(false);
            }

            bool status2 = screw2.PlcRW.WriteDB("D8500", modPallet);

            if (status2 == false)
            {
                restr = "C线绝缘板锁螺丝机2,发送模块数量失败!";
                return(false);
            }
            restr = "C线绝缘板锁螺丝机1、C线绝缘板锁螺丝机2设备模块数量设置成功!";
            return(true);
        }
Esempio n. 2
0
        private void btnParamSave_Click(object sender, EventArgs e)
        {
            foreach (Control ctl in this.flowLayoutPanel2.Controls)
            {
                PLProcessModel.ParamCfgBase.ParamCfgItemCtl paramCtl = ctl as PLProcessModel.ParamCfgBase.ParamCfgItemCtl;
                paramCtl.ParamApply();
            }
            string reStr = "";

            if (!SysCfgModel.SaveCfg(ref reStr))
            {
                MessageBox.Show("保存配置失败:" + reStr);
            }
            else
            {
                MessageBox.Show("参数保存成功");
            }
            string str = "";

            SetModPalletNum(ref str);

            MessageBox.Show(str);
        }