public static string ValidarMaquina(string sMachine) { string retorno = "0"; DataTable DTRetorno = null; string strError = string.Empty; InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); if (string.IsNullOrEmpty(sMachine)) { retorno = "0"; } else { try { DTRetorno = tticol132.ValidarMaquina(sMachine, ref strError); if (DTRetorno.Rows.Count > 0) { retorno = string.Empty; } } catch (Exception ex) { retorno = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } } return(retorno); }
public static string ValidarIdentifier(string sIdentifier) { string retorno = "0"; DataTable DTRetorno = null; string strError = string.Empty; InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); Ent_tticol132 ent_tticol132 = new Ent_tticol132(); if (string.IsNullOrEmpty(sIdentifier)) { retorno = "0"; } else { Ent_tticol132 param = new Ent_tticol132() { barcode = sIdentifier }; try { DTRetorno = tticol132.ObtenerBox(ref param, ref strError); if (DTRetorno.Rows.Count > 0) { retorno = string.Empty; } } catch (Exception ex) { retorno = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } } return(retorno); }
protected void btnContinue_Click(object sender, EventArgs e) { InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); Ent_tticol132 ent_tticol132 = new Ent_tticol132(); string strError = string.Empty; int retorno; List <Ent_tticol132> param = new List <Ent_tticol132>(); DataTable DTBox; try { if (String.IsNullOrEmpty(txtIdentifier.Text)) { strError = "Box Identifier doesn't exist"; return; } ent_tticol132.barcode = txtIdentifier.Text; DTBox = tticol132.ObtenerBox(ref ent_tticol132, ref strError); if (DTBox.Rows.Count > 0) { ent_tticol132.item = string.Format(" {0}", DTBox.Rows[0]["t$item"].ToString().Trim()); ent_tticol132.type = int.Parse(DTBox.Rows[0]["t$type"].ToString()); ent_tticol132.user = Session["user"].ToString(); //Modificado por petición de DMontoya //Al digitar un registro de uso el registro que se está guardando en la tabla el registro con: //status “Nuevo” y este campo debe quedar con valor “En Uso” (2) Pendiente //ent_tticol132.status = int.Parse(DTBox.Rows[0]["t$stat"].ToString()); ent_tticol132.status = 2; ent_tticol132.machine = txtMachine.Text.Trim().ToUpperInvariant(); ent_tticol132.refcntd = 0; ent_tticol132.refcntu = 0; param.Add(ent_tticol132); } retorno = tticol132.insertarRegistro(ref param, ref strError); if (retorno == 0 && !string.IsNullOrEmpty(strError)) { strError = "Save unsuccessfully (" + strError + ")"; } else { strError = "Save successfully"; txtIdentifier.Text = ""; //txtMachine.Text = ""; } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } lblMensaje.Text = strError; }
//[System.Web.Services.WebMethod()] //public static string GuardarDatos(string sItem, string sType, string sBarCode, string sUser) //{ // InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); // string strError = string.Empty; // int retorno; // List<Ent_tticol132> param = new List<Ent_tticol132>(); // try // { // param.Add(new Ent_tticol132() // { // barcode = sBarCode, // date = DateTime.Now, // type = int.Parse(sType), // item = sItem, // user = sUser, // status = 1, // machine = " ", // refcntd = 0, // refcntu = 0 // }); // retorno = tticol132.insertarRegistro(ref param, ref strError); // if (retorno == 0 && string.IsNullOrEmpty(strError)) // { // strError = "Save unsuccessfully"; // } // } // catch (Exception ex) // { // strError = ex.InnerException != null ? // ex.Message + " (" + ex.InnerException + ")" : // ex.Message; // } // return strError; //} protected void btnContinue_Click(object sender, EventArgs e) { InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); string strError = string.Empty; int retorno; List <Ent_tticol132> param = new List <Ent_tticol132>(); try { if (validarDatos(ref strError)) { param.Add(new Ent_tticol132() { barcode = txtBarCodeID.Text.Trim().ToUpperInvariant(), date = DateTime.Now, type = ddlType.SelectedIndex, item = string.Format(" {0}", txtItem.Text.Trim().ToUpperInvariant()), user = Session["user"].ToString(), status = 1, machine = " ", refcntd = 0, refcntu = 0 }); retorno = tticol132.insertarRegistro(ref param, ref strError); if (retorno == 0 && string.IsNullOrEmpty(strError)) { strError = "Save unsuccessfully"; } else { txtBarCodeID.Text = ""; //ddlType.SelectedIndex = 0; //txtItem.Text = ""; strError = "Save successfully"; } } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } lblMessage.Text = strError; }
public string GetItemByBarCode(string sBarCode, string sTipo) { JavaScriptSerializer js = new JavaScriptSerializer(); InterfazDAL_tticol132 idal = new InterfazDAL_tticol132(); string retorno = string.Empty; string strError = string.Empty; DataTable dtItems = null; sBarCode = sBarCode.ToString().Replace(" ", "").Replace("\"", ""); sTipo = sTipo.ToString().Replace(" ", "").Replace("\"", ""); try { dtItems = idal.listarItemByBarCode(sBarCode, sTipo, ref strError); retorno = js.Serialize(dtItems.AsEnumerable().Select(x => x.ItemArray.ToList()).ToList()); return(retorno); } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } return(string.Empty); }
protected void btnContinue_Click(object sender, EventArgs e) { string strError = string.Empty; Ent_ttdcol524 ParametrosIn = new Ent_ttdcol524(); List <Ent_ttdcol524> parametros = new List <Ent_ttdcol524>(); InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); List <Ent_tticol132> param = new List <Ent_tticol132>(); DataTable DSReturnBox = new DataTable(); try { if (ValidarDatos(ref strError)) { string item = string.Empty; string quantity = string.Empty; for (int i = 0; i < 5; i++) { string barcode = string.Empty; int type = 0; switch (i) { case 0: item = txtCover.Text.Trim().ToUpperInvariant(); quantity = txtQCover.Text; barcode = txtCoverBarCode.Text.Trim().ToUpperInvariant(); type = 3; break; case 1: item = txtMaster1.Text.Trim().ToUpperInvariant(); quantity = txtQMaster1.Text; barcode = txtMasterBarCode1.Text.Trim().ToUpperInvariant(); type = 2; break; case 2: item = txtMaster2.Text.Trim().ToUpperInvariant(); quantity = txtQMaster2.Text; barcode = txtMasterBarCode2.Text.Trim().ToUpperInvariant(); type = 2; break; case 3: item = txtMaster3.Text.Trim().ToUpperInvariant(); quantity = txtQMaster3.Text; barcode = txtMasterBarCode3.Text.Trim().ToUpperInvariant(); type = 2; break; case 4: item = txtBox.Text.Trim().ToUpperInvariant(); quantity = txtQBox.Text; barcode = string.Empty; type = 1; break; } ParametrosIn.item = item; ParametrosIn.adjustmentQuantity = quantity; long lOrderNumber; //Obtener datos DSReturnBox = ttdcol524.GetData(ref ParametrosIn, ref strError); if (!string.IsNullOrEmpty(barcode)) { param.Add(new Ent_tticol132() { barcode = barcode, date = DateTime.Now, type = type, item = string.Format(" {0}", item.Trim().ToUpperInvariant()), user = Session["user"].ToString(), status = 2, machine = " ", refcntd = 0, refcntu = 0 }); } if (DSReturnBox.Rows.Count > 0) { if (DSReturnBox.Rows.Count == 1) { if (long.TryParse(DSReturnBox.Rows[0]["orderNumber"].ToString(), out lOrderNumber)) { Ent_ttdcol524 entidad = new Ent_ttdcol524(); entidad.orderNumber = (lOrderNumber + i).ToString().PadLeft(9, '0'); entidad.employee = DSReturnBox.Rows[0]["Employee"].ToString(); entidad.warehouse = DSReturnBox.Rows[0]["Warehouse"].ToString(); entidad.item = DSReturnBox.Rows[0]["Item"].ToString(); entidad.adjustmentQuantity = quantity; entidad.unit = DSReturnBox.Rows[0]["Unit"].ToString(); entidad.adjustmentReason = DSReturnBox.Rows[0]["AdjustmentReason"].ToString(); entidad.status = DSReturnBox.Rows[0]["Status"].ToString(); entidad.adjustmentBaanOrderLine = DSReturnBox.Rows[0]["AdjustmentBaanOrderLine"].ToString(); entidad.adjustmentBaanOrder = DSReturnBox.Rows[0]["AdjustmentBaanOrder"].ToString(); entidad.refcntd = 0; entidad.refcntu = 0; parametros.Add(entidad); } } } } //Guardar en tdcol524 if (parametros.Count > 0 && param.Count > 0) { if (ttdcol524.insertarDatos(ref parametros, ref strError) == 1) { if (tticol132.insertarRegistro(ref param, ref strError) == 1) { if (ttdcol524.actualizarContadores(ref strError) < 1) { strError = "Save successfully but the counters were not updated"; } else { strError = "Save successfully"; } LimpiarControles(); } else { strError = "An error occurred while saving the information"; } } } else { strError = "Save unsuccessfully"; } } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } lblMensaje.Text = strError; }