private void button_enter_Click(object sender, EventArgs e) { //回车,清楚末尾无用的. if (this.Textbox_display.Text.Contains(".") && this.Textbox_display.Text.LastIndexOf('.') == this.Textbox_display.Text.Length - 1) { this.Textbox_display.Text = this.Textbox_display.Text.Substring(0, this.Textbox_display.Text.Length - 1); } //判断输入法内容是否包含"." if (Textbox_display.Text.Contains(".")) { try { //将数字专程float类型 为了转换如"3."格式的数字 float tempf = Convert.ToSingle(Textbox_display.Text); Textbox_display.Text = tempf.ToString(); } catch { Textbox_display.Text = "0"; } } //鼠标焦点所在的TextBox控件不为空 if (inputTxt != null) { //设置输入框的内容为输入法输入的内容 inputTxt.Text = this.Textbox_display.Text.Trim(); //将输入法内容清空 this.Textbox_display.Text = ""; //获取鼠标焦点所在的TextBox控件 string inputTxtName = inputTxt.Name; try { //如果鼠标焦点所在的TextBox控件名称为空 if (string.IsNullOrWhiteSpace(inputTxtName)) { return; } //判断输入的内容是否为数字 if (!CommonUtil.IsNumeric(inputTxt.Text)) { //如果输入为合格 if (inputTxt.Text.Contains("不合格")) { //设置输入框标红 inputTxt.BackColor = Color.LightCoral; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = false; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = false; } } else { //设置输入框不标红 inputTxt.BackColor = Color.White; //如果为表单页面 if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = true; } else if (flag == 1)//如果为修改页面 { //判断测量项是否合格的集合中是否存在该测量项 if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = true; } } return; } //当前输入框得类型,0代表时最大值、最小值和均值,1代表椭圆度 int tbType=0; //如果控件名包含以下字符则将这些字符替换为空 if (inputTxtName.Contains("_A_Value")) inputTxtName = inputTxtName.Replace("_A_Value", ""); else if (inputTxtName.Contains("_B_Value")) inputTxtName = inputTxtName.Replace("_B_Value", ""); else if (inputTxtName.Contains("_MaxA_Value")) inputTxtName = inputTxtName.Replace("_MaxA_Value", ""); else if (inputTxtName.Contains("_MaxB_Value")) inputTxtName = inputTxtName.Replace("_MaxB_Value", ""); else if (inputTxtName.Contains("_MinA_Value")) inputTxtName = inputTxtName.Replace("_MinA_Value", ""); else if (inputTxtName.Contains("_MinB_Value")) inputTxtName = inputTxtName.Replace("_MinB_Value", ""); else if (inputTxtName.Contains("_AvgA")) inputTxtName = inputTxtName.Replace("_AvgA", ""); else if (inputTxtName.Contains("_AvgB")) inputTxtName = inputTxtName.Replace("_AvgB", ""); else if (inputTxtName.Contains("_OvalityA")) { inputTxtName = inputTxtName.Replace("_OvalityA", ""); tbType = 1; } else if (inputTxtName.Contains("_OvalityB")) { inputTxtName = inputTxtName.Replace("_OvalityB", ""); tbType = 1; } //找到该测量项的值范围、和椭圆度最大值 float maxVal = 0, minVal = 0, txtVal = float.MaxValue, maxOvality = 0, sdVal = 0; Dictionary<string, string> dic = null; if (flag == 0) { if(ThreadingForm.measureInfoDic.ContainsKey(inputTxtName)) dic = ThreadingForm.measureInfoDic[inputTxtName]; } else if (flag == 1) { if(DetailForm.measureInfoDic.ContainsKey(inputTxtName)) dic = DetailForm.measureInfoDic[inputTxtName]; } if (dic != null) { string item_max_value = null, item_min_value = null, ovality_max = null, item_std_value = null; if (dic.ContainsKey("item_max_value")) { item_max_value = Convert.ToString(dic["item_max_value"]); if (CommonUtil.IsNumeric(item_max_value)) maxVal = Convert.ToSingle(item_max_value); } if (dic.ContainsKey("item_min_value")) { item_min_value = Convert.ToString(dic["item_min_value"]); if (CommonUtil.IsNumeric(item_min_value)) minVal = Convert.ToSingle(dic["item_min_value"]); } if (dic.ContainsKey("ovality_max")) { ovality_max = Convert.ToString(dic["ovality_max"]); if (CommonUtil.IsNumeric(ovality_max)) maxOvality = Convert.ToSingle(dic["ovality_max"]); } if (dic.ContainsKey("item_std_value")) { item_std_value = Convert.ToString(dic["item_std_value"]); if (CommonUtil.IsNumeric(item_std_value)) sdVal = Convert.ToSingle(dic["item_std_value"]); } } if (!string.IsNullOrWhiteSpace(inputTxt.Text.Trim())) { txtVal = Convert.ToSingle(inputTxt.Text.Trim()); } if (txtVal!=float.MaxValue) { //如果输入法输入的值不符合标准 if (txtVal < minVal || txtVal > maxVal) { //设置存放测量值的输入框的背景色 inputTxt.BackColor = Color.LightCoral; //如果该集合中包含该控件的名称 if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) { ThreadingForm.qualifiedList[inputTxtName] = false; } } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) { DetailForm.qualifiedList[inputTxtName] = false; } } } else { inputTxt.BackColor = Color.White; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) { ThreadingForm.qualifiedList[inputTxtName] = true; } } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) { DetailForm.qualifiedList[inputTxtName] = true; } } } } //找到该测量项A端、B端最大值、最小值,然后判断是否存在均值和椭圆度 TextBox txtMaxOfA = null, txtMaxOfB = null, txtMinOfA = null, txtMinOfB = null, tbAvgOfA = null, tbOvalityA = null, tbAvgOfB = null, tbOvalityB = null; if (flag == 0) { if(ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_MaxA_Value")) txtMaxOfA = ThreadingForm.controlTxtDir[inputTxtName + "_MaxA_Value"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_MaxB_Value")) txtMaxOfB = ThreadingForm.controlTxtDir[inputTxtName + "_MaxB_Value"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_MinA_Value")) txtMinOfA = ThreadingForm.controlTxtDir[inputTxtName + "_MinA_Value"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_MinB_Value")) txtMinOfB = ThreadingForm.controlTxtDir[inputTxtName + "_MinB_Value"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_AvgA")) tbAvgOfA = ThreadingForm.controlTxtDir[inputTxtName + "_AvgA"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_AvgB")) tbAvgOfB = ThreadingForm.controlTxtDir[inputTxtName + "_AvgB"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_OvalityA")) tbOvalityA = ThreadingForm.controlTxtDir[inputTxtName + "_OvalityA"]; if (ThreadingForm.controlTxtDir.ContainsKey(inputTxtName + "_OvalityB")) tbOvalityB = ThreadingForm.controlTxtDir[inputTxtName + "_OvalityB"]; } else if (flag == 1) { if(DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_MaxA_Value")) txtMaxOfA = DetailForm.controlTxtDir[inputTxtName + "_MaxA_Value"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_MaxB_Value")) txtMaxOfB = DetailForm.controlTxtDir[inputTxtName + "_MaxB_Value"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_MinA_Value")) txtMinOfA = DetailForm.controlTxtDir[inputTxtName + "_MinA_Value"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_MinB_Value")) txtMinOfB = DetailForm.controlTxtDir[inputTxtName + "_MinB_Value"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_AvgA")) tbAvgOfA = DetailForm.controlTxtDir[inputTxtName + "_AvgA"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_AvgB")) tbAvgOfB = DetailForm.controlTxtDir[inputTxtName + "_AvgB"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_OvalityA")) tbOvalityA = DetailForm.controlTxtDir[inputTxtName + "_OvalityA"]; if (DetailForm.controlTxtDir.ContainsKey(inputTxtName + "_OvalityB")) tbOvalityB = DetailForm.controlTxtDir[inputTxtName + "_OvalityB"]; } //判断输入的数值是否合理 bool reasonableFlag = false; switch (tbType) { case 0: if (maxVal != 0) { if (maxVal * 10 < txtVal) reasonableFlag = true; } else { if (txtVal > 10 || txtVal < -10) reasonableFlag = true; } break; case 1: if (maxOvality != 0) { if (maxOvality > 0 && maxOvality * 10 < txtVal) reasonableFlag = true; } else { if (maxOvality+10<txtVal) reasonableFlag = true; } break; } if (reasonableFlag) { MessagePrompt.Show("输入的数据偏差过大, 请检查!"); } //如果测量项A端最大值、最小值不为空 if (txtMaxOfA != null && !string.IsNullOrWhiteSpace(txtMaxOfA.Text) && txtMinOfA != null && !string.IsNullOrWhiteSpace(txtMinOfA.Text)) { //获取均值 float avg = ((Convert.ToSingle(txtMaxOfA.Text) + Convert.ToSingle(txtMinOfA.Text)) / 2); //判断均值是否符合要求 if (tbAvgOfA != null) { //如果均值不符合标准 if (avg < minVal || avg > maxVal) { //设置显示均值的label控件的标红 tbAvgOfA.BackColor = Color.LightCoral; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = false; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = false; } } else { tbAvgOfA.BackColor = Color.White; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = true; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = true; } } tbAvgOfA.Text = Convert.ToString(Math.Round(avg, 3)); } //获取该测量项显示椭圆度的TextBox控件 //如果显示椭圆度的label控件存在 if (tbOvalityA != null) { float ovality = float.MaxValue; //计算该测量项的椭圆度 if (sdVal!=0) ovality = (Convert.ToSingle(txtMaxOfA.Text) - Convert.ToSingle(txtMinOfA.Text)) / sdVal; //如果该测量项A端椭圆度不符合标准 if ((ovality > maxOvality || ovality < 0)&&ovality!=float.MaxValue) { //同上 tbOvalityA.BackColor = Color.LightCoral; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = false; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = false; } } else { tbOvalityA.BackColor = Color.White; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = true; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = true; } } tbOvalityA.Text = Convert.ToString(Math.Round(ovality, 3)); } } //同上 if (txtMaxOfB != null && !string.IsNullOrWhiteSpace(txtMaxOfB.Text) && txtMinOfB != null && !string.IsNullOrWhiteSpace(txtMinOfB.Text)) { float avg = ((Convert.ToSingle(txtMaxOfB.Text) + Convert.ToSingle(txtMinOfB.Text)) / 2); if (tbAvgOfB != null) { if (avg < minVal || avg > maxVal) { tbAvgOfB.BackColor = Color.LightCoral; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) { ThreadingForm.qualifiedList[inputTxtName] = false; } } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) { DetailForm.qualifiedList[inputTxtName] = false; } } } else { tbAvgOfB.BackColor = Color.White; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = true; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = true; } } tbAvgOfB.Text = Convert.ToString(Math.Round(avg, 3)); } //判断椭圆度是否满足要求 if (tbOvalityB != null) { float ovality = float.MaxValue; if(sdVal!=0) ovality = (Convert.ToSingle(txtMaxOfB.Text) - Convert.ToSingle(txtMinOfB.Text)) / sdVal; if ((ovality > maxOvality || ovality < 0)&&ovality!=float.MaxValue) { tbOvalityB.BackColor = Color.LightCoral; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = false; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = false; } } else { tbOvalityB.BackColor = Color.White; if (flag == 0) { if (ThreadingForm.qualifiedList.ContainsKey(inputTxtName)) ThreadingForm.qualifiedList[inputTxtName] = true; } else if (flag == 1) { if (DetailForm.qualifiedList.ContainsKey(inputTxtName)) DetailForm.qualifiedList[inputTxtName] = true; } } tbOvalityB.Text = Convert.ToString(Math.Round(ovality, 3)); } } } catch (Exception ex) { //Console.WriteLine("英文键盘回车时出错,错误信息:" + ex.Message); } finally //跳转到下一个输入框 { //查询鼠标焦点所在的TextBox控件在控件集合中的索引 TextBox tb = null;int index =0; if (flag == 0) { if (ThreadingForm.flpTabTwoTextBoxList != null) { index = ThreadingForm.flpTabTwoTextBoxList.IndexOf(inputTxt); if (index != -1) { if (index < ThreadingForm.flpTabTwoTextBoxList.Count - 1) index++; if (ThreadingForm.flpTabTwoTextBoxList.Count > 0) tb = ThreadingForm.flpTabTwoTextBoxList[index]; } } } else if (flag == 1) { if (DetailForm.flpTabTwoTextBoxList != null) { index = DetailForm.flpTabTwoTextBoxList.IndexOf(inputTxt); if (index != -1) { if (index < DetailForm.flpTabTwoTextBoxList.Count - 1) index++; if (DetailForm.flpTabTwoTextBoxList.Count > 0) tb = DetailForm.flpTabTwoTextBoxList[index]; } } } //设置鼠标焦点在控件集合索引为index的控件上 if (tb != null) tb.Focus(); } } }
private static void UploadVideo() { try { //获取程序中的根路径(bin目录,basePath格式如:C:\Workspace\YYOPInspectionClient\YYOPInspectionClient\bin\) string basePath = Application.StartupPath + "\\"; //ffmpeg.exe用于转换视频格式 string ffmpegPath = basePath + "ffmpeg.exe"; //bin目录下的done文件下的视频文件为可上传视频文件 string donePath = basePath + "done"; //先判断done目录是否存在,不存在则创建文件 if (!Directory.Exists(donePath)) { Directory.CreateDirectory(donePath); } //定义目录对象 DirectoryInfo folder = new DirectoryInfo(donePath); FileInfo[] files = null; while (true) { //每执行一次循环,线程休眠5秒中 Thread.Sleep(5000); try { //获取done目录下所有以.mp4结尾的视频文件 files = folder.GetFiles("*.mp4"); //如果done目录下有视频文件 if (files.Length > 0) { //遍历done目录下所有的视频文件 foreach (FileInfo file in files) { //判断当前视频文件是否在另一个线程中在占用(因为有可能视频格式刚转化完,正由其他目录转到done目录中) if (!CommonUtil.FileIsUsed(file.FullName)) { //如果文件大小大于0,则开始编码然后上传到服务器,否则删除文件 if (file.Length > 0) { //判断当前视频是否已经转化格式 if (!file.Name.Contains("vcr")) { //开始转换视频格式 CommonUtil.FormatAndUploadVideo(ffmpegPath, donePath, file.FullName); } else { //开始上传转换后的视频文件() if (CommonUtil.uploadVideoToTomcat(file.FullName)) { //上传完成删除本地视频文件 File.Delete(file.FullName); } } } else { //如果文件大小为空可能为垃圾文件 File.Delete(file.FullName); } } } } } catch (Exception exx) { } } } catch (Exception e) { //Console.WriteLine("上传视频出错,错误信息:"+e.Message); } }
public void getThreadingProcessData() { try { //封装查询螺纹检验记录的参数(参数依次是:操作工工号、班别、班次、合同号、接箍类型、外径、壁厚、炉号、试批号、开始日期、结束日期) JObject jsonData = new JObject { { "operator_no", this.txtOperatorno.Text.Trim() }, { "production_crew", this.cmbProductionCrew.Text.Trim() }, { "production_shift", this.cmbProductionShift.Text.Trim() }, { "contract_no", this.cmbContractNo.Text.Trim() }, { "threading_type", this.cmbThreadingType.Text.Trim() }, { "od", this.cmbOd.Text.Trim() }, { "wt", this.cmbWt.Text.Trim() }, { "pipe_heat_no", this.cmbPipeHeatNo.Text.Trim() }, { "pipe_lot_no", this.cmbPipeLotNo.Text.Trim() }, { "beginTime", this.dateTimePicker1.Value.ToString("yyyy-MM-dd") }, { "endTime", this.dateTimePicker2.Value.ToString("yyyy-MM-dd") } }; ASCIIEncoding encoding = new ASCIIEncoding(); String content = null; byte[] data = encoding.GetBytes(jsonData.ToString()); string url = CommonUtil.getServerIpAndPort() + "ThreadingOperation/getThreadInspectionRecordOfWinform.action"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.KeepAlive = false; request.Method = "POST"; request.ContentType = "application/json;characterSet:UTF-8"; request.ContentLength = data.Length; using (Stream sm = request.GetRequestStream()) { sm.Write(data, 0, data.Length); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamResponse = response.GetResponseStream(); using (StreamReader sr = new StreamReader(streamResponse)) { content = sr.ReadToEnd(); } response.Close(); if (content != null) { JObject jobject = JObject.Parse(content); string rowsJson = jobject["rowsData"].ToString(); if (!rowsJson.Trim().Contains("{}")) { //将搜索到json格式的螺纹检验数据转换成对象 List <ThreadInspectionRecord> list = JsonConvert.DeserializeObject <List <ThreadInspectionRecord> >(rowsJson); foreach (ThreadInspectionRecord item in list) { //此时item.Inspection_time格式如:1531909218000,需转换成用户可读的时间类型 item.Inspection_time = CommonUtil.ConvertTimeStamp(item.Inspection_time); } //设置dataGridView数据源为list集合 this.dataGridView1.DataSource = list; } else { this.dataGridView1.DataSource = null; } } } catch (Exception e) { //throw e; } }
public void excuteDelteInspectionRecord(int index) { try { //获取删除选中行的检验记录编号 object obj1 = this.dataGridView1.Rows[index].Cells["thread_inspection_record_code"].Value; if (obj1 == null) { MessagePrompt.Show("删除失败!"); return; } string thread_inspection_record_code = obj1.ToString(); JObject jsonData = new JObject { { "thread_inspection_record_code", thread_inspection_record_code } }; ASCIIEncoding encoding = new ASCIIEncoding(); String content = ""; byte[] data = encoding.GetBytes(jsonData.ToString()); string url = CommonUtil.getServerIpAndPort() + "ThreadingOperation/delThreadInspectionRecordOfWinform.action"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.KeepAlive = false; request.Method = "POST"; request.ContentType = "application/json;characterSet:UTF-8"; request.ContentLength = data.Length; using (Stream sm = request.GetRequestStream()) { sm.Write(data, 0, data.Length); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamResponse = response.GetResponseStream(); StreamReader streamRead = new StreamReader(streamResponse, Encoding.UTF8); Char[] readBuff = new Char[1024]; int count = streamRead.Read(readBuff, 0, 1024); while (count > 0) { String outputData = new String(readBuff, 0, count); content += outputData; count = streamRead.Read(readBuff, 0, 1024); } response.Close(); string jsons = content; if (jsons == null) { MessagePrompt.Show("删除失败!"); return; } JObject jobject = JObject.Parse(jsons); string rowsJson = jobject["rowsData"].ToString(); if (rowsJson.Trim().Contains("{}")) { MessagePrompt.Show("删除失败!"); return; } if (rowsJson.Contains("True")) { MessagePrompt.Show("删除成功!"); //刷新检验记录列表(dataGridView) getThreadingProcessData(); } else { MessagePrompt.Show("删除失败!"); } } catch (Exception ex) { MessagePrompt.Show("删除失败,失败原因:" + ex.Message); } }
private void getSearchParam() { try { JObject json = new JObject { }; ASCIIEncoding encoding = new ASCIIEncoding(); String content = null; byte[] data = encoding.GetBytes(json.ToString()); string url = CommonUtil.getServerIpAndPort() + "Contract/getAllContractNoOfWinform.action"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.KeepAlive = false; request.Method = "POST"; request.ContentType = "application/json;characterSet:UTF-8"; request.ContentLength = data.Length; using (Stream sm = request.GetRequestStream()) { sm.Write(data, 0, data.Length); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamResponse = response.GetResponseStream(); using (StreamReader sr = new StreamReader(streamResponse)) { content = sr.ReadToEnd(); } response.Close(); if (content != null) { JObject jobject = JObject.Parse(content); string rowsJson = jobject["rowsData"].ToString(); //将获取到的json格式的合同信息转成List对象 List <ContractInfo> list = JsonConvert.DeserializeObject <List <ContractInfo> >(rowsJson); //添加空白选项 this.cmbContractNo.Items.Add(""); this.cmbOd.Items.Add(""); this.cmbWt.Items.Add(""); this.cmbThreadingType.Items.Add(""); this.cmbPipeHeatNo.Items.Add(""); this.cmbPipeLotNo.Items.Add(""); //遍历合同信息集合 foreach (ContractInfo item in list) { //如果合同编号不为空 if (!string.IsNullOrWhiteSpace(item.Contract_no)) { //如果合同编号下拉框没有当前合同编号 if (!cmbContractNo.Items.Contains(item.Contract_no)) { //添加当前合同编号到合同编号下拉框中 this.cmbContractNo.Items.Add(item.Contract_no); } } //追加外径到外径下拉框中 if (!string.IsNullOrWhiteSpace(item.Od)) { if (!this.cmbOd.Items.Contains(item.Od)) { this.cmbOd.Items.Add(item.Od); } } //追加壁厚到壁厚下拉框中 if (!string.IsNullOrWhiteSpace(item.Wt)) { if (!this.cmbWt.Items.Contains(item.Wt)) { this.cmbWt.Items.Add(item.Wt); } } //追加螺纹类型到螺纹类型下拉框中 if (!string.IsNullOrWhiteSpace(item.Threading_type)) { if (!this.cmbThreadingType.Items.Contains(item.Threading_type)) { this.cmbThreadingType.Items.Add(item.Threading_type); } } //追加炉号到炉号下拉框中 if (!string.IsNullOrWhiteSpace(item.Pipe_heat_no)) { if (!this.cmbPipeHeatNo.Items.Contains(item.Pipe_heat_no)) { this.cmbPipeHeatNo.Items.Add(item.Pipe_heat_no); } } //追加试批号到试批号下拉框中 if (!string.IsNullOrWhiteSpace(item.Pipe_lot_no)) { if (!this.cmbPipeLotNo.Items.Contains(item.Pipe_lot_no)) { this.cmbPipeLotNo.Items.Add(item.Pipe_lot_no); } } } //设置主窗体搜索参数下拉框默认选择第一条空白选项 this.cmbProductionCrew.SelectedIndex = 0; this.cmbProductionShift.SelectedIndex = 0; this.cmbContractNo.SelectedIndex = 0; this.cmbOd.SelectedIndex = 0; this.cmbWt.SelectedIndex = 0; this.cmbThreadingType.SelectedIndex = 0; this.cmbPipeHeatNo.SelectedIndex = 0; this.cmbPipeLotNo.SelectedIndex = 0; this.cmbPipeHeatNo.SelectedIndex = 0; } } catch (Exception e) { //MessagePrompt.Show("获取查询条件时出错,错误原因:" + e.Message); } }