/// <summary> /// 取得料號關聯料盤與雷射資料, /// 傳入條件:料號 /// </summary> /// <param name="partNo">料號</param> /// <returns></returns> public ResponseModel GetConditionMain(string partNo) { ResponseModel responseModel = new ResponseModel(); PartNoJoinTrayAndLaser partNoJoinTrayAndLaser = prtNoJoinTablesRepository.GetConditionData(partNo); if (partNoJoinTrayAndLaser != null) { responseModel.PartNoJoinTrayAndLaser = partNoJoinTrayAndLaser; responseModel.Status = StatusEnum.Ok; responseModel.ResponseMsg = StatusEnum.Ok.GetEnumDescription(); } else { responseModel.ResponseMsg = PartNoEnum.Error2.GetEnumDescription(); } return(responseModel); }
/// <summary> /// DataGridView選取 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { lblPartNo.Text = string.Empty; dataGridView2.ColumnCount = 2; dataGridView2.Columns[0].Name = "項目"; dataGridView2.Columns[1].Name = "參數"; dataGridView2.Rows.Clear(); if (e.RowIndex > -1) { string pn = dataGridView1.CurrentRow.Cells[0].Value.ToString().Trim(); partNoJoinTrayAndLaser = PartNoJoinTrayAndLasers.Where(x => x.PartNo == pn).FirstOrDefault(); lblPartNo.Text = partNoJoinTrayAndLaser.PartNo; List <string[]> list = new List <string[]> { new string[] { "PartNo", partNoJoinTrayAndLaser.PartNo }, new string[] { "PieceSizeX", partNoJoinTrayAndLaser.PieceSizeX }, new string[] { "PieceSizeY", partNoJoinTrayAndLaser.PieceSizeY }, new string[] { "TrayNo", partNoJoinTrayAndLaser.TrayNo.ToString() }, new string[] { "DivideNoX", partNoJoinTrayAndLaser.DivideNoX.ToString() }, new string[] { "DivideNoY", partNoJoinTrayAndLaser.DivideNoY.ToString() }, new string[] { "DividePitchX", partNoJoinTrayAndLaser.DividePitchX }, new string[] { "DividePitchY", partNoJoinTrayAndLaser.DividePitchY }, new string[] { "PieceCenterX", partNoJoinTrayAndLaser.PieceCenterX }, new string[] { "PieceCenterY", partNoJoinTrayAndLaser.PieceCenterY }, new string[] { "TrayThickness", partNoJoinTrayAndLaser.TrayThickness }, new string[] { "TrayCenter", partNoJoinTrayAndLaser.TrayCenter }, new string[] { "TrayLength", partNoJoinTrayAndLaser.TrayLength }, new string[] { "TrayOffsetX", partNoJoinTrayAndLaser.TrayOffsetX }, new string[] { "TrayOffsetY", partNoJoinTrayAndLaser.TrayOffsetY }, new string[] { "PositionX2D", partNoJoinTrayAndLaser.PositionX2D }, new string[] { "PositionY2D", partNoJoinTrayAndLaser.PositionY2D } }; foreach (string[] rowArray in list) { dataGridView2.Rows.Add(rowArray); } dataGridView2.ClearSelection(); } }
/// <summary> /// 讀取料號 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnloadPN_Click(object sender, EventArgs e) { // 預設值 formStartModel.允許2D讀取Tag = formStartModel.允許雷射打印Tag = txtLot.Enabled = false; ButtonProperty.SetProperty(btnloadMaterial, false); // PLC:DM_8101自動AUTOREADY,正式模式才會執行此點位檢查 if (GlobalParameter.UseMode.Equals("1")) { if (!GlobalData.PLC線路異常) { if (GlobalData.DM[DmTable.DM_8101自動AUTOREADY].Equals("0")) { MessageBox.Show("PLC異常:DM_8101自動AUTOREADY,機台未準備好,請檢查機台或PLC。"); return; } } } // 驗證參數 if (ValidateUtility.DisplayMessage(ValidateUtility.CheckParameter(txtPN.Text))) { return; } try { if (MessageBox.Show("讀取確認:" + txtPN.Text, "Load", MessageBoxButtons.YesNo, MessageBoxIcon.Information).Equals(DialogResult.Yes)) { ResponseModel responseModel = new PartNoJoinTrayAndLaserService().GetConditionMain(txtPN.Text); partNoJoinTrayAndLaser = responseModel.PartNoJoinTrayAndLaser; if (partNoJoinTrayAndLaser != null) { switch (partNoJoinTrayAndLaser.UsesIten) { case "0": formStartModel.允許2D讀取Tag = formStartModel.允許雷射打印Tag = true; break; case "1": formStartModel.允許2D讀取Tag = true; break; default: formStartModel.允許雷射打印Tag = true; break; } txtLot.Enabled = true; ButtonProperty.SetProperty(btnloadMaterial, true); MessageBox.Show("讀取成功。"); } else { MessageBox.Show("查無此料號。"); } } } catch (Exception ex) { logger.Error(ex, "Exception錯誤"); MessageBox.Show(ex.Message); } }