public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from t_downtime_report Where 1=1 "); if (inVo.DowntimeReportId > 0) { sql.Append(" and downtime_report_id = :downtime_report_id "); sqlParameter.AddParameterInteger("downtime_report_id", inVo.DowntimeReportId); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL ReportDownTimeVo outVo = new ReportDownTimeVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <ReportDownTimeVo> voList = new ValueObjectList <ReportDownTimeVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append(@"SELECT * from public.t_downtime_report"); // sqlParameter.AddParameterInteger("model_id", inVo.LineId); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); //while (dataReader.Read()) //{ // LineVo outVo = new LineVo // { // LineId = int.Parse(dataReader["line_id"].ToString()), // LineCode = dataReader["line_cd"].ToString() // }; // voList.add(outVo); //} dataReader.Close(); return(voList); }
private void machine_txt_TextChanged(object sender, EventArgs e) { //if (machine_txt.SelectedItem != null) //{ ReportDownTimeVo inVo = new ReportDownTimeVo { MachineName = machine_txt.Text }; ValueObjectList <DefectiveReasonVo> defectivereasonvo = (ValueObjectList <DefectiveReasonVo>)DefaultCbmInvoker.Invoke(new GetCauseAndDefectiveCbm(), new DefectiveReasonVo { DefectiveReasonCode = inVo.MachineName }); cause_cmb.DisplayMember = "DefectiveReasonName"; cause_cmb.DataSource = defectivereasonvo.GetList(); ValueObjectList <ProdutionWorkContentVo> respmachinevolist = (ValueObjectList <ProdutionWorkContentVo>)DefaultCbmInvoker.Invoke(new GetActicAndContentCbm(), new ProdutionWorkContentVo { ProdutionWorkContentCode = inVo.MachineName }); action_cmb.DisplayMember = "ProdutionWorkContentName"; action_cmb.DataSource = respmachinevolist.GetList(); cause_cmb.ResetText(); action_cmb.ResetText(); //process_cmb.ResetText(); //} }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); sql.Append(@"update t_downtime_report set time_from=:time_from, time_to=:time_to, prodution_work_content_id=:prodution_work_content_id, line_id=:line_id, model_id=:model_id, process_work_id=:process_work_id, process_name=:process_name, machine_name=:machine_name, defective_reason_id=:defective_reason_id, remarks=:remarks"); sql.Append(" where downtime_report_id =:downtime_report_id"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("downtime_report_id", inVo.DowntimeReportId); sqlParameter.AddParameterDateTime("time_from", inVo.TimeFrom); sqlParameter.AddParameterDateTime("time_to", inVo.TimeTo); sqlParameter.AddParameterInteger("prodution_work_content_id", inVo.ProductionWorkContentId); sqlParameter.AddParameterInteger("line_id", inVo.LineId); sqlParameter.AddParameterInteger("model_id", inVo.ModelId); sqlParameter.AddParameterInteger("process_work_id", inVo.ProcessWorkId); sqlParameter.AddParameterString("process_name", inVo.ProcessCode); sqlParameter.AddParameterString("machine_name", inVo.MachineCode); sqlParameter.AddParameterInteger("defective_reason_id", inVo.DefectiveReasonId); sqlParameter.AddParameterString("remarks", inVo.Remakes); //execute SQL ReportDownTimeVo outVo = new ReportDownTimeVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <ReportDownTimeVo> voList = new ValueObjectList <ReportDownTimeVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select a.process_name, c.machine_name from m_process a left join m_process_work b on b.process_id = a.process_id left join m_machine c on c.machine_id = b.machine_id"); sql.Append(" where b.process_work_id = :process_work_id"); sqlParameter.AddParameterInteger("process_work_id", inVo.ProcessWorkId); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { ReportDownTimeVo outVo = new ReportDownTimeVo { ProcessName = dataReader["process_name"].ToString(), MachineName = dataReader["machine_name"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("SELECT count(role_cd) as RoleCount from m_mes_user_role where user_cd = :user_cd and role_cd = 'dwntfix'"); sqlParameter.AddParameterString("user_cd", inVo.RegistrationUserCode); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ReportDownTimeVo outVo = new ReportDownTimeVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["RoleCount"].ToString()); } dataReader.Close(); return(outVo); }
private void update_btn_Click(object sender, EventArgs e) { if (reportdowntime_dgv.SelectedCells.Count > 0) { ReportDownTimeVo selectedvo = (ReportDownTimeVo)reportdowntime_dgv.CurrentRow.DataBoundItem; if (new AddUpdateReportDownTimeFrom { reportDownTimeVo = selectedvo }.ShowDialog() == DialogResult.OK) { search_btn_Click(null, null); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); sql.Append(@"insert into t_downtime_report(time_from,time_to,prodution_work_content_id,line_id,model_id, machine_id,defective_reason_id, process_work_id,remarks,registration_user_cd,registration_date_time,factory_cd)"); sql.Append(@" values(:time_from,:time_to,:prodution_work_content_id,:line_id,:model_id, :machine_id,:defective_reason_id, :process_work_id,:remarks,:registration_user_cd,now(),:factory_cd)"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("downtime_report_id", inVo.DowntimeReportId); sqlParameter.AddParameterDateTime("time_to", inVo.TimeTo); sqlParameter.AddParameterDateTime("time_from", inVo.TimeFrom); sqlParameter.AddParameterString("remarks", inVo.Remakes); sqlParameter.AddParameterInteger("downtime_report_id", inVo.GroupProcessWorkId); sqlParameter.AddParameterInteger("line_id", inVo.LineId); sqlParameter.AddParameterInteger("machine_id", inVo.MachineId); sqlParameter.AddParameterInteger("model_id", inVo.ModelId); sqlParameter.AddParameterInteger("process_work_id", inVo.ProcessWorkId); sqlParameter.AddParameterInteger("prodution_work_content_id", inVo.ProductionWorkContentId); sqlParameter.AddParameterInteger("defective_reason_id", inVo.DefectiveReasonId); sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); //execute SQL ReportDownTimeVo outVo = new ReportDownTimeVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void ReportDownTimeForm_Load(object sender, EventArgs e) { int usr_cd; //Load ComboBox ValueObjectList <ModelVo> modelvolist = (ValueObjectList <ModelVo>)DefaultCbmInvoker.Invoke(new GetModelCbm(), new ModelVo()); model_cmb.DisplayMember = "ModelCode"; BindingSource b1 = new BindingSource(modelvolist.GetList(), null); model_cmb.DataSource = b1; ProcessVo processvo = (ProcessVo)DefaultCbmInvoker.Invoke(new GetProcessMasterMntCbm(), new ProcessVo()); assy_cmb.DisplayMember = "ProcessName"; BindingSource b2 = new BindingSource(processvo.ProcessListVo, null); assy_cmb.DataSource = b2; MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); machine_cmb.DataSource = b4; ResetControlValues.ResetControlValue(Search_tbpnl); //Check Permission ReportDownTimeVo inVo = new ReportDownTimeVo { RegistrationUserCode = UserData.GetUserData().UserCode }; ReportDownTimeVo usrvo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new CheckPermissionCbm(), new ReportDownTimeVo { RegistrationUserCode = inVo.RegistrationUserCode }); usr_cd = usrvo.AffectedCount; if (usr_cd == 1) { update_btn.Enabled = true; Delete_btn.Enabled = true; } }
private void process_cmb_SelectedIndexChanged(object sender, EventArgs e) { ProcessWorkVo pvo = (ProcessWorkVo)process_cmb.SelectedItem; ReportDownTimeVo inVo = new ReportDownTimeVo { ProcessWorkId = pvo.ProcessWorkId }; //ReportDownTimeVo outVo = new ReportDownTimeVo(); //outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new GetProcessMoCbm(), inVo); ValueObjectList <ReportDownTimeVo> outVo = (ValueObjectList <ReportDownTimeVo>)DefaultCbmInvoker.Invoke(new GetProcessMoCbm(), inVo); assy_txt.Text = outVo.GetList()[0].ProcessName; machine_txt.Text = outVo.GetList()[0].MachineName; //ValueObjectList<ProcessWorkVo> prwvo = (ValueObjectList<ProcessWorkVo>)DefaultCbmInvoker.Invoke(new GetCauseAndDefectiveCbm(), new ProcessWorkVo { ProcessWorkId = pvo.ProcessId }); //assy_txt.Text = prwvo.ToString(); //assy_txt.DataSource = prwvo.GetList(); }
private void buttonCommon1_Click(object sender, EventArgs e) { if (checkdata()) { ReportDownTimeVo outVo = new ReportDownTimeVo(); ReportDownTimeVo inVo = new ReportDownTimeVo { DowntimeReportId = this.reportDownTimeVo.DowntimeReportId, TimeFrom = this.timefrom_dtp.Value, TimeTo = this.timeto_dtp.Value, Remakes = this.remake_txt.Text, LineId = ((LineVo)this.line_cmb.SelectedItem).LineId, MachineId = ((MachineVo)this.machine_cmb.SelectedItem).MachineId, ModelId = ((ModelVo)this.model_cmb.SelectedItem).ModelId, ProcessWorkId = ((ProcessWorkVo)this.process_work_cmb.SelectedItem).ProcessId, ProductionWorkContentId = ((ProdutionWorkContentVo)this.action_cmb.SelectedItem).ProdutionWorkContentId, DefectiveReasonId = ((DefectiveReasonVo)this.cause_cmb.SelectedItem).DefectiveReasonId, RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; try { if (inVo.DowntimeReportId > 0) { outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new UpdateReportDownTimeCbm(), inVo); } else { outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new AddReportDownTimeCbm(), 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(); } } }
private void Delete_btn_Click(object sender, EventArgs e) { if (reportdowntime_dgv.SelectedRows.Count > 0) { int selectedrowindex = reportdowntime_dgv.SelectedCells[0].RowIndex; ReportDownTimeVo vo = (ReportDownTimeVo)reportdowntime_dgv.Rows[selectedrowindex].DataBoundItem; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, "This Report"); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { try { ReportDownTimeVo outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new DeleteReportDownTimeCbm(), vo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); selectdata(); } else if (outVo.AffectedCount == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); selectdata(); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } } } }
private void ok_btn_Click(object sender, EventArgs e) { if (checkdata()) { ReportDownTimeVo outVo = new ReportDownTimeVo(); ReportDownTimeVo inVo = new ReportDownTimeVo { DowntimeReportId = this.reportDownTimeVo.DowntimeReportId, TimeFrom = this.timefrom_dtp.Value, TimeTo = this.timeto_dtp.Value, Remakes = this.remake_txt.Text, LineId = ((LineVo)this.line_cmb.SelectedItem).LineId, MachineCode = this.machine_txt.Text, ModelId = ((ModelVo)this.model_cmb.SelectedItem).ModelId, ProcessCode = this.assy_txt.Text, ProcessWorkId = ((ProcessWorkVo)this.process_cmb.SelectedItem).ProcessWorkId, ProductionWorkContentId = ((ProdutionWorkContentVo)this.action_cmb.SelectedItem).ProdutionWorkContentId, DefectiveReasonId = ((DefectiveReasonVo)this.cause_cmb.SelectedItem).DefectiveReasonId, RegistrationUserCode = User_txt.Text, //UserData.GetUserData().UserName, FactoryCode = UserData.GetUserData().FactoryCode }; try { if (inVo.DowntimeReportId > 0) { outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new UpdateReportDownTimeCbm(), inVo); } else { outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new AddReportDownTimeCbm(), inVo); } ResetControlValues.ResetControlValue(tableLayoutPanel1); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } } }
private void update_btn_Click(object sender, EventArgs e) { if (reportdowntime_dgv.SelectedCells.Count > 0) { ReportDownTimeVo selectedvo = (ReportDownTimeVo)reportdowntime_dgv.CurrentRow.DataBoundItem; //model_cmb.Enabled = false; //line_cmb.Enabled = false; //machine_cmb.Enabled = false; //process_cmb.Enabled = false; if (new AddUpdateReportDownTimeFrom { reportDownTimeVo = selectedvo }.ShowDialog() == DialogResult.OK) { //search_btn_Click(null, null); selectdata(); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ReportDownTimeVo inVo = (ReportDownTimeVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <ReportDownTimeVo> voList = new ValueObjectList <ReportDownTimeVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("SELECT a.downtime_report_id, d.model_cd, l.process_work_name, a.process_name, h.line_cd, a.machine_name, k.defective_reason_name, o.prodution_work_content_name, a.time_to, a.time_from , a.registration_user_cd,a.remarks from t_downtime_report a left join m_model d on a.model_id = d.model_id left join m_line h on a.line_id = h.line_id left join m_defective_reason k on k.defective_reason_id = a.defective_reason_id left join m_process_work l on l.process_work_id = a.process_work_id left join m_prodution_work_content o on o.prodution_work_content_id = a.prodution_work_content_id where "); sql.Append(@"time_from > :starttime and time_from < :endtime"); sqlParameter.AddParameterDateTime("starttime", inVo.TimeFrom); sqlParameter.AddParameterDateTime("endtime", inVo.TimeTo); 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.MachineName)) { sql.Append(" and machine_name =:machine_name "); sqlParameter.AddParameterString("machine_name", inVo.MachineName); } if (!String.IsNullOrEmpty(inVo.DefectiveReasonName)) { sql.Append(" and defective_reason_name = :defective_reason_name "); sqlParameter.AddParameterString("defective_reason_name", inVo.DefectiveReasonName); } if (!String.IsNullOrEmpty(inVo.ProductionWorkContentName)) { sql.Append(" and prodution_work_content_name= :prodution_work_content_name "); sqlParameter.AddParameterString("prodution_work_content_name", inVo.ProductionWorkContentName); } sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { ReportDownTimeVo outVo = new ReportDownTimeVo { // , h., i., k., o.prodution_work_content_name DowntimeReportId = int.Parse(dataReader["downtime_report_id"].ToString()), ModelCode = dataReader["model_cd"].ToString(), ProcessName = dataReader["process_name"].ToString(), ProcessWorkName = dataReader["process_work_name"].ToString(), LineCode = dataReader["line_cd"].ToString(), MachineName = dataReader["machine_name"].ToString(), DefectiveReasonName = dataReader["defective_reason_name"].ToString(), ProductionWorkContentName = dataReader["prodution_work_content_name"].ToString(), TimeTo = DateTime.Parse(dataReader["time_to"].ToString()), TimeFrom = DateTime.Parse(dataReader["time_from"].ToString()), Remakes = dataReader["remarks"].ToString(), RegistrationUserCode = dataReader["registration_user_cd"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }