protected void clickSaveCodigo(object sender, EventArgs args) { try { Entrada_inventario oEI = JsonConvert.DeserializeObject <Entrada_inventario>(hf_entrada_inventario.Value); List <Entrada_inventario_detail> lstEntInvDet = JsonConvert.DeserializeObject <List <Entrada_inventario_detail> >(hf_entrada_inventario_detail.Value); List <Entrada_inventario_lote> lstEntInvLote = JsonConvert.DeserializeObject <List <Entrada_inventario_lote> >(hf_entrada_inventario_lote.Value); if (lstEntInvDet == null || lstEntInvDet.Count == 0) { throw new Exception("Es necesario desglosar bultos y piezas por bulto"); } oEI.LstEntInvDet = lstEntInvDet; if (lstEntInvLote == null) { lstEntInvLote = new List <Entrada_inventario_lote>(); } oEI.LstEntInvLote = lstEntInvLote; oEI.Id_usuario = ((MstCasc)this.Master).getUsrLoged().Id; EntradaCtrl.InventarioSave(oEI); ClientScript.RegisterStartupScript(this.GetType(), "alertSave", "<script type=\"text/javascript\">alert('Se guardó correctamente el registro');</script>"); //window.location.href='frmInventario.aspx?_kp=" + hf_id_entrada.Value + "'; btnSaveCodigo.PostBackUrl = "frmInventario.aspx?_kp=" + hf_id_entrada.Value; fillEntrada(Convert.ToInt32(hf_id_entrada.Value)); } catch (Exception e) { ((MstCasc)this.Master).setError = e.Message; } }
protected void rem_piso(object sender, CommandEventArgs args) { try { int consec_piso = Convert.ToInt32(args.CommandArgument); Entrada_inventario o = VSLstEntPiso.Find(p => p.Consec == consec_piso); if (o != null) { if (o.Id <= 0) { VSLstEntPiso.Remove(o); } else { EntradaCtrl.InventarioDlt(o.Id); VSLstEntPiso.Remove(o); } } } catch (Exception e) { if (string.Compare(e.InnerException.Message, "1451") == 0) { ((MstCasc)this.Master).setError = e.Message + " (órdenes de trabajo)."; } else { ((MstCasc)this.Master).setError = e.Message; } } finally { fillRepeaterPiso(); } }
private void fillData() { int entero = 0; int.TryParse(oSR.Id_entrada_inventario.ToString(), out entero); oEI = EntradaCtrl.InvetarioGetById(entero); oE = EntradaCtrl.EntradaGetAllDataById(oEI.Id_entrada); oCV = CatalogCtrl.Cliente_vendorGet(oEI.Id_vendor); hf_id_salida_remision.Value = oSR.Id.ToString(); int totalPiezas = 0; clearData(); for (int indSRD = 0; indSRD < oSR.LstSRDetail.Count; indSRD++) { Salida_remision_detail oSRD = oSR.LstSRDetail[indSRD]; totalPiezas += oSRD.Piezas; switch (indSRD) { case 0: txt_bulto_1.Text = oSRD.Bulto.ToString(); txt_piezasXbulto_1.Text = oSRD.Piezaxbulto.ToString(); txt_piezas_1.Text = oSRD.Piezas.ToString(); break; case 1: txt_bulto_2.Text = oSRD.Bulto.ToString(); txt_piezasXbulto_2.Text = oSRD.Piezaxbulto.ToString(); txt_piezas_2.Text = oSRD.Piezas.ToString(); break; default: break; } } txt_piezaTotal.Text = totalPiezas.ToString(); DateTime fecha = default(DateTime); DateTime.TryParse(oSR.Fecha_recibido.ToString(), out fecha); if (DateTime.Compare(fecha, default(DateTime)) != 0) { txt_fecha_rr.Text = fecha.ToString("dd/MM/yyyy"); } txt_RR.Text = oSR.Etiqueta_rr; }
protected void add_piso(object sender, EventArgs args) { if (Page.IsValid) { try { Entrada_inventario o = new Entrada_inventario(); int calculado = 0; int recibido = 0; int diferencia = 0; o.Id_entrada = Convert.ToInt32(hf_id_entrada.Value); o.Id_usuario = ((MstCasc)this.Master).getUsrLoged().Id; //o.Pedimento se obtiene del campo oE.Referencia (La referencia es el pedimento en la entrada) o.Referencia = hf_referencia_entrada.Value; //o.Referencia se obtiene del campo oE.Codigo (El código se refiere al código del cliente AVN-XXXX-YY) o.Codigo_cliente = hf_codigo.Value; o.Orden_compra = txt_ordencompra.Text.Trim().ToUpper(); txt_ordencompra.Text = string.Empty; o.Codigo = txt_codigo_mercancia.Text.Trim().ToUpper(); txt_codigo_mercancia.Text = string.Empty; o.Mercancia = txt_mercancia.Text.Trim(); //o.Id_ubicacion = Convert.ToInt32(hf_ubicacion.Value); //o.Ubicacion = txt_ubicacion.Text; //o.Id_comprador = Convert.ToInt32(hf_comprador.Value); //o.Comprador = txt_comprador.Text; //hf_comprador.Value = "0"; o.Id_vendor = Convert.ToInt32(hf_vendor.Value); o.Proveedor = txt_vendor.Text; hf_vendor.Value = "0"; //o.Id_mercancia = Convert.ToInt32(hf_mercancia.Value); //o.Mercancia = txt_mercancia.Text; //hf_mercancia.Value = "0"; o.Id_nom = Convert.ToInt32(hf_nom.Value); o.Nom = txt_nom.Text; hf_nom.Value = "0"; o.Solicitud = txt_solicitud.Text.Trim(); txt_solicitud.Text = string.Empty; //o.Lote = txt_lote.Text.Trim(); //txt_lote.Text = string.Empty; o.Factura = txt_factura.Text.Trim(); txt_factura.Text = string.Empty; o.Valor_unitario = Convert.ToDouble(txt_val_unitario.Text); txt_val_unitario.Text = "0"; o.Piezas = Convert.ToInt32(txt_pieza.Text); txt_pieza.Text = "0"; o.Valor_factura = o.Piezas * o.Valor_unitario; txt_valor_factura.Text = "0"; o.Bultos = Convert.ToInt32(txt_bulto.Text); txt_bulto.Text = "0"; o.Pallets = Convert.ToInt32(txt_pallet.Text); txt_pallet.Text = "0"; o.Piezas_recibidas = Convert.ToInt32(txt_pieza_recibida.Text); txt_pieza_recibida.Text = "0"; o.Bultos_recibidos = Convert.ToInt32(txt_bulto_recibido.Text); txt_bulto_recibido.Text = "0"; calculado = o.Piezas; recibido = o.Piezas_recibidas; diferencia = calculado - recibido; o.Piezas_sobr = 0; o.Piezas_falt = 0; if (diferencia < 0) { o.Piezas_sobr = diferencia * -1; } if (diferencia > 0) { o.Piezas_falt = diferencia; } txt_pieza_falt.Text = "0"; txt_pieza_sobr.Text = "0"; calculado = o.Bultos; recibido = o.Bultos_recibidos; diferencia = calculado - recibido; o.Bultos_sobr = 0; o.Bultos_falt = 0; if (diferencia < 0) { o.Bultos_sobr = diferencia * -1; } if (diferencia > 0) { o.Bultos_falt = diferencia; } txt_bulto_falt.Text = "0"; txt_bulto_sobr.Text = "0"; o.Observaciones = txt_observaciones.Text.Trim(); txt_observaciones.Text = string.Empty; o.Consec = Convert.ToInt32(hf_consec_inventario.Value); o.Consec = o.Consec + 1; hf_consec_inventario.Value = o.Consec.ToString(); //o.Id_estatus = Globals.EST_INV_SIN_APROBACION; VSLstEntPiso.Add(o); fillRepeaterPiso(); } catch (Exception e) { ((MstCasc)this.Master).setError = e.Message; } } }
private void refreshMaquilado(int IdEntradaInventario) { try { oEM = EntradaCtrl.MaquilaGetSum(IdEntradaInventario); rep_dias_trabajados.DataSource = EntradaCtrl.MaquilaSelByInventario(IdEntradaInventario); rep_dias_trabajados.DataBind(); oEI = EntradaCtrl.InvetarioGetById(IdEntradaInventario); oE = EntradaCtrl.EntradaGetAllDataById(oEI.Id_entrada); //Para casos de incidencias <<ini>> hf_referencia.Value = oE.Referencia; hf_ordencompra.Value = oEI.Orden_compra; hf_codigo.Value = oEI.Codigo; hf_pieza_faltante.Value = oEM.Pieza_faltante.ToString(); hf_pieza_sobrante.Value = oEM.Pieza_sobrante.ToString(); //Para casos de incidencias <<fin>> hf_id_cliente.Value = oE.Id_cliente.ToString(); int diferencia = 0; hf_bultos.Value = oEI.Bultos.ToString(); hf_piezasInventario.Value = oEI.Piezas.ToString(); //hf_pzasXbulto.Value = oEI.PzasPorBulto.ToString(); hf_bulto_maquilado.Value = oEM.Bulto.ToString(); //pallets diferencia = oEI.Pallets - oEM.Pallet + Convert.ToInt32(txt_pallet.Text); diferencia = 0; List <Entrada_inventario_detail> lstEID = EntradaCtrl.InventarioDetGetByInvId(IdEntradaInventario); List <Entrada_inventario_lote> lstEIL = EntradaCtrl.InventarioLoteGetDistinctByInvId(IdEntradaInventario); hf_HasLote.Value = Convert.ToString(lstEIL.Count > 0); foreach (Entrada_inventario_lote difLote in lstEIL) { optLote += "<option pzas='" + difLote.Piezas + "'>" + difLote.Lote + "</option>"; } grdDetInv.DataSource = lstEID; grdDetInv.DataBind(); btn_cerrar_maquila.Enabled = (oEM.Pieza != 0); if (btn_cerrar_maquila.Enabled) { btn_cerrar_maquila.Text = "Cerrar Orden"; btn_cerrar_maquila.CommandArgument = "False"; if (oEM.Pieza_faltante > 0 || oEM.Pieza_sobrante > 0) { btn_cerrar_maquila.Text += " con Incidencias"; btn_cerrar_maquila.CommandArgument = "True"; } } if (!oEI.Maquila_abierta) { btn_cerrar_maquila.Enabled = false; btn_save.Enabled = btn_cerrar_maquila.Enabled; btn_cerrar_maquila.Text = "Maquila Cerrada"; btn_save.Text = btn_cerrar_maquila.Text; } //Todas las ordenes y códigos del pedimento rep_oc_by_pedimento.DataSource = EntradaCtrl.InventarioGetBy(oE.Id, false); rep_oc_by_pedimento.DataBind(); } catch { throw; } }
private void fillEntradaInventario() { try { //int IdEntrada = 0; int IdEntradaInventario = 0; //int IdCliente = 0; int.TryParse(hf_id_entrada_inventario.Value, out IdEntradaInventario); //int.TryParse(hf_id_entrada.Value, out IdEntrada); //int.TryParse(hf_id_cliente.Value, out IdCliente); oEM = EntradaCtrl.MaquilaGetSum(IdEntradaInventario); //rep_dias_trabajados.DataSource = EntradaCtrl.OrdenTrabajoSelByInventario(IdEntradaInventario); //rep_dias_trabajados.DataBind(); oEI = EntradaCtrl.InvetarioGetById(IdEntradaInventario); oSR = SalidaCtrl.RemisionGetSumAvailable(IdEntradaInventario); oE = EntradaCtrl.EntradaGetAllDataById(oEI.Id_entrada); hf_id_cliente.Value = oE.Id_cliente.ToString(); oCV = CatalogCtrl.Cliente_vendorGet(oEI.Id_vendor); //txt_piezasXbulto.Text = oEI.PzasPorBulto.ToString(); txt_elaboro.Text = ((MstCasc)this.Master).getUsrLoged().Nombre; hf_referencia.Value = oE.Referencia; hf_codigo_cliente.Value = oEI.Codigo_cliente; hf_codigo.Value = oEI.Codigo; hf_orden.Value = oEI.Orden_compra; fillRemisiones(IdEntradaInventario); hf_img_codigo.Value = BarCode.Encode(oEI.Codigo); hf_img_orden.Value = BarCode.Encode(oEI.Orden_compra); hf_img_vendor.Value = BarCode.Encode(oCV.Codigo); List <Entrada_maquila_detail> lstEntMD = EntradaCtrl.MaquilaGetDetail(IdEntradaInventario).LstEntMaqDet; hf_HasLote.Value = lstEntMD.Exists(p => p.Lote != null).ToString(); grdDetMaq.DataSource = lstEntMD; grdDetMaq.DataBind(); btn_save.Text = "Guardar Remisión"; if (oSR.PiezaTotal > 0) { } else { btn_save.Enabled = false; btn_save.Text = "Sin disponibilidad de Mercancia"; } //Ordenes y codigos por pedimento List <Entrada_inventario> lst = EntradaCtrl.InventarioMaquilado(oE.Id); rep_oc_by_pedimento.DataSource = lst; rep_oc_by_pedimento.DataBind(); } catch { throw; } }