コード例 #1
0
        public STDetailResponce UpdateLoadingPlan(LoadReqForNew PAL)
        {
            STDetailResponce SM = new STDetailResponce();

            try
            {
                if (PAL.UserId == "" || PAL.UserId == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid UserId";
                    return(SM);
                }
                if (PAL.LPID == "" || PAL.LPID == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid LoadingId";
                    return(SM);
                }

                query                    = "[Sp_NewLoadingPlan]";
                dbcommand                = new SqlCommand(query, conn);
                dbcommand.CommandType    = CommandType.StoredProcedure;
                dbcommand.CommandTimeout = 0;
                dbcommand.Parameters.AddWithValue("@QueryType", "UpdateLoadingPlanStatus");
                dbcommand.Parameters.AddWithValue("@UserId", PAL.UserId);
                dbcommand.Parameters.AddWithValue("@LoadingId", PAL.LPID);
                dbcommand.Parameters.AddWithValue("@Isdiscard", PAL.Isdiscard);
                SqlDataAdapter daGetData = new SqlDataAdapter(dbcommand);
                DataSet        dsGetData = new DataSet();
                daGetData.Fill(dsGetData);


                if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "1")
                {
                    SM.Status  = "Success";
                    SM.Message = "Loading Plan finished Successfully";
                }
                else if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "3")
                {
                    SM.Status  = "Success";
                    SM.Message = "Loading Plan Discarded Successfully";
                }
                else if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "2")
                {
                    SM.Status  = "Failure";
                    SM.Message = "Loading Failure";
                }
                else
                {
                    SM.Status  = "Failure";
                    SM.Message = "Loading Failure";
                }
            }
            catch (Exception Ex)
            {
                SM.Status  = "Failure";
                SM.Message = Ex.Message;
            }

            return(SM);
        }
コード例 #2
0
        public STDetailResponce ItemUpdatedStillageWise(LoadReqForNew PAL)
        {
            STDetailResponce SM = new STDetailResponce();

            try
            {
                if (PAL.StickerNo == "" || PAL.StickerNo == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Enter StickerNo";
                    return(SM);
                }
                if (PAL.UserId == "" || PAL.UserId == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid UserId";
                    return(SM);
                }
                if (PAL.LPID == "" || PAL.LPID == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid LoadingId";
                    return(SM);
                }

                query                    = "[Sp_NewLoadingPlan]";
                dbcommand                = new SqlCommand(query, conn);
                dbcommand.CommandType    = CommandType.StoredProcedure;
                dbcommand.CommandTimeout = 0;
                dbcommand.Parameters.AddWithValue("@QueryType", "FetchNewDataPick&Load");
                dbcommand.Parameters.AddWithValue("@StillageID", PAL.StickerNo);
                dbcommand.Parameters.AddWithValue("@UserId", PAL.UserId);
                dbcommand.Parameters.AddWithValue("@ActivityID", 4);
                dbcommand.Parameters.AddWithValue("@Reason", "");
                dbcommand.Parameters.AddWithValue("@LoadingId", PAL.LPID);
                dbcommand.Parameters.AddWithValue("@planningid", PAL.PickingPlanNo);
                dbcommand.Parameters.AddWithValue("@LoadedQty", PAL.LoadQty);
                dbcommand.Parameters.AddWithValue("@IsUnLoad", PAL.IsUnload);

                SqlDataAdapter daGetData = new SqlDataAdapter(dbcommand);
                DataSet        dsGetData = new DataSet();
                daGetData.Fill(dsGetData);

                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "3")
                {
                    SM.Status  = "close";
                    SM.Message = "This loading plan is discarded";
                }
                else if (dsGetData.Tables[0].Rows[0]["value"].ToString() == "4")
                {
                    SM.Status  = "close";
                    SM.Message = "This loading plan is finished";
                }

                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");



                        ////     need to be un comment on live
                        ///
                        AXWebServiceRef1.Iace_FinishedGoodServiceClient obj = new 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"]);

                        AXWebServiceRef1.CallContext Cct = new 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, PAL.StickerNo, Convert.ToString(dsGetData.Tables[0].Rows[0]["SiteID"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["SiteID"]), Convert.ToString(dsGetData.Tables[0].Rows[0]["ItemId"]), Convert.ToDecimal(dsGetData.Tables[0].Rows[0]["WorkOrderQty"]));
                        // obj.InsertHistoryDetailData(Cct, PAL.StickerNo, Convert.ToString(dsGetData.Tables[1].Rows[0]["PlanningId"]), 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[2].Rows[0]["ReasonName"]), Convert.ToString(dsGetData.Tables[2].Rows[0]["ReasonDes"]), "No", Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["MergeQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["FromMerge"]), PAL.LoadQty, 0, Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["UserName"]), "Reserved", 0, "", "", "", Convert.ToString(dsGetData.Tables[1].Rows[0]["WareHouseID"]), 0);
                        obj.InsertHistoryDetailData(Cct, PAL.StickerNo, Convert.ToString(dsGetData.Tables[1].Rows[0]["PlanningId"]), 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[2].Rows[0]["ReasonName"]), Convert.ToString(dsGetData.Tables[2].Rows[0]["ReasonDes"]), "No", Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["MergeQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["FromMerge"]), PAL.LoadQty, 0, Convert.ToDecimal(dsGetData.Tables[1].Rows[0]["StillageQty"]), Convert.ToString(dsGetData.Tables[1].Rows[0]["UserName"]), "Reserved", 0, "", "", "", Convert.ToString(dsGetData.Tables[1].Rows[0]["WareHouseID"]));
                    }
                    else
                    {
                        SM.Status  = "Failure";
                        SM.Message = "This Stillage Does Not Exist";
                        return(SM);
                    }

                    query     = "Sp_NewLoadingPlan";
                    dbcommand = new SqlCommand(query, conn);
                    // dbcommand.Connection.Open();
                    dbcommand.CommandType = CommandType.StoredProcedure;
                    dbcommand.Parameters.AddWithValue("@QueryType", "UpdateNewPickAndLoading");
                    dbcommand.Parameters.AddWithValue("@StickerId", PAL.StickerNo);
                    dbcommand.Parameters.AddWithValue("@Reason", "");
                    dbcommand.Parameters.AddWithValue("@LoadingId", PAL.LPID);
                    dbcommand.Parameters.AddWithValue("@UserId", PAL.UserId);
                    dbcommand.Parameters.AddWithValue("@ItemId", PAL.ItemId);
                    dbcommand.Parameters.AddWithValue("@LoadedQty", PAL.LoadQty);
                    dbcommand.Parameters.AddWithValue("@planningid", PAL.PickingPlanNo);
                    dbcommand.Parameters.AddWithValue("@IsUnLoad", PAL.IsUnload);
                    dbcommand.Parameters.AddWithValue("@SalesOrder", PAL.SalesOrder);


                    dbcommand.CommandTimeout = 0;
                    da = new SqlDataAdapter(dbcommand);
                    DataTable dt = new DataTable();
                    da.Fill(dt);

                    if (dt.Rows[0]["value"].ToString() == "1")
                    {
                        SM.Status  = "Success";
                        SM.Message = "Loaded Successfully";
                    }
                    else if (dt.Rows[0]["value"].ToString() == "2")
                    {
                        SM.Status  = "Failure";
                        SM.Message = "Stillage already loaded.!";
                    }
                    else if (dt.Rows[0]["value"].ToString() == "3")
                    {
                        SM.Status  = "Success";
                        SM.Message = "Unloaded Successfully.!";
                    }
                    else
                    {
                        SM.Status  = "Failure";
                        SM.Message = "Loading Failure";
                    }
                }
            }
            catch (Exception Ex)
            {
                SM.Status  = "Failure";
                SM.Message = Ex.Message;
            }

            return(SM);
        }