private void _ucbtRECPIE_REG_Click(object sender, EventArgs e)
        {
            try
            {
                //작지 선택 여부
                if (_luORDER_ID.Text == "")
                {
                    CoFAS_DevExpressManager.ShowInformationMessage("작업지시를 확인해주세요.");
                    return;
                }

                frmPOPOrderBOM frmPopbom = new frmPOPOrderBOM(_pUserEntity, _pPOPSelect_INSPECT_MIXEntity, _luORDER_ID.Text, _luPART_CODE.Text);
                //frmPopbom._Workorder_ID = _luORDER_ID.Text;  //작업지시번호
                //frmPopbom._Part_Code = _luPART_CODE.Text;  // 반죽 번호

                frmPopbom.titleName = _luORDER_ID.Text + "_" + _luPART_NAME.Text + " 래시피 관리";

                frmPopbom.ShowDialog();

                //_pP_Name = frmComplete._pPrintName;
                //_pP_Code = frmComplete._pPrintCode;
                //_pP_SEQ = frmComplete._pPrintSEQ;
                //_pP_QTY = frmComplete._pPrintQTY;
                //_pP_Vend = frmComplete._pVendCode;
            }
            catch (Exception ex)
            {
                DisplayMessage(ex.ToString());
            }
        }
        private void _ucbtCOMPLETE_REG_Click(object sender, EventArgs e)
        {
            //작지 선택 여부
            if (_luORDER_ID.Text == "")
            {
                CoFAS_DevExpressManager.ShowInformationMessage("작업지시를 확인해주세요.");
                return;
            }

            if (c_yn == "Y")
            {
                CoFAS_DevExpressManager.ShowInformationMessage("이미 완료된 작업지시입니다.");
                return;
            }

            //if (_ucbtRECPIE_REG.Visible != false)
            //{
            //    if (CoFAS_DevExpressManager.ShowQuestionMessage("래시피 정보(관리)를 확인하셨습니까?") == DialogResult.No)
            //    {
            //        return;
            //    }
            //}

            if (_pUserEntity.PROCESS_CODE == "ME020001")
            {
                if (CoFAS_DevExpressManager.ShowQuestionMessage("'" + _luPART_NAME.Text + "'을(를) 강제완료 하시겠습니까?") == DialogResult.Yes)
                {
                    _pPOPSelect_INSPECT_MIXEntity.CRUD = "U";
                    _pPOPSelect_INSPECT_MIXEntity.PRODUCTION_ORDER_ID = _luORDER_ID.Text;
                    _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN         = "Y";

                    bool isError2 = false;
                    isError2 = new frmPOPMain_PRODUCT_MIXBusiness().usWorkResultPopup_Save_01(_pPOPSelect_INSPECT_MIXEntity);

                    CoFAS_DevExpressManager.ShowInformationMessage("저장 되었습니다.");
                }
            }
            else
            {
                DataTable isCheck = new POPProductionOrderCommonBusiness().POPProductionOrderCommon_Recipe_Check(_pORDER_ID);

                if (isCheck != null && isCheck.Rows.Count > 0)
                {
                    if (CoFAS_DevExpressManager.ShowQuestionMessage("'" + _luPART_NAME.Text + "'을(를) 강제완료 하시겠습니까?") == DialogResult.Yes)
                    {
                        _pPOPSelect_INSPECT_MIXEntity.CRUD = "U";
                        _pPOPSelect_INSPECT_MIXEntity.PRODUCTION_ORDER_ID = _luORDER_ID.Text;
                        _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN         = "Y";

                        bool isError2 = false;
                        isError2 = new frmPOPMain_PRODUCT_MIXBusiness().usWorkResultPopup_Save_01(_pPOPSelect_INSPECT_MIXEntity);

                        CoFAS_DevExpressManager.ShowInformationMessage("저장 되었습니다.");
                    }
                }
                else
                {
                    CoFAS_DevExpressManager.ShowInformationMessage("해당 작업지시의 래시피를 등록해주세요.");

                    frmPOPOrderBOM frmPopbom = new frmPOPOrderBOM(_pUserEntity, _pPOPSelect_INSPECT_MIXEntity, _luORDER_ID.Text, _luPART_CODE.Text);
                    //frmPopbom._Workorder_ID = _luORDER_ID.Text;  //작업지시번호
                    //frmPopbom._Part_Code = _luPART_CODE.Text;  // 반죽 번호
                    frmPopbom.ShowDialog();
                }
            }
        }
        private void _ucbtNG_REG_Click(object sender, EventArgs e)
        {
            if (_luORDER_ID.Text == "")
            {
                CoFAS_DevExpressManager.ShowInformationMessage("작업지시를 먼저 선택해주세요.");
                return;
            }

            //if (_ucbtRECPIE_REG.Visible != false)
            //{
            //    if (CoFAS_DevExpressManager.ShowQuestionMessage("래시피 정보(관리)를 확인하셨습니까?") == DialogResult.No)
            //    {
            //        return;
            //    }
            //}


            if (_pUserEntity.PROCESS_CODE == "ME020001")
            {
                // 불량등록
                frmPOPBad frmb = new frmPOPBad();
                frmb.titleName = _luORDER_ID.Text;

                string PopupValue  = string.Empty;
                string PopupValue2 = string.Empty;

                if (frmb.ShowDialog() == DialogResult.OK)
                {
                    PopupValue  = frmb.ReturnValue1;
                    PopupValue2 = frmb.ReturnValue2;

                    //리턴값이 빈값이 아니고 0도 아닐경우 실적등록
                    if (PopupValue != "0" && PopupValue != "")
                    {
                        _pPOPSelect_INSPECT_MIXEntity.RESOURCE_CODE   = "";// _luPROCESS_CODE.GetValue();
                        _pPOPSelect_INSPECT_MIXEntity.COLLECTION_DATE = DateTime.Now.ToString("yyyyMMddHHmmss");
                        _pPOPSelect_INSPECT_MIXEntity.PROPERTY_VALUE  = _luORDER_ID.Text;
                        //CD501001 : 양품
                        //CD501002 : 불량

                        if (_pUserEntity.PROCESS_CODE == "ME020001")
                        {
                            // 포장 공정

                            _pPOPSelect_INSPECT_MIXEntity.CONDITION_CODE   = PopupValue2.Replace(",", "");; // 배합,여과 공정 - 자재 차감
                            _pPOPSelect_INSPECT_MIXEntity.OPTION_CODE      = "";
                            _pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE = PopupValue.Replace(",", "");
                        }
                        else
                        {
                            // 배합,여과 공정

                            _pPOPSelect_INSPECT_MIXEntity.CONDITION_CODE   = PopupValue2.Replace(",", ""); // 불량코드 (BC---)
                            _pPOPSelect_INSPECT_MIXEntity.OPTION_CODE      = "PC190006";
                            _pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE = PopupValue.Replace(",", "");
                        }

                        bool isError = false;
                        isError = new frmPOPMain_PRODUCT_MIXBusiness().frmPOPMain_PRODUCT_MIX_Save(_pPOPSelect_INSPECT_MIXEntity);

                        if (!isError)
                        {
                            this.DialogResult = DialogResult.OK;
                        }

                        //작업지시상태 업데이트
                        ng_num         = ng_num + (int)Convert.ToDouble(_pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE.ToString());
                        _luNG_QTY.Text = ng_num.ToString() + " (" + unit + ") ";

                        re_num             = (int)Convert.ToDouble(ng_num.ToString()) + (int)Convert.ToDouble(ok_num.ToString());
                        _luRESULT_QTY.Text = re_num.ToString() + " (" + unit + ") ";

                        if (or_num <= re_num) // 목표수량 이상
                        {
                            _luRESULT_QTY.ForeColor = Color.Red;

                            // 작업지시 완료 처리
                            _pPOPSelect_INSPECT_MIXEntity.CRUD = "U";
                            _pPOPSelect_INSPECT_MIXEntity.PRODUCTION_ORDER_ID = _luORDER_ID.Text;

                            if (or_num <= ok_num)
                            {
                                _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN = "Y";
                            }
                            else
                            {
                                _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN = "N";
                            }

                            bool isError2 = false;

                            isError2 = new frmPOPMain_PRODUCT_MIXBusiness().usWorkResultPopup_Save_01(_pPOPSelect_INSPECT_MIXEntity);
                        }
                        else
                        {
                            _luRESULT_QTY.ForeColor = Color.Black;
                        }
                    }
                }
            }
            else
            {
                DataTable isCheck = new POPProductionOrderCommonBusiness().POPProductionOrderCommon_Recipe_Check(_pORDER_ID);

                if (isCheck != null && isCheck.Rows.Count > 0)
                {
                    // 불량등록
                    frmPOPBad frmb = new frmPOPBad();
                    frmb.titleName = _luORDER_ID.Text;

                    string PopupValue  = string.Empty;
                    string PopupValue2 = string.Empty;

                    if (frmb.ShowDialog() == DialogResult.OK)
                    {
                        PopupValue  = frmb.ReturnValue1;
                        PopupValue2 = frmb.ReturnValue2;

                        //리턴값이 빈값이 아니고 0도 아닐경우 실적등록
                        if (PopupValue != "0" && PopupValue != "")
                        {
                            _pPOPSelect_INSPECT_MIXEntity.RESOURCE_CODE   = "";// _luPROCESS_CODE.GetValue();
                            _pPOPSelect_INSPECT_MIXEntity.COLLECTION_DATE = DateTime.Now.ToString("yyyyMMddHHmmss");
                            _pPOPSelect_INSPECT_MIXEntity.PROPERTY_VALUE  = _luORDER_ID.Text;
                            //CD501001 : 양품
                            //CD501002 : 불량

                            if (_pUserEntity.PROCESS_CODE == "ME020001")
                            {
                                // 포장 공정

                                _pPOPSelect_INSPECT_MIXEntity.CONDITION_CODE   = PopupValue2.Replace(",", "");; // 배합,여과 공정 - 자재 차감
                                _pPOPSelect_INSPECT_MIXEntity.OPTION_CODE      = "";
                                _pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE = PopupValue.Replace(",", "");
                            }
                            else
                            {
                                // 배합,여과 공정

                                _pPOPSelect_INSPECT_MIXEntity.CONDITION_CODE   = PopupValue2.Replace(",", ""); // 불량코드 (BC---)
                                _pPOPSelect_INSPECT_MIXEntity.OPTION_CODE      = "PC190006";
                                _pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE = PopupValue.Replace(",", "");
                            }

                            bool isError = false;
                            isError = new frmPOPMain_PRODUCT_MIXBusiness().frmPOPMain_PRODUCT_MIX_Save(_pPOPSelect_INSPECT_MIXEntity);

                            if (!isError)
                            {
                                this.DialogResult = DialogResult.OK;
                            }

                            //작업지시상태 업데이트
                            ng_num         = ng_num + (int)Convert.ToDouble(_pPOPSelect_INSPECT_MIXEntity.COLLECTION_VALUE.ToString());
                            _luNG_QTY.Text = ng_num.ToString() + " (" + unit + ") ";

                            re_num             = (int)Convert.ToDouble(ng_num.ToString()) + (int)Convert.ToDouble(ok_num.ToString());
                            _luRESULT_QTY.Text = re_num.ToString() + " (" + unit + ") ";

                            if (or_num <= re_num) // 목표수량 이상
                            {
                                _luRESULT_QTY.ForeColor = Color.Red;

                                // 작업지시 완료 처리
                                _pPOPSelect_INSPECT_MIXEntity.CRUD = "U";
                                _pPOPSelect_INSPECT_MIXEntity.PRODUCTION_ORDER_ID = _luORDER_ID.Text;

                                if (or_num <= ok_num)
                                {
                                    _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN = "Y";
                                }
                                else
                                {
                                    _pPOPSelect_INSPECT_MIXEntity.COMPLETE_YN = "N";
                                }

                                bool isError2 = false;

                                isError2 = new frmPOPMain_PRODUCT_MIXBusiness().usWorkResultPopup_Save_01(_pPOPSelect_INSPECT_MIXEntity);
                            }
                            else
                            {
                                _luRESULT_QTY.ForeColor = Color.Black;
                            }
                        }
                    }
                    else
                    {
                        CoFAS_DevExpressManager.ShowInformationMessage("해당 작업지시의 래시피를 등록해주세요.");

                        frmPOPOrderBOM frmPopbom = new frmPOPOrderBOM(_pUserEntity, _pPOPSelect_INSPECT_MIXEntity, _luORDER_ID.Text, _luPART_CODE.Text);
                        //frmPopbom._Workorder_ID = _luORDER_ID.Text;  //작업지시번호
                        //frmPopbom._Part_Code = _luPART_CODE.Text;  // 반죽 번호
                        frmPopbom.ShowDialog();
                    }
                }
            }
        }
        private void _ucbtRESULT_REG_Click(object sender, EventArgs e)
        {
            if (_luORDER_ID.Text == "")
            {
                CoFAS_DevExpressManager.ShowInformationMessage("작업지시를 먼저 선택해주세요.");
                return;
            }

            //if (_ucbtRECPIE_REG.Visible != false)
            //{
            //    if (CoFAS_DevExpressManager.ShowQuestionMessage("래시피 정보(관리)를 확인하셨습니까?") == DialogResult.No)
            //    {
            //        return;
            //    }
            //}

            if (_pUserEntity.PROCESS_CODE == "ME020001")
            {
                // 실적등록
                frmPopupKeypad frmkey = new frmPopupKeypad();
                frmkey.titleName = _luORDER_ID.Text;

                //실적등록
                string PopupValue = string.Empty;
                if (frmkey.ShowDialog() == DialogResult.OK)
                {
                    PopupValue = frmkey.ReturnValue1;

                    InputResultData_Save(PopupValue);
                }
            }
            else
            {
                DataTable isCheck = new POPProductionOrderCommonBusiness().POPProductionOrderCommon_Recipe_Check(_pORDER_ID);

                if (isCheck != null && isCheck.Rows.Count > 0)
                {
                    // 실적등록
                    frmPopupKeypad frmkey = new frmPopupKeypad();
                    frmkey.titleName = _luORDER_ID.Text;

                    //실적등록
                    string PopupValue = string.Empty;
                    if (frmkey.ShowDialog() == DialogResult.OK)
                    {
                        PopupValue = frmkey.ReturnValue1;

                        InputResultData_Save(PopupValue);
                    }
                }
                else
                {
                    CoFAS_DevExpressManager.ShowInformationMessage("해당 작업지시의 래시피를 등록해주세요.");

                    frmPOPOrderBOM frmPopbom = new frmPOPOrderBOM(_pUserEntity, _pPOPSelect_INSPECT_MIXEntity, _luORDER_ID.Text, _luPART_CODE.Text);
                    //frmPopbom._Workorder_ID = _luORDER_ID.Text;  //작업지시번호
                    //frmPopbom._Part_Code = _luPART_CODE.Text;  // 반죽 번호
                    frmPopbom.ShowDialog();
                }
            }
        }