private void deleteCoil(CoilPoint p) { Global.coils.Remove(p); dtFrame.Rows[p.row][p.col] = ""; dataGrid2.DataSource = dtFrame; }
private void addCoil(CoilPoint p, string text) { if (p.row >= 0) { if (Global.coils.ContainsKey(p)) { if (Global.coils[p].clh != "") { frmMessage frmMessage = new frmMessage(); if (Global.coils[p].clh != text) { frmMessage.ShowDialog("当前位置已经存在板坯!", "提示", "确定"); } else { frmMessage.ShowDialog("是否取消当前位置上的板坯?", "选择", "是", "否"); if (frmMessage.ret == true) { deleteCoil(p); } } frmMessage.Dispose(); } else { doScanSesult(Global.curFrame.KZ, p, text, DateTime.Now.ToString("yyyyMMddHHmmss")); } } else { doScanSesult(Global.curFrame.KZ, p, text, DateTime.Now.ToString("yyyyMMddHHmmss")); } } }
private void addResult(string barcode, string text) //barcode条码材料号 { if (text.Length == 7) //扫描凹槽条码 { curPoint = new CoilPoint(Global.curFrame.KJH, text); dataGrid2.Invalidate(); } else//扫描材料号 { bool bval = false; foreach (KeyValuePair <CoilPoint, Coil> kv in Global.coils)//CoilPoint键,Coil值 { if (kv.Value.clh == barcode) { if (kv.Key.Equals(curPoint) == false) { bval = true; curPoint = kv.Key; dataGrid2.Invalidate(); } } } if (bval == false) { addCoil(curPoint, barcode); } } }
private void CheckCellColor(object sender, DataGridEnableEventArgs e) { if (curPoint.row == e.Row && curPoint.col == e.Column && curPoint.row != -1) { e.MeetsCriteria = true; e.BackColor = Color.Orange; e.ForeColor = SystemColors.WindowText; } else { string clh = dtFrame.Rows[e.Row][e.Column].ToString(); CoilPoint p = new CoilPoint(Global.curFrame.KJH, e.Row, e.Column); if (Global.coils.ContainsKey(p)) //有占位信息 { if (Global.coils[p].scantime != "") //材料经过比对 { if (Global.coils[p].qa != "") { e.MeetsCriteria = true; e.BackColor = Color.BlueViolet; e.ForeColor = SystemColors.WindowText; } else { if (Global.coils[p].scanflag == 1)//材料比对成功 { e.MeetsCriteria = true; e.BackColor = Color.PaleGreen; e.ForeColor = SystemColors.WindowText; } else if (Global.coils[p].scanflag == 0)//材料比对失败 { e.MeetsCriteria = true; e.BackColor = Color.LightSalmon; e.ForeColor = SystemColors.WindowText; } } } else { e.MeetsCriteria = true; e.BackColor = Color.SkyBlue; e.ForeColor = SystemColors.WindowText; } } else { e.MeetsCriteria = true; e.BackColor = Color.Cornsilk; if (e.Column == 0) { e.ForeColor = Color.Red; } else { e.ForeColor = SystemColors.WindowText; } } } }
public void Show(string clh, string qa, CoilPoint p) { this.clh = clh; this.qa = qa; this.p = p; this.Show(); }
//加载末端库框架配载图 private void loadFrameLayout10(string sFrameID) { string sql = "select Location,CLH,RKB,SteelDiameter from FrameLayout where FrameID='" + sFrameID + "' and Mold='10'"; DataTable dt = SqlCe.ExecuteQuery(sql); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Location"].ToString().Length == 7) { string clh = dt.Rows[i]["CLH"].ToString(); if (!clh.Equals("")) { CoilPoint p = new CoilPoint(sFrameID, dt.Rows[i]["Location"].ToString()); if (clh.Length > 8) { dtFrame.Rows[p.row][p.col] = clh.Substring(clh.Length - 8, 8); } else { dtFrame.Rows[p.row][p.col] = clh; } Coil coil = new Coil(p, clh); coil.kb = dt.Rows[i]["RKB"].ToString(); coil.diameter = dt.Rows[i]["SteelDiameter"].ToString(); Global.coils.Add(p, coil); } } } dt.Dispose(); }
private void doScanSesult(string kz, CoilPoint p, string text, string scantime) { DataTable dt = new DataTable(); if (Global.curFrame.KZ == "重") { dt = SearchImpCoil(text); ScanImpCoilResult(p, text, scantime, dt); } else if (Global.curFrame.KZ == "空" || Global.curFrame.KZ == "拼") { dt = SearchExpCoil(text); ScanExpCoilResult(p, text, scantime, dt); } dt.Dispose(); }
private void LoadData() { Global.coils.Clear(); #if InterfaceTest newFrameLayout(6); #else newFrameLayout(Global.curFrame.MaxRow); #endif if (Global.curFrame.KZ == "重")//入库作业 { //loadFrameLayout10(Global.curFrame.KJH); } loadFrameLayout20(Global.curFrame.KJH, Global.curFrame.KZ); curPoint = new CoilPoint(Global.curFrame.KJH, -1, -1); //PrintField(); this.dataGrid2.DataSource = dtFrame; CheckCellEventHandler cellEvent = new CheckCellEventHandler(CheckCellColor); DataGridTableStyle tablestyle = new DataGridTableStyle(); tablestyle.GridColumnStyles.Add(new ColumnStyle(0, "X", "X", 28, "", cellEvent)); tablestyle.GridColumnStyles.Add(new ColumnStyle(1, "L", "L", 206, "", cellEvent)); //tablestyle.GridColumnStyles.Add(new ColumnStyle(2, "R", "R", 103, "", cellEvent)); this.dataGrid2.TableStyles.Add(tablestyle); if (Global.curFrame.MaxRow == 6) { SetGridRowHeight(dataGrid2, 0, 45); SetGridRowHeight(dataGrid2, 1, 45); SetGridRowHeight(dataGrid2, 2, 45); SetGridRowHeight(dataGrid2, 3, 40); SetGridRowHeight(dataGrid2, 4, 40); SetGridRowHeight(dataGrid2, 5, 40); SetGridRowHeight(dataGrid2, 6, 38); SetGridRowHeight(dataGrid2, 7, 38); dataGrid2.Invalidate(); } }
private void ScanExpCoilResult(CoilPoint p, string text, string scantime, DataTable dt) { //curcoil = new Coil(p, text); int scanflag = 0; string zzdy = ""; //制造单元 if (dt.Rows.Count > 0) { scanflag = 1; zzdy = dt.Rows[0]["Make"].ToString(); } if (Global.coils.ContainsKey(p)) { Global.coils[p].scanflag = scanflag; Global.coils[p].scantime = scantime; //Global.coils[p].clh = text; Global.coils[p].zzdy = zzdy; } //else //{ // curcoil.scanflag = scanflag; // curcoil.scantime = scantime; // curcoil.zzdy = zzdy; // Global.coils.Add(p, curcoil); //} //if (text.Length > 8) //{ // dtFrame.Rows[p.row][p.col] = text.Substring(text.Length - 8, 8); //} //else //{ // dtFrame.Rows[p.row][p.col] = text; //} //dataGrid1.DataSource = dtFrame; dataGrid2.Invalidate(); if (scanflag == 1) { PsionTeklogix.Sound.Beeper.Beeper.PlayTone(5000, 500, 100); string sql = "update exportstorageacceptorder set scantime='" + scantime + "', wcflag=1 where clh2='" + text + "'"; SqlCe.ExecuteNonQuery(sql); } }
//计划号下载 //string stringSlabDownLoadDataFile = ""; private void downLoad_Click(object sender, EventArgs e) { //string strPlan = "";//计划号 //SlabWebservice.PileData[] ServiceSlabYardData = AllCode.serviceSlabYard.GetColumnData(strPlan); //string[] stringArrSlabYardData = new string[ServiceSlabYardData.Length]; //for (int inta = 0; inta < ServiceSlabYardData.Length; inta++) //{ // string[] stringArrDataThis = new string[6]; // stringArrDataThis[0] = ServiceSlabYardData[inta].ColumnNo; // stringArrDataThis[1] = ServiceSlabYardData[inta].DeterminFlag.ToString (); // stringArrDataThis[2] = ServiceSlabYardData[inta].LayerNO; // stringArrDataThis[3] = ServiceSlabYardData[inta].MaterialNO; // stringArrDataThis[4] = ServiceSlabYardData[inta].PileNO; // stringArrDataThis[5] = ServiceSlabYardData[inta].POHO; // stringArrDataThis[6] = ServiceSlabYardData[inta].RowNo; // stringArrSlabYardData[inta] = DBopt.CombineString(stringArrDataThis);//组合字符串 //} /////////////////////////// List <string[]> test = new List <string[]>(); //缓存web查询信息 test.Clear(); String[] str1 = { "1", "23123123", "abc" }; String[] str2 = { "2", "23456789", "abc" }; String[] str3 = { "3", "11111111", "abc" }; test.Add(str1); test.Add(str2); test.Add(str3); int countX = test.Count; label4.Text = "6"; label6.Text = countX.ToString(); for (int i = 0; i < countX; i++) { int j = Convert.ToInt32(test[i][0]); curPoint = new CoilPoint(Global.curFrame.KJH, j, 1); addCoil(curPoint, test[i][1]); } }
private void dataGrid2_Click(object sender, EventArgs e) { if (dataGrid2.CurrentCell.Equals(null)) { return; } if (dataGrid2.CurrentCell.ColumnNumber > 0) { curPoint = new CoilPoint(Global.curFrame.KJH, dataGrid2.CurrentCell.RowNumber, dataGrid2.CurrentCell.ColumnNumber); if (dtFrame.Rows[curPoint.row][curPoint.col].ToString() != "") { curcoil = Global.coils[curPoint]; } else { curcoil = null; } } dataGrid2.Invalidate(); }
private void loadFrameLayout20(string sFrameID, string kz) { string sql = ""; if (kz == "重") { sql = "select Location,CLH,Relative_X,Relative_Y,CLH,RKB,SteelWide,SteelDiameter from FrameLayout where FrameID='" + sFrameID + "' and Mold='20' order by Relative_X"; } else { sql = "select Location,CLH,Relative_X,Relative_Y,CLH,CKB,SteelWide,SteelDiameter from FrameLayoutExp where FrameID='" + sFrameID + "' order by Relative_X"; } DataTable dt = SqlCe.ExecuteQuery(sql); if (kz == "重") { int[] colIndex = new int[Global.curFrame.MaxRow]; for (int i = 0; i < Global.curFrame.MaxRow; i++) { colIndex[i] = 0; } for (int i = 0; i < dt.Rows.Count; i++) { int X = Convert.ToInt32(dt.Rows[i]["Relative_X"]); int Y = Convert.ToInt32(dt.Rows[i]["Relative_Y"]); int row = Y / Global.curFrame.Space; int col = colIndex[row] + 1; if (col <= 2) { CoilPoint p = new CoilPoint(sFrameID, row, col); if (Global.coils.ContainsKey(p)) { Global.coils[p].X = X; Global.coils[p].Y = Y; Global.coils[p].diameter = dt.Rows[i]["SteelDiameter"].ToString(); Global.coils[p].wide = dt.Rows[i]["SteelWide"].ToString(); } else { Coil coil = new Coil(p, ""); coil.X = X; coil.Y = Y; coil.diameter = dt.Rows[i]["SteelDiameter"].ToString(); coil.wide = dt.Rows[i]["SteelWide"].ToString(); Global.coils.Add(p, coil); } colIndex[row] = col; } } } else if (kz == "空" || kz == "拼") { for (int i = 0; i < dt.Rows.Count; i++) { int X = Convert.ToInt32(dt.Rows[i]["Relative_X"]); int Y = Convert.ToInt32(dt.Rows[i]["Relative_Y"]); string Location = dt.Rows[i]["Location"].ToString(); string clh = dt.Rows[i]["CLH"].ToString(); string kb = dt.Rows[i]["CKB"].ToString(); CoilPoint p = new CoilPoint(sFrameID, Location); if (clh.Length > 8) { dtFrame.Rows[p.row][p.col] = clh.Substring(clh.Length - 8, 8); } else { dtFrame.Rows[p.row][p.col] = clh; } //if (Global.coils.ContainsKey(p)) //{ // Global.coils[p].X = X; // Global.coils[p].Y = Y; // Global.coils[p].clh = clh; // Global.coils[p].kb = kb; // Global.coils[p].diameter = dt.Rows[i]["SteelDiameter"].ToString(); // Global.coils[p].wide = dt.Rows[i]["SteelWide"].ToString(); //} //else if (Global.coils.ContainsKey(p) == false) { Coil coil = new Coil(p, ""); coil.X = X; coil.Y = Y; coil.clh = clh; coil.kb = kb; coil.diameter = dt.Rows[i]["SteelDiameter"].ToString(); coil.wide = dt.Rows[i]["SteelWide"].ToString(); Global.coils.Add(p, coil); } } } dt.Dispose(); }
private void setCurrentPoint(CoilPoint p) { curPoint = p; dataGrid1.Invalidate(); }
private void LoadData() { Global.coils.Clear(); #if InterfaceTest newFrameLayout(10); #else newFrameLayout(Global.curFrame.MaxRow); #endif if (Global.curFrame.KZ == "重")//入库作业 { //loadFrameLayout10(Global.curFrame.KJH); } loadFrameLayout20(Global.curFrame.KJH, Global.curFrame.KZ); curPoint = new CoilPoint(Global.curFrame.KJH, -1, -1); //PrintField(); this.dataGrid1.DataSource = dtFrame; CheckCellEventHandler cellEvent = new CheckCellEventHandler(CheckCellColor); DataGridTableStyle tablestyle = new DataGridTableStyle(); tablestyle.GridColumnStyles.Add(new ColumnStyle(0, "X", "X", 28, "", cellEvent)); tablestyle.GridColumnStyles.Add(new ColumnStyle(1, "L", "L", 103, "", cellEvent)); tablestyle.GridColumnStyles.Add(new ColumnStyle(2, "R", "R", 103, "", cellEvent)); this.dataGrid1.TableStyles.Add(tablestyle); if (Global.curFrame.MaxRow == 8) { SetGridRowHeight(dataGrid1, 0, 38); SetGridRowHeight(dataGrid1, 1, 38); SetGridRowHeight(dataGrid1, 2, 38); SetGridRowHeight(dataGrid1, 3, 38); SetGridRowHeight(dataGrid1, 4, 38); SetGridRowHeight(dataGrid1, 5, 38); SetGridRowHeight(dataGrid1, 6, 38); SetGridRowHeight(dataGrid1, 7, 38); dataGrid1.Invalidate(); } else if (Global.curFrame.MaxRow == 9) { SetGridRowHeight(dataGrid1, 0, 34); SetGridRowHeight(dataGrid1, 1, 33); SetGridRowHeight(dataGrid1, 2, 34); SetGridRowHeight(dataGrid1, 3, 33); SetGridRowHeight(dataGrid1, 4, 34); SetGridRowHeight(dataGrid1, 5, 33); SetGridRowHeight(dataGrid1, 6, 34); SetGridRowHeight(dataGrid1, 7, 34); SetGridRowHeight(dataGrid1, 8, 34); dataGrid1.Invalidate(); } else if (Global.curFrame.MaxRow == 10) { SetGridRowHeight(dataGrid1, 0, 31); SetGridRowHeight(dataGrid1, 1, 30); SetGridRowHeight(dataGrid1, 2, 31); SetGridRowHeight(dataGrid1, 3, 30); SetGridRowHeight(dataGrid1, 4, 30); SetGridRowHeight(dataGrid1, 5, 30); SetGridRowHeight(dataGrid1, 6, 30); SetGridRowHeight(dataGrid1, 7, 30); SetGridRowHeight(dataGrid1, 8, 30); SetGridRowHeight(dataGrid1, 9, 30); dataGrid1.Invalidate(); } else if (Global.curFrame.MaxRow == 12) { SetGridRowHeight(dataGrid1, 0, 25); SetGridRowHeight(dataGrid1, 1, 25); SetGridRowHeight(dataGrid1, 2, 25); SetGridRowHeight(dataGrid1, 3, 25); SetGridRowHeight(dataGrid1, 4, 25); SetGridRowHeight(dataGrid1, 5, 25); SetGridRowHeight(dataGrid1, 6, 25); SetGridRowHeight(dataGrid1, 7, 25); SetGridRowHeight(dataGrid1, 8, 25); SetGridRowHeight(dataGrid1, 9, 25); SetGridRowHeight(dataGrid1, 10, 25); SetGridRowHeight(dataGrid1, 11, 25); dataGrid1.Invalidate(); } }