Ejemplo n.º 1
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigRepairInformationVo inVo = (JigRepairInformationVo)vo;
            StringBuilder          sql  = new StringBuilder();

            sql.Append(@"update t_jig_repair_info set jig_repair_cd=:jig_repair_cd,
                                                        model_id=:model_id,
                                                        line_id=:line_id,
                                                        process_id=:process_id,
                                                        jig_cause_id=:jig_cause_id,
                                                        time_from=:time_from,
                                                        time_to=:time_to,
                                                        jig_current_status=:jig_current_status,
                                                        jig_response_id=:jig_response_id,
                                                        repair_result=:repair_result,
                                                        jig_after_repair_status=:jig_after_repair_status,
                                                        place=:place
                                                        ");
            sql.Append(" where jig_repair_id =:jig_repair_id");



            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("jig_repair_id", inVo.JigRepairId);
            sqlParameter.AddParameter("jig_repair_cd", inVo.JigRepairCode);
            sqlParameter.AddParameter("model_id", inVo.ModelId);
            sqlParameter.AddParameter("line_id", inVo.LineId);
            sqlParameter.AddParameter("process_id", inVo.ProcessId);
            sqlParameter.AddParameter("jig_cause_id", inVo.JigCauseId);
            sqlParameter.AddParameter("time_from", inVo.TimeFrom);
            sqlParameter.AddParameter("time_to", inVo.TimeTo);
            sqlParameter.AddParameter("jig_current_status", inVo.JigCurrentStatus);
            sqlParameter.AddParameter("jig_response_id", inVo.JigResponseId);
            sqlParameter.AddParameter("repair_result", inVo.JigRepairResult);
            sqlParameter.AddParameter("jig_after_repair_status", inVo.JigAfterRepairStatus);
            sqlParameter.AddParameter("place", inVo.JigPlace);
            sqlParameter.AddParameter("registration_user_cd", inVo.RegistrationUserCode);
            sqlParameter.AddParameter("factory_cd", inVo.FactoryCode);


            //execute SQL

            JigRepairInformationVo outVo = new JigRepairInformationVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Ejemplo n.º 2
0
 private void update_btn_Click(object sender, EventArgs e)
 {
     if (jig_repair_information_dgv.SelectedCells.Count > 0)
     {
         JigRepairInformationVo selectedvo = (JigRepairInformationVo)jig_repair_information_dgv.CurrentRow.DataBoundItem;
         if (new AddJigRepairInformationForm { jvo = selectedvo }.ShowDialog() == DialogResult.OK)
         {
             //search_btn_Click(null, null);
             selectdata();
         }
     }
 }
        private void buttonCommon1_Click(object sender, EventArgs e) // ok buttion
        {
            if (checkdata())
            {
                JigRepairInformationVo outVo = new JigRepairInformationVo();
                JigRepairInformationVo inVo  = new JigRepairInformationVo
                {
                    JigRepairId          = jvo.JigResponseId,
                    TimeFrom             = this.timefrom_dtp.Value,
                    TimeTo               = this.timeto_dtp.Value,
                    LineId               = ((LineVo)this.line_cmb.SelectedItem).LineId,
                    JigCauseId           = ((JigCauseVo)this.jigause_cmb.SelectedItem).JigCauseId,
                    ModelId              = ((ModelVo)this.model_cmb.SelectedItem).ModelId,
                    ProcessWorkId        = ((ProcessWorkVo)this.process_work_cmb.SelectedItem).ProcessId,
                    JigResponseId        = ((JigResponseVo)this.jigresponse_cmb.SelectedItem).JigResponseId,
                    JigRepairCode        = jig_code_txt.Text,
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                    FactoryCode          = UserData.GetUserData().FactoryCode,

                    //---------------
                    JigRepairResult      = resuft_cmb.Text,
                    JigPlace             = place_txt.Text,
                    JigCauseCode         = jig_code_txt.Text,
                    JigAfterRepairStatus = afterstatus_txt.Text,
                    JigCurrentStatus     = beforestatus_txt.Text
                };
                try
                {
                    if (inVo.JigRepairId > 0)
                    {
                        outVo = (JigRepairInformationVo)DefaultCbmInvoker.Invoke(new UpdateJigRepairInformationCbm(), inVo);
                    }
                    else
                    {
                        outVo = (JigRepairInformationVo)DefaultCbmInvoker.Invoke(new AddJigRepairInformationCbm(), inVo);
                    }
                }
                catch (Com.Nidec.Mes.Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                if (outVo.AffectedCount > 0)
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
Ejemplo n.º 4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigRepairInformationVo inVo = (JigRepairInformationVo)vo;
            StringBuilder          sql  = new StringBuilder();
            ValueObjectList <JigRepairInformationVo> voList = new ValueObjectList <JigRepairInformationVo>();
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sql.Append(@"SELECT a.jig_repair_id, a.jig_repair_cd, c.model_name, c.model_cd, b.line_name, g.process_name, e.jig_cause_name, f.jig_response_name,
a.time_from, a.time_to, a.jig_current_status, a.jig_after_repair_status, a.repair_result, a.place,b.line_cd,a.registration_user_cd,a.registration_date_time,a.factory_cd
from t_jig_repair_info a 

left join m_line b on b.line_id = a.line_id
left join m_model c on c.model_id = a.model_id
left join m_process g on g.process_id = a.process_id
left join m_jig_cause e on e.jig_cause_id = a.jig_cause_id
left join m_jig_response f on f.jig_response_id = a.jig_response_id
 WHERE  ");


            sql.Append(@"time_from >= :starttime and  time_from <= :endtime"); //
            sqlParameter.AddParameterDateTime("starttime", inVo.TimeFrom);
            sqlParameter.AddParameterDateTime("endtime", inVo.TimeTo.AddDays(1));

            if (!String.IsNullOrEmpty(inVo.ModelCode))
            {
                sql.Append(" and model_cd =:model_cd ");
                sqlParameter.AddParameterString("model_cd", inVo.ModelCode);
            }
            if (!String.IsNullOrEmpty(inVo.ProcessName))
            {
                sql.Append(" and process_name =:process_name ");
                sqlParameter.AddParameterString("process_name", inVo.ProcessName);
            }
            if (!String.IsNullOrEmpty(inVo.LineCode))
            {
                sql.Append(" and line_cd =:line_cd ");
                sqlParameter.AddParameterString("line_cd", inVo.LineCode);
            }
            if (!String.IsNullOrEmpty(inVo.JigRepairCode))
            {
                sql.Append(" and jig_repair_cd =:jig_repair_cd ");
                sqlParameter.AddParameterString("jig_repair_cd", inVo.JigRepairCode);
            }
            if (!String.IsNullOrEmpty(inVo.JigCauseName))
            {
                sql.Append(" and jig_cause_name = :jig_cause_name ");
                sqlParameter.AddParameterString("jig_cause_name", inVo.JigCauseName);
            }
            if (!String.IsNullOrEmpty(inVo.JigResponseName))
            {
                sql.Append(" and jig_response_name=  :jig_response_name ");
                sqlParameter.AddParameterString("jig_response_name", inVo.JigResponseName);
            }


            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());



            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                JigRepairInformationVo outVo = new JigRepairInformationVo
                {
                    //  , h., i., k., o.prodution_work_content_name
                    JigRepairId          = int.Parse(dataReader["jig_repair_id"].ToString()),
                    JigRepairCode        = dataReader["jig_repair_cd"].ToString(),
                    ProcessName          = dataReader["process_name"].ToString(),
                    LineCode             = dataReader["line_cd"].ToString(),
                    JigCauseName         = dataReader["jig_cause_name"].ToString(),
                    JigResponseName      = dataReader["jig_response_name"].ToString(),
                    TimeTo               = DateTime.Parse(dataReader["time_to"].ToString()),
                    TimeFrom             = DateTime.Parse(dataReader["time_from"].ToString()),
                    ModelName            = dataReader["model_name"].ToString(),
                    ModelCode            = dataReader["model_cd"].ToString(),
                    JigCurrentStatus     = dataReader["jig_current_status"].ToString(),
                    JigAfterRepairStatus = (dataReader["jig_after_repair_status"].ToString()),

                    JigRepairResult      = dataReader["repair_result"].ToString(),
                    JigPlace             = dataReader["place"].ToString(),
                    RegistrationUserCode = dataReader["registration_user_cd"].ToString()
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }