public ctrl_quality(string type, string sn, string stationcode1) { InitializeComponent(); CompanyCode = LoginInfo.CompanyInfo.COMPANY_CODE; PlineID = LoginInfo.ProductLineInfo.RMES_ID; PlineCode = LoginInfo.ProductLineInfo.PLINE_CODE; StationCode = LoginInfo.StationInfo.STATION_CODE; stationname = LoginInfo.StationInfo.STATION_NAME; GridQuality.AutoGenerateColumns = false; GridQuality.RowHeadersVisible = false; GridQuality.DataSource = null; Thetype = type; TheSn = sn; product = ProductInfoFactory.GetByCompanyCodeSNSingle(CompanyCode, TheSn);//获取sn信息 if (product == null) { return; } //执行存储过程 获取RSTBOMQATS ProductDataFactory.PL_QUERY_QAZJTS(product.PLAN_SO, StationCode, PlineCode, "", product.PLAN_CODE, sn); string sql = "select count(1) from data_sn_qa where company_code='" + CompanyCode + "' and plan_code='" + product.PLAN_CODE + "' and sn='" + TheSn + "' and station_code='" + StationCode + "' and pline_code='" + PlineCode + "' "; if (dataConn.GetValue(sql) == "0") { //插入data_sn_qa sql = " insert into data_sn_qa(rmes_id,sn,company_code,plan_code,pline_code,location_code,station_code,question,standard_answer,station_name) " + " select seq_rmes_id.nextval,'" + TheSn + "','" + CompanyCode + "','" + product.PLAN_CODE + "','" + PlineCode + "',gwdm,'" + StationCode + "',question,answer,'" + stationname + "' from RSTBOMQATS where zddm='" + StationCode + "' "; dataConn.ExeSql(sql); } ThePlancode = product.PLAN_CODE; GridQuality.Focus(); IsABC = false; ShowData(type, TheSn, stationcode1);//A显示前道站点质量信息 B 显示当前站点质量信息 try { if (GridQuality.Rows.Count > 0 && IsABC) { PlanSnFactory.InitStationControl(CompanyCode, PlineID, LoginInfo.StationInfo.RMES_ID, product.PLAN_CODE, product.SN, "Rmes.WinForm.Controls.ctrl_quality"); dataConn.ExeSql("update data_sn_controls_complete set complete_flag='A' where station_code='" + LoginInfo.StationInfo.RMES_ID + "' and control_name='Rmes.WinForm.Controls.ctrl_quality' and sn='" + product.SN + "' and plan_code='" + product.PLAN_CODE + "' "); } } catch { } //this.RMesDataChanged += new RMesEventHandler(ctrl_Tj_RMesDataChanged); }
void ctrl_Tj_RMesDataChanged(object obj, Rmes.WinForm.Base.RMESEventArgs e) { RMESEventArgs arg = new RMESEventArgs(); arg.MessageHead = ""; arg.MessageBody = ""; if (e.MessageHead == null) { return; } if (e.MessageHead == "SN" || e.MessageHead == "RESN" || e.MessageHead == "RECHECK") { TheSn = e.MessageBody.ToString(); product = ProductInfoFactory.GetByCompanyCodeSNSingle(CompanyCode, TheSn);//获取sn信息 if (product == null) { return; } ThePlancode = product.PLAN_CODE; //初始化质量数据 //string sql = "select count(1) from data_sn_qa where company_code='"+CompanyCode+"' and plan_code='"+product.PLAN_CODE+"' and sn='"+TheSn+"' and station_code='"+StationCode+"' and pline_code='"+PlineCode+"' "; //if (dataConn.GetValue(sql) == "0") //{ // //插入data_sn_qa // sql = " insert into data_sn_qa(rmes_id,sn,company_code,plan_code,pline_code,location_code,station_code,question,standard_answer,station_name) values " // + " select seq_rmes_id.nextval,'"+TheSn+"','" + CompanyCode + "','" + product.PLAN_CODE + "','" + PlineCode + "',gwdm,'" + StationCode + "',question,answer,'"+stationname+"' from RSTBOMQATS where zddm='" + StationCode + "' "; // dataConn.ExeSql(sql); //} string type = "B"; Thetype = type; string sn = TheSn; product = ProductInfoFactory.GetByCompanyCodeSNSingle(CompanyCode, TheSn);//获取sn信息 if (product == null) { return; } //执行存储过程 获取RSTBOMQATS ProductDataFactory.PL_QUERY_QAZJTS(product.PLAN_SO, StationCode, PlineCode, "", product.PLAN_CODE, sn); string sql = "select count(1) from data_sn_qa where company_code='" + CompanyCode + "' and plan_code='" + product.PLAN_CODE + "' and sn='" + TheSn + "' and station_code='" + StationCode + "' and pline_code='" + PlineCode + "' "; if (dataConn.GetValue(sql) == "0") { //插入data_sn_qa sql = " insert into data_sn_qa(rmes_id,sn,company_code,plan_code,pline_code,location_code,station_code,question,standard_answer,station_name) " + " select seq_rmes_id.nextval,'" + TheSn + "','" + CompanyCode + "','" + product.PLAN_CODE + "','" + PlineCode + "',gwdm,'" + StationCode + "',question,answer,'" + stationname + "' from RSTBOMQATS where zddm='" + StationCode + "' "; dataConn.ExeSql(sql); } ThePlancode = product.PLAN_CODE; GridQuality.Focus(); IsABC = false; ShowData(type, TheSn, StationCode);//A显示前道站点质量信息 B 显示当前站点质量信息 try { if (GridQuality.Rows.Count > 0 && IsABC) { PlanSnFactory.InitStationControl(CompanyCode, PlineID, LoginInfo.StationInfo.RMES_ID, product.PLAN_CODE, product.SN, "Rmes.WinForm.Controls.ctrl_quality"); dataConn.ExeSql("update data_sn_controls_complete set complete_flag='A' where station_code='" + LoginInfo.StationInfo.RMES_ID + "' and control_name='Rmes.WinForm.Controls.ctrl_quality' and sn='" + product.SN + "' and plan_code='" + product.PLAN_CODE + "' "); } } catch { } // } }
void ctrQualityCheck_RMesDataChanged(object obj, Rmes.WinForm.Base.RMESEventArgs e) { string stationID = LoginInfo.StationInfo.RMES_ID; RMESEventArgs arg = new RMESEventArgs(); arg.MessageHead = ""; arg.MessageBody = ""; if (e.MessageHead == null) { return; } //if (e.MessageHead == "WORK" || e.MessageHead=="MESLL") // this.Visible = false; //else if (e.MessageHead == "QUA") // this.Visible = true; //else if (e.MessageHead.ToString() == "SN") { SN = e.MessageBody.ToString(); ProductInfoEntity product = ProductInfoFactory.GetByCompanyCodeSNSingle(LoginInfo.CompanyInfo.COMPANY_CODE, SN); if (product == null) { return; } PlanCode = product.PLAN_CODE; PlanSo = product.PLAN_SO; Fdjxl = product.PRODUCT_SERIES; Gylx = product.ROUNTING_REMARK; //this.GridQuality.DataSource = SNDetectTempFactory.GetBySNStation(SN, StationCode); //StationEntity station = StationFactory.GetByKey(StationID); //List<SNDetectTempEntity> temp = SNDetectTempFactory.GetBySNStation(SN, StationID); //foreach (var t in temp) //{ // int i=GridQuality.Rows.Add(); // GridQuality.Rows[i].Cells["colRmesID"].Value = t.RMES_ID; // GridQuality.Rows[i].Cells["colDetectCode"].Value = t.DETECT_ITEM_CODE; // GridQuality.Rows[i].Cells["colDetectDesc"].Value = t.DETECT_ITEM_DESC; // GridQuality.Rows[i].Cells["colQuanVal"].Value = t.DETECT_QUAN_VALUE; // //GridQuality.Rows[i].Cells["colDetectRequire"].Value = t.QUAN_VALUE_REQUIRE; // //GridQuality.Rows[i].Cells["colImage"].Value = t.IMAGE_FILE; // GridQuality.Rows[i].Cells["colRemark"].Value = t.REMARK; // GridQuality.Rows[i].Cells["colDataUp"].Value = t.MAX_VALUE; // GridQuality.Rows[i].Cells["colDataDown"].Value = t.MIN_VALUE; // GridQuality.Rows[i].Cells["colDetectFlag"].Value = t.DETECT_FLAG; // ////DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)(GridQuality.Rows[i].Cells["colFaultCode"]); // ////List<DetectErrorItemEntity> errors = DetectErrorItemFactory.GetByDetectItemCode(station.WORKUNIT_CODE,t.DETECT_ITEM_CODE); // ////c.DataSource = errors; // ////c.DisplayMember = "ERROR_ITEM_NAME"; // ////c.ValueMember = "RMES_ID"; //} //if (GridQuality.Rows.Count > 0) //{ // RMESEventArgs args = new RMESEventArgs(); // args.MessageHead = "QUACTRL"; // args.MessageBody = ""; // SendDataChangeMessage(args); // ShowQualityList(); //} } else if (e.MessageHead.ToString() == "PLAN") { //PlanCode = e.MessageBody.ToString(); //SNDetectTempFactory.InitQualitDetectList(CompanyCode, PlineID, StationID, PlanCode, SN, UserID); ////this.GridQuality.DataSource = SNDetectTempFactory.GetBySNStation(SN, StationID); //StationEntity station = StationFactory.GetByKey(StationID); //List<SNDetectTempEntity> temp = SNDetectTempFactory.GetBySNStation(SN, StationID); //foreach (var t in temp) //{ // int i = GridQuality.Rows.Add(); // GridQuality.Rows[i].Cells["colRmesID"].Value = t.RMES_ID; // GridQuality.Rows[i].Cells["colDetectCode"].Value = t.DETECT_ITEM_CODE; // GridQuality.Rows[i].Cells["colDetectDesc"].Value = t.DETECT_ITEM_DESC; // GridQuality.Rows[i].Cells["colQuanVal"].Value = t.DETECT_QUAN_VALUE; // //GridQuality.Rows[i].Cells["colDetectRequire"].Value = t.QUAN_VALUE_REQUIRE; // //GridQuality.Rows[i].Cells["colImage"].Value = t.IMAGE_FILE; // GridQuality.Rows[i].Cells["colRemark"].Value = t.REMARK; // GridQuality.Rows[i].Cells["colDataUp"].Value = t.MAX_VALUE; // GridQuality.Rows[i].Cells["colDataDown"].Value = t.MIN_VALUE; // GridQuality.Rows[i].Cells["colDetectFlag"].Value = t.DETECT_FLAG; // //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)(GridQuality.Rows[i].Cells["colFaultCode"]); // //List<DetectErrorItemEntity> errors = DetectErrorItemFactory.GetByDetectItemCode(station.WORKUNIT_CODE, t.DETECT_ITEM_CODE); // //c.DataSource = errors; // //c.DisplayMember = "ERROR_ITEM_NAME"; // //c.ValueMember = "RMES_ID"; //} //if (GridQuality.Rows.Count > 0) //{ // RMESEventArgs args = new RMESEventArgs(); // args.MessageHead = "QUACTRL"; // args.MessageBody = ""; // SendDataChangeMessage(args); // ShowQualityList(); //} } else if (e.MessageHead.ToString() == "FOCUSDETECT") { //指定站点先防错 后采集数据 if (GridQuality.Rows.Count > 0) { if (StationName == "Z100" || StationName == "Z110" || StationName == "Z120") { GetFocus(0); } } } else if (e.MessageHead == "SCP" || e.MessageHead == "OFFLINE")//下线处理data_sn_detect { //this.GridQuality.DataSource = null; //ProductDataFactory.QualityControlComplete(CompanyCode, PlineCode, StationCode, PlanCode, SN); } else if (e.MessageHead == "SHOWDETECT") { SN = e.MessageBody.ToString(); ProductInfoEntity product = ProductInfoFactory.GetByCompanyCodeSNSingle(LoginInfo.CompanyInfo.COMPANY_CODE, SN); if (product == null) { return; } PlanCode = product.PLAN_CODE; PlanSo = product.PLAN_SO; Fdjxl = product.PRODUCT_SERIES; Gylx = product.ROUNTING_REMARK; stationcode_fx = StationCode; stationname_fx = StationName; //check中 显示BOM信息和检测数据 SNDetectTempFactory.InitQualitDetectList(CompanyCode, PlineID, StationID, PlanCode, SN, UserCode, StationID); string sql = "select * from data_sn_detect_data_TEMP where station_code='" + StationCode + "' and sn='" + SN + "' and plan_code='" + PlanCode + "' and detect_name!='LJTM' order by location_code,detect_seq "; DataTable dt = dataConn.GetTable(sql); if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dt.Rows.Add(dr); } this.GridQuality.DataSource = dt; ShowQualityList(); if (GridQuality.Rows.Count > 0) { PlanSnFactory.InitStationControl(CompanyCode, PlineID, StationID, product.PLAN_CODE, product.SN, "Rmes.WinForm.Controls.ctrlQualityDetect"); if (StationName == "Z100" || StationName == "Z110" || StationName == "Z120") { //指定站点先防错后采集数据 } else { GetFocus(0); } } else { arg.MessageHead = "INIT"; arg.MessageBody = ""; SendDataChangeMessage(arg); } SendBomConfirm2SN(); } else if (e.MessageHead == "SHOWDETECTFX1") { SN = e.MessageBody.ToString(); ProductInfoEntity product = ProductInfoFactory.GetByCompanyCodeSNSingle(LoginInfo.CompanyInfo.COMPANY_CODE, SN); if (product == null) { return; } PlanCode = product.PLAN_CODE; PlanSo = product.PLAN_SO; Fdjxl = product.PRODUCT_SERIES; Gylx = product.ROUNTING_REMARK; stationcode_fx = StationCode; stationname_fx = StationName; //check中 显示BOM信息和检测数据 //返修站点无需在往temp表中更新数据,在返修发动机上线时已经获取了历史记录,20161106 //如果需要实时检测数据,则要对检测数据进行删除和新增,在选择对应站点是进行处理 //SNDetectTempFactory.InitQualitDetectList(CompanyCode, PlineID, StationID, PlanCode, SN, UserCode, StationID); string sql = "select * from data_sn_detect_data_TEMP where sn='" + SN + "' and plan_code='" + PlanCode + "' and detect_name!='LJTM' order by location_code,detect_seq "; DataTable dt = dataConn.GetTable(sql); if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dt.Rows.Add(dr); } this.GridQuality.DataSource = dt; ShowQualityList(); if (GridQuality.Rows.Count > 0) { //PlanSnFactory.InitStationControl(CompanyCode, PlineID, StationID, product.PLAN_CODE, product.SN, "Rmes.WinForm.Controls.ctrlQualityDetect"); if (StationName == "Z100" || StationName == "Z110" || StationName == "Z120") { //指定站点先防错后采集数据 } else { GetFocus(0); } } else { arg.MessageHead = "INIT"; arg.MessageBody = ""; SendDataChangeMessage(arg); } //SendBomConfirm2SN(); } else if (e.MessageHead == "SHOWDETECT_FX") { try { //SN = e.MessageBody.ToString(); string item_info = e.MessageBody.ToString();//消息体是sn^stationcode^stationname string[] cmd_info = item_info.Split('^'); SN = cmd_info[0]; stationcode_fx = cmd_info[1]; stationname_fx = cmd_info[2]; StationEntity ent_st = StationFactory.GetBySTATIONCODE(stationcode_fx); string station_id1 = ent_st.RMES_ID; ProductInfoEntity product = ProductInfoFactory.GetByCompanyCodeSNSingle(LoginInfo.CompanyInfo.COMPANY_CODE, SN); if (product == null) { return; } PlanCode = product.PLAN_CODE; PlanSo = product.PLAN_SO; Fdjxl = product.PRODUCT_SERIES; Gylx = product.ROUNTING_REMARK; //check中 显示BOM信息和检测数据 SNDetectTempFactory.InitQualitDetectList(CompanyCode, PlineID, station_id1, PlanCode, SN, UserCode, StationID); string sql = "select * from data_sn_detect_data_TEMP where station_code='" + stationcode_fx + "' and sn='" + SN + "' and plan_code='" + PlanCode + "' and detect_name!='LJTM' order by location_code,detect_seq "; DataTable dt = dataConn.GetTable(sql); if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dt.Rows.Add(dr); } this.GridQuality.DataSource = dt; ShowQualityList(); if (GridQuality.Rows.Count > 0) { GetFocus(0); } else { arg.MessageHead = "INIT"; arg.MessageBody = ""; SendDataChangeMessage(arg); } SendBomConfirm2SN(); } catch { } } }