Exemple #1
0
        private void RefreshDevCfg()
        {
            MesDBAccess.BLL.BatteryCataBll batCataBll = new MesDBAccess.BLL.BatteryCataBll();
            List <string> batCatas = GetBatteryCataList();

            this.comboBox4.Items.Clear();
            if (batCatas.Count > 0)
            {
                this.comboBox4.Items.AddRange(batCatas.ToArray());
            }

            if (this.comboBox4.Items.Count > 0)
            {
                this.comboBox4.SelectedIndex = 0;
            }
            MesDBAccess.BLL.ViewDevLineBatteryCfgBll devLineCfgBll = new MesDBAccess.BLL.ViewDevLineBatteryCfgBll();
            string strWhere = "";

            if (comboBox3.Text != "所有")
            {
                strWhere = string.Format("ShopSection='{0}' ", comboBox3.Text);
            }
            DataSet ds = devLineCfgBll.GetList(strWhere);

            this.dataGridView2.DataSource = ds.Tables[0];
            this.dataGridView2.Columns["DevBatteryCfgID"].HeaderText = "产线配置ID";
            this.dataGridView2.Columns["ShopSection"].HeaderText     = "工段名称";
            this.dataGridView2.Columns["LineID"].HeaderText          = "产线序号";
            this.dataGridView2.Columns["mark"].HeaderText            = "描述";
            this.dataGridView2.Columns["batteryCataCode"].HeaderText = "电芯型号";
            this.dataGridView2.Columns["palletCataID"].HeaderText    = "料筐型号";
            this.dataGridView2.Columns["plcDefVal"].HeaderText       = "PLC值";
            this.dataGridView2.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
            this.dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
        }
Exemple #2
0
        public bool SendDevlinePalletCfg(string shopSection, ref string reStr)
        {
            //throw new NotImplementedException();
            Console.WriteLine("发送{0} ", shopSection);

            if (SysCfg.SysCfgModel.SimMode)
            {
                return(true);
            }
            MesDBAccess.BLL.ViewDevLineBatteryCfgBll devLineCfgBll = new MesDBAccess.BLL.ViewDevLineBatteryCfgBll();
            string[] addrSts                  = new string[] { "D4001", "D4011", "D4021" };
            short[]  blockNums                = new short[] { 4, 6, 4 };
            string[] shopSections             = new string[] { "注液", "化成", "二封" };
            List <DevInterface.IPlcRW> plcRWS = new List <DevInterface.IPlcRW>();

            plcRWS.Add(devCommManager.GetPlcByID(11));
            plcRWS.Add(devCommManager.GetPlcByID(12));
            plcRWS.Add(devCommManager.GetPlcByID(13));
            for (int i = 0; i < 3; i++)
            {
                if (shopSection != "所有")
                {
                    if (shopSection != shopSections[i])
                    {
                        continue;
                    }
                }
                short[] vals = new short[blockNums[i]];
                List <MesDBAccess.Model.ViewDevLineBatteryCfgModel> cfgList = devLineCfgBll.GetModelList(string.Format(" ShopSection='{0}' ", shopSections[i]));
                foreach (MesDBAccess.Model.ViewDevLineBatteryCfgModel m in cfgList)
                {
                    int valIndex = int.Parse(m.LineID) - 1;
                    vals[valIndex] = (short)m.plcDefVal;
                }

                if (!plcRWS[i].WriteMultiDB(addrSts[i], vals.Count(), vals))
                {
                    reStr = string.Format("发送{0}料筐配置失败", shopSections[i]);
                    return(false);
                }
                //}
                //else
                //{
                //    if (!plcRW2.WriteMultiDB(addrSts[i], vals.Count(), vals))
                //    {
                //        reStr = string.Format("发送{0}料筐配置失败", shopSections[i]);
                //        return false;
                //    }
                //}
            }
            return(true);
        }