private void btnOK_Click(object sender, EventArgs e)
        {
            //유효값 확인
            bool bWO      = txtWOcode.Text.Trim().Length > 0;
            bool bQTY     = txtPlanQTY.Text.Trim().Length > 0;
            bool bWorkSEQ = txtWorkSEQ.Text.Trim().Length > 0;

            if (!(bWO || bQTY || bWorkSEQ))
            {
                MessageBox.Show("필수값을 입력해주세요.", "필수값 입력 확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            //전달 vo 생성
            WORKORDERInsert_VO vo = new WORKORDERInsert_VO();

            vo.WO_Code             = txtWOcode.Text;
            vo.ITEM_CODE           = cboItem.SelectedValue.ToString();
            vo.FCLTS_CODE          = cboFC.SelectedValue.ToString();
            vo.WO_PLAN_DATE        = dtpPlanDate.Value.ToShortDateString();
            vo.WO_PLAN_STARTTIME   = dtpPlanStart.Value.ToShortDateString();
            vo.WO_PLAN_ENDTIME     = dtpPlanEnd.Value.ToShortDateString();
            vo.WO_PLAN_QTY         = int.Parse(txtPlanQTY.Text.Trim());
            vo.WO_WORK_SEQ         = int.Parse(txtWorkSEQ.Text.Trim());
            vo.WO_LAST_MDFR        = LoginInfo.UserInfo.LI_ID;
            vo.WO_LAST_MDFY        = DateTime.Now.ToShortDateString();
            vo.SALES_WORK_ORDER_ID = cboWO.Text;
            vo.PLAN_ID             = cboPlanID.Text;
            vo.WO_REMARK           = txtRemark.Text.Trim();

            //서비스호출
            WorkOrderINService service = new WorkOrderINService();

            if (service.InsertWorkOrder(vo))
            {
                MessageBox.Show("등록되었습니다.", "등록 확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("등록에 실패하였습니다.", "등록 실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        public bool InsertWorkOrder(WORKORDERInsert_VO vo)
        {
            bool Result = false;

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = new SqlConnection(this.ConnectionString);
                    cmd.CommandText = $@"insert into [dbo].[WORKORDER]
            (WO_Code,ITEM_CODE,FCLTS_CODE,WO_PLAN_DATE,WO_WORK_STATE,WO_PLAN_STARTTIME,WO_PLAN_ENDTIME,WO_PLAN_QTY,WO_WORK_SEQ,WO_LAST_MDFR,WO_LAST_MDFY,SALES_WORK_ORDER_ID,PLAN_ID,WO_REMARK)
            values(@WO_Code,@ITEM_CODE,@FCLTS_CODE,@WO_PLAN_DATE,'작업생성',@WO_PLAN_STARTTIME,@WO_PLAN_ENDTIME,@WO_PLAN_QTY,@WO_WORK_SEQ,@WO_LAST_MDFR,@WO_LAST_MDFY,@SALES_WORK_ORDER_ID,@PLAN_ID,@WO_REMARK)
            ";
                    cmd.Parameters.AddWithValue("@WO_Code", vo.WO_Code);
                    cmd.Parameters.AddWithValue("@ITEM_CODE", vo.ITEM_CODE);
                    cmd.Parameters.AddWithValue("@FCLTS_CODE", vo.FCLTS_CODE);
                    cmd.Parameters.AddWithValue("@WO_PLAN_DATE", vo.WO_PLAN_DATE);
                    cmd.Parameters.AddWithValue("@WO_PLAN_STARTTIME", vo.WO_PLAN_STARTTIME);
                    cmd.Parameters.AddWithValue("@WO_PLAN_ENDTIME", vo.WO_PLAN_ENDTIME);
                    cmd.Parameters.AddWithValue("@WO_PLAN_QTY", vo.WO_PLAN_QTY);
                    cmd.Parameters.AddWithValue("@WO_WORK_SEQ", vo.WO_WORK_SEQ);
                    cmd.Parameters.AddWithValue("@WO_LAST_MDFR", vo.WO_LAST_MDFR);
                    cmd.Parameters.AddWithValue("@WO_LAST_MDFY", vo.WO_LAST_MDFY);
                    cmd.Parameters.AddWithValue("@SALES_WORK_ORDER_ID", vo.SALES_WORK_ORDER_ID);
                    cmd.Parameters.AddWithValue("@PLAN_ID", vo.PLAN_ID);
                    cmd.Parameters.AddWithValue("@WO_REMARK", vo.WO_REMARK);

                    cmd.Connection.Open();
                    int iResult = cmd.ExecuteNonQuery();
                    cmd.Connection.Close();
                    return((iResult > 0) ? true : false);
                }
            }
            catch (Exception err)
            {
                string msg = err.Message;
                return(Result);
            }
        }
        public bool InsertWorkOrder(WORKORDERInsert_VO vo)
        {
            WorkOrderINDAC dac = new WorkOrderINDAC();

            return(dac.InsertWorkOrder(vo));
        }