コード例 #1
0
        public AssigningResponse BinData(AssigningReq CMR)
        {
            AssigningResponse res = new AssigningResponse();

            try
            {
                if (CMR == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Object reference not set to an instance of an object.";
                }
                else
                {
                    query     = "Sp_AssignWebApi";
                    dbcommand = new SqlCommand(query, conn);
                    dbcommand.Connection.Open();
                    dbcommand.CommandType = CommandType.StoredProcedure;
                    dbcommand.Parameters.AddWithValue("@QueryType", "GetBinData");
                    dbcommand.Parameters.AddWithValue("@WareHouseID", CMR.WareHouseID);
                    dbcommand.Parameters.AddWithValue("@aisle", CMR.Aisle);
                    dbcommand.Parameters.AddWithValue("@rack", CMR.Rack);

                    dbcommand.CommandTimeout = 0;
                    SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                    DataSet        ds = new DataSet();
                    da.Fill(ds);

                    List <BinList> BinList = new List <BinList>();
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        BinList A = new BinList();
                        A.name = row["name"].ToString();
                        A.id   = row["id"].ToString();
                        BinList.Add(A);
                    }
                    res.BinList = BinList;
                    res.Status  = "Success";
                    res.Message = "Data retrived successfully";
                }
            }
            catch (Exception Ex)
            {
                res.Status  = "Failure";
                res.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }
コード例 #2
0
        public AssigningResponse AssignData(AssigningReq CMR)
        {
            AssigningResponse res = new AssigningResponse();

            try
            {
                if (CMR == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Object reference not set to an instance of an object.";
                }
                else if (CMR.StickerNo == "")
                {
                    res.Status  = "Failure";
                    res.Message = "Invalid Sticker No.";
                }
                else
                {
                    query     = "Sp_AssignWebApi";
                    dbcommand = new SqlCommand(query, conn);
                    dbcommand.Connection.Open();
                    dbcommand.CommandType = CommandType.StoredProcedure;
                    dbcommand.Parameters.AddWithValue("@QueryType", "GetAssignedData");
                    dbcommand.Parameters.AddWithValue("@StickerId", CMR.StickerNo);
                    dbcommand.Parameters.AddWithValue("@UserId", CMR.UserId);
                    dbcommand.CommandTimeout = 0;
                    SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                    DataSet        ds = new DataSet();
                    da.Fill(ds);
                    if (ds.Tables[0].Rows[0]["value"].ToString() != "3")
                    {
                        res.StillageLocation = Convert.ToString(ds.Tables[0].Rows[0]["StillageLocation"]);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["value"].ToString() == "1")
                            {
                                res.Status  = "Failure";
                                res.Message = "Don't have access to get the details";
                            }

                            //else if (res.StillageLocation != "NPRO-000001")
                            else
                            {
                                res.StickerID        = ds.Tables[0].Rows[0]["StickerID"].ToString();
                                res.StandardQty      = Convert.ToDecimal(ds.Tables[0].Rows[0]["StandardQty"]);
                                res.ItemId           = ds.Tables[0].Rows[0]["ItemId"].ToString();
                                res.Description      = ds.Tables[0].Rows[0]["Description"].ToString();
                                res.ItemStdQty       = Convert.ToDecimal(ds.Tables[0].Rows[0]["ItemStdQty"]);
                                res.WareHouseID      = Convert.ToString(ds.Tables[0].Rows[0]["WareHouseID"]);
                                res.IsAssignTransfer = Convert.ToByte(ds.Tables[0].Rows[0]["IsAssignTransfer"]);

                                List <AisleList> AisleList = new List <AisleList>();
                                foreach (DataRow row in ds.Tables[1].Rows)
                                {
                                    AisleList A = new AisleList();
                                    A.name = row["name"].ToString();
                                    A.id   = row["id"].ToString();
                                    AisleList.Add(A);
                                }
                                res.AisleList = AisleList;

                                //List<BinList> BinList = new List<BinList>();
                                //foreach (DataRow row in ds.Tables[3].Rows)
                                //{
                                //    BinList A = new BinList();
                                //    A.name = row["name"].ToString();
                                //    A.id = row["id"].ToString();
                                //    BinList.Add(A);
                                //}
                                //res.BinList = BinList;

                                //List<RackList> RackList = new List<RackList>();
                                //foreach (DataRow row in ds.Tables[2].Rows)
                                //{
                                //    RackList A = new RackList();
                                //    A.name = row["name"].ToString();
                                //    A.id = row["id"].ToString();
                                //    RackList.Add(A);
                                //}
                                //res.RackList = RackList;
                                List <ZoneList> ZoneList = new List <ZoneList>();
                                foreach (DataRow row in ds.Tables[2].Rows)
                                {
                                    ZoneList A = new ZoneList();
                                    A.name = row["name"].ToString();
                                    A.id   = row["id"].ToString();
                                    ZoneList.Add(A);
                                }
                                res.ZoneList = ZoneList;

                                List <FLTList> FLTList = new List <FLTList>();
                                foreach (DataRow row in ds.Tables[3].Rows)
                                {
                                    FLTList A = new FLTList();
                                    A.name = row["name"].ToString();
                                    A.id   = Convert.ToInt64(row["id"]);
                                    FLTList.Add(A);
                                }
                                res.FLTList = FLTList;



                                res.Status  = "Success";
                                res.Message = "Data retrived successfully";
                            }
                            //else
                            //{
                            //    res.Status = "Operation Invalid";
                            //    res.Message = "Stillage will only move to Loading Area.";

                            //}
                        }
                        else
                        {
                            res.Status  = "Failure";
                            res.Message = "Invalid Sticker Id";
                        }
                    }
                    else
                    {
                        res.Status  = "Failure";
                        res.Message = "This stillage does not exist";
                        return(res);
                    }
                }
            }
            catch (Exception Ex)
            {
                res.Status  = "Failure";
                res.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }