예제 #1
0
        public ErrorPaged CrearDetallesOrden(EE_DETALLES_ORDEN orden, string tallas, int ID_ORDEN_PRODUCCION)
        {
            var result = new ErrorPaged();

            try
            {
                ExecuteManager(uow =>
                {
                    var manager = new OrdenesProduccionManager(uow);

                    string puesto = manager.CrearDetallesOrden(orden, tallas, ID_ORDEN_PRODUCCION);

                    if (puesto == "Exito")
                    {
                        //uow.Rollback();
                        result.success = true;
                        result.msg     = "Se inserto Correctamente";
                    }
                    else
                    {
                        result.success = false;
                        result.msg     = puesto;
                    }
                });
                return(result);
            }
            catch (Exception ex)
            {
                result.success = false;
                result.msg     = "(Consulte Administrador ) : " + ex;
                return(result);
            }
        }
        public ActionResult ModificarDetallesOrden(EE_DETALLES_ORDEN c)
        {
            var result = new ErrorPaged();

            try
            {
                var context   = new Entities();
                int idusuario = Convert.ToInt32(Session["ID_USR"]);
                var v_resp    = new ObjectParameter("p_res", typeof(Int32));
                context.P_EE_ALTA_EE_DETALLES_ORDEN(c.ID_DETALLE_ORDEN, c.ID_ORDEN_PRODUCCION, c.ARTICULO, c.TELA, c.DETALLE_ITEM, c.DETALLE_BORDADO, c.DETALLE_COSTURA, c.ESTADO, c.CANTIDAD, c.CANTIDAD_ENTREGADA, c.TALLA, c.COSTO, c.TOTAL, c.FECHA_REG, c.COLOR, idusuario, v_resp);
                string valor = v_resp.Value.ToString();
                if (valor == "1")
                {
                    result.success = true;
                    result.msg     = "Se inserto Correctamente";
                    result.datos   = valor;
                }
                else
                {
                    result.success = false;
                    result.msg     = valor;
                }
            }
            catch (Exception ex)
            {
                result.success = false;

                result.msg = "Error Al ejecturase el Procedimiento " + ex;
            }
            return(Json(result));
        }
예제 #3
0
        public string CrearDetallesOrden(EE_DETALLES_ORDEN orden, string tallas, int ID_ORDEN_PRODUCCION)
        {
            try
            {
                var     obj     = JsonConvert.DeserializeObject <List <Tallas> >(tallas);
                var     context = (Entities)Context;
                decimal?total   = 0;
                foreach (var item in obj)
                {
                    //if (item.ID_DETALLE_INGRESO == 0)
                    //{
                    var v_resp     = new ObjectParameter("p_res", typeof(Int32));
                    var result     = context.P_EE_SECUENCIA("D_ORD", v_resp);
                    var data       = v_resp.Value.ToString();
                    var id_detalle = Convert.ToInt32(data);

                    EE_DETALLES_ORDEN detalle = new EE_DETALLES_ORDEN()
                    {
                        ID_DETALLE_ORDEN    = id_detalle,
                        TELA                = orden.TELA,
                        DETALLE_BORDADO     = orden.DETALLE_BORDADO,
                        DETALLE_COSTURA     = orden.DETALLE_COSTURA,
                        DETALLE_ITEM        = orden.DETALLE_ITEM,
                        ESTADO              = orden.ESTADO,
                        ID_ORDEN_PRODUCCION = ID_ORDEN_PRODUCCION,
                        ARTICULO            = orden.ARTICULO,
                        TALLA               = item.talla,
                        COLOR               = orden.COLOR,
                        CANTIDAD            = item.cantidad,
                        CANTIDAD_A_PRODUCIR = item.cantidad,
                        CANTIDAD_ENTREGADA  = 0,
                        COSTO               = 0,
                        TOTAL               = 0,
                        TOTAL_A_CANCELAR    = 0,
                        //NRO_OP = orden.NRO_OP,
                        SASTRE    = 0,
                        HILO      = 0,
                        FECHA_REG = DateTime.Now
                    };
                    total = total + item.cantidad;
                    context.AddToEE_DETALLES_ORDEN(detalle);
                }
                var current1 = (from p in context.EE_ORDENES_PRODUCCION
                                where p.ID_ORDEN_PRODUCCION == ID_ORDEN_PRODUCCION
                                select p).FirstOrDefault();
                current1.CANTIDAD         = total;
                current1.TOTAL_POR_COBRAR = total;
                context.SaveChanges();
                var v_resp1 = new ObjectParameter("p_res", typeof(Int32));
                context.P_EE_ACTUALIZAR_CANTIDAD_OP(ID_ORDEN_PRODUCCION, v_resp1);
                return("Exito");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
        public ActionResult CrearDetallesOrden(EE_DETALLES_ORDEN orden, string tallas, int ID_ORDEN_PRODUCCION)
        {
            var service = new OrdenesProduccionService();

            var result = service.CrearDetallesOrden(orden, tallas, ID_ORDEN_PRODUCCION);

            //IQueryable result = null;
            return(Json(result));
        }