Esempio n. 1
0
 private void FinalizarFactura()
 {
     try
     {
         var _objPicking = new SwiftExpressWSPicking();
         var result      = _objPicking.UpdatePicking("", Convert.ToInt32(FacturaEncabezado.SOURCE_CODE), Session["connectionString"].ToString());
         if (result.Equals("OK"))
         {
             DevExpress.Web.ASPxWebControl.RedirectOnCallback("PanleListingPicking.aspx");
         }
         else
         {
             UiVistaSku.JSProperties.Add("cpError", result);
         }
     }
     catch (Exception ex)
     {
         UiVistaSku.JSProperties.Add("cpError", ex.Message);
     }
 }
Esempio n. 2
0
        protected bool ValidPickingSbo(string erpDoc)
        {
            var objPicking = new SwiftExpressWSPicking();
            var pResult    = "";
            var bResult    = false;
            var dsSap      = new DataSet();
            var ds         = new DataSet();

            if (erpDoc == "")
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: Debe ingresar una referencia válida');", true);
                return(false);
            }
            try
            {
                ds    = (DataSet)Session["DATOS"];
                dsSap = objPicking.GetSapPicking(Session["connectionString"].ToString(), erpDoc, ref pResult);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }

            try
            {
                if (pResult == "")
                {
                    var dvSap = new DataView(dsSap.Tables[0], "", "SKU", DataViewRowState.CurrentRows);

                    if (dvSap.Count == ds.Tables[1].Rows.Count)
                    {
                        foreach (DataRowView rowSap in dvSap)
                        {
                            var customerDifferent = ds.Tables[0].Select("CODE_CUSTOMER = '" + rowSap["CUSTOMER_ID"] + "'").Length == 1;
                            var isDifferent       = ds.Tables[1].Select("CODE_SKU = '" + rowSap["SKU"] + "' AND SCANNED = " + rowSap["QTY_SOURCE"] + "").Length == 1;

                            if (isDifferent)
                            {
                                bResult = true;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerdan los productos.');", true);
                                return(false);
                            }
                            if (customerDifferent)
                            {
                                bResult = true;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerdan los codigos de cliente.');", true);
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No concuerda la cantidad de productos.');", true);
                        return(false);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + pResult + ".');", true);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }

            return(bResult);
        }