Beispiel #1
0
        public GetrequestNo UpdateRAF(RAFDetailsReq RAFD)
        {
            GetrequestNo res = new GetrequestNo();

            //        List<GetrequestNoRes> ListView = new List<GetrequestNoRes>();
            try
            {
                if (RAFD.StickerNo == "" || RAFD.StickerNo == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Enter Sticker ID";
                }
                if (RAFD.Shift == "" || RAFD.Shift == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Enter Shift";
                }
                //if (RAFD.WorkOrderNo == "" || RAFD.WorkOrderNo == null)
                //{
                //    res.Status = "Failure";
                //    res.Message = "Invalid WorkOrderNo";
                //}


                bool AutoPicked = true;
                bool AutoRoute  = true;
                if (RAFD.AutoPick == 1)
                {
                    AutoPicked = true;
                }
                else
                {
                    AutoPicked = false;
                }
                if (RAFD.AutoRoute == 1)
                {
                    AutoRoute = true;
                }
                else
                {
                    AutoRoute = false;
                }
                RAFD.ActivityID          = 6;
                query                    = "Sp_Counting";
                dbcommand                = new SqlCommand(query, conn);
                dbcommand.CommandType    = CommandType.StoredProcedure;
                dbcommand.CommandTimeout = 0;
                dbcommand.Parameters.AddWithValue("@QueryType", "FetchRafData");
                dbcommand.Parameters.AddWithValue("@StillageID", RAFD.StickerNo);
                dbcommand.Parameters.AddWithValue("@UserId", RAFD.UserId);
                dbcommand.Parameters.AddWithValue("@ActivityID", RAFD.ActivityID);
                SqlDataAdapter daGetData = new SqlDataAdapter(dbcommand);
                DataSet        dsGetData = new DataSet();
                daGetData.Fill(dsGetData);
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);

                var Hold = "";
                if (dsGetData.Tables[0].Rows[0]["isHold"].ToString() == "True")
                {
                    Hold = "Qc Hold";
                }
                else
                {
                    Hold = "Qc Release";
                }

                if (Convert.ToString(dsGetData.Tables[1].Rows[0]["WorkOrderNo"]) == "NA")
                {
                    res.Status  = "Failure";
                    res.Message = "This operation doesn't process this stillage sticker ";
                    return(res);
                }

                if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "3")
                {
                    res.Status  = "Failure";
                    res.Message = "This stillage is already counted";
                    return(res);
                }
                else if (dsGetData.Tables[0].Rows[0]["value"].ToString() != "2")
                {
                    query     = "Sp_AxWebserviceIntegration";
                    dbcommand = new SqlCommand(query, conn);
                    //dbcommand.Connection.Open();
                    dbcommand.CommandType    = CommandType.StoredProcedure;
                    dbcommand.CommandTimeout = 0;
                    da = new SqlDataAdapter(dbcommand);
                    DataSet ds = new DataSet();
                    da.Fill(ds);

                    //  DataSet ds = CommonManger.FillDatasetWithParam("Sp_AxWebserviceIntegration");
                    NeproWebApi.AXWebServiceRef1.Iace_FinishedGoodServiceClient obj = new NeproWebApi.AXWebServiceRef1.Iace_FinishedGoodServiceClient();
                    obj.ClientCredentials.Windows.ClientCredential.Domain   = Convert.ToString(ds.Tables[0].Rows[0]["Domain"]);
                    obj.ClientCredentials.Windows.ClientCredential.UserName = Convert.ToString(ds.Tables[0].Rows[0]["Username"]);
                    obj.ClientCredentials.Windows.ClientCredential.Password = Convert.ToString(ds.Tables[0].Rows[0]["Password"]);

                    NeproWebApi.AXWebServiceRef1.CallContext Cct = new NeproWebApi.AXWebServiceRef1.CallContext();
                    Cct.Company  = Convert.ToString(ds.Tables[0].Rows[0]["Company"]);
                    Cct.Language = Convert.ToString(ds.Tables[0].Rows[0]["Language"]);

                    Global global   = new Global();
                    string Username = global.GetUsername(RAFD.UserId.ToString());

                    string value2 = obj.ReportAsFinished(Cct, Convert.ToString(dsGetData.Tables[1].Rows[0]["WorkOrderNo"]), AutoPicked, AutoRoute, RAFD.Shift, RAFD.StickerNo, Username + "-HHD", false, false, false);
                    //string value2 = obj.UpdateQty(Cct, Convert.ToString(dsGetData.Tables[1].Rows[0]["WorkOrderNo"]), AutoPicked, AutoRoute, RAFD.Shift, RAFD.StickerNo, "HDD",150);
                    string value = obj.InsertHistoryHeaderData(Cct, RAFD.StickerNo, Convert.ToString(dsGetData.Tables[1].Rows[0]["SiteID"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["WorkOrderNo"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["ItemId"]), Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["WorkOrderQty"]));
                    //obj.InsertHistoryDetailData(Cct, RAFD.StickerNo, "", Convert.ToString(dsGetData.Tables[0].Rows[0]["ActivityName"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["ActivityDesc"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["StillageLocation"]), "", "", "", "", "", "", "Yes", 0, "", 0, Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["StillageQty"]), Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["UserName"]), Hold, 0, "","","", Convert.ToString(dsGetData.Tables[0].Rows[0]["WareHouseID"]),0);
                    obj.InsertHistoryDetailData(Cct, RAFD.StickerNo, "", Convert.ToString(dsGetData.Tables[0].Rows[0]["ActivityName"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["ActivityDesc"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["StillageLocation"]), "", "", "", "", "", "", "Yes", 0, "", 0, Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["StillageQty"]), Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["UserName"]), Hold, 0, "", "", "", Convert.ToString(dsGetData.Tables[0].Rows[0]["WareHouseID"]));

                    // DataTable dtItems = (DataTable)JsonConvert.DeserializeObject(Xmlitems, (typeof(DataTable)));
                }
                else
                {
                    res.Status  = "Failure";
                    res.Message = "This stillage does not exist";
                    return(res);
                }

                query     = "Sp_MovingWebApi";
                dbcommand = new SqlCommand(query, conn);
                //dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "UpdateRAF");
                //dbcommand.Parameters.AddWithValue("@WorkOrderNo", RAFD.WorkOrderNo);
                dbcommand.Parameters.AddWithValue("@StickerId", RAFD.StickerNo);
                dbcommand.Parameters.AddWithValue("@UserId", RAFD.UserId);
                dbcommand.Parameters.AddWithValue("@Shift", RAFD.Shift);
                dbcommand.Parameters.AddWithValue("@Quantity", RAFD.Quantity);
                dbcommand.Parameters.AddWithValue("@AutoPick", RAFD.AutoPick);
                dbcommand.Parameters.AddWithValue("@AutoRoute", RAFD.AutoRoute);
                dbcommand.CommandTimeout = 0;
                da = new SqlDataAdapter(dbcommand);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows[0]["value"].ToString() == "1")
                {
                    res.Status  = "Success";
                    res.Message = "RAF Posted successfully";
                    return(res);
                }
                else
                {
                    res.Status  = "Failure";
                    res.Message = "RAF Not Posted successfully";
                    return(res);
                }
            }
            catch (Exception Ex)
            {
                res.Status  = "Failure";
                res.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }
        public ReceivingResponse UpdateAssignation(AssigningReq AR)
        {
            ReceivingResponse res = new ReceivingResponse();

            try
            {
                if (AR == null)
                {
                    res.Status  = "Failure";
                    res.Message = "Object reference not set to an instance of an object.";
                }
                if (AR.StickerNo == "")
                {
                    res.Status  = "Failure";
                    res.Message = "Invalid Sticker No.";
                }
                else
                {
                    query                    = "Sp_AssignWebApi";
                    dbcommand                = new SqlCommand(query, conn);
                    dbcommand.CommandType    = CommandType.StoredProcedure;
                    dbcommand.CommandTimeout = 0;
                    dbcommand.Parameters.AddWithValue("@QueryType", "FetchDataAssigning");
                    dbcommand.Parameters.AddWithValue("@StillageID", AR.StickerNo);
                    dbcommand.Parameters.AddWithValue("@UserId", AR.UserId);
                    dbcommand.Parameters.AddWithValue("@Aisle", AR.Aisle);
                    dbcommand.Parameters.AddWithValue("@Bin", AR.Bin);
                    dbcommand.Parameters.AddWithValue("@Rack", AR.Rack);
                    dbcommand.Parameters.AddWithValue("@Zone", AR.Zone);
                    dbcommand.Parameters.AddWithValue("@AssignedUser", AR.AssignedFLT);
                    dbcommand.Parameters.AddWithValue("@WareHouseID", AR.WareHouseID);
                    SqlDataAdapter daGetData = new SqlDataAdapter(dbcommand);
                    DataSet        dsGetData = new DataSet();
                    daGetData.Fill(dsGetData);
                    SqlDataAdapter da = new SqlDataAdapter(dbcommand);

                    var Hold = "";
                    if (dsGetData.Tables[0].Rows[0]["isHold"].ToString() == "True")
                    {
                        Hold = "Qc Hold";
                    }
                    else
                    {
                        Hold = "Qc Release";
                    }



                    if (dsGetData.Tables[0].Rows[0]["value"].ToString() != "2")
                    {
                        query     = "Sp_AxWebserviceIntegration";
                        dbcommand = new SqlCommand(query, conn);
                        //  dbcommand.Connection.Open();
                        dbcommand.CommandType    = CommandType.StoredProcedure;
                        dbcommand.CommandTimeout = 0;
                        da = new SqlDataAdapter(dbcommand);
                        DataSet ds = new DataSet();
                        da.Fill(ds);

                        //  DataSet ds = CommonManger.FillDatasetWithParam("Sp_AxWebserviceIntegration");
                        NeproWebApi.AXWebServiceRef1.Iace_FinishedGoodServiceClient obj = new NeproWebApi.AXWebServiceRef1.Iace_FinishedGoodServiceClient();
                        obj.ClientCredentials.Windows.ClientCredential.Domain   = Convert.ToString(ds.Tables[0].Rows[0]["Domain"]);
                        obj.ClientCredentials.Windows.ClientCredential.UserName = Convert.ToString(ds.Tables[0].Rows[0]["Username"]);
                        obj.ClientCredentials.Windows.ClientCredential.Password = Convert.ToString(ds.Tables[0].Rows[0]["Password"]);

                        NeproWebApi.AXWebServiceRef1.CallContext Cct = new NeproWebApi.AXWebServiceRef1.CallContext();
                        Cct.Company  = Convert.ToString(ds.Tables[0].Rows[0]["Company"]);
                        Cct.Language = Convert.ToString(ds.Tables[0].Rows[0]["Language"]);
                        string value = obj.InsertHistoryHeaderData(Cct, AR.StickerNo, Convert.ToString(dsGetData.Tables[0].Rows[0]["SiteID"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["WorkOrderNo"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["ItemId"]), Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["WorkOrderQty"]));
                        //obj.InsertHistoryDetailData(Cct, AR .StickerNo, "", Convert.ToString(dsGetData.Tables[1].Rows[0]["ActivityName"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["ActivityDesc"]), Convert.ToString(dsGetData.Tables[2].Rows[0]["ZONEID"]), "", Convert.ToString(dsGetData.Tables[1].Rows[0]["AssignedFLT"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["StillageLocation"]), "", "", "", "No", 0, "", 0, 0, Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["UserName"]), "", 0, "");

                        obj.InsertHistoryDetailData(Cct, AR.StickerNo, "", Convert.ToString(dsGetData.Tables[1].Rows[0]["ActivityName"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["ActivityDesc"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["StillageLocation"]), "", Convert.ToString(dsGetData.Tables[1].Rows[0]["AssignedFLT"]), "", Convert.ToString(dsGetData.Tables[2].Rows[0]["ZONEID"]), "", "", "No", 0, "", 0, 0, Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["UserName"]), Hold, 0, "", "", "", Convert.ToString(dsGetData.Tables[1].Rows[0]["WareHouseID"]), 0);
                    }
                    else
                    {
                        res.Status  = "Failure";
                        res.Message = "This Stillage Does Not Exist";
                        return(res);
                    }



                    query     = "[Sp_AssignWebApi]";
                    dbcommand = new SqlCommand(query, conn);
                    dbcommand.Connection.Open();
                    dbcommand.CommandType = CommandType.StoredProcedure;
                    dbcommand.Parameters.AddWithValue("@QueryType", "UpdateAssign");
                    dbcommand.Parameters.AddWithValue("@StickerId", AR.StickerNo);
                    dbcommand.Parameters.AddWithValue("@Aisle", AR.Aisle);
                    dbcommand.Parameters.AddWithValue("@Rack", AR.Rack);
                    dbcommand.Parameters.AddWithValue("@Bin", AR.Bin);
                    dbcommand.Parameters.AddWithValue("@UserId", AR.UserId);
                    dbcommand.Parameters.AddWithValue("@AssignedUser", AR.AssignedFLT);
                    dbcommand.Parameters.AddWithValue("@WareHouseID", AR.WareHouseID);
                    dbcommand.Parameters.AddWithValue("@Zone", AR.Zone);

                    dbcommand.CommandTimeout = 0;
                    da = new SqlDataAdapter(dbcommand);
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    if (dt.Rows[0]["value"].ToString() == "1")
                    {
                        res.Status  = "Success";
                        res.Message = "Stillage assigned successfully";
                    }
                    else
                    {
                        res.Status  = "Failure";
                        res.Message = "Stillage not successfully assigned.!";
                    }
                }
            }
            catch (Exception Ex)
            {
                res.Status  = "Failure";
                res.Message = Ex.Message;
            }
            finally
            {
                dbcommand.Connection.Close();
            }
            return(res);
        }