예제 #1
0
        /// <summary>
        /// 修改需求日期
        /// </summary>
        private void btnReqDate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                DataRow headRow = ((DataRowView)bindingSource_PSchedule.Current).Row;
                if (headRow == null || headRow.RowState == DataRowState.Added)
                {
                    MessageHandler.ShowMessageBox("请先保存生产计划单后,再进行Bom操作。");
                    return;
                }

                List <TreeListNode> nodes = GetCheckedPSBomNodeList(false);
                if (nodes.Count == 0)
                {
                    MessageHandler.ShowMessageBox("请选择要操作的零件Bom的子节点信息。");
                    return;
                }

                List <int> autoIdList = new List <int>();
                foreach (TreeListNode node in nodes)
                {
                    autoIdList.Add(DataTypeConvert.GetInt(node["ListAutoId"]));
                }

                string psNoStr = DataTypeConvert.GetString(headRow["PsNo"]);

                DateTime reqDate = DateTime.Now.Date;
                if (FrmInputDate.ShowFrmInputDate("输入日期", "需求日期", DateTime.Now.Date.AddDays(14), ref reqDate))
                {
                    if (reqDate.Date < BaseSQL.GetServerDateTime().Date)
                    {
                        MessageHandler.ShowMessageBox("设定的需求日期不能小于当前的日期,请重新选择。");
                        return;
                    }

                    psDAO.ProductionSchedule_BomListReqDate(psNoStr, autoIdList, reqDate);
                }

                RefreshPSBom();
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--操作当前选中的信息错误。", ex);
            }
        }
예제 #2
0
        /// <summary>
        /// 显示输入日期的窗体
        /// </summary>
        /// <param name="formText">窗体名称</param>
        /// <param name="textLabel">输入项名称</param>
        /// <param name="defaultValue">默认值</param>
        public static bool ShowFrmInputDate(string formText, string textLabel, DateTime defaultValue, ref DateTime DateValue)
        {
            FrmInputDate form = new FrmInputDate();

            form.Text               = formText;
            form.labNumber.Text     = textLabel;
            form.dateValue.DateTime = defaultValue;
            if (form.ShowDialog() == DialogResult.OK)
            {
                DateValue = form.dateValue.DateTime.Date;
                return(true);
            }
            else
            {
                return(false);
            }
        }