/// <summary> /// 初始化界面 /// </summary> private void ClearData() { txtDocNo.Text = ""; txtBarCode.Text = ""; txtInfo.Text = ""; dataSet.ShipBarCode.Clear(); docInfoArray = null; mainRow = null; }
/// <summary> /// 扫描条码 /// </summary> private void ScanBarCode() { try { string barcode = txtBarCode.Text.Trim(); if (string.IsNullOrEmpty(barcode)) { return; } if (docInfoArray == null || docInfoArray.Length == 0) { BuildTabOrder(true); throw new PDAException(txtDocNo, "请先录入出货计划单号或者扫描出货计划单条码"); } BuildTabOrder(false); tabOrderManager.Reset(); BarCodeInfoDTO dto = ServiceAgent.Agent.QueryBarCodeInfo(PDAContext.LoginOrgID, barcode); if (dto == null) { throw new PDAException(txtBarCode, "没有找到该条形码的料品信息!"); } ShipPlanDocDTO docDTO = MatchCompleteApplyDocDTO(dto); if (docDTO == null) { throw new PDAException(txtBarCode, "该条码没有匹配到出货计划信息或者录入的条码超过该出货计划单!"); } mainRow = dataSet.ShipBarCode.AddNewRow(dto, docDTO.ShipPlanID, docDTO.ShipPlanLineID); ShowInfo(); // 显示行数 ShowRowCount(); // 焦点定位到最后一行 this.dataGrid1.Focus(); this.dataGrid1.CurrentRowIndex = this.dataSet.ShipBarCode.Count - 1; // 跳转到下一个控件 tabOrderManager.Next(); } catch (Exception ex) { MessageBox.Show(ExceptionParser.ParseError(ex)); tabOrderManager.DealException(ex); } }
/// <summary> /// 扫描单号 /// </summary> private void ScanDocNo() { try { string barcode = txtDocNo.Text.Trim(); if (string.IsNullOrEmpty(barcode)) { return; } BuildTabOrder(true); tabOrderManager.Reset(); if (dataSet.ShipBarCode.Rows.Count > 0 && MessageBox.Show("存在未提交的条形码,是否确定重新录入出货计划单号?", "确定重新扫单", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { tabOrderManager.Next(); return; } txtBarCode.Text = ""; txtInfo.Text = ""; dataSet.ShipBarCode.Clear(); mainRow = null; docInfoArray = ServiceAgent.Agent.QueryShipPlanDocInfo(PDAContext.LoginOrgID, barcode); if (docInfoArray == null || docInfoArray.Length == 0) { throw new PDAException(txtDocNo, "没有找到该条码对应出货计划信息或者该出货计划单已经完全出库!"); } ShowInfo(); tabOrderManager.Next(); } catch (Exception ex) { MessageBox.Show(ExceptionParser.ParseError(ex)); tabOrderManager.DealException(ex); } }