Example #1
0
 public static void Add(OptionRecordEntity OptionInfo)
 {
     new OptionRecordDal().Add(OptionInfo);
 }
Example #2
0
        private void gridOptionList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {   //点击按钮是执行事件
            OptionRecordEntity option_record = new OptionRecordEntity();

            if (gridOptionList.Columns[e.ColumnIndex].Name == "operate")  //开始
            {
                if (oldrow == -1)
                {
                    if (gridOptionList.Rows[e.RowIndex].Cells["option_code"].Style.BackColor != Color.Green) //未完成工序
                    {
                        if (type == "0")                                                                     //按站点
                        {
                            if (nums == 0)
                            {
                                starttime = DateTime.Now;
                                gridOptionList.Rows[e.RowIndex].Cells["stime"].Value = starttime.ToString();
                            }
                        }
                        else
                        {
                            starttime = DateTime.Now;
                            gridOptionList.Rows[e.RowIndex].Cells["stime"].Value = starttime.ToString();
                        }


                        oldrow = e.RowIndex;
                        for (int j = 0; j < gridOptionList.Columns.Count; j++)
                        {
                            gridOptionList.Rows[oldrow].Cells[j].Style.BackColor = Color.Red;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("前一序未完成!");
                }
            }
            if (gridOptionList.Columns[e.ColumnIndex].Name == "operates")  //结束
            {
                if (oldrow == -1)
                {
                    MessageBox.Show("尚无工序开始!");
                    return;
                }

                int newrow = e.RowIndex;
                if (oldrow == newrow)  //当前工序完成
                {
                    for (int j = 0; j < gridOptionList.Columns.Count; j++)
                    {
                        gridOptionList.Rows[oldrow].Cells[j].Style.BackColor = Color.Green;
                    }

                    oldrow = -1;
                    nums  += 1;
                    if (type == "1") //按工序
                    {
                        endtime = DateTime.Now;
                        gridOptionList.Rows[e.RowIndex].Cells["etime"].Value = endtime.ToString();
                        RMESEventArgs arg = new RMESEventArgs();
                        arg.MessageHead = "OPTIONCOMPLETE";
                        //option_record.RMES_ID = "";
                        option_record.COMPANY_CODE = LoginInfo.CompanyInfo.COMPANY_CODE;
                        option_record.PLINE_CODE   = LoginInfo.ProductLineInfo.PLINE_CODE.ToString();
                        option_record.STATION_CODE = LoginInfo.StationInfo.STATION_CODE.ToString();
                        option_record.OPTION_CODE  = gridOptionList.Rows[e.RowIndex].Cells["option_code"].Value.ToString();
                        option_record.OPTION_NAME  = gridOptionList.Rows[e.RowIndex].Cells["option_name"].Value.ToString();
                        option_record.START_TIME   = starttime;
                        option_record.END_TIME     = endtime;
                        option_record.SN           = sn;
                        arg.MessageBody            = option_record;
                        UiFactory.CallDataChanged(this, arg);
                        if (nums == gridOptionList.RowCount)
                        {
                            RMESEventArgs args = new RMESEventArgs();
                            args.MessageHead = "OPTIONCOMPLETES";
                            args.MessageBody = null;
                            UiFactory.CallDataChanged(this, args);
                        }
                    }
                    else
                    {
                        if (type == "0") //按站点
                        {
                            if (nums == gridOptionList.RowCount)
                            {
                                endtime = DateTime.Now;
                                gridOptionList.Rows[e.RowIndex].Cells["etime"].Value = endtime.ToString();
                                RMESEventArgs arg = new RMESEventArgs();
                                arg.MessageHead            = "OPTIONCOMPLETE";
                                option_record.COMPANY_CODE = LoginInfo.CompanyInfo.COMPANY_CODE;
                                option_record.PLINE_CODE   = LoginInfo.ProductLineInfo.PLINE_CODE.ToString();
                                option_record.STATION_CODE = LoginInfo.StationInfo.STATION_CODE.ToString();
                                option_record.START_TIME   = starttime;
                                option_record.END_TIME     = endtime;
                                option_record.SN           = sn;
                                arg.MessageBody            = option_record;
                                UiFactory.CallDataChanged(this, arg);
                                RMESEventArgs args = new RMESEventArgs();
                                args.MessageHead = "OPTIONCOMPLETES";
                                args.MessageBody = null;
                                UiFactory.CallDataChanged(this, args);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("当前工序尚未开始,前一序未完成!");
                    return;
                }
            }
        }
Example #3
0
 public void Add(OptionRecordEntity OptionInfo)
 {
     db.Insert(OptionInfo);
 }