public static string vallidatePalletID(string palletID, string quantity) { //TextBox palletIdTextBox = (TextBox)e.Row.Cells[10].FindControl("palletId"); // //quantityToReturn = "2"; InterfazDAL_tticol125 idal = new InterfazDAL_tticol125(); Ent_tticol125 obj = new Ent_tticol125(); string strError = string.Empty; string retorno = string.Empty; //TextBox quantity = (TextBox)e.Row.Cells[10].FindControl("palletId"); obj.paid = palletID.Trim().ToUpperInvariant(); //obj.reqt = Convert.ToInt32(fila.GetValue(8).ToString().Trim()); obj.reqt = Convert.ToDecimal(quantity); DataTable resultado = idal.vallidatePalletID(ref obj, ref strError); decimal palletQuantity = 0; decimal status; string tableName = string.Empty; decimal givenQuantity = Convert.ToDecimal(quantity); if (resultado.Rows.Count < 1) { return(PalletIDdoesntexists); } else { foreach (DataRow dr in resultado.Rows) { status = Convert.ToDecimal(dr.ItemArray[8].ToString()); palletQuantity = Convert.ToDecimal(dr.ItemArray[3].ToString()); tableName = dr.ItemArray[0].ToString(); if (palletQuantity < givenQuantity) { retorno = QuantitytoreturnmustbeequalorlessthanPalletIDquantityforpalletId + " " + palletID.Trim().ToUpperInvariant(); break; } if (((tableName == "whcol131") || (tableName == "whcol130")) && (status != 9)) { retorno = PalletIDstatusdoesntallowreturn ; break; } else if (((tableName == "ticol022") || (tableName == "ticol042")) && (status != 11)) { retorno = PalletIDstatusdoesntallowreturn; break; } } } return(retorno); }
protected void btnSend_Click(object sender, EventArgs e) { lblError.Text = ""; lblConfirm.Text = ""; InterfazDAL_tticol125 idal = new InterfazDAL_tticol125(); Ent_tticol125 obj = new Ent_tticol125(); string strError = string.Empty; obj.paid = txtPalletId.Text.ToUpperInvariant(); HttpContext.Current.Session["flag022"] = 0; HttpContext.Current.Session["flag042"] = 0; HttpContext.Current.Session["flag131"] = 0; divPrint.Visible = false; string retorno = string.Empty; decimal palletQuantity = 0; decimal status; string tableName = string.Empty; DataTable resultadoPaid = idal.vallidatePalletID(ref obj, ref strError); if (resultadoPaid.Rows.Count < 1) { retorno = PalletIDdoesntexists; } else { foreach (DataRow dr in resultadoPaid.Rows) { status = Convert.ToDecimal(dr.ItemArray[8].ToString()); palletQuantity = Convert.ToDecimal(dr.ItemArray[3].ToString()); tableName = dr.ItemArray[0].ToString(); if (((tableName == "whcol131") || (tableName == "whcol130")) && (status != 3)) { lblError.Text = PalletIDstatusdoesntallowadjustment; return; } else if (((tableName == "ticol022") || (tableName == "ticol042")) && (status != 7)) { lblError.Text = PalletIDstatusdoesntallowadjustment; return; } } } if (string.IsNullOrEmpty(txtPalletId.Text.Trim())) { //minlenght.Enabled = true; //minlenght.ErrorMessage = mensajes("Please Fill all the Required Fields."); //minlenght.IsValid = false; //return; } DataTable resultado = idal.invGetPalletInfo(ref obj, ref strError); DataTable resultadoSerie = idal.invGetPalletInfoSerie(ref strError); if (resultado == null || resultado.Rows.Count == 0) { lblError.Text = PalletIDdoesntexists; return; } string palletId, item, warehouse, lot, location, quantity, dsca, unit, waredesc, machine, tbl, pono; if (resultado.Rows.Count == 1) { if (resultadoSerie.Rows.Count > 0) { Session["emno"] = resultadoSerie.Rows[0]["EMNO"].ToString(); Session["cdis"] = resultadoSerie.Rows[0]["CDIS"].ToString(); lblReason.Text = resultadoSerie.Rows[0]["CDIS"].ToString() + " - " + resultadoSerie.Rows[0]["DSCA"].ToString(); lblCost.Text = resultadoSerie.Rows[0]["EMNO"].ToString() + " - " + resultadoSerie.Rows[0]["NAMA"].ToString(); } else { lblReason.Text = string.Empty; lblCost.Text = string.Empty; } DataRow dr = resultado.Rows[0]; tbl = dr.ItemArray[0].ToString(); if (tbl.Trim() == "ticol022") { HttpContext.Current.Session["flag022"] = 1; HttpContext.Current.Session["flag131"] = 0; HttpContext.Current.Session["flag042"] = 0; } else if (tbl.Trim() == "whcol131") { HttpContext.Current.Session["flag022"] = 0; HttpContext.Current.Session["flag131"] = 1; HttpContext.Current.Session["flag042"] = 0; } else if (tbl.Trim() == "ticol042") { HttpContext.Current.Session["flag022"] = 0; HttpContext.Current.Session["flag131"] = 0; HttpContext.Current.Session["flag042"] = 1; } palletId = dr.ItemArray[2].ToString(); quantity = dr.ItemArray[3].ToString(); item = dr.ItemArray[4].ToString(); dsca = dr.ItemArray[5].ToString(); unit = dr.ItemArray[6].ToString(); warehouse = dr.ItemArray[7].ToString(); waredesc = dr.ItemArray[8].ToString(); lot = dr.ItemArray[10].ToString(); location = dr.ItemArray[9].ToString(); Pquantity = Convert.ToDouble(quantity); machine = dr.ItemArray[11].ToString(); pono = dr.ItemArray[12].ToString(); HttpContext.Current.Session["pono"] = pono; lblPalletId1Value.Text = palletId; lblItemValue.Text = item; lblItemDescValue.Text = dsca; lblWarehouseValue.Text = warehouse; lblWarehouseDescValue.Text = waredesc; lblLotValue.Text = lot; lblLocationValue.Text = location; lblQuantityValue.Text = quantity; lblUnitValue.Text = unit; lblUnitValue1.Text = unit; tblPalletInfo.Visible = true; btnSend.Visible = false; btnSave.Visible = true; lblMachine.Text = machine; generateDropDownReasonCodes(); generateDropDownCostCenters(); dropDownCostCenters.SelectedValue = Session["emno"].ToString(); dropDownReasonCodes.SelectedValue = Session["cdis"].ToString(); if (Session["emno"].ToString() == "DO3062" && Session["cdis"].ToString() == "CS1004") { dropDownCostCenters.Visible = true; dropDownReasonCodes.Visible = true; lblReason.Visible = false; lblCost.Visible = false; } else { dropDownCostCenters.Visible = false; dropDownReasonCodes.Visible = false; lblReason.Visible = true; lblCost.Visible = true; } } }
public static string VerificarPalletId(string PAID) { string strError = string.Empty; Ent_tticol125 Obj_tticol125 = new Ent_tticol125(); Obj_tticol125.paid = PAID; DataTable DtTticol125 = ITticol125.vallidatePalletID(ref Obj_tticol125, ref strError); if (DtTticol125.Rows.Count > 0) { var myObj = DtTticol125.Rows[0]; Obj_tticol125.pdno = myObj["T$ORNO"].ToString(); Obj_tticol125.paid = myObj["T$PAID"].ToString(); Obj_tticol125.cwar = myObj["T$CWAR"].ToString(); Obj_tticol125.item = myObj["T$ITEM"].ToString(); Obj_tticol125.clot = myObj["T$CLOT"].ToString(); Obj_tticol125.dsca = myObj["T$DSCA"].ToString(); Obj_tticol125.cuni = myObj["T$CUNI"].ToString(); Obj_tticol125.stat = myObj["T$STAT"].ToString(); Obj_tticol125.tbl = myObj["TBL"].ToString(); Obj_tticol125.qtyc = myObj["T$QTYC"].ToString(); Obj_tticol125.Error = false; Obj_tticol125.TypeMsgJs = "console"; Obj_tticol125.SuccessMsg = "Pallet Encontrado"; string tableName = myObj["TBL"].ToString(); int status = Convert.ToInt32(myObj["T$STAT"].ToString().ToString()); if (((tableName == "whcol130") && (status != 3)) || ((tableName == "whcol131") && (status != 3)) || ((tableName == "ticol022") && (status != 7)) || ((tableName == "ticol042") && (status != 7))) { Obj_tticol125.Error = true; Obj_tticol125.TypeMsgJs = "label"; Obj_tticol125.ErrorMsg = PalletIDnotavailable; return(JsonConvert.SerializeObject(Obj_tticol125)); } HttpContext.Current.Session["PAID"] = PAID.ToString(); //HttpContext.Current.Session["PDNO"] = myObj["T$ORNO"].ToString(); string PDNO = HttpContext.Current.Session["PDNO"].ToString(); string ITEM = Obj_tticol125.item.ToString(); HttpContext.Current.Session["QTYC"] = myObj["T$QTYC"].ToString(); HttpContext.Current.Session["TBL"] = myObj["TBL"].ToString(); DataTable dtTticst001 = ITticst001.findByItemAndPdno(ref PDNO, ref ITEM, ref strError); if (dtTticst001.Rows.Count < 1) { Obj_tticol125.Error = true; Obj_tticol125.TypeMsgJs = "label"; Obj_tticol125.ErrorMsg = doesnotexistaregisterwithItemassociatedtopalletIDandWorkOrder; } } else { Obj_tticol125.Error = true; Obj_tticol125.TypeMsgJs = "label"; Obj_tticol125.ErrorMsg = PalletIddoesntexist ; } return(JsonConvert.SerializeObject(Obj_tticol125)); }