예제 #1
0
 public void initRecordDetail(TechnologyDetail techDetail)
 {
     currentRecordDetail          = new RecordDetail();
     currentRecordDetail.RecordId = currentRecord.Id;
     currentRecordDetail.Standard = techDetail.Standard;
     currentRecordDetail.Lower    = techDetail.Lower;
     currentRecordDetail.Upper    = techDetail.Upper;
     //新增
     currentRecordDetail.ManualWriteValue = 0;
 }
        private void saveBtn_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < techDgv.Rows.Count - 1; i++)
            {
                for (int j = 1; j < techDgv.Columns.Count; j++)
                {
                    if (techDgv.Rows[i].Cells[j].Value == null || techDgv.Rows[i].Cells[j].Value.ToString() == "")
                    {
                        MessageBox.Show("不能有空值");
                        return;
                    }
                }
            }
            if (MessageBox.Show("确认更改?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                /**
                 * 工艺更新逻辑
                 * 1、获取当前工艺,即currentTech中的version字段,字段+1,如由V00-V01
                 * 2、向technology表中插入新的一条tech数据,返回其id
                 * 3、更新product对应的techid为上述Id
                 * 4、将dgv中的数据插入到techdetail中,并绑定第2条中的id为techId
                 */
                //生成新的technology对象
                Technology techTemp = new Technology(Guid.NewGuid().ToString("N"),
                                                     testModeCbx.SelectedIndex + 1,
                                                     "V" + (currentTech == null ? "01" : (int.Parse(currentTech.Version.Substring(1, currentTech.Version.Length - 1)) + 1).ToString("00")),
                                                     currentProduct.Id);
                technologyService.addOne(techTemp);

                //更新product中的数据
                productService.updateTechId(currentProduct, techTemp.Id);

                //读取dgv中的数据,创建新的techDetail
                List <TechnologyDetail> technologyDetailList = new List <TechnologyDetail>();
                for (int i = 0; i < techDgv.Rows.Count - 1; i++)
                {
                    TechnologyDetail technologyDetail = new TechnologyDetail();
                    technologyDetail.Id       = Guid.NewGuid().ToString("N");
                    technologyDetail.Index    = int.Parse(techDgv.Rows[i].Cells["index"].Value.ToString());
                    technologyDetail.Num      = int.Parse(techDgv.Rows[i].Cells["num"].Value.ToString());
                    technologyDetail.Standard = float.Parse(techDgv.Rows[i].Cells["standard"].Value.ToString());
                    technologyDetail.Upper    = float.Parse(techDgv.Rows[i].Cells["upper"].Value.ToString());
                    technologyDetail.Lower    = float.Parse(techDgv.Rows[i].Cells["lower"].Value.ToString());
                    technologyDetailList.Add(technologyDetail);
                }
                technologyDetailService.addList(technologyDetailList, techTemp.Id);
                saveBtn.Enabled = false;
            }
        }
        public List <TechnologyDetail> selectPostList(string toolId)
        {
            string    query_string = "SELECT ID Id,PRECHECK_PRE_COUNT PreNum,PRECHECK_STANDARD Standard,PRECHECK_UPPER PreUpper,PRECHECK_LOWER PreLower,PRECHECK_BACK_COUNT PostNum,PRECHECK_BACK_UPPER PostUpper,PRECHECK_BACK_LOWER PostLower from `base_tool_precheck` where TOOL_ID=@toolId and DEL_FLAG=0";
            DataTable dt           = MESMysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter("@toolId", toolId)
            });
            List <TechnologyDetail> ls = new List <TechnologyDetail>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                TechnologyDetail temp = new TechnologyDetail();
                temp.Id       = dt.Rows[i]["id"].ToString();
                temp.Num      = int.Parse(dt.Rows[i]["PostNum"].ToString());
                temp.Standard = float.Parse(dt.Rows[i]["Standard"].ToString());
                temp.Upper    = float.Parse(dt.Rows[i]["PostUpper"].ToString());
                temp.Lower    = float.Parse(dt.Rows[i]["PostLower"].ToString());
                ls.Add(temp);
            }
            return(ls.Count > 0 ? ls : null);
        }
예제 #4
0
 public void AddOrUpdateTechnologyDetail(TechnologyDetail technologyDetail)
 {
     _technologyDetails.AddOrUpdate(c => c.Id, technologyDetail);
 }