コード例 #1
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);
        }
コード例 #2
0
        public ItemMovingResponse StillageMoving(MovingReq movingReq)
        {
            ItemMovingResponse res = new ItemMovingResponse();

            try
            {
                if (movingReq.StickerNo == "" || movingReq.StickerNo == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Enter StickerNo";
                    return(res);
                }
                if (movingReq.UserId == "" || movingReq.UserId == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Invalid UserId";
                    return(res);
                }


                query     = "Sp_MovingWebApi";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "GetMovingData");
                dbcommand.Parameters.AddWithValue("@StickerId", movingReq.StickerNo);
                dbcommand.Parameters.AddWithValue("@UserID", movingReq.UserId);
                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        ds = new DataSet();
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["value"].ToString() != "2")
                    {
                        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            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;
                            if (ds != null && ds.Tables[3].Rows.Count > 0)
                            {
                                res.AssignedAisleId   = Convert.ToString(ds.Tables[3].Rows[0]["AssignedAisleId"]);
                                res.AssignedBinId     = Convert.ToString(ds.Tables[3].Rows[0]["AssignedBinId"]);
                                res.AssignedRackId    = Convert.ToString(ds.Tables[3].Rows[0]["AssignedRackId"]);
                                res.AssignedAisleName = Convert.ToString(ds.Tables[3].Rows[0]["AssignedAisleName"]);
                                res.AssignedBinName   = Convert.ToString(ds.Tables[3].Rows[0]["AssignedBinName"]);
                                res.AssignedRackName  = Convert.ToString(ds.Tables[3].Rows[0]["AssignedRackName"]);
                                res.AssignedZoneName  = Convert.ToString(ds.Tables[3].Rows[0]["ZoneName"]);
                                res.AssignedZoneId    = Convert.ToString(ds.Tables[3].Rows[0]["ZONEID"]);
                            }
                            else
                            {
                                res.AssignedAisleId = "";
                                res.AssignedBinId   = "";
                                res.AssignedRackId  = "";
                            }

                            res.WareHouseID          = ds.Tables[0].Rows[0]["WareHouseID"].ToString();
                            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.AssignedLocation     = ds.Tables[0].Rows[0]["AssignedLocation"].ToString();
                            res.IsMovedFromProdLine  = Convert.ToByte(ds.Tables[0].Rows[0]["IsMovedFromProdLine"]);
                            res.StillageLocationName = Convert.ToString(ds.Tables[0].Rows[0]["StillageLocationName"]);
                            res.IsAssignTransfer     = Convert.ToByte(ds.Tables[0].Rows[0]["IsAssignTransfer"]);
                            if (res.StillageLocationName == "Production Line")
                            {
                                res.LoadingAreaId = res.LoadingAreaId = Convert.ToString(ds.Tables[4].Rows[0]["ZONEID"]);
                            }
                            else
                            {
                                res.LoadingAreaId = "";
                            }



                            res.Status  = "Success";
                            res.Message = "Data retrived successfully";
                        }
                        else
                        {
                            res.Status  = "Failure";
                            res.Message = "Invalid Sticker Number.";
                        }
                    }
                    else
                    {
                        res.Status  = "Failure";
                        res.Message = "This Stillage Does not Exist";
                        return(res);
                    }
                }
                else
                {
                    res.Status  = "Failure";
                    res.Message = "This stillage is assigned to another user";
                }
            }
            catch (Exception ex)
            {
                res.Status  = "Failure";
                res.Message = ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }