public Boolean GuardarDB(prd_ControlProduccion_Obrero_x_in_movi_inve_Info Info) { try { List <prd_ControlProduccion_Obrero_x_in_movi_inve_Info> Lst = new List <prd_ControlProduccion_Obrero_x_in_movi_inve_Info>(); using (EntitiesProduccion_Cidersus Context = new EntitiesProduccion_Cidersus()) { var Address = new prd_ControlProduccion_Obrero_x_in_movi_inve(); Address.cp_IdEmpresa = Info.cp_IdEmpresa; Address.cp_IdSucursal = Info.cp_IdSucursal; Address.cp_IdControlProduccionObrero = Info.cp_IdControlProduccionObrero; Address.mv_IdEmpresa = Info.mv_IdEmpresa; Address.mv_IdSucursal = Info.mv_IdSucursal; Address.mv_IdBodega = Info.mv_IdBodega; Address.mv_IdMovi_inven_tipo = Info.mv_IdMovi_inven_tipo; Address.mv_IdNumMovi = Info.mv_IdNumMovi; Context.prd_ControlProduccion_Obrero_x_in_movi_inve.Add(Address); Context.SaveChanges(); } 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); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(prd_ControlProduccion_Obrero_x_in_movi_inve_Info Info) { try { return(data.GuardarDB(Info)); } 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("", "GuardarDB", ex.Message), ex) { EntityType = typeof(prd_ControlProduccion_Obrero_x_in_movi_inve_Bus) }; } }
public List <prd_ControlProduccion_Obrero_x_in_movi_inve_Info> Get_List_ControlProduccion_x_Obrero_x_in_movi_inven(int IdEmpresa, Decimal IdControlProduccion, int IdSucursal) { try { List <prd_ControlProduccion_Obrero_x_in_movi_inve_Info> Lst = new List <prd_ControlProduccion_Obrero_x_in_movi_inve_Info>(); EntitiesProduccion_Cidersus oEnti = new EntitiesProduccion_Cidersus(); var Query = from q in oEnti.prd_ControlProduccion_Obrero_x_in_movi_inve select q; foreach (var item in Query) { prd_ControlProduccion_Obrero_x_in_movi_inve_Info Obj = new prd_ControlProduccion_Obrero_x_in_movi_inve_Info(); Obj.cp_IdEmpresa = item.cp_IdEmpresa; Obj.cp_IdSucursal = item.cp_IdSucursal; Obj.cp_IdControlProduccionObrero = item.cp_IdControlProduccionObrero; Obj.mv_IdEmpresa = item.mv_IdEmpresa; Obj.mv_IdSucursal = item.mv_IdSucursal; Obj.mv_IdBodega = item.mv_IdBodega; Obj.mv_IdMovi_inven_tipo = item.mv_IdMovi_inven_tipo; Obj.mv_IdNumMovi = item.mv_IdNumMovi; Lst.Add(Obj); } return(Lst); } 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 GenerarMovimientoInvenario() { try { decimal IdMoviInvenIngres = 0; string mensaje_cbte_cble = ""; in_producto_x_tb_bodega_Bus prod_B = new in_producto_x_tb_bodega_Bus(); in_movi_inve_detalle_x_Producto_CusCider_Bus CusCidersus_B = new in_movi_inve_detalle_x_Producto_CusCider_Bus(); in_movi_inve_Bus in_Movi_B = new in_movi_inve_Bus(); in_movi_inve_detalle_x_Producto_CusCider_Bus BusCusCidersu = new in_movi_inve_detalle_x_Producto_CusCider_Bus(); var OrdenTaller = ((List <prd_OrdenTaller_Info>)(cmbOrdenTaller.Properties.DataSource)).First(v => v.IdOrdenTaller == Convert.ToDecimal(cmbOrdenTaller.EditValue)); var Parametros = BusParmetros.ObtenerObjeto(param.IdEmpresa); prd_ControlProduccion_Obrero_x_in_movi_inve_Info MoviXcConv; in_movi_inve_Info MoviInfo = new in_movi_inve_Info(); MoviInfo.IdEmpresa = param.IdEmpresa; MoviInfo.cm_fecha = Convert.ToDateTime(dtpFecha.Value); MoviInfo.cm_observacion = txtObservacion.Text + " Eg x Prd x Ob" + cmbObra.Text + " Ot " + cmbOrdenTaller.Text + " Gt " + cmbGrupoAsignado.Text + " Et I " + txtEtapaAnterior.Text + " Et F " + txtEtapa.Text ; MoviInfo.cm_tipo = "-"; MoviInfo.IdBodega = Convert.ToInt32(ctrl_Sucbod.cmb_bodega.EditValue); MoviInfo.IdSucursal = Convert.ToInt32(ctrl_Sucbod.cmb_sucursal.EditValue); MoviInfo.IdMovi_inven_tipo = Convert.ToInt32(Parametros.IdMovi_inven_tipo_egr_ContrlProduccion); in_producto_Bus busprod = new in_producto_Bus(); List <in_movi_inve_detalle_Info> Listdetalle = new List <in_movi_inve_detalle_Info>(); foreach (var item in _ListDetalle) { in_movi_inve_detalle_Info Obj = new in_movi_inve_detalle_Info(); var Producto = prod_B.Get_Info_Producto_x_Producto(param.IdEmpresa, MoviInfo.IdSucursal, MoviInfo.IdBodega, item.IdProducto); Obj.IdProducto = item.IdProducto; Obj.IdSucursal = MoviInfo.IdSucursal; Obj.IdBodega = MoviInfo.IdBodega; Obj.IdEmpresa = param.IdEmpresa; Obj.IdMovi_inven_tipo = MoviInfo.IdMovi_inven_tipo; Obj.IdProducto = item.IdProducto; Obj.mv_costo = ProductosXEtapa.First(v => v.IdProducto == item.IdProducto).mv_costo; Obj.dm_precio = ProductosXEtapa.First(v => v.IdProducto == item.IdProducto).dm_precio; Obj.mv_tipo_movi = "-"; Obj.dm_stock_actu = Producto.pr_stock - 1; Obj.dm_stock_ante = Producto.pr_stock; var prod = busprod.Get_Info_BuscarProducto(item.IdProducto, param.IdEmpresa); Obj.dm_observacion = " Prod " + prod.pr_descripcion; Obj.dm_observacion = MoviInfo.cm_observacion + Obj.dm_observacion; Obj.dm_cantidad = -1; MoviInfo.listmovi_inve_detalle_Info.Add(Obj); } decimal IdMoviInven = 0; string Msj = ""; int c = 1; //MoviInfo.listmovi_inve_detalle_Info.ForEach(var => var.dm_cantidad = var.dm_cantidad * -1); if (in_Movi_B.GrabarDB(MoviInfo, ref IdMoviInven, ref mensaje_cbte_cble, ref Msj) == false) { MessageBox.Show(Msj, "Movimiento Egreso"); } else { MoviXcConv = new prd_ControlProduccion_Obrero_x_in_movi_inve_Info(); MoviXcConv.mv_IdBodega = MoviInfo.IdBodega; MoviXcConv.mv_IdEmpresa = MoviInfo.IdEmpresa; MoviXcConv.mv_IdMovi_inven_tipo = MoviInfo.IdMovi_inven_tipo; MoviXcConv.mv_IdNumMovi = IdMoviInven; MoviXcConv.mv_IdSucursal = MoviInfo.IdSucursal; listMovi.Add(MoviXcConv); MoviInfo.cm_tipo = "+"; MoviInfo.IdNumMovi = 0; MoviInfo.IdMovi_inven_tipo = Convert.ToInt32(Parametros.IdMovi_inven_tipo_ing_ContrlProduccion); MoviInfo.cm_observacion = txtObservacion.Text + " Ing x Prd x Ob" + cmbObra.Text + " Ot " + cmbOrdenTaller.Text + " Gt " + cmbGrupoAsignado.Text + " Et I " + txtEtapaAnterior.Text + " Et F " + txtEtapa.Text ; foreach (var v in MoviInfo.listmovi_inve_detalle_Info) { v.mv_tipo_movi = "+"; v.IdMovi_inven_tipo = MoviInfo.IdMovi_inven_tipo; v.dm_cantidad = 1; v.dm_stock_actu = v.dm_stock_actu + 1; v.dm_stock_ante = v.dm_stock_actu; var prod = busprod.Get_Info_BuscarProducto(v.IdProducto, param.IdEmpresa); v.dm_observacion = " Prod " + prod.pr_descripcion; v.dm_observacion = MoviInfo.cm_observacion + v.dm_observacion; } if (in_Movi_B.GrabarDB(MoviInfo, ref IdMoviInvenIngres, ref mensaje_cbte_cble, ref Msj) == false) { MessageBox.Show(Msj, "Movimiento Ingreso"); } MoviXcConv = new prd_ControlProduccion_Obrero_x_in_movi_inve_Info(); MoviXcConv.mv_IdBodega = MoviInfo.IdBodega; MoviXcConv.mv_IdEmpresa = MoviInfo.IdEmpresa; MoviXcConv.mv_IdMovi_inven_tipo = MoviInfo.IdMovi_inven_tipo; MoviXcConv.mv_IdNumMovi = IdMoviInvenIngres; MoviXcConv.mv_IdSucursal = MoviInfo.IdSucursal; listMovi.Add(MoviXcConv); } List <in_movi_inve_detalle_x_Producto_CusCider_Info> ListCidersusInfo = new List <in_movi_inve_detalle_x_Producto_CusCider_Info>(); foreach (var item in _ListDetalle) { in_movi_inve_detalle_x_Producto_CusCider_Info CusCidersusInfo = new in_movi_inve_detalle_x_Producto_CusCider_Info(); CusCidersusInfo.IdEmpresa = param.IdEmpresa; CusCidersusInfo.CodigoBarra = item.CodBarraMaestro; CusCidersusInfo.dm_cantidad = -1; var prod = busprod.Get_Info_BuscarProducto(item.IdProducto, param.IdEmpresa); CusCidersusInfo.dm_observacion = txtObservacion.Text + " Eg x Prd x Ob" + cmbObra.Text + " Ot " + cmbOrdenTaller.Text + " Gt " + cmbGrupoAsignado.Text + " Et I " + txtEtapaAnterior.Text + " Et F " + txtEtapa.Text + " Prod " + prod.pr_descripcion ; CusCidersusInfo.dm_precio = ProductosXEtapa.First(v => v.IdProducto == item.IdProducto).dm_precio; CusCidersusInfo.et_IdEmpresa = param.IdEmpresa; CusCidersusInfo.et_IdEtapa = EtapaAnterior.IdEtapa; CusCidersusInfo.et_IdProcesoProductivo = EtapaAnterior.IdProcesoProductivo; CusCidersusInfo.IdBodega = MoviInfo.IdBodega; CusCidersusInfo.IdSucursal = MoviInfo.IdSucursal; CusCidersusInfo.IdMovi_inven_tipo = Convert.ToInt32(Parametros.IdMovi_inven_tipo_egr_ContrlProduccion); CusCidersusInfo.IdNumMovi = IdMoviInven; CusCidersusInfo.IdProducto = item.IdProducto; CusCidersusInfo.mv_costo = ProductosXEtapa.First(v => v.IdProducto == item.IdProducto).mv_costo; CusCidersusInfo.ot_CodObra = OrdenTaller.CodObra; CusCidersusInfo.ot_IdEmpresa = OrdenTaller.IdEmpresa; CusCidersusInfo.ot_IdOrdenTaller = OrdenTaller.IdOrdenTaller; CusCidersusInfo.ot_IdSucursal = OrdenTaller.IdSucursal; CusCidersusInfo.mv_Secuencia = c; CusCidersusInfo.mv_tipo_movi = "-"; c++; ListCidersusInfo.Add(CusCidersusInfo); } if (BusCusCidersu.GuardarDB(ListCidersusInfo, ref Msj) == false) { MessageBox.Show(Msj, "Cus Cidersus Egreso"); } else { foreach (var v in ListCidersusInfo) { v.dm_cantidad = 1; v.et_IdEtapa = Etapa.IdEtapa; v.et_IdProcesoProductivo = Etapa.IdProcesoProductivo; v.IdMovi_inven_tipo = Convert.ToInt32(Parametros.IdMovi_inven_tipo_ing_ContrlProduccion); v.IdNumMovi = IdMoviInvenIngres; v.mv_tipo_movi = "+"; var prod = busprod.Get_Info_BuscarProducto(v.IdProducto, param.IdEmpresa); v.dm_observacion = txtObservacion.Text + " Ing x Prd x Ob" + cmbObra.Text + " Ot " + cmbOrdenTaller.Text + " Gt " + cmbGrupoAsignado.Text + " Et I " + txtEtapaAnterior.Text + " Et F " + txtEtapa.Text + " Prod " + prod.pr_descripcion ; } if (BusCusCidersu.GuardarDB(ListCidersusInfo, ref Msj) == false) { MessageBox.Show(Msj, "Cus Cidersus Ingreso"); } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }