コード例 #1
0
        public static string vallidatePalletID(string palletID, string position, string returnOrder)
        {
            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();

            DataTable resultado = idal.vallidatePalletData(ref obj, ref strError);
            //decimal palletQuantity = 0;
            //decimal status;
            //string tableName = string.Empty;
            //decimal givenQuantity = Convert.ToDecimal(quantity);

            /* select  col131.t$paid "palletid", col131.t$loaa "current_location",
             * col131.t$qtya "current_qty", col131.t$item "item", ibd001.t$dsca "description"*/
            string  item, description, palletid, current_location, unit, war, stat;
            decimal current_qty;

            if (resultado.Rows.Count < 1)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in resultado.Rows)
                {
                    palletid         = dr.ItemArray[0].ToString();
                    current_location = dr.ItemArray[1].ToString();
                    current_qty      = Convert.ToDecimal(dr.ItemArray[2].ToString());
                    item             = dr.ItemArray[3].ToString();
                    description      = dr.ItemArray[4].ToString();
                    unit             = dr.ItemArray[5].ToString();
                    war  = dr.ItemArray[6].ToString();
                    stat = dr.ItemArray[7].ToString();

                    // lblItemValue.Text = item;
                    //lblItemDescValue.Text = description;
                    //lblUnitValue.Text = unit;
                    //lbllotValue.Text = lot;


                    string  warehouse, itemcode;
                    decimal qty;
                    InterfazDAL_twhcol130 idal2      = new InterfazDAL_twhcol130();
                    DataTable             resultado1 = idal2.vallidatePurchaseOrderWithPosition(ref returnOrder, ref position, ref strError);
                    if (resultado1.Rows.Count < 1)
                    {
                        return(null);
                    }
                    else
                    {
                        foreach (DataRow dr1 in resultado1.Rows)
                        {
                            itemcode  = dr1.ItemArray[0].ToString();
                            warehouse = dr1.ItemArray[1].ToString();
                            qty       = Convert.ToDecimal(dr1.ItemArray[2].ToString());
                            if (warehouse.Trim() != war.Trim())
                            {
                                return(PalletWarehousedoesnotmatch);
                            }
                            if (itemcode.Trim() != item.Trim())
                            {
                                return(PalletItemcodedoesnotmatch);
                            }
                            if (current_qty < qty)
                            {
                                return(ActualquantitypalletIDequalorlessthanorderedquantity
                                       );
                            }
                        }
                    }
                }

                return(JsonConvert.SerializeObject(resultado));
            }
        }