Exemple #1
0
        }   //cbo.SelectedValue null처리(string)

        private void ComboBoxBinding()
        {
            common_service = new CommonCodeService();
            bom_service    = new BomService();
            codelist       = common_service.GetCommonCodeAll();

            #region 사용여부cbo
            List <CommonVO> _cboUseFlag = (from item in codelist
                                           where item.common_type == "user_flag"
                                           select item).ToList();
            ComboUtil.ComboBinding(cboIsUsed, _cboUseFlag, "common_value", "common_name", "선택");

            List <CommonVO> _cboRequiredPlan = (from item in codelist
                                                where item.common_type == "user_flag"
                                                select item).ToList();
            ComboUtil.ComboBinding(cboRequiredPlan, _cboRequiredPlan, "common_value", "common_name");
            #endregion

            #region 품목cbo

            product_service = new ProductService();
            List <ProductVO> product_list = new List <ProductVO>();
            product_list = product_service.GetAllProducts();
            ComboUtil.ComboBinding(cboProduct, product_list, "product_id", "product_name", "선택");
            #endregion

            #region 상위품목cbo
            List <BomVO> bom_list = new List <BomVO>();
            bom_list = bom_service.GetBomAll();
            ComboUtil.ComboBinding(cboParentProduct, bom_list, "product_id", "bom_name", "-");



            #endregion
        }
Exemple #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            BomPop frm = new BomPop(BomPop.EditMode.Insert);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                bom_service = new BomService();
                List <BomVO> newBOMlist = bom_service.GetBomAll();    //등록후 다시 조회
                dgvBom.DataSource = newBOMlist;
                dgvBom.ClearSelection();
                SetBottomStatusLabel("신규 BOM이 등록되었습니다.");
            }
        }
Exemple #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //ProductVO product_vo = new ProductVO();
            BomVO vo = new BomVO();

            foreach (DataGridViewRow row in this.dgvBom.SelectedRows)
            {
                vo = row.DataBoundItem as BomVO;
            }

            BomPop frm = new BomPop(BomPop.EditMode.Update, vo);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                bom_service = new BomService();
                List <BomVO> newBOMlist = bom_service.GetBomAll();    //등록후 다시 조회
                dgvBom.DataSource = newBOMlist;
                dgvBom.ClearSelection();
                SetBottomStatusLabel("BOM 수정이 완료되었습니다.");
            }
        }
Exemple #4
0
        private void dgvBom_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            dgvBomDetail.DataSource = null;
            dgvBomDetail.Columns.Clear();
            //dgvBom[11, dgvBom.CurrentRow.Index].Value.ToString()
            bom_service = new BomService();
            List <BomVO> bomDetail = bom_service.GetBomAll(Convert.ToInt32(dgvBom[11, dgvBom.CurrentRow.Index].Value));

            dgvBomDetail.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvBomDetail.Columns.Add("Number", "No.");
            dgvBomDetail.Columns[0].Width   = 53;
            dgvBomDetail.Columns[0].Visible = false;

            #region DGV바인딩
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "상위품목", "bom_parent_codename", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품목", "bom_codename", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품명", "bom_name", true, 220);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품목유형", "bom_type", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "단위", "bom_unit", true, 78, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "소요량", "bom_use_count", true, 80, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "BOM레벨", "bom_level", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "시작일", "bom_sdate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "종료일", "bom_edate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "사용여부", "bom_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "소요계획", "plan_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "수정자", "bom_uadmin", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "수정일", "bom_udate", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "비고", "bom_comment", true, 130, DataGridViewContentAlignment.MiddleCenter);
            #endregion

            #region visible_false
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품번", "product_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "BomID", "bom_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            #endregion
            dgvBomDetail.AutoGenerateColumns = false;
            dgvBomDetail.DataSource          = bomDetail;
            dgvBomDetail.ClearSelection();
        }
Exemple #5
0
        private void LoadDGV()
        {
            BomService service = new BomService();

            BOM_list = service.GetBomAll();

            dgvBom.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvBom.Columns.Add("Number", "No.");
            dgvBom.Columns[0].Width   = 53;
            dgvBom.Columns[0].Visible = false;

            #region DGV바인딩
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품목유형", "bom_type", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품목", "bom_codename", true, 150, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품명", "bom_name", true, 220);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "단위", "bom_unit", true, 100, DataGridViewContentAlignment.MiddleCenter);

            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "사용여부", "bom_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "소요계획", "plan_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "시작일", "bom_sdate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "종료일", "bom_edate", true, 130, DataGridViewContentAlignment.MiddleRight);
            //GridViewUtil.AddNewColumnToDataGridView(dgvBom, "수정자", "bom_uadmin", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "수정일", "bom_udate", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "비고", "bom_comment", true, 150, DataGridViewContentAlignment.MiddleLeft);
            #endregion

            #region visible_false
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품번", "product_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "BOM레벨", "bom_level", false, 80, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "소요량", "bom_use_count", false, 80, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "BomID", "bom_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "상위품목", "bom_parent_id", false, 130);
            #endregion
            GridViewUtil.SetDataGridView(dgvBom);
            dgvBom.AutoGenerateColumns = false;
            dgvBom.DataSource          = BOM_list;
            dgvBom.ClearSelection();
        }
Exemple #6
0
        private void dgvBomDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            foreach (DataGridViewRow row in this.dgvBomDetail.SelectedRows)
            {
                BomVO vo = new BomVO();
                vo = row.DataBoundItem as BomVO;
                if (vo.bom_typevalue == "RM")
                {
                    BomPop frm = new BomPop(BomPop.EditMode.Update, vo);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        bom_service = new BomService();
                        List <BomVO> newBOMlist = bom_service.GetBomAll();    //등록후 다시 조회
                        dgvBom.DataSource = newBOMlist;
                        dgvBom.ClearSelection();
                        SetBottomStatusLabel("BOM 수정이 완료되었습니다.");
                    }
                    SetBottomStatusLabel("원자재는 선택할 수 없습니다.");
                    return;
                }
            }



            int product_id = Convert.ToInt32(dgvBomDetail[15, dgvBomDetail.CurrentRow.Index].Value);

            bom_service = new BomService();

            List <BomVO> newBom = bom_service.GetBomAll(0, product_id);

            dgvBom.DataSource = null;
            dgvBom.Columns.Clear();

            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품목유형", "bom_type", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품목", "bom_codename", true, 150, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품명", "bom_parent_name", true, 220);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "단위", "bom_unit", true, 100, DataGridViewContentAlignment.MiddleCenter);

            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "사용여부", "bom_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "소요계획", "plan_yn", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "시작일", "bom_sdate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "종료일", "bom_edate", true, 130, DataGridViewContentAlignment.MiddleRight);
            //GridViewUtil.AddNewColumnToDataGridView(dgvBom, "수정자", "bom_uadmin", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "수정일", "bom_udate", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "비고", "bom_comment", true, 150, DataGridViewContentAlignment.MiddleLeft);


            #region visible_false
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "품번", "product_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "BOM레벨", "bom_level", false, 80, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "소요량", "bom_use_count", false, 80, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "BomID", "bom_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBom, "상위품목", "bom_parent_id", false, 130);
            #endregion
            dgvBom.AutoGenerateColumns = false;
            dgvBom.DataSource          = newBom;
            dgvBom.ClearSelection();

            int          bom_id       = Convert.ToInt32(dgvBomDetail[15, dgvBomDetail.CurrentRow.Index].Value);
            List <BomVO> newBomDetail = bom_service.GetBomAll(0, bom_id);

            dgvBomDetail.DataSource = null;
            dgvBomDetail.Columns.Clear();

            dgvBomDetail.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvBomDetail.Columns.Add("Number", "No.");
            dgvBomDetail.Columns[0].Width   = 53;
            dgvBomDetail.Columns[0].Visible = false;

            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "상위품목", "bom_parent_name", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품목", "bom_codename", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품명", "bom_name", true, 220);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품목유형", "bom_type", true, 130);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "단위", "bom_unit", true, 78, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "소요량", "bom_use_count", true, 80, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "BOM레벨", "bom_level", true, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "시작일", "bom_sdate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "종료일", "bom_edate", true, 130, DataGridViewContentAlignment.MiddleRight);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "사용여부", "bom_yn", true, 120, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "소요계획", "plan_yn", true, 120, DataGridViewContentAlignment.MiddleCenter);
            //GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "수정자", "bom_uadmin", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "수정일", "bom_udate", true, 130, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "비고", "bom_comment", true, 130, DataGridViewContentAlignment.MiddleCenter);

            #region visible_false
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "품번", "product_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            GridViewUtil.AddNewColumnToDataGridView(dgvBomDetail, "BomID", "bom_id", false, 100, DataGridViewContentAlignment.MiddleCenter);
            #endregion

            dgvBomDetail.AutoGenerateColumns = false;
            dgvBomDetail.DataSource          = newBomDetail;
            dgvBomDetail.ClearSelection();
            SetBottomStatusLabel("BOM을 선택하세요");
        }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (edit == EditMode.Insert)        //신규등록
            {
                if (MessageBox.Show("등록하시겠습니까?", "신규등록", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    bom_service = new BomService();
                    BomVO vo = new BomVO();

                    if (cboParentProduct.SelectedIndex == 0)
                    {
                        vo.bom_parent_id = null;
                    }
                    else
                    {
                        vo.bom_parent_id = cboParentProduct.SelectedValue.ToString();
                    }

                    vo.product_id    = Convert.ToInt32(cboProduct.SelectedValue);
                    vo.bom_use_count = Convert.ToInt32(txtUseCount.Text.Trim());
                    vo.bom_sdate     = dtpStartDate.Value.ToString("yyyy-MM-dd");
                    vo.bom_edate     = dtpEndDate.Value.ToString("yyyy-MM-dd");
                    vo.bom_yn        = cboIsUsed.SelectedValue.ToString();
                    vo.plan_yn       = cboRequiredPlan.SelectedValue.ToString();
                    vo.bom_comment   = txtNote.Text;
                    //vo.bom_uadmin = txtModifier.Text;
                    vo.bom_udate = txtModifyDate.Text;



                    bool bResult = bom_service.AddBom(vo);
                    if (bResult)
                    {
                        MessageBox.Show("등록성공");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("등록실패 , 다시시도 하세요");
                        return;
                    }
                }
            }
            else if (edit == EditMode.Update)       //수정
            {
                if (MessageBox.Show("수정하시겠습니까?", "품목수정", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    bom_service = new BomService();
                    BomVO vo = new BomVO();


                    if (cboParentProduct.SelectedIndex == 0)
                    {
                        vo.bom_parent_id = null;
                    }
                    else
                    {
                        vo.bom_parent_id = (cboParentProduct.SelectedValue == null) ? "" : cboParentProduct.SelectedValue.ToString();
                    }
                    vo.bom_id        = this.vo.bom_id;
                    vo.product_id    = Convert.ToInt32(cboProduct.SelectedValue);
                    vo.bom_use_count = Convert.ToInt32(txtUseCount.Text.Trim());
                    vo.bom_sdate     = dtpStartDate.Value.ToString("yyyy-MM-dd");
                    vo.bom_edate     = dtpEndDate.Value.ToString("yyyy-MM-dd");
                    vo.bom_yn        = cboIsUsed.SelectedValue.ToString();
                    vo.plan_yn       = cboRequiredPlan.SelectedValue.ToString();
                    vo.bom_comment   = txtNote.Text;
                    //vo.bom_uadmin = txtModifier.Text;
                    vo.bom_udate = txtModifyDate.Text;

                    bool bResult = bom_service.UpdateBOM(vo);
                    if (bResult)
                    {
                        MessageBox.Show("수정성공");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("수정실패 , 다시시도 하세요");
                        return;
                    }
                }
            }
        }