public Boolean AnularDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, ref string msg) { try { using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus()) { var contact = context.prd_ControlProduccion_Obrero.FirstOrDefault(A => A.IdEmpresa == IdEmpresa && A.IdSucursal == info.IdSucursal && A.IdControlProduccionObrero == info.IdControlProduccionObrero); if (contact != null) { contact.Estado = "I"; context.SaveChanges(); msg = "Se Cambio el estado del Control de Producción # :" + info.IdControlProduccionObrero.ToString() + " exitosamente"; } } return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); return(false); } }
public Boolean ModificarDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, ref string msg) { try { using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus()) { var contact = context.prd_ControlProduccion_Obrero.FirstOrDefault(obj => obj.IdEmpresa == IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdControlProduccionObrero == info.IdControlProduccionObrero); if (contact != null) { contact.NumCPO = info.NumDoc; contact.IdGrupoTrabajo = info.IdGrupoTrabajo; contact.CodObra = info.CodObra; contact.IdOrdenTaller = info.IdOrdenTaller; contact.IdEmpleado = info.IdEmpleado; contact.Observacion = info.Observacion; contact.FechaRegistro = info.FechaRegistro; contact.Estado = info.Estado; contact.CantAsignada = info.CantAsignada; context.SaveChanges(); msg = "Se ha procedido actualizar el registro del Control de Producción #: " + info.IdControlProduccionObrero + " exitosamente"; } } return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); return(false); } }
public List <prd_ControlProduccionObrero_Info> Get_List_ControlProduccionObrero(int IdEmpresa, int IdGrupoT, DateTime FechaIni, DateTime FechaFin) { try { TimeSpan TiempoProduccion; EntitiesProduccion_Cidersus OEProduccion = new EntitiesProduccion_Cidersus(); List <prd_ControlProduccionObrero_Info> lM = new List <prd_ControlProduccionObrero_Info>(); var select = from C in OEProduccion.vwprd_ControlProduccion_Obrero_Cab where C.IdEmpresa == IdEmpresa && C.IdGrupoTrabajo == IdGrupoT && C.FechaTransaccion >= FechaIni && C.FechaTransaccion <= FechaFin orderby C.FechaTransaccion ascending select C; foreach (var item in select) { prd_ControlProduccionObrero_Info info = new prd_ControlProduccionObrero_Info(); info.IdEmpresa = IdEmpresa; info.IdSucursal = item.IdSucursal; info.IdGrupoTrabajo = item.IdGrupoTrabajo; info.FechaHoraFinFabricacion = (DateTime)item.FechaTransaccion; if (item.FechaFinProceso != null) { info.FechaHoraInicioFabricacion = (DateTime)item.FechaFinProceso; int hh = Convert.ToInt32(((TimeSpan)(item.FechaFinProceso - item.FechaTransaccion)).TotalHours); int mm = Convert.ToInt32(((TimeSpan)(item.FechaFinProceso - item.FechaTransaccion)).Minutes); int ss = Convert.ToInt32(((TimeSpan)(item.FechaFinProceso - item.FechaTransaccion)).TotalSeconds); TiempoProduccion = new TimeSpan(hh, mm, ss); info.TiempoDuroPP = TiempoProduccion; } info.NombreProcesoProductivo = item.Nombre; info.Nom_grupoTrabajo = item.Descripcion; info.NombreEtapa = item.NombreEtapa; info.NombreProducto = item.DescripcionPieza; info.Observacion = item.Observacion; info.Estado = item.Estado; info.NombreEtapa = item.NombreEtapa; lM.Add(info); } return(lM); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
void ucGe_Menu_event_btnGuardar_Click(object sender, EventArgs e) { try { txtEtapa.Focus(); if (Validar()) { Get(); string mnj = ""; decimal Id = 0; if (_ListDetalle.Count != 0) { if (Bus.GrabarCabeceraDB(param.IdEmpresa, _Info, _ListDetalle, ref mnj, ref Id)) { txtId.Text = Id.ToString(); GenerarMovimientoInvenario(); listMovi.ForEach(v => { v.cp_IdEmpresa = param.IdEmpresa; v.cp_IdControlProduccionObrero = Id; v.cp_IdSucursal = _Info.IdSucursal; }); foreach (var item in listMovi) { Contr_x_movi_B.GuardarDB(item); } MessageBox.Show(mnj); { setAccion(Cl_Enumeradores.eTipo_action.consultar); _SetInfo = _Info; _SetInfo.IdControlProduccionObrero = Id; Set(); this.frmPrd_ControlProduccionxGrupo_Mant_Load(sender, e); } } else { MessageBox.Show(mnj); } } else { MessageBox.Show("Ingrese Al menos Un Producto"); } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public Boolean GrabarDB(int IdEmpresa, prd_ControlProduccionObrero_Info info, List <prd_ControlProduccionObreroDetalle_Info> lmDetalleInfo, ref string msg, ref decimal idgenerada) { try { using (EntitiesProduccion_Cidersus context = new EntitiesProduccion_Cidersus()) { var address = new prd_ControlProduccion_Obrero(); int id = GetId(IdEmpresa, info.IdSucursal); address.IdEmpresa = IdEmpresa; address.IdSucursal = info.IdSucursal; address.IdBodega = info.IdBodega; address.IdControlProduccionObrero = id; //Para pasarla al winform idgenerada = id; address.NumCPO = id; address.IdGrupoTrabajo = info.IdGrupoTrabajo; address.CodObra = info.CodObra; address.IdOrdenTaller = info.IdOrdenTaller; address.IdEmpleado = info.IdEmpleado; address.CantAsignada = info.CantAsignada; address.Observacion = info.Observacion; address.FechaRegistro = info.FechaRegistro; address.Estado = "A"; context.prd_ControlProduccion_Obrero.Add(address); context.SaveChanges(); prd_ControlProduccionObreroDetalle_Data datadetalle = new prd_ControlProduccionObreroDetalle_Data(); if (datadetalle.grabarDB(lmDetalleInfo, IdEmpresa, id, ref msg)) { return(true); msg = "Se ha procedido a grabar el registro del Control de Producción #: " + id.ToString() + " exitosamente."; } else { return(false); } } } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); msg = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); return(false); } }
public Boolean AnularReactiva(int idempresa, prd_ControlProduccionObrero_Info info, ref string msg) { try { return(data.AnularDB(idempresa, info, ref msg)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularReactiva", ex.Message), ex) { EntityType = typeof(prd_ControlProduccionObrero_Bus) }; } }
public Boolean GrabarCabeceraDB(int idempresa, prd_ControlProduccionObrero_Info info, List <prd_ControlProduccionObreroDetalle_Info> lmDetalleInfo, ref string msg, ref decimal idgenerada) { try { return(data.GrabarDB(idempresa, info, lmDetalleInfo, ref msg, ref idgenerada)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarCabeceraDB", ex.Message), ex) { EntityType = typeof(prd_ControlProduccionObrero_Bus) }; } }
void Get() { try { _Info = new prd_ControlProduccionObrero_Info(); _ListDetalle = new List <prd_ControlProduccionObreroDetalle_Info>(); _Info.CantAsignada = Convert.ToDouble(txtCantDisponible.Text); _Info.CodObra = cmbObra.EditValue.ToString(); _Info.FechaRegistro = Convert.ToDateTime(dtpFecha.Value); _Info.IdEmpleado = ((List <prd_SubGrupoTrabajo_Info>)(cmbGrupoAsignado.Properties.DataSource)).First(V => V.IdGrupoTrabajo == Convert.ToDecimal(cmbGrupoAsignado.EditValue)).IdLider; _Info.IdEmpresa = param.IdEmpresa; _Info.IdGrupoTrabajo = Convert.ToDecimal(cmbGrupoAsignado.EditValue); _Info.IdOrdenTaller = Convert.ToDecimal(cmbOrdenTaller.EditValue); _Info.IdSucursal = Convert.ToInt32(ctrl_Sucbod.cmb_sucursal.EditValue); _Info.IdBodega = Convert.ToInt32(ctrl_Sucbod.cmb_bodega.EditValue); _Info.Observacion = txtObservacion.Text + " Prd x Ob" + cmbObra.Text + " Ot " + cmbOrdenTaller.Text + " Gt " + cmbGrupoAsignado.Text + " Et I " + txtEtapaAnterior.Text + " Et F " + txtEtapa.Text ; //_ListDetalle = ((List<prd_ControlProduccionObreroDetalle_Info>)(gridControlDetalle.DataSource)).FindAll(v => v.CodBarra != "" && v.pr_descripcion != "" && v.Cantidad != 0); foreach (var item in ListadoDisponible) { if (item.Checked == true) { item.IdEmpresa = param.IdEmpresa; item.IdSucursal = Convert.ToInt32(ctrl_Sucbod.cmb_sucursal.EditValue); _ListDetalle.Add(item); } } _Info.IdControlProduccionObrero = Convert.ToDecimal((txtId.Text == "") ? "0" : txtId.Text); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public prd_ControlProduccionObrero_Info Get_Info_ControlProduccionObrero(int IdEmpresa, int IdSucursal, decimal codGT, string CodObra, decimal codCPO) { try { EntitiesProduccion_Cidersus GTProduccion = new EntitiesProduccion_Cidersus(); prd_ControlProduccionObrero_Info lGT = new prd_ControlProduccionObrero_Info(); return(lGT); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); return(new prd_ControlProduccionObrero_Info()); } }