Exemple #1
0
        /// <summary>
        /// 审批按钮事件
        /// </summary>
        private void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                int count = dataSet_PSchedule.Tables[0].Select("select=1").Length;
                if (count == 0)
                {
                    MessageHandler.ShowMessageBox("请在要操作的记录前面选中。");
                    return;
                }

                if (!CheckReqState_Multi(false, true, true, false))
                {
                    return;
                }

                if (MessageHandler.ShowMessageBox_YesNo(string.Format("确定要审批当前选中的{0}条记录吗?", count)) != DialogResult.Yes)
                {
                    return;
                }

                int type = SystemInfo.ProductionScheduleBOMType;

                if (type == 3)
                {
                    CustomXtraMessageBoxForm xtraMBForm = new CustomXtraMessageBoxForm();
                    type = xtraMBForm.ShowMessageBox("请选择生产计划单审批生成BOM信息的方式", new string[] { "BOM信息的子节点", "BOM信息的末节点", "取消" });
                    if (type == 2)
                    {
                        return;
                    }
                }

                if (!psDAO.ApproveProductionSchedule_Multi(dataSet_PSchedule.Tables[0], type + 1))
                {
                    btnQuery_Click(null, null);
                }
                else
                {
                    MessageHandler.ShowMessageBox(string.Format("成功审批了{0}条记录。", count));
                }

                ClearHeadGridAllSelect();

                dataSet_PSchedule.Tables[1].Clear();
                psDAO.QueryProductionScheduleBom(dataSet_PSchedule.Tables[1], DataTypeConvert.GetString(gridViewPSchedule.GetFocusedDataRow()["PsNo"]), false);

                //if (!orderDAO.ApproveOrder_Multi(dataSet_Order.Tables[0]))
                //    btnQuery_Click(null, null);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--审批按钮事件错误。", ex);
            }
        }
        /// <summary>
        /// 设定代替更新计划进度事件
        /// </summary>
        private void btnSetIsReplace_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                int[] rowNos = gridViewProjectUser.GetSelectedRows();
                if (rowNos.Length == 0)
                {
                    MessageHandler.ShowMessageBox("请选择要操作的人员信息。");
                    return;
                }

                int resultInt    = new CustomXtraMessageBoxForm().ShowMessageBox("请选择是否可以代替更新计划进度", new string[] { "可以代替", "不可以代替", "取消" });
                int isReplaceInt = 0;
                switch (resultInt)
                {
                case 0:
                    isReplaceInt = 1;
                    break;

                case 1:
                    isReplaceInt = 0;
                    break;

                case 2:
                    return;
                }

                string autoIdListStr = "";
                foreach (int rowno in rowNos)
                {
                    autoIdListStr += string.Format(" {0},", DataTypeConvert.GetString(gridViewProjectUser.GetDataRow(rowno)["AutoId"]));
                }
                autoIdListStr = autoIdListStr.Substring(0, autoIdListStr.Length - 1);
                string projectNoStr = DataTypeConvert.GetString(searchLookUpProjectNo.EditValue);

                taskTypeDAO.UpdateProjectUser_IsReplace(projectNoStr, autoIdListStr, isReplaceInt);

                RefreshProjectUser(projectNoStr);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--设定代替更新计划进度事件错误。", ex);
            }
        }