/// <summary> /// 新增按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolbarNew_Click(object sender, EventArgs e) { NewEdcPoint newPoint = new NewEdcPoint(); if (DialogResult.OK == newPoint.ShowDialog()) { edcPoint = newPoint.edcPoint; CtrlState = ControlState.New; BindData(edcPoint); } }
/// <summary> /// 绑定采集项目。 /// </summary> private void BindEDCItem() { string strOperation = this.cbOperation.Text; string strFactoryRoomKey = this.lueFactoryRoom.EditValue == null ? string.Empty : this.lueFactoryRoom.EditValue.ToString(); string equipmentKey = Convert.ToString(this.lueEquipment.EditValue); string partType = Convert.ToString(this.luePartType.EditValue); this.lueEDCItem.EditValue = string.Empty; string strParam = string.Empty; EdcPoint entity = new EdcPoint(); DataSet ds = entity.GetEDCPoint(strFactoryRoomKey, strOperation, partType, equipmentKey); if (string.IsNullOrEmpty(entity.ErrorMsg))//执行成功。 { ds.Tables[0].Rows.InsertAt(ds.Tables[0].NewRow(), 0); this.lueEDCItem.Properties.DataSource = ds.Tables[0]; this.lueEDCItem.Properties.DisplayMember = "EDC_NAME"; this.lueEDCItem.Properties.ValueMember = "EDC_KEY";//EDCPoint主键。 } }
/// <summary> /// 查询按钮Click事件处理方法。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolbarQuery_Click(object sender, EventArgs e) { //EDCPointSearch eps = new EDCPointSearch(); //eps.Width = this.Width; //eps.Height = this.Height; //if (DialogResult.OK == eps.ShowDialog()) //{ // edcPoint = eps.edcPoint; // CtrlState = ControlState.Edit; // EntityStatus status = (EntityStatus)Enum.Parse(typeof(EntityStatus), eps.edcPoint.PointState); // if (status != EntityStatus.InActive) // { // this.toolbarDelete.Enabled = false; // } // BindData(edcPoint); //} edcPoint = new EdcPoint(); DataSet dsPoint = new DataSet(); edcPoint.PartName = this.tePartName.Text.Trim(); edcPoint.OperationName = this.teOpName.Text.Trim(); dsPoint = edcPoint.SearchEdcPoint(); //判断返回的结果若成功则绑定在视图上,若失败则弹出对话框进行提示 if (edcPoint.ErrorMsg == string.Empty) { if (dsPoint.Tables.Count > 0) { EDCPionts.MainView = gridViewEdc; EDCPionts.DataSource = dsPoint.Tables[0]; gridViewEdc.BestFitColumns(); } } else { MessageService.ShowError(edcPoint.ErrorMsg); } }
/// <summary> /// 构造函数。 /// </summary> public EDCPointSearch() : base("查询抽检点") { InitializeComponent(); edcPoint = new EdcPoint(); }
/// <summary> /// 确定按钮Click事件按钮。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirm_Click(object sender, EventArgs e) { string actionName = this.cmbActionName.Text; //判断相应栏位是否都不为空 if (actionName.Equals(ACTIVITY_FIELD_VALUES.FIELD_ACTIVITY_TRACKOUT) && string.IsNullOrEmpty(this.luePartType.Text)) { MessageService.ShowMessage("动作设置为TRACKOUT,必须选择成品类型。", "提示"); this.luePartName.Select(); return; } if (string.IsNullOrEmpty(this.lueEDCName.Text)) { MessageService.ShowMessage("请选择参数组名称。", "提示"); this.lueEDCName.Select(); return; } if (string.IsNullOrEmpty(this.lueOperationName.Text)) { MessageService.ShowMessage("请选择工序名称。", "提示"); this.lueOperationName.Select(); return; } //this.cmbActionName.Text = COMMON_FIELDS.FIELD_ACTIVITY_TRACKOUT; DataSet dsPoint = new DataSet(); Hashtable mainDataHashTable = new Hashtable(); if (!string.IsNullOrEmpty(this.cmbActionName.Text)) { mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_ACTION_NAME, this.cmbActionName.Text); } mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_EDC_KEY, this.lueEDCName.EditValue.ToString()); if (!string.IsNullOrEmpty(this.lueEquipmentKey.Text)) { mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_EQUIPMENT_KEY, this.lueEquipmentKey.EditValue.ToString()); mainDataHashTable.Add(EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME, this.lueEquipmentKey.Text.ToString()); } if (this.lueSPName.EditValue != null) { mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_SP_KEY, this.lueSPName.EditValue.ToString()); } string routeKey = Convert.ToString(this.lueRoute.EditValue); string routeName = this.lueRoute.Text; string stepKey = string.Empty; if (!string.IsNullOrEmpty(routeKey)) { stepKey = Convert.ToString(this.lueOperationName.GetColumnValue(POR_ROUTE_STEP_FIELDS.FIELD_ROUTE_STEP_KEY)); } string groupKey = CommonUtils.GenerateNewKey(0); //表示抽检点设置分组的标识键。 mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_TOPRODUCT, this.luePartName.Text); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_OPERATION_NAME, this.lueOperationName.Text); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_PART_TYPE, Convert.ToString(this.luePartType.EditValue)); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_GROUP_KEY, groupKey); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_ROUTE_VER_KEY, routeKey); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_STEP_KEY, stepKey); mainDataHashTable.Add(EDC_POINT_FIELDS.FIELD_EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME)); edcPoint = new EdcPoint(); DataTable mainDataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(mainDataHashTable); mainDataTable.TableName = EDC_POINT_FIELDS.DATABASE_TABLE_NAME; dsPoint.Tables.Add(mainDataTable); int code = edcPoint.CreateEdcPoint(dsPoint); if (code == 1) { //新增成功 edcPoint.PointRowKey = edcPoint.ErrorMsg; edcPoint.PartName = this.luePartName.Text; edcPoint.OperationName = this.lueOperationName.Text; edcPoint.OperationKey = this.lueOperationName.EditValue.ToString(); edcPoint.EquipmentName = this.lueEquipmentKey.Text; edcPoint.EquipmentKey = Convert.ToString(this.lueEquipmentKey.EditValue).Replace(" ", ""); edcPoint.ActionName = this.cmbActionName.Text; edcPoint.SpName = this.lueSPName.Text; edcPoint.EdcName = this.lueEDCName.Text; edcPoint.RouteKey = routeKey; edcPoint.RouteName = routeName; edcPoint.StepKey = stepKey; edcPoint.PartType = Convert.ToString(this.luePartType.EditValue); edcPoint.GroupKey = groupKey; edcPoint.SpKey = Convert.ToString(this.lueSPName.EditValue); DialogResult = DialogResult.OK; this.Close(); } else { MessageService.ShowError(edcPoint.ErrorMsg); } }
/// <summary> /// 绑定抽检点参数数据。 /// </summary> /// <param name="point">抽检点对象。</param> private void BindData(EdcPoint point) { this.meDesc.Text = point.EDIT_DESC; this.teActionName.Text = point.ActionName; this.teEDCName.Text = point.EdcName; this.txtGroupName.Text = point.GroupName; //this.teEquipmentKey.EditValue = edcPoint.EquipmentKey; //this.teEquipmentKey.Text = point.EquipmentName; string[] equipmnetKeys = edcPoint.EquipmentKey.Split(','); foreach (CheckedListBoxItem item in this.teEquipmentKey.Properties.Items) { foreach (string equipmentKey in equipmnetKeys) { if (equipmentKey.Trim().Equals(item.Value.ToString().Trim())) { item.CheckState = CheckState.Checked; break; } } } this.teSPName.Text = point.SpName; this.tePartName.Text = point.PartName; this.teOperationName.Text = point.OperationName; this.txtPartType.Text = point.PartType; this.txtRoute.Text = point.RouteName; if (point.ActionName == ACTIVITY_FIELD_VALUES.FIELD_ACTIVITY_NONE) { this.lciIsMustInputLotNo.Visibility = LayoutVisibility.Always; bool bChecked = ((edcPoint.MustInputField & EDCPointMustInputField.LotNo) == EDCPointMustInputField.LotNo); this.chkIsMustInputLotNo.Checked = bChecked; } DataSet dsParam = point.GetEdcPointParams(); PagingQueryConfig config = new PagingQueryConfig() { PageNo = paginationControl1.PageNo, PageSize = paginationControl1.PageSize }; //Q.002 DataSet dsHis = point.GetEdcPointParamsTrans(ref config); //Q.002 if (point.ErrorMsg == string.Empty) { if (dsParam != null && dsParam.Tables.Count > 0 && dsParam.Tables[0].Rows.Count > 0) { grdEDCPoint.DataSource = dsParam.Tables[0]; grdEDCPoint.MainView = gvEDCPoint; //Q.001 //Q.002 if (dsHis.Relations.Count > 0) { paginationControl1.Pages = config.Pages; paginationControl1.Records = config.Records; this.gcHistoryResults.DataSource = dsHis.Relations[0].ParentTable; }//Q.002 } } else { MessageService.ShowError(point.ErrorMsg); } }