Example #1
0
        /// <summary>
        /// 修改生产计划信息
        /// </summary>
        private void btnAlterPSBom_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                DataRow dr = gridViewPSBom.GetFocusedDataRow();
                if (dr == null)
                {
                    MessageHandler.ShowMessageBox("请选择要修改的生产计划Bom信息。");
                    return;
                }
                if (DataTypeConvert.GetString(dr["PrReqNo"]) != "")
                {
                    MessageHandler.ShowMessageBox("当前修改的生产计划信息已经生成请购单,不可以进行操作。");
                    return;
                }

                FrmProductionScheduleBom_InputSingle.bomListAutoId = DataTypeConvert.GetInt(dr["BomListAutoId"]);
                FrmProductionScheduleBom_InputSingle.psBomAutoId   = DataTypeConvert.GetInt(dr["AutoId"]);
                FrmProductionScheduleBom_InputSingle psBomForm = new FrmProductionScheduleBom_InputSingle();
                if (psBomForm.ShowDialog() == DialogResult.OK)
                {
                    RefreshPSBomInfo();
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--双击查询明细错误。", ex);
            }
        }
Example #2
0
        /// <summary>
        /// 设定计划事件
        /// </summary>
        private void btnPlan_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                TreeListMultiSelection NodeList = treeListDesignBom.Selection;
                if (NodeList.Count == 1)
                {
                    TreeListNode focusedNode = treeListDesignBom.FocusedNode;
                    if (focusedNode == null)
                    {
                        MessageHandler.ShowMessageBox("请选择要设定生产计划的设计Bom信息。");
                        return;
                    }
                    int isUse = DataTypeConvert.GetInt(focusedNode["IsUse"]);
                    if (isUse == 0)
                    {
                        MessageHandler.ShowMessageBox("设计Bom已经停用,不可以设定生产计划。");
                        return;
                    }

                    int autoId = DataTypeConvert.GetInt(focusedNode["ReId"]);
                    FrmProductionScheduleBom_InputSingle.bomListAutoId = autoId;
                    FrmProductionScheduleBom_InputSingle.psBomAutoId   = 0;
                    FrmProductionScheduleBom_InputSingle psBomForm = new FrmProductionScheduleBom_InputSingle();
                    if (psBomForm.ShowDialog() == DialogResult.OK)
                    {
                        RefreshPSBomInfo();
                    }
                }
                else
                {
                    if (NodeList.Count == 0)
                    {
                        MessageHandler.ShowMessageBox("请选择要设定生产计划的设计Bom信息。");
                        return;
                    }
                    List <int> bomListAutoIdList = new List <int>();
                    foreach (TreeListNode node in NodeList)
                    {
                        bomListAutoIdList.Add(DataTypeConvert.GetInt(node["ReId"]));
                    }

                    FrmProductionScheduleBom_InputMulti multiPSBomForm = new FrmProductionScheduleBom_InputMulti();
                    if (multiPSBomForm.ShowDialog() == DialogResult.OK)
                    {
                        //int isAll = DataTypeConvert.GetInt(multiPSBomForm.radioType.EditValue);
                        double   remainQty = DataTypeConvert.GetDouble(multiPSBomForm.spinRemainQty.Value);
                        DateTime planDate  = multiPSBomForm.datePlanDate.DateTime.Date;
                        if (bomDAO.SaveMultiProductionScheduleBom(bomListAutoIdList, 0, planDate, remainQty))
                        {
                            RefreshPSBomInfo();
                            ClearTreeListSelection_FocusedNode();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--设定计划事件错误。", ex);
            }
        }