| | |
| | | else |
| | | { |
| | | string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString(); |
| | | this.txtHBath.Text = HProjectNum; |
| | | this.txtHBath.Text = HProjectNum.Split('-')[0]; |
| | | this.txtHBardCode.ReadOnly = true; |
| | | } |
| | | } |
| | |
| | | private void btnReadData_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | if (this.HEmpCode.Text == "" || this.txtHBath.Text == "") |
| | | if (this.HEmpCode.Text == "" || this.txtHBath.Text == ""|| this.HSouceName.Text == "") |
| | | { |
| | | |
| | | MessageBox.Show("请输入员工编码或者条形码!"); |
| | | MessageBox.Show("请输入生产资源,员工编码,者条形码!"); |
| | | } |
| | | else { |
| | | if (num == 0) |
| | | { |
| | | this.btnReadData.Text = "暂停"; |
| | | this.timer1.Enabled = true; |
| | | this.btnGH.Enabled = false; |
| | | this.btnSelect.Enabled = false; |
| | | num = 1; |
| | | } |
| | | else if (num == 1) |
| | | { |
| | | this.btnReadData.Text = "启动"; |
| | | this.timer1.Enabled = false; |
| | | this.btnGH.Enabled = true; |
| | | this.btnSelect.Enabled = true; |
| | | num = 0; |
| | | } |
| | | } |
| | |
| | | { |
| | | if (this.HEmpCode.Text == ""|| this.txtHBath.Text == "") |
| | | { |
| | | |
| | | MessageBox.Show("请输入员工编码或者条形码!"); |
| | | MessageBox.Show("请输入员工编码或者流转卡!"); |
| | | } |
| | | else |
| | | { |
| | |
| | | //读取csv格式文件 |
| | | private void ReadCsv() |
| | | { |
| | | string Date = DateTime.Now.ToString("yyMMdd"); |
| | | string HBath = this.txtHBath.Text; |
| | | string csv_file_path = $@"C:\Users\admin\Desktop\新建文件夹 (2)\20231123.csv"; |
| | | //string csv_file_path = $@"D:\THLCR_Data\{HBath}\20231123.csv"; |
| | | |
| | | //注:斯莫尔组装3 在E盘 _332009 |
| | | //其余在D盘 _C332001_2M |
| | | //string csv_file_path = $@"C:\Users\admin\Desktop\新建文件夹 (2)\20231123.csv"; |
| | | string csv_file_path = $@"D:\THLCR_Data\{HBath}\{HBath}_{Date}_C332001_2M.csv"; //组装1 组装2路径 |
| | | //string csv_file_path = $@"E:\THLCR_Data\{HBath}\{HBath}_{Date}_332009.csv"; //组装3路径 |
| | | |
| | | bool flag = File.Exists(csv_file_path); |
| | | |
| | | if (flag) |
| | |
| | | parser.Close(); |
| | | |
| | | //获取当前时间 |
| | | DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-100).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00")); |
| | | |
| | | foreach (DataRow item in dt.Rows) |
| | |
| | | DateTime NowTime = DateTime.Parse(item["测试时间"].ToString()); |
| | | string HBadCodeSN = item["序号"].ToString(); |
| | | |
| | | if (NowTime >= ActionTime && NowTime < EndTime && HBadCodeSN != "") |
| | | if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "") |
| | | { |
| | | |
| | | string HSourceCode = "9994";//设备编号 组装1 9994 组装2 9995 组装3 9996 |
| | | string HSourceCode = this.HSouce.Text; //设备编号 组装1 9994 组装2 9995 组装3 9996 |
| | | string HEmpCode = this.HEmpCode.Text; |
| | | string HBarCode = item["序号"].ToString(); |
| | | string HCreateTime = item["测试时间"].ToString(); |
| | | string HDate = DateTime.Parse(item["测试时间"].ToString()).ToString("yyyy-MM-dd"); |
| | | string HResult = item["分选"].ToString() == "PASS" ? "OK" : "NG"; |
| | | string HProcNumber = "105"; |
| | | string HProcNumber = "005"; |
| | | int HFlag = 0; |
| | | //string HEmpCode = ""; |
| | | if (HBadCodeSN != "") |
| | |
| | | |
| | | for (int i = 0; i < dt.Columns.Count; i++) |
| | | { |
| | | if (dt.Columns[i].ColumnName.Contains("Ls")) |
| | | if (dt.Columns[i].ColumnName.Contains("Hz")) |
| | | { |
| | | string HType = dt.Columns[i].ColumnName; |
| | | string HCount = item[HType].ToString(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //生产资源回车 |
| | | private void HSouce_KeyDown(object sender, KeyEventArgs e) |
| | | { |
| | | if (e.KeyCode == Keys.Enter) |
| | | { |
| | | SelectHSouc(this.HSouce.Text); |
| | | } |
| | | } |
| | | |
| | | //查询生产资源 |
| | | public void SelectHSouc(string HNumber) |
| | | { |
| | | try |
| | | { |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_Source where HNumber='" + HNumber + "' ", "Gy_Source"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("查无数据!"); |
| | | } |
| | | else |
| | | { |
| | | string HSouceName = ds.Tables[0].Rows[0]["HName"].ToString(); |
| | | string HSouceNumber = ds.Tables[0].Rows[0]["HNumber"].ToString(); |
| | | this.HSouceName.Text = HSouceName; |
| | | this.HSouce.Text = HSouceNumber; |
| | | this.HSouce.ReadOnly = true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show(this, e.Message, "提示"); |
| | | } |
| | | } |
| | | } |
| | | } |